semiotic 3.8.5 → 3.8.7

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 (277) hide show
  1. package/CLAUDE.md +37 -10
  2. package/README.md +83 -56
  3. package/ai/behaviorContracts.cjs +88 -3
  4. package/ai/componentMetadata.cjs +5 -10
  5. package/ai/dist/mcp-server.js +99 -10
  6. package/ai/examples.md +198 -9
  7. package/ai/schema.json +2002 -165
  8. package/ai/surface-manifest.json +14 -10
  9. package/ai/system-prompt.md +9 -3
  10. package/dist/{chunk-chartContainerDataAudit-74TLKIP6.module.min.js → chunk-chartContainerDataAudit-JDSVSKGM.module.min.js} +1 -1
  11. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
  12. package/dist/chunk-chunk-2YAZHXL4.module.min.js +2 -0
  13. package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
  14. package/dist/{chunk-chunk-G7WFWHAD.module.min.js → chunk-chunk-4ITOQRXM.module.min.js} +1 -1
  15. package/dist/chunk-chunk-5SD6BHVW.module.min.js +2 -0
  16. package/dist/chunk-chunk-6V5VQVCT.module.min.js +2 -0
  17. package/dist/chunk-chunk-7TTBHSAG.module.min.js +2 -0
  18. package/dist/chunk-chunk-7ZDJSYKI.module.min.js +2 -0
  19. package/dist/chunk-chunk-BGHPD3RA.module.min.js +1 -0
  20. package/dist/chunk-chunk-BMRZ2SPU.module.min.js +2 -0
  21. package/dist/chunk-chunk-BNGBEY7N.module.min.js +2 -0
  22. package/dist/chunk-chunk-C7APLVQD.module.min.js +2 -0
  23. package/dist/chunk-chunk-DGWFBOGB.module.min.js +1 -0
  24. package/dist/chunk-chunk-DIVE2DRA.module.min.js +2 -0
  25. package/dist/chunk-chunk-FBUNUIPV.module.min.js +2 -0
  26. package/dist/chunk-chunk-FQPKOAIH.module.min.js +2 -0
  27. package/dist/chunk-chunk-FRO4TRXK.module.min.js +2 -0
  28. package/dist/chunk-chunk-G7QVPZUD.module.min.js +2 -0
  29. package/dist/chunk-chunk-GBPYV4FP.module.min.js +2 -0
  30. package/dist/chunk-chunk-GU2EJIDJ.module.min.js +2 -0
  31. package/dist/chunk-chunk-J5QD4RAM.module.min.js +2 -0
  32. package/dist/{chunk-chunk-LJLS6DY7.module.min.js → chunk-chunk-JWXLNZSM.module.min.js} +1 -1
  33. package/dist/chunk-chunk-KXAFCCDB.module.min.js +2 -0
  34. package/dist/chunk-chunk-LG7YKJAK.module.min.js +2 -0
  35. package/dist/{chunk-chunk-I36PJ4OC.module.min.js → chunk-chunk-LVHDZAT3.module.min.js} +1 -1
  36. package/dist/chunk-chunk-LWITSR2O.module.min.js +2 -0
  37. package/dist/chunk-chunk-MX35T6RX.module.min.js +2 -0
  38. package/dist/chunk-chunk-NH4MEAKP.module.min.js +2 -0
  39. package/dist/chunk-chunk-NJETWX42.module.min.js +2 -0
  40. package/dist/chunk-chunk-NW25WGLS.module.min.js +2 -0
  41. package/dist/{chunk-chunk-TMWIZL3K.module.min.js → chunk-chunk-OI7R7EJB.module.min.js} +1 -1
  42. package/dist/chunk-chunk-ONMLEXHR.module.min.js +2 -0
  43. package/dist/chunk-chunk-OY66GCE6.module.min.js +1 -0
  44. package/dist/chunk-chunk-PZFT457G.module.min.js +1 -0
  45. package/dist/chunk-chunk-Q3WW6JGR.module.min.js +1 -0
  46. package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +1 -0
  47. package/dist/chunk-chunk-RJRM2E6P.module.min.js +1 -0
  48. package/dist/chunk-chunk-RPL7WYXI.module.min.js +1 -0
  49. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  50. package/dist/chunk-chunk-TSCFL235.module.min.js +1 -0
  51. package/dist/chunk-chunk-UOQRPGPK.module.min.js +2 -0
  52. package/dist/chunk-chunk-V3OAKG32.module.min.js +1 -0
  53. package/dist/chunk-chunk-WLOIUMWG.module.min.js +2 -0
  54. package/dist/chunk-chunk-XEGXX4F7.module.min.js +1 -0
  55. package/dist/chunk-chunk-XFRBLXYM.module.min.js +1 -0
  56. package/dist/chunk-chunk-Z2AJERX5.module.min.js +2 -0
  57. package/dist/chunk-chunk-ZXYDYAB7.module.min.js +2 -0
  58. package/dist/components/ai/SemioticVACPBridge.d.ts +22 -0
  59. package/dist/components/ai/chartCapabilities.d.ts +5 -3
  60. package/dist/components/ai/conversationArc.d.ts +2 -176
  61. package/dist/components/ai/conversationArcTypes.d.ts +202 -0
  62. package/dist/components/ai/readerGrounding.d.ts +12 -0
  63. package/dist/components/ai/vacpAdapter.d.ts +13 -0
  64. package/dist/components/ai/vacpAdapterActions.d.ts +2 -0
  65. package/dist/components/ai/vacpAdapterModel.d.ts +7 -0
  66. package/dist/components/ai/vacpAdapterRuntime.d.ts +26 -0
  67. package/dist/components/ai/vacpAdapterState.d.ts +3 -0
  68. package/dist/components/ai/vacpAdapterTypes.d.ts +169 -0
  69. package/dist/components/ai/vacpTypes.d.ts +160 -0
  70. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  71. package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
  72. package/dist/components/charts/index.d.ts +7 -4
  73. package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
  74. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  75. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
  76. package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
  77. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
  78. package/dist/components/charts/physics/ChainReactionChart.capability.d.ts +9 -0
  79. package/dist/components/charts/physics/ChainReactionChart.d.ts +29 -0
  80. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
  81. package/dist/components/charts/physics/EventDropChart.d.ts +7 -2
  82. package/dist/components/charts/physics/GaltonBoardChart.d.ts +1 -1
  83. package/dist/components/charts/physics/{PhysicsPileChart.capability.d.ts → PacketFlowChart.capability.d.ts} +1 -1
  84. package/dist/components/charts/physics/{PhysicalFlowChart.d.ts → PacketFlowChart.d.ts} +22 -6
  85. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +1 -1
  86. package/dist/components/charts/physics/ProcessFlowChart.d.ts +7 -4
  87. package/dist/components/charts/physics/{PhysicalFlowChart.capability.d.ts → UnitPileChart.capability.d.ts} +1 -1
  88. package/dist/components/charts/physics/{PhysicsPileChart.d.ts → UnitPileChart.d.ts} +19 -6
  89. package/dist/components/charts/physics/crucibleChartProps.d.ts +1 -1
  90. package/dist/components/charts/physics/crucibleChartUtils.d.ts +9 -0
  91. package/dist/components/charts/physics/gauntletChartProps.d.ts +6 -1
  92. package/dist/components/charts/physics/gauntletTerminal.d.ts +61 -0
  93. package/dist/components/charts/physics/packetFlowSemantics.d.ts +6 -0
  94. package/dist/components/charts/physics/physicsHocUtils.d.ts +45 -2
  95. package/dist/components/charts/shared/auditAccessibilityStyles.d.ts +9 -0
  96. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -4
  97. package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
  98. package/dist/components/charts/shared/gradient.d.ts +35 -0
  99. package/dist/components/charts/shared/hatchFill.d.ts +3 -10
  100. package/dist/components/charts/shared/hooks.d.ts +2 -50
  101. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  102. package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
  103. package/dist/components/charts/shared/useChartLegend.d.ts +65 -0
  104. package/dist/components/charts/shared/useChartSetup.d.ts +12 -0
  105. package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
  106. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
  107. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  108. package/dist/components/charts/xy/AreaChart.d.ts +25 -42
  109. package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
  110. package/dist/components/charts/xy/BumpChart.d.ts +161 -0
  111. package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
  112. package/dist/components/charts/xy/Heatmap.d.ts +3 -0
  113. package/dist/components/charts/xy/LineChart.d.ts +6 -8
  114. package/dist/components/data/portability/capabilityBinding.d.ts +41 -0
  115. package/dist/components/data/portability/index.d.ts +2 -0
  116. package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
  117. package/dist/components/legendLayout.d.ts +75 -1
  118. package/dist/components/recipes/geographicDotGrid.d.ts +82 -0
  119. package/dist/components/recipes/geographicGrid.d.ts +100 -0
  120. package/dist/components/recipes/physics.d.ts +2 -0
  121. package/dist/components/recipes/physicsStageGeography.d.ts +137 -0
  122. package/dist/components/semiotic-ai.d.ts +6 -4
  123. package/dist/components/semiotic-experimental-vacp.d.ts +11 -0
  124. package/dist/components/semiotic-experimental.d.ts +6 -3
  125. package/dist/components/semiotic-geo.d.ts +5 -0
  126. package/dist/components/semiotic-network.d.ts +1 -0
  127. package/dist/components/semiotic-ordinal.d.ts +2 -0
  128. package/dist/components/semiotic-physics.d.ts +10 -6
  129. package/dist/components/semiotic-realtime-core.d.ts +1 -0
  130. package/dist/components/semiotic-recipes-core.d.ts +6 -1
  131. package/dist/components/semiotic-server-edge.d.ts +1 -1
  132. package/dist/components/semiotic-server.d.ts +1 -1
  133. package/dist/components/semiotic-xy.d.ts +4 -0
  134. package/dist/components/semiotic.d.ts +4 -4
  135. package/dist/components/server/renderEvidence.d.ts +1 -1
  136. package/dist/components/server/renderToStaticSVG.d.ts +2 -1
  137. package/dist/components/server/serverChartConfigHeatmap.d.ts +6 -0
  138. package/dist/components/server/serverChartConfigNetworkStyles.d.ts +12 -0
  139. package/dist/components/server/serverChartConfigShared.d.ts +16 -0
  140. package/dist/components/server/serverChartConfigs.d.ts +3 -2
  141. package/dist/components/server/serverChartConfigsPhysics.d.ts +2 -2
  142. package/dist/components/server/serverChartConfigsXY.d.ts +1 -1
  143. package/dist/components/server/staticLegend.d.ts +10 -2
  144. package/dist/components/server/staticSVGChrome.d.ts +14 -6
  145. package/dist/components/server/staticValue.d.ts +8 -0
  146. package/dist/components/stream/GeoSVGOverlay.d.ts +4 -10
  147. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
  148. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
  149. package/dist/components/stream/SVGOverlay.d.ts +2 -6
  150. package/dist/components/stream/StalenessBadge.d.ts +2 -6
  151. package/dist/components/stream/geoPipelineConfig.d.ts +10 -0
  152. package/dist/components/stream/geoTypes.d.ts +3 -6
  153. package/dist/components/stream/legendRenderer.d.ts +10 -6
  154. package/dist/components/stream/ordinalTypes.d.ts +7 -31
  155. package/dist/components/stream/physics/PhysicsEvidence.d.ts +37 -0
  156. package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
  157. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +9 -0
  158. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
  159. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +5 -0
  160. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
  161. package/dist/components/stream/physics/physicsFramePipelineConfig.d.ts +19 -0
  162. package/dist/components/stream/physics/physicsPipelineSettle.d.ts +52 -0
  163. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +23 -0
  164. package/dist/components/stream/pipelineConfig.d.ts +7 -15
  165. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
  166. package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
  167. package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
  168. package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
  169. package/dist/components/stream/types.d.ts +34 -56
  170. package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
  171. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
  172. package/dist/components/types/legendTypes.d.ts +31 -6
  173. package/dist/controls.min.js +1 -1
  174. package/dist/controls.module.min.js +1 -1
  175. package/dist/geo.min.js +1 -1
  176. package/dist/geo.module.min.js +1 -1
  177. package/dist/network.min.js +1 -1
  178. package/dist/network.module.min.js +1 -1
  179. package/dist/ordinal.min.js +1 -1
  180. package/dist/ordinal.module.min.js +1 -1
  181. package/dist/physics.min.js +1 -1
  182. package/dist/physics.module.min.js +1 -1
  183. package/dist/physicsWorker.js +1 -1
  184. package/dist/realtime.min.js +1 -1
  185. package/dist/realtime.module.min.js +1 -1
  186. package/dist/semiotic-ai-core.min.js +1 -1
  187. package/dist/semiotic-ai-core.module.min.js +1 -1
  188. package/dist/semiotic-ai.d.ts +6 -4
  189. package/dist/semiotic-ai.min.js +1 -1
  190. package/dist/semiotic-ai.module.min.js +1 -1
  191. package/dist/semiotic-data.module.min.js +1 -1
  192. package/dist/semiotic-experimental-vacp.d.ts +11 -0
  193. package/dist/semiotic-experimental-vacp.min.js +1 -0
  194. package/dist/semiotic-experimental-vacp.module.min.js +1 -0
  195. package/dist/semiotic-experimental.d.ts +6 -3
  196. package/dist/semiotic-experimental.min.js +2 -1
  197. package/dist/semiotic-experimental.module.min.js +2 -1
  198. package/dist/semiotic-geo.d.ts +5 -0
  199. package/dist/semiotic-network.d.ts +1 -0
  200. package/dist/semiotic-ordinal.d.ts +2 -0
  201. package/dist/semiotic-physics.d.ts +10 -6
  202. package/dist/semiotic-realtime-core.d.ts +1 -0
  203. package/dist/semiotic-realtime-core.min.js +1 -1
  204. package/dist/semiotic-realtime-core.module.min.js +1 -1
  205. package/dist/semiotic-recipes-core.d.ts +6 -1
  206. package/dist/semiotic-recipes-core.min.js +1 -1
  207. package/dist/semiotic-recipes-core.module.min.js +1 -1
  208. package/dist/semiotic-recipes.min.js +1 -1
  209. package/dist/semiotic-recipes.module.min.js +1 -1
  210. package/dist/semiotic-server-edge.d.ts +1 -1
  211. package/dist/semiotic-server-edge.min.js +1 -1
  212. package/dist/semiotic-server-edge.module.min.js +1 -1
  213. package/dist/semiotic-server-node.min.js +1 -1
  214. package/dist/semiotic-server-node.module.min.js +1 -1
  215. package/dist/semiotic-server.d.ts +1 -1
  216. package/dist/semiotic-utils-core.min.js +1 -1
  217. package/dist/semiotic-utils-core.module.min.js +1 -1
  218. package/dist/semiotic-utils.min.js +1 -1
  219. package/dist/semiotic-utils.module.min.js +1 -1
  220. package/dist/semiotic-xy.d.ts +4 -0
  221. package/dist/semiotic.d.ts +4 -4
  222. package/dist/semiotic.min.js +1 -1
  223. package/dist/semiotic.module.min.js +1 -1
  224. package/dist/server.min.js +1 -1
  225. package/dist/server.module.min.js +1 -1
  226. package/dist/xy.min.js +1 -1
  227. package/dist/xy.module.min.js +1 -1
  228. package/package.json +18 -2
  229. package/spec/README.md +94 -2
  230. package/spec/bindings/README.md +14 -3
  231. package/spec/v0.1/examples/annotation-provenance-reviewed-revision.json +27 -0
  232. package/spec/v0.1/examples/annotation-provenance-watcher-threshold.json +21 -0
  233. package/spec/v0.1/examples/audience-profile-executive-review.json +24 -0
  234. package/spec/v0.1/examples/audience-profile-incident-operators.json +42 -0
  235. package/spec/v0.1/examples/chart-capability-bar-comparison.json +48 -0
  236. package/spec/v0.1/examples/chart-capability-service-flow.json +54 -0
  237. package/dist/chunk-chunk-4AANPFOX.module.min.js +0 -2
  238. package/dist/chunk-chunk-5I3UZV4Q.module.min.js +0 -2
  239. package/dist/chunk-chunk-5RKXZQ2P.module.min.js +0 -1
  240. package/dist/chunk-chunk-74CCPVXB.module.min.js +0 -1
  241. package/dist/chunk-chunk-7ALTGHK6.module.min.js +0 -1
  242. package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
  243. package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
  244. package/dist/chunk-chunk-BANTPINB.module.min.js +0 -2
  245. package/dist/chunk-chunk-C4YA6TDR.module.min.js +0 -1
  246. package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
  247. package/dist/chunk-chunk-CKMD5NV3.module.min.js +0 -2
  248. package/dist/chunk-chunk-CO5KQMGH.module.min.js +0 -1
  249. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +0 -2
  250. package/dist/chunk-chunk-E6TXX6MI.module.min.js +0 -1
  251. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +0 -1
  252. package/dist/chunk-chunk-JCG72SGW.module.min.js +0 -2
  253. package/dist/chunk-chunk-K3DMEW22.module.min.js +0 -1
  254. package/dist/chunk-chunk-KT2VAZMZ.module.min.js +0 -1
  255. package/dist/chunk-chunk-L6EA5V3G.module.min.js +0 -2
  256. package/dist/chunk-chunk-LJPCLYSC.module.min.js +0 -2
  257. package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
  258. package/dist/chunk-chunk-N5DDKCCF.module.min.js +0 -1
  259. package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
  260. package/dist/chunk-chunk-NLO44TOS.module.min.js +0 -2
  261. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +0 -2
  262. package/dist/chunk-chunk-QSQVBIJA.module.min.js +0 -1
  263. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +0 -1
  264. package/dist/chunk-chunk-RBIDBUT4.module.min.js +0 -2
  265. package/dist/chunk-chunk-RCF52Z42.module.min.js +0 -2
  266. package/dist/chunk-chunk-RFLAG356.module.min.js +0 -1
  267. package/dist/chunk-chunk-RPU4IZAV.module.min.js +0 -2
  268. package/dist/chunk-chunk-SKMBCFIL.module.min.js +0 -2
  269. package/dist/chunk-chunk-TAE7W424.module.min.js +0 -2
  270. package/dist/chunk-chunk-TUBMTZMU.module.min.js +0 -2
  271. package/dist/chunk-chunk-UFFEXJQY.module.min.js +0 -1
  272. package/dist/chunk-chunk-XSCHTS4D.module.min.js +0 -2
  273. package/dist/chunk-chunk-XXWSHGPL.module.min.js +0 -2
  274. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +0 -1
  275. package/dist/chunk-chunk-ZXIXAPRE.module.min.js +0 -2
  276. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
  277. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
package/dist/xy.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e,t,n,o,r,i,s=Object.create,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,d=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[c(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},f=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},p=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of c(t))h.call(e,r)||r===n||a(e,r,{get:()=>t[r],enumerable:!(o=l(t,r))||o.enumerable});return e},y=(e,t,n)=>(n=null!=e?s(u(e)):{},p(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),m=d({"src/components/stream/brushAccessibility.ts"(){e=y(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),g={};function x(e,t,n,o){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(o)0>n?a=Math.max(r,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(r,Math.min(i-e,a+n*s)),l=a+e}return[a,l]}function b(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function v(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function k({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,dimension:h,scales:d,onBrush:f,binSize:p,snap:y,binBoundaries:m,snapDuring:g,streaming:k}){const w=(0,n.useRef)(null),A=(0,n.useRef)(null),S=(0,n.useRef)(f);S.current=f;const M=(0,n.useRef)(d);M.current=d;const C=(0,n.useMemo)(()=>m?[...m].sort((e,t)=>e-t):void 0,[m]),j=(0,n.useRef)(C);j.current=C;const _=(0,n.useRef)(!1),R=(0,n.useRef)(null),P=function({label:n="Data range brush",description:o=t,onAction:r}={}){const i=e.useId().replace(/:/g,""),s=e.useRef(r);return s.current=r,{description:o,descriptionId:"semiotic-brush-description-"+i,svgProps:{role:"region",tabIndex:0,"aria-label":n,"aria-describedby":"semiotic-brush-description-"+i,onKeyDown:e.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),s.current?.(t))},[])}}}({label:"xy"===h?"Two-dimensional data range brush":h.toUpperCase()+" data range brush",onAction:e=>{const t=M.current,n=A.current;if(!t||!n||!w.current)return;const r=(0,o.select)(w.current).select(".brush-g");if("clear"===e.type)return _.current=!0,r.call(n.move,null),_.current=!1,R.current=null,void S.current(null);const i=t.x.domain(),s=t.y.domain(),a=R.current;let l=a?.x??[i[0]+.4*(i[1]-i[0]),i[0]+.6*(i[1]-i[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==h&&(l=x(l,i,d,e.resize)),u||"x"===h||(c=x(c,s,d,e.resize)),u&&"y"===h||!u&&"x"===h)return;const f={x:l,y:c};_.current=!0,r.call(n.move,"x"===h?[t.x(l[0]),t.x(l[1])]:"y"===h?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),_.current=!1,R.current=f,S.current(f)}});return(0,n.useEffect)(()=>{if(!w.current)return;const e=(0,o.select)(w.current).select(".brush-g"),t="x"===h?(0,r.brushX)():"y"===h?(0,r.brushY)():(0,r.brush)();return t.extent([[0,0],[s,a]]),t.on("brush end",n=>{if(_.current)return;const o=M.current;if(!o)return;if(!n.selection)return R.current=null,void S.current(null);let r,i;if("x"===h){const[e,t]=n.selection;r=[o.x.invert(e),o.x.invert(t)],i=[o.y.invert(a),o.y.invert(0)]}else if("y"===h){const[e,t]=n.selection;r=[o.x.invert(0),o.x.invert(s)],i=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[s,a]]=n.selection;r=[o.x.invert(e),o.x.invert(s)],i=[o.y.invert(a),o.y.invert(t)]}if("bin"===y&&"y"!==h&&("end"===n.type||"brush"===n.type&&g)){const i=j.current;i&&i.length>0?r=function(e,t){return 0===t.length?e:[b(e[0],t),v(e[1],t)]}(r,i):p&&p>0&&(r=[Math.floor(r[0]/p)*p,Math.ceil(r[1]/p)*p]);const s=o.x(r[0]),a=o.x(r[1]);if(_.current=!0,"x"===h)e.call(t.move,[s,a]);else if("xy"===h){const o=n.selection;e.call(t.move,[[s,o[0][1]],[a,o[1][1]]])}_.current=!1}const l={x:r,y:i};R.current=l,S.current(l)}),e.call(t),A.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),A.current=null}},[s,a,h,y,p,g]),(0,n.useEffect)(()=>{if(!(k&&d&&A.current&&R.current))return;if(!w.current)return;if("y"===h)return;const e=R.current,t=d.x.domain()[0],n=(0,o.select)(w.current).select(".brush-g");if(t>=e.x[1])return _.current=!0,n.call(A.current.move,null),_.current=!1,R.current=null,void S.current(null);let r=e.x[0],i=!1;if(t>e.x[0]){if(r=t,"bin"===y){const e=j.current;e&&e.length>0?r=v(t,e):p&&p>0&&(r=Math.ceil(t/p)*p)}if(r>=e.x[1])return _.current=!0,n.call(A.current.move,null),_.current=!1,R.current=null,void S.current(null);i=!0}const s=d.x(r),a=d.x(e.x[1]);if(_.current=!0,"x"===h)n.call(A.current.move,[s,a]);else{const t=d.y(e.y[1]),o=d.y(e.y[0]);n.call(A.current.move,[[s,t],[a,o]])}if(_.current=!1,i){const t={x:[r,e.x[1]],y:e.y};R.current=t,S.current(t)}},[d,k,h,y,p]),(0,i.jsxs)("svg",{ref:w,width:l,height:c,...P.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,i.jsx)("title",{children:P.svgProps["aria-label"]}),(0,i.jsx)("desc",{id:P.descriptionId,children:P.description}),(0,i.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`})]})}f(g,{XYBrushOverlay:()=>k});var w=d({"src/components/stream/XYBrushOverlay.tsx"(){n=require("react"),o=require("d3-selection"),r=require("d3-brush"),m(),i=require("react/jsx-runtime")}});function A(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function S(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}var M=d({"src/components/charts/shared/minMax.ts"(){}});function C(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function j(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var _,R,P=d({"src/components/charts/shared/colorManipulation.ts"(){}}),L={};function I(e,t,n,o){const r=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!r&&!i)return;const s="object"==typeof r?r:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[R]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=n(e),r=o(e);return null!=t&&null!=r&&Number.isFinite(t)&&Number.isFinite(r)?Math.abs(t-r):NaN}),u=c.filter(e=>Number.isFinite(e));if(0===u.length)return;const[h,d]=A(u),f=d-h;e.forEach((e,t)=>{const n=c[t];Number.isFinite(n)&&(e[R]=l-(f>0?(n-h)/f:0)*(l-a))})}function T(e,t){return"function"==typeof t?t(e):!!e[t]}function N(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function F(e,t,n,o,r){return(i=o).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,n,o,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:h=.15,anomalyColor:d="#ef4444",anomalyRadius:f=6,label:p}=o,y=e.map(e=>{let t="observed";return s&&T(e,s)?t="forecast":i&&T(e,i)&&(t="training"),{...e,[_]:t}}),m=o._groupBy,g=[];if(m){const e=new Map;for(const t of y){const n=t[m]??"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][_]!==n[e+1][_]&&(t.push({...n[e+1],[_]:n[e][_]}),t.push({...n[e],[_]:n[e+1][_]}));g.push(...y,...t)}else for(let e=0;y.length>e;e++)g.push(y[e]),y.length-1>e&&y[e][_]!==y[e+1][_]&&(g.push({...y[e+1],[_]:y[e][_]}),g.push({...y[e],[_]:y[e+1][_]}));if(o.trainUnderline){const e=[];for(const t of g)"training"===t[_]&&e.push({...t,[_]:"training-base"});g.unshift(...e)}const x=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const n of g)"function"==typeof l&&(n[e]=l(n)),"function"==typeof c&&(n[t]=c(n));x.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:h,label:p})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};I(g.filter(e=>"forecast"===e[_]),o,e,t)}if(a){const e=o.anomalyStyle,t={type:"highlight",filter:e=>T(e,a)};e?(t.style=e,t.r=f):"function"==typeof d?(t.style=e=>{const t=d(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=d,t.r=f,t.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),x.push(t)}return r&&x.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:g,annotations:x}}(e,0,0,o,r):function(e,t,n,o,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=o;if(null==i)return{processedData:e,annotations:[]};const h=[],d=[];for(const n of e)n[t]>i?d.push({...n,[_]:"observed"}):h.push({...n,[_]:"training"});const f=h.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),p=[],y=[];if(f.length>=3){const r=f.length;let i=0,h=0,d=0,m=0;for(const[e,t]of f)i+=e,h+=t,d+=e*e,m+=e*t;const g=r*d-i*i;if(Math.abs(g)>1e-12){const d=(r*m-i*h)/g,x=(h-d*i)/r,b=e=>x+d*e,v=f.map(([e,t])=>t-b(e)).reduce((e,t)=>e+t*t,0),k=Math.sqrt(v/Math.max(r-2,1)),w=f.reduce((e,t)=>e+t[0],0)/r,A=f.reduce((e,t)=>e+(t[0]-w)**2,0),M=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,C=S(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),j=f.length>1?(f[r-1][0]-f[0][0])/(r-1):1;for(let e=1;s>=e;e++){const o=C+e*j,i=b(o),s=k*Math.sqrt(1+1/r+(A>0?(o-w)**2/A:0))*M;y.push({[t]:o,[n]:i,[_]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}I(y,o,e=>e.__forecastUpper,e=>e.__forecastLower),p.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}p.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&p.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label});const m=[];if(m.push(...h),h.length>0&&d.length>0&&m.push({...h[h.length-1],[_]:"observed"}),m.push(...d),y.length>0){const e=d.length>0?d[d.length-1]:h[h.length-1];e&&m.push({...e,[_]:"forecast"}),m.push(...y)}return{processedData:m,annotations:p}}(e,t,n,o,r);var i}function O(e,t){const n=t.trainDasharray??"8,4",o=t.forecastDasharray??"4,4",r=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),h=t[_];if("training"===h){let e=u.stroke;return"darken"===a?e=C(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:n,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===h){let e=u.stroke||"#666";return"lighten"===c&&(e=j(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===h){const e=t[R],n=null!=e?e:s;return{...u,stroke:r,strokeDasharray:o,...null!=n&&{strokeOpacity:n}}}return u}}f(L,{FORECAST_OPACITY_FIELD:()=>R,SEGMENT_FIELD:()=>_,buildAnomalyAnnotations:()=>N,buildForecast:()=>F,createSegmentLineStyle:()=>O,darkenColor:()=>C,lightenColor:()=>j,stampForecastOpacity:()=>I});var B,W,D,z,H,E=d({"src/components/charts/shared/statisticalOverlays.ts"(){M(),P(),P(),_="__forecastSegment",R="__forecastOpacity"}}),$=d({"src/components/charts/xy/scatterplotMatrixInteractionTypes.ts"(){}}),Y={};function G({frameRef:e,cellSize:t,onBrush:n}){const o=(0,B.useRef)(null),r=t-H.left-H.right,i=t-H.top-H.bottom;return(0,B.useEffect)(()=>{if(!o.current)return;const t=(0,D.select)(o.current).select(".brush-g"),s=(0,W.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const o=e.current?.getScales();if(!o)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void n(null);var r;const[[i,s],[a,l]]=t.selection,c=[[o.x.invert(i),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];n(c)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[r,i,e,n]),(0,z.jsx)("svg",{ref:o,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,z.jsx)("g",{className:"brush-g",transform:`translate(${H.left},${H.top})`})})}f(Y,{ScatterplotMatrixBrushOverlay:()=>G});var q,V,X,U,K=d({"src/components/charts/xy/scatterplotMatrixBrushOverlay.tsx"(){B=require("react"),W=require("d3-brush"),D=require("d3-selection"),$(),z=require("react/jsx-runtime"),H={top:4,bottom:4,left:4,right:4}}}),Q={};function Z({width:e,height:t,margin:n,scales:o,brushDirection:r,extent:i,onBrush:s}){const a=(0,q.useRef)(null),l=(0,q.useRef)(null),c=(0,q.useRef)(!1),u=e+n.left+n.right,h=t+n.top+n.bottom;return(0,q.useEffect)(()=>{if(!a.current||!o)return;const n=(0,X.select)(a.current).select(".brush-group"),i="x"===r?(0,V.brushX)().extent([[0,0],[e,t]]):(0,V.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const n=("x"===r?o.x:o.y).invert;if(!n)return;const i=[n(t[0]),n(t[1])];s(i)}),n.call(i),l.current=e=>{n.call(i.move,e)},n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[o,e,t,r,s]),(0,q.useEffect)(()=>{if(!l.current||!o||!a.current)return;const e="x"===r?o.x:o.y;if(c.current=!0,i){const t=[e(i[0]),e(i[1])];l.current(t)}else l.current(null);c.current=!1},[i,o,r]),(0,U.jsx)("svg",{ref:a,width:u,height:h,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,U.jsx)("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}f(Q,{MinimapBrushOverlay:()=>Z});var J,ee=d({"src/components/charts/xy/minimapBrushOverlay.tsx"(){q=require("react"),V=require("d3-brush"),X=require("d3-selection"),U=require("react/jsx-runtime")}}),te={};f(te,{AreaChart:()=>su,BubbleChart:()=>Ru,CandlestickChart:()=>Ah,ConnectedScatterplot:()=>Cu,DEFAULT_HIT_RADIUS:()=>Rh,DifferenceChart:()=>uu,Heatmap:()=>Tu,LineChart:()=>eu,MinimapChart:()=>oh,MultiAxisLineChart:()=>bh,QuadrantChart:()=>hh,Scatterplot:()=>wu,ScatterplotMatrix:()=>Uu,StackedAreaChart:()=>fu,StreamXYFrame:()=>ul,XYCustomChart:()=>jh,composeStyleRules:()=>Wc,glyphExtent:()=>$n,glyphPlacement:()=>En,hatchFillId:()=>ao,hatchPatternDef:()=>co,hitTargetPoint:()=>Lh,hitTargetRect:()=>Ih,isHatchFill:()=>io,makeRuleValueResolver:()=>Ic,makeXYRuleContext:()=>Tc,matchesThreshold:()=>Fc,resolveResponsiveRules:()=>Vl,resolveStyleRules:()=>Bc,resolveSvgFill:()=>uo,responsiveRuleMatches:()=>ql,ruleMatches:()=>Oc,useCustomLayoutSelection:()=>Tn}),module.exports=(J=te,p(a({},"__esModule",{value:!0}),J));var ne=y(require("react")),oe=require("react"),re=y(require("react")),ie=require("react/jsx-runtime"),se=null,ae=null;function le(e){const[t,n]=re.useState(()=>se);return re.useEffect(()=>{if(t)return;let e=!1;return(se?Promise.resolve(se):(ae||(ae=Promise.resolve().then(()=>(w(),g)).then(e=>se=e.XYBrushOverlay).catch(e=>{throw ae=null,e})),ae)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,ie.jsx)(t,{...e}):null}var ce=Object.freeze([]);function ue(e){if(!e)return ce;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var he=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=ue(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=ue(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},de=require("react"),fe=require("react/jsx-runtime");function pe(e){let t=null;const n=()=>(t||(t=(0,de.createContext)(null)),t),o=ye(e);return[function({children:t,initialState:o}){const r=(0,de.useRef)(o),i=(0,de.useMemo)(()=>ye(e,r.current),[]),s=n();return(0,fe.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,de.useContext)(r)??o,s=(0,de.useRef)(e);s.current=e;const a=(0,de.useRef)({hasValue:!1,value:void 0}),l=(0,de.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,de.useCallback)(()=>s.current(i.getState()),[i]);return(0,de.useSyncExternalStore)(i.subscribe,l,c)}]}function ye(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function me(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function ge(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:xe}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var xe=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],be={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},ve={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},ke={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:xe,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function we(e,t){if("light"===t)return be;if("dark"===t)return ve;if("high-contrast"===t)return ke;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?ve:be;return ge({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return ge({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Ae,Se]=pe(e=>({theme:be,setTheme(t){e(e=>({theme:we(e.theme,t)}))}})),Me=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},Ce=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(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.isFinite(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 je(e,t){return e===t}function _e(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Re(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Pe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var Le=/^\d{4}-\d{1,2}$/;function Ie(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=Le.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const o=Date.parse(n);return Number.isFinite(o)?o:NaN}function Te(e){return e instanceof Date?e.getTime():"string"==typeof e?Ie(e):+e}function Ne(e){return new Set(Array.isArray(e)?e:[e])}var Fe=require("d3-scale");function Oe(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Be(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function We(e){const t=e.map(Oe),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Be(e,n,o)}if(e>=1){const[e,o,r]=t[n];return Be(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,h]=t[r+1];return Be(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(h-l)*i))}}var De=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ze=We(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),He=We(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ee=We(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),$e=We(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Ye=We(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ge=We(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),qe=We(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Ve=We(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Xe=We(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Ue=We(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Ke=We(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Qe=We(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Ze={blues:ze,reds:He,greens:Ee,viridis:qe,oranges:$e,purples:Ye,greys:Ge,plasma:Ve,inferno:Xe,magma:Ue,cividis:Ke,turbo:Qe};function Je(e){return e&&Ze[e]||ze}We(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),We(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),We(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),We(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),We(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),We(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),We(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var et={category10:De,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Ze},tt=De,nt="#007bff",ot=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],rt=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function it(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||rt.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):tt[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))%tt.length]}function st(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function at(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>st(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,Fe.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=et[n]||et.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:tt;return(0,Fe.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function lt(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function ct(e,t,n){return e+(t-e)*n}function ut(){return"undefined"!=typeof performance?performance.now():Date.now()}function ht(e,t,n){if(1>=n)return 1;const o=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function dt(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}function ft(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function pt(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function yt(e,t,n){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+n;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function mt(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function gt(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function xt(e,t,n,o){const r=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const r of t)e+=n(r,o)||0;r.set(o,-e/2)}else if("wiggle"===o){e.length>0&&r.set(e[0],0);for(let o=1;e.length>o;o++){const i=e[o-1],s=e[o];let a=0,l=0,c=0;for(const e of t){const t=n(e,s)||0;a+=(2*c+t)*(t-(n(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(r.get(i)??0)+e/2}const i=o/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function bt(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function vt(e,t,n,o,r,i,s,a){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function kt(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function wt(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function At(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function St(e,t,n,o){if(!e.scales)return null;const r=[],i=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,...e.config.curve&&"linear"!==e.config.curve&&{curve:e.config.curve},style:At(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Mt(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function Ct(e,t,n){const o=[];for(const r of n){const n=St(e,t,"__ribbon_aggregate",r);n&&o.push(n)}return o}function jt(e,t,n,o){const r=[];for(const i of o){const o=St(e,t,n,i);o&&r.push(o)}return r}function _t(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),r=o.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&n.push({y0:r,y1:t})}return 0===n.length?e:{...e,band:n[0],bands:n}}function Rt(e,t,n,o){if(!e.config.pointStyle)return;const r=o??e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const i of o.data){let o=e.config.pointStyle(i);!o.fill&&t&&(o={...o,fill:t});const s=o.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=bt(i,e.scales,e.getX,r,s,o,a);l&&n.push(l)}}}function Pt(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var Lt={topOpacity:.8,bottomOpacity:.05};function It(e){if(e)return!0===e?Lt:"colorStops"in e?e:{topOpacity:e.topOpacity??Lt.topOpacity,bottomOpacity:e.bottomOpacity??Lt.bottomOpacity}}var Tt=require("d3-shape"),Nt={circle:Tt.symbolCircle,square:Tt.symbolSquare,triangle:Tt.symbolTriangle,diamond:Tt.symbolDiamond,star:Tt.symbolStar,cross:Tt.symbolCross,wye:Tt.symbolWye},Ft=["circle","triangle","diamond","star","square","chevron","cross","wye"];function Ot(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*Bt(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,Tt.symbol)(Nt[o]??Tt.symbolCircle,Math.max(1,t))()??""}function Bt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var Wt=new Map;function Dt(e,t,n){const o=n.config.areaStyle?.(t);return o&&(e.style=o),e}function zt(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function Ht(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Ht))}function Et(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function $t(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function Yt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=$t(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=_e(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:$t(e.y1Accessor,"y1"),getBottom:$t(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var Gt=require("d3-scale");function qt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Vt(e,t,n){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,Gt.scaleLog)().domain(e).range(n).clamp(!0)}return"symlog"===e?(0,Gt.scaleSymlog)().domain(t).range(n):"time"===e?(0,Gt.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(n):(0,Gt.scaleLinear)().domain(t).range(n)}function Xt(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var Ut=new WeakMap;var Kt={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function Qt(e,t){const n={...e};for(const e of t)n[Kt[e]]++;return n}function Zt(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Qt(n,o)}}var Jt=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Zt({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=Zt(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},en=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],tn=["scene-style","data-paint","accessibility","evidence"],nn=(e,t)=>({retainedData:e,invalidations:t}),on=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],rn=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],sn=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],an=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ln=["scene-geometry","data-paint","accessibility","evidence"],cn=["scene-style","data-paint","accessibility","evidence"],un=[],hn={chartType:nn("rebuild",on),runtimeMode:nn("rebuild",on),xAccessor:nn("rebuild",on),yAccessor:nn("rebuild",on),timeAccessor:nn("rebuild",on),valueAccessor:nn("rebuild",on),y0Accessor:nn("rebuild",on),boundsAccessor:nn("rebuild",on),band:nn("rebuild",on),openAccessor:nn("rebuild",on),highAccessor:nn("rebuild",on),lowAccessor:nn("rebuild",on),closeAccessor:nn("rebuild",on),candlestickRangeMode:nn("rebuild",on),accessorRevision:nn("rebuild",on),groupAccessor:nn("rebuild",rn),categoryAccessor:nn("rebuild",rn),lineDataAccessor:nn("rebuild",rn),colorAccessor:nn("rebuild",cn),sizeAccessor:nn("rebuild",ln),symbolAccessor:nn("rebuild",ln),pointIdAccessor:nn("rebuild",ln),xScaleType:nn("preserve",sn),yScaleType:nn("preserve",sn),xExtent:nn("preserve",sn),yExtent:nn("preserve",sn),extentPadding:nn("preserve",sn),scalePadding:nn("preserve",sn),axisExtent:nn("preserve",sn),binSize:nn("preserve",sn),normalize:nn("preserve",sn),heatmapAggregation:nn("preserve",sn),heatmapXBins:nn("preserve",sn),heatmapYBins:nn("preserve",sn),arrowOfTime:nn("preserve",an),baseline:nn("preserve",an),stackOrder:nn("preserve",an),sizeRange:nn("preserve",an),curve:nn("preserve",an),areaGroups:nn("preserve",an),customLayout:nn("preserve",an),layoutConfig:nn("preserve",an),layoutMargin:nn("preserve",an),symbolMap:nn("preserve",ln),showValues:nn("preserve",ln),heatmapValueFormat:nn("preserve",ln),lineStyle:nn("preserve",cn),pointStyle:nn("preserve",cn),areaStyle:nn("preserve",cn),barStyle:nn("preserve",cn),swarmStyle:nn("preserve",cn),waterfallStyle:nn("preserve",cn),candlestickStyle:nn("preserve",cn),boundsStyle:nn("preserve",cn),gradientFill:nn("preserve",cn),lineGradient:nn("preserve",cn),colorScheme:nn("preserve",cn),themeCategorical:nn("preserve",cn),themeSemantic:nn("preserve",cn),themeSequential:nn("preserve",cn),themeDiverging:nn("preserve",cn),barColors:nn("preserve",cn),decay:nn("preserve",cn),pulse:nn("preserve",cn),staleness:nn("preserve",cn),layoutSelection:nn("preserve",cn),annotations:nn("preserve",["overlay","accessibility","evidence"]),windowSize:nn("preserve",un),windowMode:nn("preserve",un),maxCapacity:nn("preserve",un),clock:nn("preserve",un),transition:nn("preserve",un),introAnimation:nn("preserve",un),onLayoutError:nn("preserve",un)},dn=nn("preserve",an),fn=class{constructor(){this.tracker=new Jt}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},en)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},tn):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=hn[o]??dn;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},pn=require("d3-quadtree"),yn=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let n=0,o=0;for(const e of t)"point"===e.type&&(n++,e.r>o&&(o=e.r));if(this.maxRadius=o,500>=n)return void(this.tree=null);const r=Array(n);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,pn.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},mn=class e{constructor(e){if(this.xExtent=new Ce,this.yExtent=new Ce,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new fn,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new yn,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=r??(()=>{const e=new Map;for(let t=0;n.length>t;t++)e.set(n[t],t);return e})();for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0,a=!1;for(const n of t){const t=c.get(n);if(null==t)continue;a=!0;const s=o.get(t);if(null==s)continue;const l=ft(e,s,i);l>r&&(r=l)}a&&(l=pt(n,r,s)||l);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);l=pt(n,null==r?0:ft(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),n),this.config=e,this.buffer=new Me(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=_e(e.timeAccessor||e.xAccessor,"time"),this.getY=_e(e.valueAccessor||e.yAccessor,"value")):(this.getX=_e(e.xAccessor,"x"),this.getY=_e(e.yAccessor,"y")),this.getGroup=Pe(e.groupAccessor),this.getCategory=Pe(e.categoryAccessor),this.getSize=e.sizeAccessor?_e(e.sizeAccessor,"size"):void 0,this.getColor=Pe(e.colorAccessor),this.getSymbol=Pe(e.symbolAccessor),this.getY0=e.y0Accessor?_e(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Yt(e),this.getPointId=Pe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?_e(e.openAccessor,"open"):void 0,this.getHigh=_e(e.highAccessor,"high"),this.getLow=_e(e.lowAccessor,"low"),this.getClose=n?_e(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Me(e.windowSize))}currentTime(){return this.config.clock?.()??ut()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=function(e,t){const n=new Me(e.capacity);return e.forEach(()=>n.push(t)),n}(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?_e(this.config.timeAccessor||this.config.xAccessor,"time"):_e(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&Number.isFinite(Ie(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>Te(t[e]):e=>Te(n(e))}}r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)Xt(this.buffer,n,this.timestampBuffer,t),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=Xt(this.buffer,n,this.timestampBuffer,t);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}var n,o,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=qt(this.xExtent.extent,t.xExtent),l=qt(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&n.size>0){const e=function(e){const{config:t,groups:n,getX:o,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const n=[0,i?1:1+t.extentPadding];return{yDomain:n,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:n}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const e of n){const t=new Map;let n=0;for(const i of e.data){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),n+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),h.set(e.key,n)}const d=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,y;if("input"===d)p=n.map(e=>e.key);else if("insideOut"===d){const e=[...n].map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}),t=[],o=[];let r=0,i=0;for(const n of e)i>r?(t.push(n),r+=h.get(n)??0):(o.push(n),i+=h.get(n)??0);p=[...o.reverse(),...t]}else p="asc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(e,t)}):"desc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}):n.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),n=xt(e,p,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let o=1/0,r=-1/0;for(const t of e){const e=n.get(t)??0,i=u.get(t)??0;o>e&&(o=e),e+i>r&&(r=e+i)}Number.isFinite(o)&&Number.isFinite(r)||(o=0,r=0);const s=r-o,c=i?0:s>0?s*t.extentPadding:1;y=[o-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[n,o]=function(e,t,n){let o=0,r=0;for(const i of e){let e=0,s=0;for(const o of t){const t=n(o,i)||0;0>t?s+=t:e+=t}o>s&&(o=s),e>r&&(r=e)}return[o,r]}(e,p,(e,t)=>a.get(e)?.get(t)||0),r=o-n,s=i?0:r>0?r*t.extentPadding:1;y=[n-s,o+s]}else y=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:y,stackExtentCache:{key:s,yDomain:y}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&n.size>0?l=function(e,t,n,o,r,i,s){const[,a]=function(e,t,n,o,r){const i=zt(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,n,o,r);return[0,s?a:a+a*i]}(n,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,h):"waterfall"===t.chartType&&!c&&n.size>0?l=function(e,t,n,o){const[r,i]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(e,t),s=i-r,a=o?0:s>0?s*n:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(n,this.getY,t.extentPadding,h):c||l[0]===1/0||(l=function(e,t,n){if(!n.length)return e;let[o,r]=e;for(const e of t)for(const t of n){const n=t.getTop(e),i=t.getBottom(e);Number.isFinite(n)&&(o>n&&(o=n),n>r&&(r=n)),Number.isFinite(i)&&(o>i&&(o=i),i>r&&(r=i))}return[o,r]}(l,i,this.resolvedRibbons),l=function(e,t){const n=e[1]-e[0],o=t.exactMode?0:n>0?n*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-o,null!=t.userMax?e[1]:e[1]+o];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:h,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,n){if(!t||n)return e;const o=t[0],r=t[1];return null==o&&null==r?e:[null!=o?o:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,n){let o=e,r=t;if(o[0]===1/0||o[1]===-1/0)if("time"===n){const e=Date.now();o=[e-864e5,e]}else o=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:o,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:n,xDomain:o,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(n.width,n.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,n.width-s]:[n.width-s,s];return{x:(0,Gt.scaleLinear)().domain(o).range(e),y:Vt(t.yScaleType,r,[n.height-s,s])}}const e="down"===t.arrowOfTime?[s,n.height-s]:[n.height-s,s];return{x:Vt(t.yScaleType,r,[s,n.width-s]),y:(0,Gt.scaleLinear)().domain(o).range(e)}}var a;return{x:Vt(t.xScaleType,o,[s,n.width-s]),y:Vt(t.yScaleType,r,[n.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=r):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":case"glyph":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=Vt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o)return[];if(n.customLayout){const r={data:t,scales:o,dimensions:{width:e.width,height:e.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??ot},resolveColor:(e,t)=>{const o=this.resolveGroupColor(e);if(o)return o;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let i;try{i=n.customLayout(r)}catch(e){const t=null!==this.lastCustomLayoutResult,o=function(e,t,n,o){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("xy",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{n.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,n.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;Ht(o)&&0===n.length&&Et(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Et(r,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:o,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){const n=e.groupData(t),o=[],r=e.config.annotations?.filter(Pt).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(...jt(e,t.data,t.key,r))}for(const t of n){const n=e.resolveLineStyle(t.key,t.data[0]),i=mt(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Rt(e,n,o),o}(r,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(...jt(e,t.data,t.key,r))}const r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=gt(t.data,e.scales,e.getX,e.getY,r,n,t.key,i),a=It(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return Rt(e,n,o),o}(r,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(...jt(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=gt(t.data,e.scales,e.getX,e.getY,i,n,t.key,s),a=It(e.config.gradientFill);a&&(r.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=mt(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return Rt(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t),o=e.config.stackOrder??"key",r=()=>n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===o);else if("key"===o)r();else if("asc"===o||"desc"===o||"insideOut"===o){const t=new Map;for(const o of n){let n=0;for(const t of o.data){const o=e.getX(t),r=e.getY(t);Number.isFinite(o)&&Number.isFinite(r)&&(n+=r)}t.set(o.key,n)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===o)n.sort((e,n)=>{const o=(t.get(e.key)??0)-(t.get(n.key)??0);return 0!==o?o:r(e.key,n.key)});else if("desc"===o)n.sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)});else{const e=[...n].sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)}),o=[],i=[];let s=0,a=0;for(const n of e)a>s?(o.push(n),s+=t.get(n.key)??0):(i.push(n),a+=t.get(n.key)??0);n.length=0,n.push(...i.reverse(),...o)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,n,o,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let h;if(i){h=new Map;for(const t of c){let n=0;for(const o of e)n+=u.get(o.key)?.get(t)||0;h.set(t,n||1)}}const d=xt(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,p=[],y=new Map,m=new Map,g=new Map,x=new Map;for(const e of c)m.set(e,d.get(e)??0),g.set(e,0),x.set(e,0);for(const n of e){const e=u.get(n.key),o=new Map;let a=[],l=[];const d=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(e.curve=s),p.push(e)}a=[],l=[]};for(const n of c){const r=e.has(n);let s,c,u=r?e.get(n):0;if(i&&r&&(u/=h.get(n)),!r||!Number.isFinite(u)||0===u){d();continue}f?u>0?(s=g.get(n),c=s+u,g.set(n,c)):(s=x.get(n),c=s+u,x.set(n,c)):(s=m.get(n),c=s+u,m.set(n,c));const p=t.x(n);l.push([p,t.y(s)]),a.push([p,t.y(c)]),o.set(n,c)}d(),y.set(n.key,o)}return{nodes:p,stackedTops:y}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=l.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>t.get(n)??e.getY(n);Rt(e,n,c,o)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let h=0;const d=e=>{const t=c?.[e];if(t)return t;let n=u.get(e);return n||(n=Ft[h%Ft.length],h++,u.set(e,n)),n};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},c=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t={...t,fill:s.get(n)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const o=d(l(r)+""),i=vt(r,e.scales,e.getX,e.getY,Math.PI*c*c,o,t,u);i&&n.push(i)}else{const o=bt(r,e.scales,e.getX,e.getY,c,t,u);o&&n.push(o)}}return n}(r,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){const o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=_e(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),h=(l-a||1)/o,d=(u-c||1)/r,f=o*r;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let n=0;t.length>n;n++){const i=t[n],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/h),o-1),m=Math.min(Math.floor((u-c)/d),r-1);if(0>f||0>m)continue;const g=m*o+f;p[g]++;const x=s(i);y[g]+=isFinite(x)?x:0}let m=1/0,g=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=y[e];break;case"mean":t=y[e]/p[e];break;default:t=p[e]}m>t&&(m=t),t>g&&(g=t)}if(!isFinite(m))return[];const x=g-m||1,b=n.width/o,v=n.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,A=[];for(let t=0;r>t;t++){const n=t*o;for(let s=0;o>s;s++){const o=n+s;if(0===p[o])continue;let l;switch(i){case"sum":l=y[o];break;case"mean":l=y[o]/p[o];break;default:l=p[o]}const u=(l-m)/x,f={xi:s,yi:t,value:l,count:p[o],sum:y[o],xCenter:a+(s+.5)*h,yCenter:c+(t+.5)*d,agg:i};A.push(Dt(wt(s*b,(r-1-t)*v,b,v,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,k?{value:l,showValues:!0,valueFormat:w}:void 0),f,e))}}return A}(e,t,n);if(0===t.length)return[];const o=_e(e.config.valueAccessor,"value"),r=Re(e.config.xAccessor,"x"),i=Re(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,h=a.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(a.keys()),p=d.every(e=>"number"==typeof e&&!isNaN(e)),y=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){d.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(y){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const m=new Float64Array(t.length),g=new Float64Array(t.length),x=Array(t.length),b=new Map;let v=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const h=o(n),d=i*u+r,f=b.get(d);let p;void 0!==f?p=f:(p=v++,b.set(d,p)),m[p]=d,g[p]=h,x[p]=n}let k=1/0,w=-1/0;for(let e=0;v>e;e++){const t=g[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Ze?e:"blues";let n=Wt.get(t);if(n)return n;n=Array(256);const o=Je(t);for(let e=0;256>e;e++)n[e]=o(e/255);return Wt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),M=n.width/u,C=n.height/h,j=e.config.showValues,_=e.config.heatmapValueFormat,R=[];for(let t=0;v>t;t++){const n=g[t];if(!isFinite(n))continue;const o=m[t],r=o%u,i=x[t];R.push(Dt(wt(r*M,(h-1-(o-r)/u)*C,M,C,A[Math.min((n-k)*S+.5|0,255)],i,j?{value:n,showValues:!0,valueFormat:_}:void 0),i,e))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const n=zt(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){const t=new Set;for(const e of n.values())for(const n of e.categories.keys())t.add(n);const r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=r.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?o=e.barCategoryCache.order:(o=[...a,...s],e.barCategoryCache={key:l,order:o})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const t of n.values()){const n=Math.max(t.start,s),u=Math.min(t.end,a);if(n>=u)continue;const f=i.x(n),p=i.x(u),y=Math.abs(p-f),m=y>h+1?h:0,g=Math.min(f,p)+m/2,x=Math.max(y-m,1);if(x>0)if(o&&t.categories.size>0){let n=0;for(const s of o){const o=t.categories.get(s)||0;if(0===o)continue;const a=i.y(n),u=i.y(n+o);r.push(kt(g,Math.min(a,u),x,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...d},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:o},s)),n+=o}}else{const e=i.y(0),n=i.y(t.total);r.push(kt(g,Math.min(e,n),x,Math.abs(e-n),{fill:l?.fill||c||"#007bff",...d},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of n.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const n=[],o=e.config.swarmStyle||{},r=o.radius??3,i=o.fill??e.config.themeSemantic?.primary??"#007bff",s=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of t){const t=e.getX(o),c=e.getY(o);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),h=e.scales.y(c);let d=i;if(e.getCategory){const t=e.getCategory(o);d=e.config.barColors?.[t]||d}const{r:f,...p}=e.config.pointStyle?.(o)??{},y={type:"point",x:u,y:h,r:f??r,style:{fill:d,opacity:s,stroke:a,strokeWidth:l,...p},datum:o};e.getPointId&&(y.pointId=e.getPointId(o)+""),n.push(y)}return n}(r,t);case"waterfall":return function(e,t,n){const o=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===s.length)return o;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,h=i?.strokeWidth,d=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const p=s[t],y=e.getX(p),m=e.getY(p),g=f+m;let x;x=s.length-1>t?e.getX(s[t+1])-y:t>0?y-e.getX(s[t-1]):0;const b=r.x(y),v=0!==x?r.x(y+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=g;continue}const A=r.y(f),S=r.y(g),M=Math.min(A,S),C=Math.abs(A-S),j={fill:0>m?l:a,stroke:u,strokeWidth:h};null!=d&&(j.opacity=d),o.push(kt(k,M,w,C,j,{...p,baseline:f,cumEnd:g,delta:m,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=g}return o}(r,t,e);case"candlestick":return function(e,t,n){if(!e.getHigh||!e.getLow||!e.scales)return[];const o=e.config.candlestickRangeMode??!1;if(!(o||e.getOpen&&e.getClose))return[];const r=[],i=e.config.candlestickStyle||{},s=i.rangeColor||"#6366f1",a=o?s:i.upColor||"#28a745",l=o?s:i.downColor||"#dc3545",c=o?s:i.wickColor||"#333",u=i.wickWidth||(o?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let d=i.bodyWidth??0;if(null==i.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}d=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else d=6;for(const i of t){const t=e.getX(i);if(null==t||Number.isNaN(t))continue;const s=e.getHigh(i),h=e.getLow(i);if(null==s||Number.isNaN(s)||null==h||Number.isNaN(h))continue;const f=o?s:e.getOpen(i),p=o?h:e.getClose(i);if(!o&&[f,p].some(e=>null==e||Number.isNaN(e)))continue;const y=p>=f,m={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(f),closeY:e.scales.y(p),highY:e.scales.y(s),lowY:e.scales.y(h),bodyWidth:d,upColor:a,downColor:l,wickColor:c,wickWidth:u,isUp:y,datum:i};o&&(m.isRange=!0,m.dotRadius=Math.max(2,Math.min(d/2,.12*n.height))),r.push(m)}return r}(r,t,e);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,n,o){const r=e.boundsStyle;return"function"==typeof r?r(n||{},t):r&&"object"==typeof r?r:{fill:o(t,n).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?ht(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=dt(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,n,o=dt(n)){const r=n.length;if(r>1)for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let n=0;t.length>n;n++){const a=o.get(t[n]);null!=a?(i[n]=ht(e,a,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let n=0;t.length>n;n++){const i=o.get(t[n]);null!=i?(s[n]=ht(e,i,r),1>s[n]&&(a=!0)):s[n]=1}a&&(n._decayOpacities=s)}else{let s=1;for(const n of t){const t=o.get(n);if(null!=t){const n=ht(e,t,r);s>n&&(s=n)}}if(1>s){const e=Array(i);e.fill(s),n._decayOpacities=e}}continue}const t=o.get(n.datum);if(null==t)continue;const i=ht(e,t,r);"heatcell"===n.type?n.style={opacity:i}:"candlestick"===n.type?n._decayOpacity=i:n.style={...n.style,opacity:(n.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){n.clear(),o.clear();for(let r=0;t.length>r;r++){const i=t[r],s=yt(e,i,r);s&&("point"===i.type?n.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?n.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?n.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?o.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&o.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=yt(this.transitionContext,n,t);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:e,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(o,{path:n.path.map(e=>[e[0],e[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(o,{topPath:n.topPath.map(e=>[e[0],e[1]]),bottomPath:n.bottomPath.map(e=>[e[0],e[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r,i=ut()){if(0===o.size&&0===r.size)return n;const s=t.duration??300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],s=yt(e,i,t);if(!s)continue;if(i._transitionKey=s,"line"===i.type||"area"===i.type){const e=r.get(s);if(e){if(c.add(s),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];a=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];a=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},a=!0;continue}const u=o.get(s);if("point"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("glyph"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("rect"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("heatcell"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){l.add(s);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0}for(const[e,t]of r)if(!c.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}for(const[e,t]of o)if(!l.has(e)){if(e.startsWith("p:"))n.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)n.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))n.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const o=t.openY??t.y;n.exitNodes.push({type:"candlestick",x:t.x,openY:o,closeY:t.closeY??o,highY:t.highY??o,lowY:t.lowY??o,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}a=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),a&&(n.activeTransition={startTime:i,duration:s}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){if(!n.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.r=ct(n.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.size=ct(n.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==n.w&&(e.w=ct(n.w,e._targetW,i)),void 0!==n.h&&(e.h=ct(n.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:ct(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==n.w&&(e.w=ct(n.w,e._targetW,i)),void 0!==n.h&&(e.h=ct(n.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:ct(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),void 0!==n.openY&&(e.openY=ct(n.openY,e._targetOpenY,i)),void 0!==n.closeY&&(e.closeY=ct(n.closeY,e._targetCloseY,i)),void 0!==n.highY&&(e.highY=ct(n.highY,e._targetHighY,i)),void 0!==n.lowY&&(e.lowY=ct(n.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:ct(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=ct(t[o][0],n[o][0],i),e.path[o][1]=ct(t[o][1],n[o][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:ct(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=ct(t[n][0],o[n][0],i),e.topPath[n][1]=ct(t[n][1],o[n][1],i);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=ct(n[t][0],r[t][0],i),e.bottomPath[t][1]=ct(n[t][1],r[t][1],i)}}if(r>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:n}=function(e,t,n,o){if(o&&o.version===n&&o.group===t&&o.data===e)return{result:o.result,cache:o};let r;if(t){const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}r=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:n,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,t}resolveColorMap(e){const{map:t,cache:n}=function(e,t,n,o,r){if(r&&r.version===o)return{map:r.map,cache:r};const i=new Set;if(t)for(const n of e){const e=t(n);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:o};return{map:e.map,cache:e}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||ot,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,t}resolveLineStyle(e,t){return function(e,t,n,o){const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.stroke&&t){const n=o(t);if(n)return{...e,stroke:n}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:o(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,n,o){if(e.areaStyle){const r=e.areaStyle(n||{});if(r&&!r.fill&&t){const e=o(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.fill&&t){const n=o(t);if(n)return{...e,fill:n,stroke:e.stroke||n}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const s=o(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:n,groupColorCounter:o}=function(e){const{group:t,colorMapCache:n,groupColorMap:o,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(n){const e=n.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=o.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||ot;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,o.set(t,c),o.size>r){const e=o.keys().next().value;void 0!==e&&o.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=Ne(e),n=this.getPointId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=Ne(e),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},n=Object.keys(e).filter(n=>e[n]!==t[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let o=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!je(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!je(n,s);(a||l)&&(e?(this.getX=_e(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=_e(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=_e(this.config.xAccessor,"x"),this.getY=_e(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Yt(this.config)),o=!0,r=!0)}if("groupAccessor"in e&&!je(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Pe(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in e&&!je(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Pe(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in e&&!je(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?_e(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in e&&!je(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Pe(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in e&&!je(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in e&&!je(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?_e(this.config.y0Accessor,"y0"):void 0,o=!0,r=!0),("boundsAccessor"in e&&!je(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Yt(this.config),o=!0,r=!0),"pointIdAccessor"in e&&!je(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Pe(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!je(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!je(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!je(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!je(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?_e(this.config.openAccessor,"open"):void 0,this.getHigh=_e(this.config.highAccessor,"high"),this.getLow=_e(this.config.lowAccessor,"low"),this.getClose=t?_e(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,o=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(o=!0,r=!0),!o){const n=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of n)if(e[r]!==t[r]){o=!0;break}}o&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};mn.GROUP_COLOR_MAP_CAP=1e3;var gn=mn;Object.assign(gn.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){Ut.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Ut.get(this);return Ut.delete(this),e}});var xn=require("react"),bn={sceneGeometry:0,layout:0,domain:0};function vn(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function kn(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var wn="production"!==process.env.NODE_ENV,An={revisions:bn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Sn=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=bn,this.lastObserved=bn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){wn&&(this.lastObserved=kn(this.lastObserved,vn(e)))}beforeCompute(e,t){if(!wn)return An;const n=kn(vn(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(wn){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},Mn=(0,xn.memo)(function({store:e,diagnostics:t}){return(0,xn.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),Cn=y(require("react"));function jn(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Cn.createElement(Cn.Fragment,null,...t)}var _n=y(require("react")),Rn=require("react/jsx-runtime"),Pn={isActive:!1,predicate:()=>!0},Ln=_n.createContext(null);function In({value:e,children:t}){return(0,Rn.jsx)(Ln.Provider,{value:e,children:t})}function Tn(){return _n.useContext(Ln)??Pn}function Nn(e,t){return null!=e?(0,Rn.jsx)(In,{value:t,children:e}):e}var Fn=require("react");function On(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}}function Bn(e,t=30){return Math.max((e??4)+5,12,t)}function Wn(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Dn(e,t){const n=Wn(e);if(!n)return!1;const o=Wn(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var zn=[40,40],Hn=[.5,.5];function En(e,t){const[n,o]=e.viewBox??zn,[r,i]=e.anchor??Hn,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function $n(e,t){const n=En(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function Yn(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var Gn=null;function qn(e){if("undefined"==typeof Path2D)return null;Gn||(Gn=new Map);const t=Gn.get(e);if(t)return t;const n=new Path2D(e);return Gn.size>1024&&Gn.clear(),Gn.set(e,n),n}function Vn(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??zn,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function Xn(e,t){const n=En(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function Un(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=qn(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:Yn(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:Yn(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}var Kn=new WeakMap,Qn=0,Zn=!1,Jn=null,eo=null;function to(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),o=n.indexOf(",");if(-1===o){const e=n.trim();return e.startsWith("--")?{name:e}:null}const r=n.slice(0,o).trim(),i=n.slice(o+1).trim();return r.startsWith("--")?{name:r,fallback:i||void 0}:null}(t);if(!n)return t;const o=()=>n.fallback?to(e,n.fallback):t,r=e.canvas;if(!r)return o();!function(){if(Zn)return;if("undefined"==typeof window||"undefined"==typeof document)return;Zn=!0;const e=()=>{Qn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"],subtree:!0}),"function"==typeof window.matchMedia)try{Jn=window.matchMedia("(prefers-color-scheme: dark)"),eo=e,"function"==typeof Jn.addEventListener?Jn.addEventListener("change",eo):"function"==typeof Jn.addListener&&Jn.addListener(eo)}catch{}}();let i=Kn.get(r);i&&i.version===Qn||(i={version:Qn,map:new Map},Kn.set(r,i));const s=i.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(n.name).trim()||o()||t;return i.map.set(t,a),a}function no(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var oo=null;var ro=require("react/jsx-runtime");function io(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function so(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function ao(e,t){let n=2166136261;const o=so(t);for(let e=0;o.length>e;e++)n^=o.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var lo=new Map;function co(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,ro.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,ro.jsx)("rect",{width:l,height:l,fill:n}),(0,ro.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,ro.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function uo(e,t,n="#4e79a7"){if(io(e)){const n=ao(t,e);return{fill:`url(#${n})`,def:co(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var ho=require("d3-shape");function fo(e){switch(e){case"monotoneX":return ho.curveMonotoneX;case"monotoneY":return ho.curveMonotoneY;case"cardinal":return ho.curveCardinal;case"catmullRom":return ho.curveCatmullRom;case"step":return ho.curveStep;case"stepBefore":return ho.curveStepBefore;case"stepAfter":return ho.curveStepAfter;case"basis":return ho.curveBasis;case"natural":return ho.curveNatural;default:return null}}function po(e,t,n){if(null==t)return n;if(io(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${so(e)}@${n}`,r=lo.get(o);if(void 0!==r)return r;const i=function(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a={background:n,stroke:o,lineWidth:r,spacing:i,angle:s},l=Math.max(8,Math.ceil(2*i));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(oo||(oo=document.createElement("canvas")),oo.width=e,oo.height=e,oo)}(l)}catch{return no(a)}const u=c.getContext("2d");if(!u)return no(a);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=o,u.lineWidth=r,u.lineCap="square";const h=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-l;2*l>=t;t+=i)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(h);const e=2*l;for(let t=-e;e>=t;t+=i)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),s=io(i)?null:i;return lo.set(o,s),s}(t,e);return o||t.background&&to(e,t.background)||n}return"string"!=typeof t?t:to(e,t)||n}function yo(e,t,n,o,r,i,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,r,i,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),h=e.createLinearGradient(o,r,i,s),[d,f,p]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,n);return h.addColorStop(0,`rgba(${d},${f},${p},${c})`),h.addColorStop(1,`rgba(${d},${f},${p},${u})`),h}function mo(e,t,n,o,r,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,r,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var go=require("d3-shape"),xo=new WeakMap;function bo(e,t){const n=fo(t);if(!n)return e;const o=xo.get(e);if(o)return o;const r=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let r=null;const i={moveTo(e,t){r=[e,t],o.push([e,t])},lineTo(e,t){r=[e,t],o.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void o.push([a,l]);const[c,u]=r;for(let r=1;n>=r;r++){const h=r/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*i+h*h*h*a,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,i){r=[n,i],o.push([n,i])}};return(0,go.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),o}(e,n);return xo.set(e,r),r}function vo(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,y,m)=>{if(r>u||c>y||l>d||h>m)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Bn(a(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=wo(i,t,n,o);break;case"symbol":e=Ao(i,t,n,o);break;case"glyph":e=So(i,t,n,o);break;case"line":e=Mo(i,t,n,o);break;case"rect":if(null==i.datum)break;e=jo(i,t,n);break;case"heatcell":e=_o(i,t,n);break;case"area":if(!1===i.interactive)break;e=Po(i,t,n);break;case"candlestick":e=Ro(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ko(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Lo(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function wo(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>Bn(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Ao(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>Bn(Bt(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function So(e,t,n,o=30){if(null==e.datum)return null;const r=Xn(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>Bn(r.radius,o)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function Mo(e,t,n,o=30){if(0===e.path.length)return null;const r=Lo(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let o=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[a,l]=e.path[r+1],c=Co(t,n,i,s,a,l);o>c&&(o=c)}a=o}else{const e=t-i,o=n-s;a=Math.sqrt(e*e+o*o)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function Co(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*s+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(o+c*a))**2)}function jo(e,t,n){const o=On(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function _o(e,t,n){const o=On(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ro(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function Po(e,t,n){if(0===e.topPath.length)return null;const o=Lo(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function Lo(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}var Io=require("react"),To={fresh:1,aging:.7,stale:.45,expired:.25},No={alpha:1,band:"fresh",isStale:!1};function Fo(e,t){if(!e||0>=t)return No;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...To,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:No}var Oo=require("react/jsx-runtime");function Bo({isStale:e,position:t}){return(0,Oo.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Wo=require("react"),Do=y(require("react")),zo=16,Ho=6,Eo=10,$o=22,Yo=require("react/jsx-runtime"),Go={fill:(e,t)=>(0,Yo.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Yo.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function qo(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Go[n])(o(e,t),r),i}function Vo({swatchSize:e}){return(0,Yo.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Xo(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Uo=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let y=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=r,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((e,c)=>{const u=qo(e,c,h,d,x),k=Xo(e,o,r),w=r&&r.size>0&&r.has(e.label);p.push((0,Yo.jsxs)("g",{transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?a===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?w||!1:void 0,"aria-current":m&&!g&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&(0,Yo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,Yo.jsx)(Vo,{swatchSize:x}),(0,Yo.jsx)("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),y+=v}),p},Ko=({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const h=[],d=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:o})=>{n+=5;const r=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const s=n;return n+=o*t+8,{lineY:r,labelY:i,itemsY:s,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const p=d[f];h.push((0,Yo.jsx)("line",{stroke:"gray",x1:0,y1:p.lineY,x2:t,y2:p.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=p.labelY&&h.push((0,Yo.jsx)("text",{y:p.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h.push((0,Yo.jsx)("g",{className:"legend-item",transform:`translate(0,${p.itemsY})`,children:Uo(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f))}),h},Qo=({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const y=((e,t,n,o,r,i,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,y=[],{swatchSize:m,labelGap:g,itemGap:x,rowHeight:b,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=r,A=p.map(e=>m+g+7*e.label.length),S=[];let M=0,C=0;A.forEach((e,t)=>{const n=0===C?e:C+x+e;h&&h>0&&C>0&&n>h?(S.push({start:M,end:t,width:C}),M=t,C=e):C=n}),p.length>0&&S.push({start:M,end:p.length,width:C}),S.forEach((e,c)=>{let u="center"===v?Math.max(0,((h??e.width)-e.width)/2):"end"===v?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],v=qo(e,h,d,f,m),S=Xo(e,o,r),M=r&&r.size>0&&r.has(e.label);y.push((0,Yo.jsxs)("g",{transform:`translate(${u},${c*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===i&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?M||!1:void 0,"aria-current":k&&!w&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(h+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,Yo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,M&&(0,Yo.jsx)(Vo,{swatchSize:m}),(0,Yo.jsx)("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=A[h]+x}});const j=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:j,totalRows:_,totalHeight:_*b}})(e,o,r,i,s,a,l,t,c,u,h,h.maxWidth??n);p+=y.offset+5,f.push({label:e.label,...y,offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight}),d+=p+12});const p=h.maxWidth??n;let y=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const m=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(m.push((0,Yo.jsx)("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),y+=16),m.push((0,Yo.jsx)("g",{className:"legend-item",transform:`translate(${y},0)`,children:n.items},"legend-group-"+o)),y+=n.offset+5,e[o+1]&&m.push((0,Yo.jsx)("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),(0,Yo.jsx)("g",{children:m})};function Zo({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Do.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Yo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,Yo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Yo.jsx)("defs",{children:(0,Yo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Yo.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Yo.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Yo.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,Yo.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Yo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,Yo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Yo.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Yo.jsx)("defs",{children:(0,Yo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Yo.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Yo.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,Yo.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function Jo(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=e,d=function(e){const t=Math.max(1,e?.swatchSize??zo),n=Math.max(t,e?.rowHeight??$o);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??Ho),itemGap:Math.max(0,e?.itemGap??Eo),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(h),[f,p]=Do.useState(0),[y,m]=Do.useState(0),g=Do.useCallback((e,t)=>{p(e),m(t)},[]),x="vertical"===u?Ko({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}):Qo({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}),b=!(!n&&!o);return(0,Yo.jsxs)("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Yo.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function er(...e){let t;for(const n of e)n&&(t=tr(t)&&tr(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}function tr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}var nr=require("react/jsx-runtime");function or(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,y=Math.max(0,n-r.left-r.right),m=Math.max(1,f?s?.maxWidth??y:100);let g,x;return"left"===i?(g=Math.max(4,r.left-m-10),x=r.top):"top"===i?(g=r.left,x=p?32:8):"bottom"===i?(g=r.left,x=o-r.bottom+38):(g=n-r.right+10,x=r.top),(0,nr.jsx)("g",{transform:`translate(${g}, ${x})`,children:(b=t,"object"==typeof b&&null!==b&&"gradient"in b?(0,nr.jsx)(Zo,{config:t.gradient,orientation:f?"horizontal":"vertical",width:m}):tr(t)?(0,nr.jsx)(Jo,{legendGroups:t.legendGroups,title:"",width:m,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var b}var rr=require("react"),ir=require("d3-array");M();var sr=require("react/jsx-runtime");function ar(e){return"string"==typeof e?{type:e}:e}function lr({orient:e,config:t,values:n,scale:o,size:r,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,rr.useMemo)(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(n);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:h}=t,d=Math.min(.5*l,20),f=(l-d)/2+4;if(a){const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="top"===e?-1:1,m=0;return(0,sr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,sr.jsx)("line",{x1:l,y1:m+y*(f+d/2),x2:p,y2:m+y*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:l,y1:m+y*f,x2:l,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("rect",{x:Math.min(t,n),y:"top"===e?m-f-d:m+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:a,y1:"top"===e?m-f-d:m+f,x2:a,y2:"top"===e?m-f:m+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="left"===e?-1:1,m=0;return(0,sr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,sr.jsx)("line",{x1:m+y*(f+d/2),y1:l,x2:m+y*(f+d/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:m+y*f,y1:l,x2:m+y*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:m+y*f,y1:p,x2:m+y*(f+d),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("rect",{x:"left"===e?m-f-d:m+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:"left"===e?m-f-d:m+f,y1:a,x2:"left"===e?m-f:m+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,ir.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=S(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,sr.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,sr.jsx)("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,sr.jsx)("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.type){const t=l/2+4,n=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),s=o((r.x0+r.x1)/2);n.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,sr.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,sr.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${r},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${s},${n}`),t.push("Z")}else{const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${n},${r}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${s}`),t.push("Z")}return(0,sr.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,sr.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,o,s,r,i,e,a,4]);return l?(0,sr.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var cr=y(require("react")),ur=require("react/jsx-runtime");function hr(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function dr(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 fr(e,t,n,o){if(!e)return(0,ur.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,ur.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>t?"end":"start";const f=16,p=i?c?[i]:hr(i,l):[],y=r?c?[r]:hr(r,l):[],m="leftRight"===u?"end"===d?-4:4:0;let g=0;const x=[],b=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push((0,ur.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?m-l:"middle"===d?m-l/2:m,y:-16,width:l,height:Math.max(f,(p.length+y.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,ur.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,ur.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,ur.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(x.push((0,ur.jsx)("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>(0,ur.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),y.length>0&&x.push((0,ur.jsx)("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:g,children:y.map((e,t)=>(0,ur.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),v=(0,ur.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+y.length)*f+(y.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=(0,ur.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+y.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,ur.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,ur.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function pr(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,ur.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,ur.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,ur.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,ur.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,ur.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,ur.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,ur.jsx)("path",{d:dr(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,ur.jsx)("g",{className:"annotation-subject",children:i})}function yr(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;a=r+s*d,l=i+c*d}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.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}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,p=o+h*f,y=i+d*f;s.push((0,ur.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${y} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(y-l,p-a)}else s.push((0,ur.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,ur.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,ur.jsx)("g",{className:"annotation-connector",children:s})}function mr(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:p,strokeDasharray:y,events:m={},"data-testid":g}=e,x=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=o||0,w=r||0;null!=i&&(k=i-x),null!=s&&(w=s-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,ur.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":g,...null!=p&&{opacity:p},...y&&{strokeDasharray:y},...m,children:[!v.has("connector")&&yr(k,w,l,h,A,c),!v.has("subject")&&pr(A,c,h,x,b),!v.has("note")&&fr(a,k,w,h)]})}function gr(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,ur.jsx)(mr,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,ur.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,ur.jsx)(mr,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var xr=require("d3-hierarchy"),br=require("d3-shape");function vr(e){return Math.round(100*e)/100}function kr(e,t=2){const n=[],o=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[n,o]of e)null!==o&&(i+=n**t*o);n.push(i);const s=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));s.push(o)}o.push(s)}o.push(n);const i=function(e,t){const n=e,o=e.length-1,r=[t];for(let e=0;o>e;e++){let t=e;for(let r=e+1;o>r;r++)Math.abs(n[e][r])>Math.abs(n[e][t])&&(t=r);for(let r=e;o+1>r;r++){const o=n[r][e];n[r][e]=n[r][t],n[r][t]=o}for(let t=e+1;o>t;t++)for(let r=o;r>=e;r--)n[r][t]-=n[r][e]*n[e][t]/n[e][e]}for(let e=o-1;e>=0;e--){let t=0;for(let i=e+1;o>i;i++)t+=n[i][e]*r[i];r[e]=(n[o][e]-t)/n[e][e]}return r}(o,r).map(vr);return{points:e.map(([e])=>[vr(e),vr(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function wr(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function Ar(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Sr(e){return null==e?null:e+""}function Mr(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Cr(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return Mr(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?Mr(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return Sr(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>Sr(e.pointId)===o);if(r)return Mr(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return Sr(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=wr(i,n),a=Ar(i,n);return null==s||null==a?null:Mr(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=wr(e,n),i=Ar(e,n)),null!=r&&null!=i)return Mr(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function jr(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var _r=require("react/jsx-runtime"),Rr={secondary:0,primary:3};function Pr(e){return!0===e?._annotationDeferred}function Lr(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Ir(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Tr(e){return Math.max(.72,.95-.06*e)}M();var Nr=y(require("react")),[Fr,Or]=pe(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 Br(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(o){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(o);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Wr=require("react/jsx-runtime"),Dr="var(--semiotic-bg, #ffffff)";function zr(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:h}=e,d=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,Wr.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:h,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??Dr,strokeWidth:d.haloWidth??3});const p=d.padding??{x:6,y:3},y="number"==typeof p?p:p.x,m="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(o,i),x=i+2*m;let b,v;return b="middle"===l?t-g/2-y:"end"===l?t-g-y:t-y,v="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,(0,Wr.jsxs)("g",{className:h,children:[(0,Wr.jsx)("rect",{x:b,y:v,width:g+2*y,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??Dr,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}var Hr=require("react/jsx-runtime"),Er={linear:br.curveLinear,monotoneX:br.curveMonotoneX,monotoneY:br.curveMonotoneY,step:br.curveStep,stepAfter:br.curveStepAfter,stepBefore:br.curveStepBefore,basis:br.curveBasis,cardinal:br.curveCardinal,catmullRom:br.curveCatmullRom};var $r=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Yr(e){return!!e&&"object"==typeof e&&$r.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Gr(e){return"primary"===e?.emphasis||!0===e?.defensive}function qr(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Vr(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Xr=32,Ur=6,Kr=4,Qr=8,Zr=72;var Jr={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function ei(e){if(!ti(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function ti(e){return Yr(e)}function ni(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function oi(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function ri(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function ii(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function si(e,t,n,o,r,i,s,a){const l=ri(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*ii(l,e);for(const e of o)c+=4*ii(l,e);return c}function ai(e){const{annotations:t,context:n,defaultOffset:o=Xr,notePadding:r=Ur,markPadding:i=Kr,edgePadding:s=Qr,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Zr,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:y,audience:m}=e,g=n.width||0,x=n.height||0,b="object"==typeof p?p:{},v=b.breakpoint??480,k=!!p&&v>=g,w=k&&!1!==b.preferShortText?t.map(ei):t,A=k&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,S=h||k&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),M=k&&!f?b.responsive??{minWidth:v}:f,C=k&&!y?b.cohesion:y;if(0===w.length||0>=g||0>=x)return w.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=w.map((e,t)=>{if(!ti(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Cr(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...ni("string"==typeof e.title?e.title:void 0,t),...ni("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(h=e).dx||"number"==typeof h.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(ri(oi(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var h;let d=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(o)){const t=si(oi(i.x,i.y,e.dx,e.dy,u),e,j,_,g,x,r,s);f>t&&(d=e,f=t)}if(!d)return e;const p=ri(oi(i.x,i.y,d.dx,d.dy,u),r);j.push(p);const y=Math.hypot(d.dx,d.dy),m=l&&y>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:d.dx,dy:d.dy,...m?{connector:m}:{}}}),L=R?P:w.slice();let I=L;if(d){let e=!1;const t=L.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:L}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Jr[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const T=new Set;if(A){const e="object"==typeof A?A:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(m),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??qr(g,x,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=qr(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Yr(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Gr(e.annotation)),c=a.filter(e=>!Gr(e.annotation)).sort((e,t)=>Vr(t.annotation)-Vr(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),h=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),d=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:I,width:g,height:x,...n});for(const e of o)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=g)for(const e of I)ti(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let N;return N=0===T.size?I:S?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>ti(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(N,C):N}var li=require("react"),ci={positions:new Map},ui=new Set;function hi(){for(const e of ui)e()}function di(e,t){const n=ci.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ci.positions);o.delete(e),ci={positions:o},hi()}function fi(e,t){const n=ci.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(ci.positions);o.delete(e),ci={positions:o},hi()}function pi(){return ci}function yi(e){return ui.add(e),()=>ui.delete(e)}var mi={positions:new Map};function gi(){return()=>{}}function xi(){return mi}function bi(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}function vi(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function ki(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function wi(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function Ai(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Si(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}var Mi=require("react/jsx-runtime");function Ci(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=e,f=(0,Wo.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||u||ji,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o),a=e?.tickValues??bi(s.x,i,d),c=a.map(e=>e.valueOf()),h=a.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,c)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return _i(h,Math.max(55,f+8))},[s,l,u,t,d]),p=(0,Wo.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||h||ji,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o);return _i((e?.tickValues??bi(s.y,i,d)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,h,n,d]),y=c&&s,m=a&&s;if(!y&&!m)return null;const g=l?.find(e=>"bottom"===e.orient),x=l?.find(e=>"left"===e.orient),b=m&&(!g||!1!==g.baseline),v=m&&(!x||!1!==x.baseline),k=g?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return(0,Mi.jsx)("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,Mi.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&(()=>{const e=Ai(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=Ai(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Mi.jsxs)("g",{className:"stream-grid",children:[f.map((t,o)=>(0,Mi.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),p.map((e,n)=>(0,Mi.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),b&&!k&&(0,Mi.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&(0,Mi.jsx)("path",{d:Si("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&(0,Mi.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&(0,Mi.jsx)("path",{d:Si("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function ji(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function _i(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function Ri(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:p,showGrid:y,title:m,legend:g,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:M,marginalGraphics:C,xValues:j,yValues:_,annotations:R,onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T,autoPlaceAnnotations:N,svgAnnotationRules:F,xAccessor:O,yAccessor:B,annotationData:W,pointNodes:D,curve:z,underlayRendered:H,canvasObscuresUnderlay:E=!0,linkedCrosshairName:$,linkedCrosshairSourceId:Y,children:G}=e,q=function(e){const t=Or(e=>e.pushObservation),n=Nr.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return Nr.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T}),V=(0,Wo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||d||ji,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o),c=e?.tickValues??bi(s.x,i,p),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,u)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),y=e?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let m=_i(h,y);if(m.length>1&&(m=m.filter((e,t)=>0===t||e.label+""!=m[t-1].label+"")),e?.includeMax&&m.length>0&&"exact"!==p&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=m[m.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,m.length,u);y>t-o&&m.length>1&&(m=m.slice(0,-1)),m.push({value:e,pixel:t,label:r})}}return m},[a,s,l,d,t,p]),X=(0,Wo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||ji,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o);let c=_i((e?.tickValues??bi(s.y,i,p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==p&&!e?.tickValues){const e=s.y.domain()[1],n=s.y(e),o=c[c.length-1].pixel;if(Math.abs(n-o)>1){const r=t(e);22>Math.abs(n-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:n,label:r})}}return c},[a,s,l,f,n,p]),U=(0,Wo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||ji,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return _i((e.tickValues??bi(s.y,"exact"===p?Math.max(2,r):Math.min(r,o),p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,f,n,p]),K=(0,Wo.useRef)(new Map),Q=(0,Wo.useRef)(R?.length??0),Z=R?.length??0;Q.current!==Z&&(Q.current=Z,K.current=new Map);const J=(0,Wo.useMemo)(()=>{if(!R||0===R.length)return null;const e=function(e,t={}){const n=!0===t.showRetractedAnnotations,o=!0===t.showSupersededAnnotations,r=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&r.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&r.has(t)&&!o)})}(R),o=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Cr(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!jr(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,Hr.jsx)(gr,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=wr(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const a=t>.6*(o.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,Hr.jsxs)("g",{opacity:e.opacity,children:[(0,Hr.jsx)("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Hr.jsx)(zr,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Ar(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=t)?Math.min((o.height||0)-4,s+16):s-4;return(0,Hr.jsxs)("g",{opacity:e.opacity,children:[(0,Hr.jsx)("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Hr.jsx)(zr,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:wr({...e,type:"point"},o),y:Ar({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,xr.packEnclose)(t),i=e.padding||10;return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Hr.jsx)(zr,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:wr({...e,type:"point"},o),y:Ar({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=A(i),[c,u]=A(s),h=a-r,d=l+r,f=c-r;return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("rect",{x:h,y:f,width:d-h,height:u+r-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Hr.jsx)(zr,{x:(h+d)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=o.data||[],r="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,Hr.jsx)("g",{children:r.map((t,n)=>{const r=wr(t,o),s=Ar(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,Hr.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=wr(e,o),r=Ar(e,o);return(0,Hr.jsx)(gr,{noteData:{x:t??0,y:r??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}},"ann-"+n)}case"trend":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const h=[],d=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=d.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,p=o.scales?.y??o.scales?.value;if(!f||!p)return null;const y=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(h.length-1,n+1),r=t-n,i=e(h[n]);return i+(e(h[o])-i)*r},m=f,g=p;let x;if(s)if(a){const e=y(g);x=(t,n)=>[m(n),e(t)]}else{const e=y(m);x=(t,n)=>[e(t),g(n)]}else x=(e,t)=>[m(e),g(t)];const b=e.method||"linear";let v;if("loess"===b)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]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*r[e],d+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*f-h*h;if(1e-12>Math.abs(y))a.push([t,d/u]);else{const e=(u*p-h*d)/y;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===b?kr(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[o,r]of e)null!==r&&(n++,t[0]+=o,t[1]+=r,t[2]+=o*o,t[3]+=o*r);const o=n*t[2]-t[0]*t[0],r=0===o?0:vr((n*t[3]-t[0]*t[1])/o),i=vr(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[vr(e),vr(r*e+i)]),equation:[r,i]}}(u);v=t.points}const k=v.map(([e,t])=>{const[n,o]=x(e,t);return`${n},${o}`}).join(" "),w=e.color||"#6366f1",A=v[v.length-1],[S,M]=x(A[0],A[1]);return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Hr.jsx)("text",{x:S+4,y:M-4,fill:w,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,s=t?.domain?.(),a=e.y0??s?.[0],l=e.y1??s?.[1],c=null!=a&&t?t(a):0,u=null!=l&&t?t(l):o.height||0,h=uo(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Hr.jsxs)("g",{opacity:e.opacity,children:[h.def&&(0,Hr.jsx)("defs",{children:h.def}),(0,Hr.jsx)("rect",{x:0,y:Math.min(c,u),width:o.width||0,height:Math.abs(u-c),fill:h.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,Hr.jsx)(zr,{x:(o.width||0)-4,y:(r=c,i=u,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=o.scales?.x??o.scales?.time,r=t?.domain?.(),i=e.x0??r?.[0],s=e.x1??r?.[1],a=null!=i&&t?t(i):null,l=null!=s&&t?t(s):null;if(null==a||null==l)return null;const c=uo(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Hr.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,Hr.jsx)("defs",{children:c.def}),(0,Hr.jsx)("rect",{x:Math.min(a,l),y:0,width:Math.abs(l-a),height:o.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,Hr.jsx)(zr,{x:Math.min(a,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const h=Er[o.curve||"linear"]||br.curveLinear,d=(0,br.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Hr.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",y=e.fillOpacity??.1,m=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,x=s(l+h*u),b=s(d),v=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return(0,Hr.jsxs)("g",{children:[f&&(0,Hr.jsx)("rect",{x:0,y:Math.min(x,b),width:o.width||0,height:Math.abs(b-x),fill:p,fillOpacity:y}),v.map((e,t)=>{const n=wr(e,o),r=Ar(e,o);return null==n||null==r?null:(0,Hr.jsx)("circle",{cx:n,cy:r,r:g,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Hr.jsx)("text",{x:(o.width||0)-4,y:Math.min(x,b)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],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>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=kr(l,e.order||2).equation;c=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,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,h=l.map(([e,t])=>t-c(e)),d=h.reduce((e,t)=>e+t*t,0),f=Math.sqrt(d/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,y=l.reduce((e,t)=>e+(t[0]-p)**2,0),m=e.confidence??.95,g=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,x=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;x>=e;e++)k.push(b+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/u+(y>0?(e-p)**2/y:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(b)},${a(c(b))}`,C=e.strokeColor||"#6366f1";return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("path",{d:A,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Hr.jsx)("polyline",{points:`${M} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,Hr.jsx)("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=Cr(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!jr(r,i,o))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,Hr.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,Hr.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Hr.jsx)("div",{...Br(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Cr(e,n,o);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,Hr.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?cr.cloneElement(c,{key:"ann-text-"+n}):(0,Hr.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Hr.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),cr.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return(0,Hr.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,Hr.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&(0,Hr.jsx)(zr,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,Hr.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,Hr.jsx)(zr,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,q),r={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:O,yAccessor:B,width:t,height:n,data:W,frameType:"xy",pointNodes:D,curve:z,stickyPositionCache:K.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Ir(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>Pr(e.annotation)),r=e.some(e=>null!=Lr(e.annotation)),i=e.some(e=>"layer"===Lr(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=Rr[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=Pr(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,_r.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Tr(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=Lr(t.annotation);return a&&(s=(0,_r.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,_r.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,_r.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&a.unshift((0,_r.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(N?ai({annotations:e,context:r,..."object"==typeof N?N:{}}):e,o,F,r)},[R,N,F,t,n,O,B,W,s,D,z,q]),ee=function(e){const t=(0,li.useSyncExternalStore)(e?yi:gi,e?pi:xi,e?pi:xi);return e?t.positions.get(e)??null:null}($);return(0,Wo.useEffect)(()=>{if(!ee?.locked||!$)return;const e=e=>{"Escape"===e.key&&fi($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ee?.locked,$]),a||m||g||M||C||J&&J.length>0||y||G||ee?(0,Mi.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Mi.jsx)("title",{children:"string"==typeof m?m:"XY Chart"}),(0,Mi.jsx)("desc",{children:"string"==typeof m?m+" (XY data visualization)":"XY data visualization"}),(0,Mi.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&s&&(!H||E)&&(()=>{const e=Ai(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=Ai(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Mi.jsxs)("g",{className:"stream-grid",children:[V.map((t,o)=>(0,Mi.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),X.map((e,n)=>(0,Mi.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,s=!o||!1!==o.baseline,a=e?.jaggedBase||!1,d=o?.jaggedBase||!1,f=o?.landmarkTicks,p=e?.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",x=!!o?.autoRotate&&V.length>1&&(()=>{const e=t/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),b=x?12:18,v=n+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=o?.tickAnchor,M=e?.tickAnchor,C=wi(V),j=wi(X);return(0,Mi.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,Mi.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||E)&&s&&!d&&(0,Mi.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&d&&(0,Mi.jsx)("path",{d:Si("bottom",t,n),fill:"none",stroke:y,strokeWidth:1}),V.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):Dn(e.value,t>0?V[t-1].value:void 0));return(0,Mi.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,Mi.jsx)("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Mi.jsx)("text",{y:b,textAnchor:x?"end":vi(S,e.pixel===C.min,e.pixel===C.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},transform:x?"rotate(-45)":void 0,children:e.label}):(0,Mi.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Mi.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,Mi.jsx)("text",{x:t/2,y:v,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),(0,Mi.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||E)&&r&&!a&&(0,Mi.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&a&&(0,Mi.jsx)("path",{d:Si("left",t,n),fill:"none",stroke:y,strokeWidth:1}),X.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):Dn(e.value,t>0?X[t-1].value:void 0));return(0,Mi.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,Mi.jsx)("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Mi.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:ki(M,e.pixel===j.min,e.pixel===j.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):(0,Mi.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Mi.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,Mi.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===U.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,s=e.label||h,a=e.tickAnchor,c=wi(U);return(0,Mi.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&(0,Mi.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:y,strokeWidth:1}),U.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):Dn(e.value,n>0?U[n-1].value:void 0));return(0,Mi.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,Mi.jsx)("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Mi.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:ki(a,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,Mi.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Mi.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+n)}),s&&(0,Mi.jsx)("text",{x:t+i.right-15,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${t+i.right-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:s})]})})()]})})(),J,C&&s&&j&&_&&(0,Mi.jsxs)(Mi.Fragment,{children:[C.top&&(0,Mi.jsx)("g",{transform:"translate(0, 0)",children:(0,Mi.jsx)(lr,{orient:"top",config:ar(C.top),values:j,scale:s.x,size:i.top,length:t})}),C.bottom&&(0,Mi.jsx)("g",{transform:`translate(0, ${n})`,children:(0,Mi.jsx)(lr,{orient:"bottom",config:ar(C.bottom),values:j,scale:s.x,size:i.bottom,length:t})}),C.left&&(0,Mi.jsx)("g",{transform:"translate(0, 0)",children:(0,Mi.jsx)(lr,{orient:"left",config:ar(C.left),values:_,scale:s.y,size:i.left,length:n})}),C.right&&(0,Mi.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,Mi.jsx)(lr,{orient:"right",config:ar(C.right),values:_,scale:s.y,size:i.right,length:n})})]}),M,ee&&ee.sourceId!==Y&&s?.x&&(()=>{const e=s.x(ee.xValue);if(null==e||0>e||e>t)return null;const o=ee.locked;return(0,Mi.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),G]}),m&&"string"==typeof m?(0,Mi.jsx)("text",{x:o/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?(0,Mi.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,or({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:w,title:m,legendLayout:S,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k})]}):null}var Pi=y(require("react")),Li=require("d3-shape");function Ii(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}var Ti=require("react/jsx-runtime");function Ni(e,t="#4e79a7"){return io(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function Fi(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function Oi(e){const t=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));return 2>t.length?null:t.map((e,t)=>(0,Ti.jsx)("stop",{offset:e.offset,stopColor:e.color},t))}var Bi=require("react/jsx-runtime");function Wi(e,t,n){if(!e||2>t.length)return null;const o=Oi(e.colorStops);return o?(0,Bi.jsx)("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:o}):null}var Di="undefined"==typeof window||"undefined"==typeof document,zi=require("react"),Hi="undefined"!=typeof window?zi.useLayoutEffect:zi.useEffect,Ei=()=>()=>{},$i=()=>!1,Yi=()=>!0,Gi=require("react");function qi(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Vi(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Xi(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Ui(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:o=""}=e;return"transparent"===t||n?null:t||(o&&"transparent"!==o?o:"")||null}var Ki={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function Qi(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}var Zi=y(require("react")),Ji=y(require("react")),es=(require("react/jsx-runtime"),Ji.createContext(null)),ts=require("react/jsx-runtime"),ns={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function os({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,ts.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:ns,children:t})}function rs(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}function is(e){return e&&"object"==typeof e?e:{}}function ss(e){return is(e.accessibility).tableFields??e.accessibleDatum??e.datum}var as=require("react/jsx-runtime");function ls(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var cs=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},us="semiotic-accessible-data-table",hs=us+" semiotic-accessible-data-table-hidden",ds=us+" semiotic-accessible-data-table-visible",fs={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},ps={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ys={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},ms={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},gs={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},xs={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},bs={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},vs={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function ks({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=Zi.useState(!1),[s,a]=Zi.useState(5),l=Ji.useContext(es),c=l?.visible??!1,u=r||c,h=Zi.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;Zi.useEffect(()=>{u||a(5)},[u]);const f=Zi.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=Zi.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,as.jsx)("span",{id:n,tabIndex:-1,style:ns}):null;if(!u)return(0,as.jsx)("div",{id:n,className:hs,tabIndex:-1,onFocus:f,style:ns,role:"region","aria-label":d,children:(0,as.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const y=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:rs(ss(o))});break;case"line":case"area":{const e=ss(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:rs(e)});break}case"rect":{const e=ss(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=rs(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=rs(ss(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=ss(o),n=rs(e);if(null==n.category){const t=is(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:rs(ss(o))});break;case"arc":t.push({label:"Arc",values:rs(ss(o))});break;case"candlestick":t.push({label:"Candlestick",values:rs(ss(o))});break;case"geoarea":{const e=is(ss(o)),n=rs(e);if(null==n.name){const t=is(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${cs(e.min)} to ${cs(e.max)}, mean ${cs(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),x=Math.min(s,y.length),b=y.slice(0,x),v=y.length-x,k=new Set;for(const e of b)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,as.jsxs)("div",{ref:h,id:n,className:ds,tabIndex:-1,onBlur:p,style:fs,role:"region","aria-label":d,children:[(0,as.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:ys,children:"×"}),(0,as.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ps,children:g}),(0,as.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:ms,children:[(0,as.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:bs,children:v>0?`First ${x} of ${y.length} data points`:`All ${y.length} data points`}),(0,as.jsx)("thead",{children:(0,as.jsxs)("tr",{children:[(0,as.jsx)("th",{style:gs,children:"type"}),w.map(e=>(0,as.jsx)("th",{style:gs,children:e},e))]})}),(0,as.jsx)("tbody",{children:b.map((e,t)=>(0,as.jsxs)("tr",{children:[(0,as.jsx)("td",{style:xs,children:e.label}),w.map(t=>{return(0,as.jsx)("td",{style:xs,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":cs(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&(0,as.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:vs,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function ws({summary:e}){return e?(0,as.jsx)("div",{role:"note",style:ns,children:e}):null}function As({tableId:e}){return(0,as.jsx)("a",{href:"#"+e,style:ns,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ns)},children:"Skip to data table"})}var Ss=require("react/jsx-runtime"),Ms="var(--semiotic-focus, #005fcc)";function Cs({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Ss.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ms,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Ss.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Ms,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ms,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Ss.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Ss.jsx)("path",{d:a,fill:"none",stroke:Ms,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Ss.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var js=y(require("react"));function _s(e,t){return"touch"===t?Math.max(e,24):e}function Rs(e){return Array.isArray(e)?e[0]:e}function Ps(e,t,n,o){return{data:Rs(e),x:t,y:n,__semioticHoverData:!0,...o}}var Ls=["name","label","title"],Is=["type","kind","category","group","class","status","role","shape"],Ts=["value","amount","total","count","weight","score"],Ns=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function Fs(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function Os(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&Ns.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Ls.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=Fs(l,Is),u=Fs(l,Ts),h=new Set(Is),d=new Set(Ts),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(h.has(e.lower)||d.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}var Bs=require("react/jsx-runtime"),Ws={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Ds(e,t){return"function"==typeof t?t(e):e[t]}function zs(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Hs(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=Ds(e,n);s=zs(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=Ds(e,r);a.push({label:n,value:zs(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=zs(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=zs(e[t[0]],o))}}const l={...Ws,...r};return(0,Bs.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Bs.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Bs.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Bs.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Es(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,Bs.jsx)("div",{className:"semiotic-tooltip",style:Ws,children:(0,Bs.jsx)("div",{children:zs(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return(0,Bs.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[null!=n&&(0,Bs.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:zs(n)}),t.map((e,t)=>(0,Bs.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,Bs.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,Bs.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,Bs.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:zs(e.value)})]},t))]})}}function $s(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Rs(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,Bs.jsx)("div",{className:"semiotic-tooltip",style:Ws,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Hs(e):"multi"===e?("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip — prefer charts that set tooltipMode (LineChart, AreaChart, StackedAreaChart, DifferenceChart). Rendering MultiLineTooltip content as a fallback.'),function(e={}){const{fields:t=[],title:n,format:o,style:r={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=Ds(e,n);l.push({value:zs(t,o)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=zs(Ds(e,r),i);l.push({label:s?n:void 0,value:a})});else{const t=Os(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:zs(t.title,o),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:zs(e.value,o)})})}const c={...Ws,...r};return Array.isArray(l)&&0!==l.length?(0,Bs.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,Bs.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,Bs.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}()):Hs())}}var Ys=require("react/jsx-runtime");function Gs({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=js.useRef(null),[u,h]=js.useState(null);js.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,o,l]);let d;d=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!js.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),p=f?null:Ws;return l?(0,Ys.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var qs=y(require("react")),Vs=require("react"),Xs=require("react");var Us=require("react");function Ks(e,t,n){const o=(0,Us.useRef)(null),[r,i]=(0,Us.useState)(null);return(0,Us.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}var Qs=()=>"undefined"!=typeof performance?performance.now():Date.now();function Zs(e,t){const n=e();return Number.isFinite(n)?n:t}var Js=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Qs,this.lastWallTime=Zs(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=Zs(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??Qs;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Zs(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},ea="undefined"==typeof window?Vs.useEffect:Vs.useLayoutEffect,ta={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function na(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function oa(e){const t=function(){const[e,t]=(0,Xs.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Xs.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Vs.useRef)(t);n.current=t;const[o,r]=Ks(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Vs.useMemo)(()=>function(e,t,n=!1){const o=n?t?58:34:t?36:0;return o>e.top?{...e,top:o}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=na(e.foregroundGraphics,r,a),h=na(e.backgroundGraphics,r,a),d=Se(e=>e.theme),{transition:f,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),y="semiotic-table-"+qs.useId(),m=(0,Vs.useRef)(null);if(!m.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;m.current=new Js({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=m.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,Vs.useRef)(null),b=(0,Vs.useRef)(e.frameScheduler??ta);b.current=e.frameScheduler??ta;const v=(0,Vs.useRef)(null),k=(0,Vs.useRef)(!1),w=(0,Vs.useRef)(()=>{}),A=(0,Vs.useCallback)(()=>{if(null!==x.current||k.current)return;const e=b.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(k.current=!0),x.current=null,v.current=null;try{w.current()}finally{e&&(k.current=!1)}});n=!0,t||(x.current=o,v.current=e)},[]),S=(0,Vs.useCallback)(()=>{null!==x.current&&((v.current??b.current).cancelAnimationFrame(x.current),x.current=null,v.current=null)},[]);ea(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,Vs.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,Vs.useEffect)(()=>()=>{S()},[S]);const M=(0,Vs.useRef)(()=>{}),C=(0,Vs.useRef)(()=>{}),j=(0,Vs.useRef)(null),_=(0,Vs.useRef)(null),R=(0,Vs.useRef)(null),P=(0,Vs.useCallback)(()=>{const e=j.current;j.current=null,e&&M.current(e)},[]),L=(0,Vs.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=b.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,_.current=null,R.current=null,P()});t||(_.current=n,R.current=e)}},[P]),I=(0,Vs.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),C.current()},[]);(0,Vs.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return ea(()=>{T&&(Qn++,T.current=!0,A())},[d,A,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:h,currentTheme:d,transition:f,introEnabled:p,tableId:y,frameRuntime:g,rafRef:x,renderFnRef:w,scheduleRender:A,cancelRender:S,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:L,onPointerLeave:I}}var ra=require("react"),ia=require("react/jsx-runtime");function sa({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,ia.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,ia.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function aa(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function la(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),s=Math.round(t[1]*o),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(n.left,n.top),r}var ca=require("react");function ua(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var ha=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],da=3156e7;function fa(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:da>t?e=>{const t=new Date(e);return`${ha[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*da>t?e=>{const t=new Date(e);return`${ha[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function pa(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:Bt(n.size)});else if("glyph"===n.type){const e=Xn(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}var ya=require("d3-shape");function ma(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function ga(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}var xa=(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const r=t.style.stroke||"#007bff",i=to(e,r)||r,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){ga(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=fo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,h=t._decayOpacities;if(h&&h.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let o=0;t.path.length-1>o;o++)e.globalAlpha=.5*(h[o]+h[o+1])*n,e.beginPath(),e.moveTo(t.path[o][0],t.path[o][1]),e.lineTo(t.path[o+1][0],t.path[o+1][1]),e.stroke()}else if(u){let n=function(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),h=!0},o=function(){h&&(e.stroke(),h=!1)},r=null,s=null,c=null,u=null,h=!1;for(let h=0;t.path.length>h;h++){const[d,f]=t.path[h],p=l[h],y=ma(p,a,i);if(null!==r&&null!==u&&null!==c){if(y===u)e.lineTo(d,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(d-r)*l.t,u=s+(f-s)*l.t,h=ma(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,s=f,c=p,u=y}else n(y,d,f),r=d,s=f,c=p,u=y}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?mo(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,ya.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=po(e,t.style.fill,t.style.fill),c&&!u)(0,ya.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],o.height),e.lineTo(n,o.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function ba(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function va(e,t,n=.3){ba(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ka(e,t,n=.6){if(!ba(t))return;const o=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function wa(e,t,n,o=.35){ba(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var Aa=require("d3-shape");function Sa(e,t){const n=fo(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=(0,Aa.area)().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}var Ma=(e,t,n,o)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,o.width*r,o.height),e.clip());const i=po(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const n=t.style.fillOpacity??.7;e.fillStyle=i;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(Sa(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=yo(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,n,0,o);e.fillStyle=r||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Sa(e,t),wa(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const n=t.strokeGradient&&t.topPath.length>=2?mo(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=fo(t.curve);if(e.beginPath(),o)(0,Aa.line)().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Ca=(e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=po(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=po(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),ka(e,n)}finally{e.restore()}}},ja=new Map;function _a(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=ja.get(t);return n||(n=new Path2D(Ot(e.symbolType,e.size)),ja.size>256&&ja.clear(),ja.set(t,n)),n}catch{return null}}var Ra=(e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=_a(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=n*i*(t.style.fillOpacity??1),e.fillStyle=po(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=po(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n};function Pa(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=En(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=po(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=Vn(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Un(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Un(e,i,c,t.accent,void 0,l),e.restore()}function La(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Ia(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var Ta=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Na(e,t);else if(t.cornerRadii&&Ii(t.cornerRadii)){const n=po(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),o=Ia(t),r=t.fillGradient&&"string"==typeof n?yo(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,La(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=po(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),o=Ia(t),r=t.fillGradient&&"string"==typeof n?yo(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=po(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),o=Ia(t),r=t.fillGradient&&"string"==typeof n?yo(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}va(e,t),e.globalAlpha=1}};function Na(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function Fa(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Oa(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var Ba=(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h);const o=Math.max(0,n?.strokeWidth??1);if(o>0&&(e.strokeStyle=to(e,n?.stroke??"var(--semiotic-surface, #fff)"),e.lineWidth=o,e.strokeRect(t.x,t.y,t.w,t.h)),va(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Oa(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=Fa(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}},Wa=(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=to(e,t.wickColor)||t.wickColor,s=60>o.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const n=t.dotRadius??Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=to(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}s&&l(),e.restore()}},Da={line:[Ma,xa,Ca],area:[Ma,Ca],stackedarea:[Ma,Ca],scatter:[Ca,Ra],bubble:[Ca,Ra],heatmap:[Ba],bar:[Ta],swarm:[Ca],waterfall:[(e,t,n,o)=>{Ta(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=to(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Wa],mixed:[Ma,xa,Ca],custom:[Ma,Ta,Ba,xa,Ca,Ra,(e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Pa(e,o,o.x,o.y,n);e.globalAlpha=n},Wa]},za=new Set;function Ha(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(o=n)&&"object"==typeof o&&"string"==typeof o.id&&"function"==typeof o.cacheKey&&"function"==typeof o.drawCanvas&&"function"==typeof o.renderStaticSVG?n:void 0;var o}function Ea(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;za.has(n)||(za.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var $a=require("react/jsx-runtime");function Ya(e){return"string"==typeof e?e:"value"}function Ga(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function qa(e,t){if(!t)return Ga(e);try{const n=t(e);return null==n?Ga(e):n}catch{return Ga(e)}}function Va(e,t){return"function"==typeof t?t(e):e[t]}function Xa(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";n.push({label:r,accessor:e=>e.bands?.[o]?.y0??(0===o?e.band?.y0:void 0),format:t}),n.push({label:i,accessor:e=>e.bands?.[o]?.y1??(0===o?e.band?.y1:void 0),format:t})}),n}function Ua(e){const t=e.find(e=>"title"===e.role),n=e.filter(e=>"title"!==e.role);return e=>{const o=e.data;if(!o)return null;const r=t?qa(Va(o,t.accessor),t.format):null;return(0,$a.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[null!=r&&(0,$a.jsx)("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((e,t)=>{const n=qa(Va(o,e.accessor),e.format);return(0,$a.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,$a.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,$a.jsx)("span",{children:n})]},t)})]})}}var Ka=require("react/jsx-runtime");function Qa(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Za({hover:e}){const t=e.data??{},n=t.y??t.value,o=t.x??t.time;if(void 0===n&&void 0===o){const e=Os(t);if(null!=e.title||e.entries.length>0)return(0,Ka.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[null!=e.title&&(0,Ka.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,Ka.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,Ka.jsx)("span",{style:{fontWeight:600},children:Qa(e.value)})]},e.key))]})}return(0,Ka.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[(0,Ka.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:Qa(n)}),(0,Ka.jsx)("div",{style:{opacity:.7,fontSize:11},children:Qa(o)})]})}function Ja(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function el(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}Za.ownsChrome=!0;var tl=require("react"),nl=require("react");function ol(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function rl(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=Xn(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n],shape:"circle",group:r});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n],shape:"circle",group:r});break}case"rect":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}var il=require("react/jsx-runtime"),sl={top:20,right:20,bottom:30,left:40},al=Ki;function ll(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var cl=(0,oe.memo)((0,oe.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p,lineDataAccessor:y,curve:m,normalize:g,baseline:x,stackOrder:b,binSize:v,valueAccessor:k,arrowOfTime:w="right",windowMode:A="sliding",windowSize:S=200,timeAccessor:M,xExtent:C,yExtent:j,extentPadding:_=.1,scalePadding:R,sizeRange:P,size:L=[500,300],responsiveWidth:I,responsiveHeight:T,margin:N,className:F,background:O,renderMode:B,lineStyle:W,pointStyle:D,areaStyle:z,barStyle:H,waterfallStyle:E,swarmStyle:$,barColors:Y,colorScheme:G,boundsAccessor:q,boundsStyle:V,y0Accessor:X,band:U,gradientFill:K,lineGradient:Q,areaGroups:Z,openAccessor:J,highAccessor:ee,lowAccessor:te,closeAccessor:re,candlestickStyle:ie,showAxes:se=!0,axes:ae,xLabel:ce,yLabel:de,yLabelRight:fe,xFormat:pe,yFormat:ye,axisExtent:ge,tickFormatTime:xe,tickFormatValue:be,hoverAnnotation:ve,tooltipContent:ke,customHoverBehavior:we,customClickBehavior:Ae,onObservation:Se,annotationObservationCallback:Me,chartId:Ce,enableHover:je,hoverRadius:_e=30,tooltipMode:Re,annotations:Pe,onAnnotationActivate:Le,autoPlaceAnnotations:Ie,svgAnnotationRules:Te,showGrid:Ne,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:ze,legendLayout:He,legendCategoryAccessor:Ee,onCategoriesChange:$e,backgroundGraphics:Ye,foregroundGraphics:Ge,canvasPreRenderers:qe,svgPreRenderers:Ve,title:Xe,categoryAccessor:Ue,brush:Ke,onBrush:Qe,decay:Ze,pulse:Je,transition:et,animate:tt,staleness:nt,frameScheduler:ot,clock:rt,random:it,seed:st,paused:at=!1,suspendWhenHidden:lt=!0,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:ht,showValues:dt,heatmapValueFormat:ft,marginalGraphics:pt,pointIdAccessor:yt,xScaleType:mt,yScaleType:gt,accessibleTable:xt=!0,description:bt,summary:vt,linkedCrosshairName:kt,linkedCrosshairSourceId:wt,customLayout:At,onLayoutError:St,layoutConfig:Mt,layoutSelection:Ct}=e,{customHoverBehavior:jt,customClickBehavior:Rt,hasClickBehavior:Pt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,tl.useCallback)((t,i)=>{e?.(t,i),Ja({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:i})},[o,r,e,n]),customClickBehavior:(0,tl.useCallback)((e,i)=>{t?.(e,i),el({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:i})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:we,customClickBehavior:Ae,onObservation:Se,chartId:Ce,chartType:"StreamXYFrame"}),Lt=(0,oe.useId)().replace(/:/g,""),It=(0,oe.useRef)(!1),Tt=(0,oe.useRef)({w:-1,h:-1}),Nt=(0,oe.useRef)(!1),Ft=oa({sizeProp:L,responsiveWidth:I,responsiveHeight:T,userMargin:N,marginDefault:sl,title:Xe,legend:Fe,legendPosition:ze,animate:tt,transitionProp:et,frameScheduler:ot,clock:rt,random:it,seed:st,paused:at,suspendWhenHidden:lt,themeDirtyRef:It}),Bt=function(){const[e,t]=(0,zi.useState)(!1);return Hi(()=>{t(!0)},[]),e}(),Wt=function(){const e=(0,zi.useSyncExternalStore)(Ei,$i,Yi);return(0,zi.useRef)(e).current}(),{reducedMotionRef:Dt,responsiveRef:zt,size:Ht,currentTheme:Et,transition:$t,introEnabled:Yt,tableId:Gt,rafRef:qt,renderFnRef:Vt,scheduleRender:Xt,frameRuntime:Ut}=Ft;let Kt=Ft.margin;if(pt){const e=60,t={...Ft.margin};pt.top&&e>t.top&&(t.top=e),pt.bottom&&e>t.bottom&&(t.bottom=e),pt.left&&e>t.left&&(t.left=e),pt.right&&e>t.right&&(t.right=e),Kt=t}const Qt=Ht[0]-Kt.left-Kt.right,Zt=Ht[1]-Kt.top-Kt.bottom,Jt=(0,oe.useMemo)(()=>ue(r),[r]),en=ve??je,[tn,nn]=(0,oe.useState)(0),on=(0,oe.useRef)(0),[rn,sn]=(0,oe.useState)(null),an=aa(Ge,Ht,Kt,rn),ln=aa(Ye,Ht,Kt,rn),cn=(0,oe.useRef)(null),un=(0,oe.useRef)(null),hn=(0,oe.useRef)(void 0),[dn,fn]=(0,oe.useState)(null),pn=(0,oe.useRef)(al.primary),yn=(0,oe.useRef)(function(){let e=-1,t=Ki;return{resolve(n){if(!n)return Ki;const o=Qn;return o===e||(t=function(e){if(!e)return Ki;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||n||i?{axisStroke:l||Ki.axisStroke,tickText:s||Ki.tickText,crosshair:s?Qi(s,"66"):Ki.crosshair,hoverFill:c?Qi(c,"4D"):Ki.hoverFill,hoverStroke:s?Qi(s,"99"):Ki.hoverStroke,pointRing:c||Ki.pointRing,primary:i||Ki.primary,background:c||Ki.background}:Ki}(n),e=o),t},invalidate(){e=-1}}}()),mn=(0,oe.useRef)(!1),bn=(0,xn.useRef)(new Sn("StreamXYFrame")),[vn,kn]=(0,oe.useState)(!1),[wn,An]=(0,oe.useState)([]),[Cn,_n]=(0,oe.useState)([]),Rn="streaming"===o||["bar","swarm","waterfall"].includes(n),Pn=function(e){const t=(0,Gi.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Vi(e,t);if(!Xi(e)||!Xi(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!Vi(n,r))return!1}else{if(!Xi(n)||!Xi(r))return!1;if(!qi(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,oe.useMemo)(()=>({chartType:n,runtimeMode:Rn?"streaming":"bounded",windowSize:S,windowMode:A,arrowOfTime:Rn?w:"right",extentPadding:_,scalePadding:R,axisExtent:ge,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Rn?M:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p||(y?"_lineGroup":void 0),categoryAccessor:Ue,lineDataAccessor:y,xScaleType:mt,yScaleType:gt,xExtent:C,yExtent:j,sizeRange:P,binSize:v,normalize:g,baseline:x,stackOrder:b,boundsAccessor:q,boundsStyle:V,y0Accessor:X,band:U,gradientFill:!0===K?{topOpacity:.8,bottomOpacity:.05}:!1===K?void 0:K,areaGroups:Z?new Set(Z):void 0,lineGradient:Q,openAccessor:J,highAccessor:ee,lowAccessor:te,closeAccessor:re,candlestickStyle:ie,lineStyle:W,pointStyle:D,areaStyle:z,swarmStyle:$,waterfallStyle:E,colorScheme:G,barColors:Y,barStyle:H,annotations:Pe,decay:Ze,pulse:Je,transition:$t,introAnimation:Yt,staleness:nt,clock:Ut.now,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:ht,showValues:dt,heatmapValueFormat:ft,pointIdAccessor:yt,curve:m,themeCategorical:Et?.colors?.categorical,themeSemantic:me(Et),themeSequential:Et?.colors?.sequential,themeDiverging:Et?.colors?.diverging,customLayout:At,onLayoutError:St,layoutConfig:Mt,layoutMargin:Kt}),[n,Rn,S,A,w,_,R,ge,a,l,c,M,k,u,h,d,f,p,y,Ue,mt,gt,C,j,P,v,g,x,b,q,V,X,U,K,Z,Q,J,ee,te,re,ie,W,D,z,$,E,G,Y,H,Pe,Ze,Je,$t,Yt,nt,Ut.now,ct,ut,ht,dt,ft,yt,m,Et,At,St,Mt,Kt])),Ln=(0,oe.useRef)(null);Ln.current||(Ln.current=new gn(Pn));const In=function(e,t,n,o){const r=(0,ca.useRef)({accessor:t,onChange:n,readData:o}),i=(0,ca.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,ca.useCallback)(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?o(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,i.current)||(i.current=s,n(s))},[e])}(Ln,Ee,$e,e=>e.getData());!function(e,t,n,o){(0,Fn.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(Ln,Pn,It,Xt),function(e,t,n,o){const r=(0,Fn.useRef)(null);(0,Fn.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(Ln,Ct,It,Xt);const Tn=(0,oe.useRef)(null);Tn.current||(Tn.current=new he(e=>{const t=Ln.current;t&&t.ingest(e)&&(It.current=!0,Xt())},{chunkThreshold:i,chunkSize:s})),(0,oe.useEffect)(()=>{Tn.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const On=(0,oe.useCallback)(e=>{Tn.current?.push(e)},[]),Bn=(0,oe.useCallback)(e=>{Tn.current?.pushMany(e)},[]),Wn=(0,oe.useCallback)(()=>{Tn.current?.clear(),Ln.current?.clear(),It.current=!0,Xt()},[Xt]);(0,oe.useImperativeHandle)(t,()=>({push:On,pushMany:Bn,remove:e=>{Tn.current?.flush();const t=Ln.current?.remove(e)??[];return t.length>0&&(cn.current&&t.some(e=>e===cn.current?.data)&&(cn.current=null,fn(null)),It.current=!0,Xt()),t},update:(e,t)=>{Tn.current?.flush();const n=Ln.current?.update(e,t)??[];return n.length>0&&(It.current=!0,Xt()),n},clear:Wn,getData:()=>(Tn.current?.flush(),Ln.current?.getData()??[]),getScales:()=>Ln.current?.scales??null,getExtents:()=>Ln.current?.getExtents()??null,getCustomLayout:()=>Ln.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Ln.current?.lastCustomLayoutFailure??null}),[On,Bn,Wn,Xt]),(0,oe.useEffect)(()=>{if(r){if(y&&Jt.length>0&&"object"==typeof Jt[0]&&null!==Jt[0]){const e="string"==typeof y?y:"coordinates";if(Array.isArray(Jt[0][e])){const t=[];for(const n of Jt){const o=n[e];if(Array.isArray(o)){const e=n.label||n.id||n.key;if(null!=e)for(const n of o)t.push({...n,_lineGroup:e});else for(const e of o)t.push(e)}}return void Tn.current?.setBoundedData(t)}}Tn.current?.setBoundedData(Jt)}},[r,Jt,y]);const{canvasRef:Dn,interactionCanvasRef:zn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,ra.useRef)(null),a=(0,ra.useRef)(null),l=(0,ra.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Hi(()=>{const e=o.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():r.current=!0,s?.(),i.current()},[t,n]);const l=(0,zi.useRef)(a);l.current=a,(0,zi.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,ra.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,ra.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(Ft,{storeRef:Ln,dirtyRef:It,hydrated:Bt,wasHydratingFromSSR:Wt,cleanup:()=>Tn.current?.clear(),canvasPaintDependencies:[n,Qt,Zt,se,O,Ye,W,B,qe,Xt]}),{hoverHandlerRef:Hn,hoverLeaveRef:$n,onPointerMove:Gn,onPointerLeave:qn}=Ft;Hn.current=e=>{if(!en)return;const t=Dn.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Kt.left,i=e.clientY-o.top-Kt.top;if(0>r||r>Qt||0>i||i>Zt)return void(cn.current&&(cn.current=null,un.current=null,fn(null),jt&&(jt(null),It.current=!0),Xt()));const s=Ln.current;if(!s||0===s.scene.length)return;const l=_s(_e,e.pointerType),c=vo(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Re,h=()=>{cn.current&&(cn.current=null,un.current=null,fn(null),jt&&jt(null),Xt())};if(!c&&!u)return void h();const d=u||!c?r:c.x,f=u||!c?i:c.y,p=c?.datum?_t(c.datum,s.resolvedRibbons):{},y=s.scales?.x?.invert,m="function"==typeof y?y(d):void 0;let g=Ps(p,d,f,null!=m?{xValue:m,xPx:d}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=ko(bo(e.path,e.curve),t,n);if(null===i)continue;const s=Lo(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=bo(e.topPath,e.curve),s=bo(e.bottomPath,e.curve),a=ko(i,t,n);if(null===a)continue;const l=ko(s,t,n),c=Lo(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(s.scene,d,Math.max(l,Qt));if(e.length>0){const t=s.scales.y.invert,o=pn.current,r=y?y(d):d;if(c)g.xValue=r,g.xPx=d;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),g=Ps(e,d,f,{xValue:r,xPx:d})}g.allSeries=e.map(e=>{const r=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=i?r-i:r,valuePx:e.y,color:e.color||o,datum:_t(e.datum,s.resolvedRibbons)}})}}c||g.allSeries?.length?(cn.current=g,un.current=c?.node??null,fn(g),jt&&(jt(g),It.current=!0),Xt()):h()},$n.current=()=>{cn.current&&(cn.current=null,un.current=null,fn(null),jt&&(jt(null),It.current=!0),Xt())};const Xn=(0,oe.useRef)(()=>{});Xn.current=e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Rt)return;const n=Dn.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Kt.left,i=e.clientY-o.top-Kt.top;if(0>r||r>Qt||0>i||i>Zt)return void Rt(null);const s=Ln.current;if(!s||0===s.scene.length)return void Rt(null);const a=_s(_e,hn.current),l=vo(s.scene,r,i,a,s.quadtree,s.maxPointRadius);if(!l)return void Rt(null);const c=l.datum||{},u=s.scales?.x?.invert,h="function"==typeof u?u(l.x):void 0;var d;Rt(Ps(c,l.x,l.y,null!=h?{xValue:h,xPx:l.x}:void 0),{type:"activate",inputType:(d=hn.current,"touch"===d?"touch":"pointer")})};const Un=(0,oe.useCallback)(e=>Xn.current(e),[]),{kbFocusIndexRef:Kn,focusedNavPointRef:Zn,onKeyDown:Jn}=(eo={storeRef:Ln,hoverRef:cn,hoveredNodeRef:un,setHoverPoint:fn,customHoverBehavior:jt,customClickBehavior:Rt,scheduleRender:Xt},function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,nl.useRef)(-1),u=(0,nl.useRef)(null),h=(0,nl.useRef)(null),d=(0,nl.useCallback)(d=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(d))return;const f=e.current;if(!f)return;const p=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||p());let y;if(h.current?.version===f.version)y=h.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||p());y=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),h.current={version:f.version,graph:y}}let m=c.current;if(y.flat.length>m||(p(),m=-1),("Enter"===d.key||" "===d.key)&&m>=0)return d.preventDefault(),void i(l(y.flat[m],f),{type:"activate",inputType:"keyboard"});if(0>m){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const e=y.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void s()}const g=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?ol(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?ol(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(d.key,function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(y,m),y);if(null===g)return;if(d.preventDefault(),0>g)return void p();c.current=g;const x=y.flat[g];u.current=x;const b=l(x,f);t.current=b,o(b),r(b,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...eo,extractPoints:rl,toHover:(e,t)=>function(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}({...e,datum:_t(e.datum,t.resolvedRibbons)})}));var eo;const no=(0,oe.useCallback)(e=>{hn.current=e.pointerType,Kn.current=-1,Zn.current=null,Gn(e)},[Zn,Kn,Gn]),oo=(0,oe.useCallback)(e=>{hn.current="mouse",Kn.current=-1,Zn.current=null,Gn({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[Zn,Kn,Gn]),ro=(0,oe.useCallback)(e=>{hn.current=e.pointerType},[]);Vt.current=()=>{if(qt.current=null,!Ut.isActive)return;const e=Dn.current,t=zn.current;if(!e||!t)return;const o=Ln.current;if(!o)return;const r=Ut.now(),i=o.advanceTransition(Dt.current?r+1e6:r),s=!Dt.current&&i,c=Tt.current.w!==Qt||Tt.current.h!==Zt,u=It.current||i||c,h=o.consumeStylePaintPending();let d=!1;const f=o.getLastUpdateResult(),p=bn.current.beforeCompute(f,s);!u||s&&!c||(o.computeScene({width:Qt,height:Zt}),Tt.current={w:Qt,h:Zt},d=!0,In()),bn.current.afterCompute(p,d,c);const y=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,d,Nt),m=function(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}(),g=yn.current.resolve(e);pn.current=g.primary;const x=Fo(nt,o.lastIngestTime>0?r-o.lastIngestTime:0),b=nt&&x.isStale;if(u||h||y.changed){const t=la(e,Ht,Kt,m);if(t){if(t.clearRect(-Kt.left,-Kt.top,Ht[0],Ht[1]),nt&&1>x.alpha&&(t.globalAlpha=x.alpha),function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t,c=Ui({background:n,hasBackgroundGraphics:o,themeBackground:r});if(!c)return!1;const u=to(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:O,hasBackgroundGraphics:!!Ye,themeBackground:g.background,x:-Kt.left,y:-Kt.top,width:Ht[0],height:Ht[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Qt,Zt),t.clip()),qe&&o.scales)for(const e of qe)t.save(),e(t,o.scene,o.scales,{width:Qt,height:Zt}),t.restore();const e=At?Da.custom:Da[n];!function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=Ha(o,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(Ea(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:B,pixelRatio:m,paintBuiltIn:n=>{if(e&&o.scales)for(const r of e)r(t,n,o.scales,{width:Qt,height:Zt})}}),t.restore(),nt&&1>x.alpha&&(t.globalAlpha=1)}}const v=!!(en&&cn.current&&o.scales),k=!!(un.current&&Array.isArray(ve)&&ve.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=v||k;if(w||mn.current){const e=la(t,Ht,Kt,m);if(e&&(e.clearRect(-Kt.left,-Kt.top,Ht[0],Ht[1]),v&&cn.current&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,o),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,cn.current,Qt,Zt,"object"==typeof en?en:{},un.current,g),k&&un.current&&Array.isArray(ve))){const t=ve.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,r){if(!n)return;const i="group"in n?n.group:void 0;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,o.scene,un.current,t,g)}mn.current=w}u&&e&&e.setAttribute("aria-label",ls(o.scene,n+" chart"));const A=It.current;if(It.current=A&&s&&!d,A&&o.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!rn||e(rn.x.domain()[0])!==e(o.scales.x.domain()[0])||e(rn.x.domain()[1])!==e(o.scales.x.domain()[1])||e(rn.y.domain()[0])!==e(o.scales.y.domain()[0])||e(rn.y.domain()[1])!==e(o.scales.y.domain()[1])||rn.x.range()[0]!==o.scales.x.range()[0]||rn.x.range()[1]!==o.scales.x.range()[1]||rn.y.range()[0]!==o.scales.y.range()[0]||rn.y.range()[1]!==o.scales.y.range()[1])&&sn(o.scales),pt){const e=o.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];An(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),_n(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Pe&&Pe.length>0||At)&&(d||s))||!d&&33>r-on.current||(nn(e=>e+1),on.current=r),nt?.showBadge&&kn(!!b),(s||null!=o.activeTransition||y.pending)&&Xt()},function(e,t,n,o,r,i){const s=(0,Io.useRef)("fresh");(0,Io.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=Fo(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,i,n])}(nt,Ln,It,Xt,vn,kn);const so=(0,oe.useMemo)(()=>{if(pe||xe)return;const e=Ln.current;return e?.xIsDate&&rn?fa(rn.x.domain()):void 0},[pe,xe,rn]),ao=pe||xe||so,lo=en&&dn?ke?ke(dn):(0,il.jsx)(Za,{hover:dn}):null,uo=lo?(0,il.jsx)(Gs,{x:dn.x,y:dn.y,containerWidth:Qt,containerHeight:Zt,margin:Kt,className:"stream-frame-tooltip",children:lo}):null,ho=Zn.current,po=(0,il.jsx)(Cs,{active:Kn.current>=0,hoverPoint:dn,margin:Kt,size:Ht,shape:ho?.shape,width:ho?.w,height:ho?.h}),yo=ua(a,M,"__semiotic_resolvedX","__semiotic_resolvedTime"),mo=ua(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),go=yo.key,xo=mo.key,wo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(yo,mo,Pe&&Pe.length>0||!1);if(Di||!Bt&&Wt){const e=Ln.current;e&&r&&(e.ingest({inserts:Jt,bounded:!0}),e.computeScene({width:Qt,height:Zt}));const t=e?.scene??[],n=e?.scales??null,o=aa(Ge,Ht,Kt,n),i=aa(Ye,Ht,Kt,n),s=ao||(()=>{if(e?.xIsDate&&n)return fa(n.x.domain())})();return(0,il.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(F?" "+F:""),role:"img","aria-label":bt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:I?"100%":Ht[0],height:T?"100%":Ht[1]},children:[(0,il.jsx)(ws,{summary:vt}),(0,il.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[(0,il.jsx)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:i}),(0,il.jsxs)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:[O&&(0,il.jsx)("rect",{x:0,y:0,width:Qt,height:Zt,fill:O}),Ve&&n&&Ve.map((e,o)=>(0,il.jsx)(ne.Fragment,{children:e(t,n,{width:Qt,height:Zt})},"svgpre-"+o)),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=Ha(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Ea(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:B,fallback:()=>function(e,t,n){switch(e.type){case"line":{const o=e;if(0===o.path.length)return null;const r=fo(o.curve),i=r?(0,Li.line)().x(([e])=>e).y(([,e])=>e).curve(r)(o.path)??"":"M"+o.path.map(([e,t])=>`${e},${t}`).join("L"),s=Fi(`${n?n+"-":""}line-${t}-stroke-gradient`),a=Wi(o.strokeGradient,o.path,s);return(0,Bi.jsxs)(Pi.Fragment,{children:[a&&(0,Bi.jsx)("defs",{children:a}),(0,Bi.jsx)("path",{d:i,fill:"none",stroke:a?`url(#${s})`:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})]},"line-"+t)}case"area":{const o=e;if(0===o.topPath.length)return null;const r=fo(o.curve),i=!r||2>o.topPath.length||2>o.bottomPath.length?`M${o.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...o.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:(0,Li.area)().x(([e])=>e).y0((e,t)=>o.bottomPath[t][1]).y1(([,e])=>e).curve(r)(o.topPath)??"",s=`${n?n+"-":""}area-${t}-hatch`,a=io(o.style.fill)?co(o.style.fill,s):void 0,l=Fi(`${n?n+"-":""}area-${t}-gradient`),c=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let o=1/0;for(const[,t]of e.topPath)o=Math.min(o,t);let r=-1/0;for(const[,t]of e.bottomPath)r=Math.max(r,t);if(!Number.isFinite(o)||!Number.isFinite(r))return null;const i=[];if("colorStops"in n){const e=Oi(n.colorStops);if(!e)return null;i.push(...e)}else{if(!Number.isFinite(n.topOpacity)||!Number.isFinite(n.bottomOpacity))return null;i.push((0,Bi.jsx)("stop",{offset:0,stopColor:Ni(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.topOpacity))},"0")),i.push((0,Bi.jsx)("stop",{offset:1,stopColor:Ni(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.bottomOpacity))},"1"))}return(0,Bi.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:o,x2:0,y2:r,children:i})}(o,l),u=c?`url(#${l})`:a?`url(#${s})`:Ni(o.style.fill),h=c?void 0:o.style.fillOpacity??o.style.opacity??.7,d=r?(0,Li.line)().x(([e])=>e).y(([,e])=>e).curve(r)(o.topPath)??"":"M"+o.topPath.map(([e,t])=>`${e},${t}`).join("L"),f=Fi(`${n?n+"-":""}area-${t}-stroke-gradient`),p=Wi(o.strokeGradient,o.topPath,f),y=o.style.stroke&&"none"!==o.style.stroke?(0,Bi.jsx)("path",{d:d,fill:"none",stroke:p?`url(#${f})`:Ni(o.style.stroke),strokeWidth:o.style.strokeWidth||2,opacity:o.style.opacity}):null;if(o.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return(0,Bi.jsxs)("g",{children:[(0,Bi.jsxs)("defs",{children:[c,!c&&a,p,(0,Bi.jsx)("clipPath",{id:e,children:(0,Bi.jsx)("rect",{x:o.clipRect.x,y:o.clipRect.y,width:o.clipRect.width,height:o.clipRect.height})})]}),(0,Bi.jsxs)("g",{clipPath:`url(#${e})`,children:[(0,Bi.jsx)("path",{d:i,fill:u,fillOpacity:h,opacity:c?o.style.opacity:void 0,stroke:"none"}),y]})]},"area-"+t)}return(0,Bi.jsxs)(Pi.Fragment,{children:[(c||a||p)&&(0,Bi.jsxs)("defs",{children:[c,!c&&a,p]}),(0,Bi.jsx)("path",{d:i,fill:u,fillOpacity:h,opacity:c?o.style.opacity:void 0,stroke:"none"}),y]},"area-"+t)}case"point":{const o=e,r=`${n?n+"-":""}point-${t}-hatch`,i=io(o.style.fill)?co(o.style.fill,r):void 0;return(0,Bi.jsxs)(Pi.Fragment,{children:[i&&(0,Bi.jsx)("defs",{children:i}),(0,Bi.jsx)("circle",{cx:o.x,cy:o.y,r:o.r,fill:i?`url(#${r})`:Ni(o.style.fill),opacity:o.style.opacity??o.style.fillOpacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"point-"+t)}case"symbol":return function(e,t){const n=Ot(e.symbolType,e.size,e.path);return(0,Ti.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Ni(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"symbol-"+t)}(e,t);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=En(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=Vn(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?Fi(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),h=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:Yn(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:Yn(n.stroke??"none",a,e.accent);return r||i?(0,Ti.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,Ti.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Ti.jsx)("clipPath",{id:c,children:(0,Ti.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Ti.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,Ti.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const o=e,r=`${n?n+"-":""}xyrect-${t}-hatch`,i=io(o.style.fill)?co(o.style.fill,r):void 0;return(0,Bi.jsxs)(Pi.Fragment,{children:[i&&(0,Bi.jsx)("defs",{children:i}),(0,Bi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:i?`url(#${r})`:Ni(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[o,r,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),s=.299*o+.587*r+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return(0,Bi.jsxs)("g",{children:[(0,Bi.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth}),(0,Bi.jsx)("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,Bi.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth},"heatcell-"+t)}case"candlestick":{const n=e;if(n.isRange){const e=n.dotRadius??Math.max(2,n.bodyWidth/2);return(0,Bi.jsxs)("g",{children:[(0,Bi.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,Bi.jsx)("circle",{cx:n.x,cy:n.highY,r:e,fill:n.wickColor}),(0,Bi.jsx)("circle",{cx:n.x,cy:n.lowY,r:e,fill:n.wickColor})]},"candle-"+t)}const o=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return(0,Bi.jsxs)("g",{children:[(0,Bi.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,Bi.jsx)("rect",{x:n.x-n.bodyWidth/2,y:o,width:n.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,Lt)})).filter(Boolean)]})]}),(0,il.jsx)(Ri,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:n,showAxes:se,axes:ae,xLabel:ce,yLabel:de,yLabelRight:fe,xFormat:s,yFormat:ye||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:ze,legendLayout:He,foregroundGraphics:jn(o,Nn(Ln.current?.customLayoutOverlays,Ct??null)),marginalGraphics:pt,xValues:[],yValues:[],annotations:Pe,onAnnotationActivate:Le,onObservation:Me??Se,chartId:Ce,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:0,xAccessor:go,yAccessor:xo,annotationData:wo(Ln.current?.getData()),pointNodes:pa(Ln.current?.scene),curve:"string"==typeof m?m:void 0,linkedCrosshairName:kt,linkedCrosshairSourceId:wt})]})}return(0,il.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(F?" "+F:""),role:"group","aria-label":bt||("string"==typeof Xe?Xe:"XY chart"),tabIndex:0,style:{position:"relative",width:I?"100%":Ht[0],height:T?"100%":Ht[1],overflow:"visible",touchAction:ll(Ke)},onKeyDown:Jn,children:["production"!==process.env.NODE_ENV&&Ln.current&&(0,il.jsx)(Mn,{store:Ln.current,diagnostics:bn.current}),xt&&(0,il.jsx)(As,{tableId:Gt}),xt&&(0,il.jsx)(ks,{scene:Ln.current?.scene??[],chartType:n+" chart",tableId:Gt,chartTitle:"string"==typeof Xe?Xe:void 0}),(0,il.jsx)(ws,{summary:vt}),(0,il.jsx)(os,{hoverPoint:dn}),(0,il.jsxs)("div",{role:"img","aria-label":bt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:en?no:void 0,onMouseMove:en?oo:void 0,onPointerLeave:en?qn:void 0,onMouseLeave:en?qn:void 0,onPointerDown:en||Pt?ro:void 0,onClick:Pt?Un:void 0,children:[(0,il.jsx)(sa,{size:Ht,margin:Kt,children:ln}),(0,il.jsx)(Ci,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:rn,showAxes:se,axes:ae,showGrid:Ne,xFormat:ao,yFormat:ye||be,axisExtent:ge}),(0,il.jsx)("canvas",{ref:Dn,"aria-label":ls(Ln.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),(0,il.jsx)("canvas",{ref:zn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,il.jsx)(Ri,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:rn,showAxes:se,axes:ae,xLabel:ce,yLabel:de,yLabelRight:fe,xFormat:ao,yFormat:ye||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:ze,legendLayout:He,foregroundGraphics:jn(an,Nn(Ln.current?.customLayoutOverlays,Ct??null)),marginalGraphics:pt,xValues:wn,yValues:Cn,annotations:Pe,onAnnotationActivate:Le,onObservation:Me??Se,chartId:Ce,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:tn,xAccessor:go,yAccessor:xo,annotationData:wo(Ln.current?.getData()),pointNodes:pa(Ln.current?.scene),curve:"string"==typeof m?m:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!Ui({background:O,hasBackgroundGraphics:!!Ye,themeBackground:Et?.colors.background}),linkedCrosshairName:kt,linkedCrosshairSourceId:wt}),(Ke||Qe)&&(0,il.jsx)(le,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,dimension:Ke?.dimension??"xy",scales:rn,onBrush:Qe??(()=>{}),binSize:v,snap:Ke?.snap,binBoundaries:Ke?.binBoundaries??("bar"===n?Ln.current?.getBinBoundaries():void 0),snapDuring:Ke?.snapDuring,streaming:"streaming"===o}),nt?.showBadge&&(0,il.jsx)(Bo,{isStale:vn,position:nt.badgePosition}),po,uo]})]})}));cl.displayName="StreamXYFrame";var ul=cl,hl=require("react"),dl=require("react"),fl=require("react"),pl=require("react/jsx-runtime"),yl=(0,fl.createContext)(null);function ml({colors:e,categories:t,colorScheme:n="category10",children:o}){const r=(0,fl.useMemo)(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,o={};let r=0;for(const n of t)o[n]=st(e,n)??tt[r++%tt.length];return o}const e=Array.isArray(n)?n:et[n]||tt,o={};for(let n=0;t.length>n;n++)o[t[n]]=e[n%e.length];return o}return{}},[e,t,n]);return(0,pl.jsx)(yl.Provider,{value:r,children:o})}function gl(){return(0,fl.useContext)(yl)}ml.displayName="CategoryColorProvider";var xl=require("react");function bl(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function vl(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function kl(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[wl,Al]=pe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!kl(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=vl(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=vl(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}})),Sl=require("react");function Ml(e){const t=(0,Sl.useId)(),n=e.clientId||t,{name:o}=e,r=Al(e=>e.selections.get(o)),i=Al(e=>e.setClause),s=Al(e=>e.clearClause),a=(0,Sl.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,Sl.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(bl(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,Sl.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,Sl.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,Sl.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function Cl(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function jl(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Ml({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,Sl.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&Cl(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Cl(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),_l(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,Sl.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function _l(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Rl=require("react/jsx-runtime"),Pl=(0,xl.createContext)(!1),Ll=(0,xl.createContext)(!1),Il=(0,xl.createContext)(null),Tl="undefined"==typeof window?xl.useEffect:xl.useLayoutEffect;function Nl(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function Fl(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}var Ol="__linked-legend-isolate__",Bl="__linked-legend-highlight__";function Wl({categoryColors:e,interaction:t,selectionName:n,field:o}){const r=Object.entries(e),i=r.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=Ml({name:n,fields:[o],clientId:Ol}),{selectPoints:c,clear:u}=Ml({name:n,fields:[o],clientId:Bl}),h=Al(e=>e.selections.get(n)),{isolatedCategories:d,highlightedCategory:f}=(0,xl.useMemo)(()=>{const e=new Set;let t=null;const n=h?.clauses.get(Ol)?.fields[o];if("point"===n?.type)for(const t of n.values)e.add(t+"");const r=h?.clauses.get(Bl)?.fields[o];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[h,o]),p=(0,xl.useCallback)(e=>{"highlight"===t&&(e?c({[o]:[e.label]}):u())},[t,o,c,u]),y=(0,xl.useCallback)(e=>{if("isolate"!==t)return;const n=new Set(d);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():a({[o]:Array.from(n)})},[t,o,d,i.length,a,l]),[m,[g]]=Ks([0,0],!0,!1),x=(0,xl.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(r.map(([e])=>e),g),[r,g]);return 0===r.length?null:(0,Rl.jsx)("div",{ref:m,style:{width:"100%",display:"block"},children:(0,Rl.jsx)("svg",{width:"100%",height:Math.max(30,22*x+8),style:{display:"block",overflow:"visible"},children:(0,Rl.jsx)(Jo,{legendGroups:s,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?y:void 0,highlightedCategory:f,isolatedCategories:d})})})}function Dl({children:e,selections:t,showLegend:n,legendPosition:o="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,xl.useMemo)(()=>{if(!t)return;const e=new Map;for(const[n,o]of Object.entries(t))o.resolution&&e.set(n,{name:n,resolution:o.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=gl(),[c,u]=(0,xl.useState)({}),h=(0,xl.useRef)({}),d=(0,xl.useMemo)(()=>({registerCategories:(e,t)=>{const n=Nl(t);u(t=>Fl(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=(0,xl.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return Nl(e)},[c]),p=(0,xl.useMemo)(()=>{const e=l??{},t=h.current;let n=Object.keys(e).length+Object.keys(t).length;for(const o of f)e[o]||t[o]||(t[o]=tt[n%tt.length],n++);const o={...e};for(const n of f)o[n]=e[n]??t[n];return o},[l,f]),y=void 0===n||n,m=Object.keys(p).length>0;return(0,Rl.jsx)(wl,{initialState:a,children:(0,Rl.jsx)(Fr,{children:(0,Rl.jsx)(Ll.Provider,{value:!0,children:(0,Rl.jsx)(Il.Provider,{value:d,children:(0,Rl.jsx)(ml,{colors:p,children:(0,Rl.jsxs)(Pl.Provider,{value:y&&m,children:[y&&"top"===o&&(0,Rl.jsx)(Wl,{categoryColors:p,interaction:r,selectionName:i,field:s}),e,y&&"bottom"===o&&(0,Rl.jsx)(Wl,{categoryColors:p,interaction:r,selectionName:i,field:s})]})})})})})})}function zl(e){return e?"string"==typeof e?{name:e}:e:null}var Hl=.5;function El(e,t,n){return t?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??Hl;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var $l=y(require("react"));function Yl(){return Se(e=>e.theme)}function Gl(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ql(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Vl(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>ql(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])Gl(e[o])&&Gl(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}require("react/jsx-runtime"),$l.createContext(void 0);var Xl=44,Ul={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Xl,snap:"nearestDatum",brushHandleSize:Xl,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Kl(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return Ul;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??Xl,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Xl,standardControls:a.standardControls??!1}}var Ql={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}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function Zl(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Jl(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function ec(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function tc(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var nc=[];function oc(){const e=Yl(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function rc(e,t,n){const o=gl(),r=oc();return(0,dl.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&tc(i)){const e=at(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return at(n.map(e=>({_cat:e})),"_cat",s)}if(i&&tc(i)){const n=at(e,t,s);return e=>i[e]||n(e)}return at(e,t,s)}if(i&&tc(i)){const e=at([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}function ic({selection:e,linkedHover:t,fallbackFields:n=nc,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,dl.useId)(),d=(0,dl.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,dl.useMemo)(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n,[d,c,n]),p=Ml({name:e?.name||"__unused__",fields:f}),y=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Ml({name:t,fields:n});return{onHover:(0,Sl.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}_l(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:d?.name||"hover",fields:f}),m=Or(e=>e.pushObservation),g=(0,dl.useCallback)(e=>{r?.(e),m?.(e)},[r,m]),x=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,v]=(0,dl.useState)(null),k=(0,dl.useRef)(!1),w=c||n[0],A=(0,dl.useMemo)(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,w]),S=(0,dl.useCallback)((e,n)=>{const o=!e&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===d?.mode&&d.xField){const n=Jl(e,t,d.xField);null!=n&&function(e,t,n){const o=ci.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(ci={positions:new Map(ci.positions).set(e,{xValue:t,sourceId:n})},hi())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&y.onHover(t)}else"x-position"!==d?.mode||o||di(d.name||"hover",h),"x-position"===d?.mode||o||y.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else o||v(null);(r||m)&&Ja({onObservation:g,datum:e?ec(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,y,d,h,r,i,s,m,g,l,w,u]),M=(0,dl.useCallback)((n=!0)=>{k.current=!1,t&&"x-position"!==d?.mode&&y.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&v(null),"x-position"===d?.mode&&(fi(d.name||"hover",h),di(d.name||"hover",h))},[t,d,y,e,u,p,l,h]),C=(0,dl.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Jl(n,e,d.xField);null!=t&&function(e,t,n){const o=ci.positions.get(e);if(o?.locked){const t=new Map(ci.positions);return t.delete(e),ci={positions:t},hi(),!1}ci={positions:new Map(ci.positions).set(e,{xValue:t,sourceId:n,locked:!0})},hi()}(d.name||"hover",t,h)}if(c)if(n){k.current=!0;const o=ec(n);if(t&&"x-position"!==d?.mode&&y.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}tc(e)&&p.selectPoints(e)}if(l&&w){const e=o?.[w];v(null!=e?e+"":null)}}else x&&M();if(n||x){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(r||m)&&el({onObservation:g,datum:n?ec(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,m,g,i,s,d,h,u,t,y,e,p,f,l,w,M]);return(0,dl.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,dl.useEffect)(()=>()=>{k.current&&M(!1)},[M]),(0,dl.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{fi(e,h),di(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:A,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:h}}function sc(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function ac({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:l}){const c=(0,xl.useContext)(Pl),u=null!==(0,xl.useContext)(Il),h=void 0!==o?o:!c&&!!t,d=!!t&&(h||u),f=(0,dl.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,d]);!function(e){const t=(0,xl.useContext)(Il),n=(0,xl.useId)(),o=Nl(e),r=(0,xl.useRef)([]);Fl(r.current,o)||(r.current=o);const i=r.current;Tl(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Tl(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(u&&t?f:[]);const p=(0,dl.useMemo)(()=>{if(!h||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):ot[i%ot.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:it,categories:f});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[h,t,e,n,f]),y=(0,dl.useMemo)(()=>er(p,l),[p,l]),m=(0,dl.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return y&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,y,r]);return{legend:y,margin:m,legendPosition:r}}function lc(e,t,n){const[o,r]=(0,dl.useState)(null),[i,s]=(0,dl.useState)(new Set),a=(0,dl.useMemo)(()=>new Set,[]),l=(0,dl.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,dl.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,dl.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}function cc(e,t,n){return function(e,t,n){const o=Ql[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=Vl({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e||"primary",l=Ql[a],c="context"===a||"sparkline"===a,u="primary"===a&&n?.width?n.width:l.width;return{mode:a,width:s.width??u,height:s.height??("primary"===a&&n?.height?n.height:l.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Zl(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Kl(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}var uc=require("react/jsx-runtime");function hc({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,uc.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,uc.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,uc.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,uc.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,uc.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var dc=y(require("react")),fc=require("react/jsx-runtime"),pc=class extends dc.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(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:(0,fc.jsx)(hc,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},yc=require("react/jsx-runtime"),mc="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function gc({componentName:e,width:t,height:n,children:o}){return(0,yc.jsx)(pc,{fallback:o=>(0,yc.jsx)(hc,{componentName:e,message:o.message,width:t,height:n}),children:o})}var xc={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},bc={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function vc(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,yc.jsx)("div",{style:{...xc,width:t,height:n},children:o||"No data available"}):null}function kc(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,yc.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,yc.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,yc.jsx)("div",{className:"semiotic-loading-bar",style:{...bc,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function wc(e,t,n,o){if(!mc)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Ac(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Sc(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=Ac(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function Mc({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"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(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";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[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Sc(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var Cc=require("react"),jc=require("react");function _c(e){const t=Se(e=>e.theme.colors.selectionOpacity);return(0,jc.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function Rc(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,legend:y,userMargin:m,marginDefaults:g,onClick:x,hoverHighlight:b,mobileInteraction:v,mobileSemantics:k,loading:w,loadingContent:A,emptyContent:S,width:M,height:C}=e,j=void 0===n,_=(0,Cc.useMemo)(()=>ue(t),[t]),[R,P]=(0,Cc.useState)([]),L=(0,Cc.useCallback)(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,Cc.useMemo)(()=>Kl(v,{width:M,mobileSemantics:k}),[v,M,k]),{activeSelectionHook:N,hoverSelectionHook:F,customHoverBehavior:O,customClickBehavior:B,crosshairSourceId:W}=ic({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:x,hoverHighlight:b,colorByField:I,mobileInteraction:T}),D=sc(l,W),z=rc(_,o,r),H=(0,Cc.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of _){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[_,o]),E=(0,Cc.useMemo)(()=>j&&R.length>0?R:H,[j,R,H]),$=lc(i,o,E),Y=(0,Cc.useMemo)(()=>F||($.legendSelectionHook?$.legendSelectionHook:N),[F,$.legendSelectionHook,N]),G=_c(a),q=oc(),V=gl(),X=(0,Cc.useMemo)(()=>{if(z)return z;if(!o||0===E.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:q&&q.length>0?q:ot,t="__streamCat",n=at(E.map(e=>({[t]:e})),t,e);return e=>V?.[e]||n(e)||"#999"},[z,o,E,r,q,V]),{legend:U,margin:K,legendPosition:Q}=ac({data:_,colorBy:o,colorScale:X,showLegend:p,legendPosition:s,userMargin:m,defaults:g,categories:E,additionalLegend:y}),Z=(0,Cc.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=$.onLegendHover,e.legendClickBehavior=$.onLegendClick,e.legendHighlightedCategory=$.highlightedCategory,e.legendIsolatedCategories=$.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[U,Q,i,$.onLegendHover,$.onLegendClick,$.highlightedCategory,$.isolatedCategories,j,o,L]),J=Array.isArray(n)?ue(n):n,ee=kc(w,M,C,A),te=ee?null:vc(J,M,C,S);return{data:_,colorScale:z,allCategories:E,legendState:$,effectiveSelectionHook:Y,activeSelectionHook:N,customHoverBehavior:O,customClickBehavior:B,mobileInteraction:T,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:D,resolvedSelection:G}}var Pc=require("react");function Lc(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function Ic(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Nc(t(e))}function Tc(e,t){const n=Ic(e),o=Ic(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function Nc(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function Fc(e,t,n){const o=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&o!==e.eq)return!1;if(void 0!==e.ne&&o===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(o))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=Nc(o);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>r||r>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(r>=t&&n>=r)return!1}return!0}function Oc(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):Fc(o,t,n))}function Bc(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!Oc(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function Wc(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=o(e),a={...r(e,i)};return Object.assign(a,Bc(s,t,n(s,i))),a}:r}function Dc(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,styleRules:f,ruleContext:p}=e,y=(0,Pc.useMemo)(()=>function(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,styleRules:l,ruleContext:c}=e;return(e,u)=>{const h={strokeWidth:t},d=!0===s||Array.isArray(s)&&null!=u&&s.includes(u);let f;return i?f=i(e,u):n?o&&(f=it(e,n,o)):f=r||nt,void 0!==f&&(h.stroke=f,d&&(h.fill=f,h.fillOpacity=a)),l?.length&&Object.assign(h,Bc(e,l,c?c(e,u):{value:void 0,category:u})),h}}({lineWidth:t,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a,styleRules:f,ruleContext:p}),[t,n,o,r,i,s,a,f,p]),m=(0,Pc.useMemo)(()=>Lc(y,{stroke:l,strokeWidth:c,opacity:u}),[y,l,c,u]);return(0,Pc.useMemo)(()=>El(m,h??null,d),[m,h,d])}var zc=require("react");function Hc(e,t){const{variant:n,frameRef:o,overrides:r}=t,i=(0,zc.useRef)(r);i.current=r,(0,zc.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return new Proxy(e,{get(e,t,n){if("string"==typeof t){const e=i.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,n)},has:(e,t)=>!("string"!=typeof t||!i.current||!(t in i.current))||Reflect.has(e,t)})},[])}function Ec(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function $c(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={};o&&(f.annotationObservationCallback=o);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}function Yc(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:$s(t)||n}}var Gc="__forecastSegment",qc=null;async function Vc(){return qc||(qc=await Promise.resolve().then(()=>(E(),L))),qc}var Xc=require("react"),Uc="__semiotic_resolvedX",Kc="__semiotic_resolvedY";function Qc(e){const{data:t,xAccessor:n,yAccessor:o,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof n?n:Uc,l="string"==typeof o?o:Kc,c=(0,Xc.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof n,s="function"==typeof o;return e||s?t.map(t=>{const r={...t};return e&&(r[Uc]=n(t)),s&&(r[Kc]=o(t)),r}):t},[t,r,i,n,o]),[u,h]=(0,Xc.useState)(null),[d,f]=(0,Xc.useState)([]),p=(0,Xc.useRef)(r),y=(0,Xc.useRef)(i);return(0,Xc.useEffect)(()=>{if(!r&&!i)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=i));let e=!1;const t=r!==p.current||i!==y.current;if(p.current=r,y.current=i,t&&(h(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await Vc()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else i&&async function(...e){return(await Vc()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:d,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var Zc=require("react/jsx-runtime"),Jc="__lineObjectSeries",eu=(0,hl.forwardRef)(function(e,t){const n=(0,hl.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:h="y",lineBy:d,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,styleRules:m,curve:g="linear",showPoints:x=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:A,tooltip:S,pointIdAccessor:M,annotations:C,directLabel:j,gapStrategy:_="break",anomaly:R,forecast:P,band:L,xExtent:I,yExtent:T,frameProps:N={},selection:F,linkedHover:O,onObservation:B,onClick:W,hoverHighlight:D,hoverRadius:z,chartId:H,loading:E,loadingContent:$,emptyContent:Y,legendInteraction:G,legendPosition:q,legend:V,xScaleType:X,yScaleType:U,color:K,stroke:Q,strokeWidth:Z,opacity:J}=e,{legend:ee,...te}=N,ne=(0,hl.useMemo)(()=>er(ee,V),[ee,V]),{width:oe,height:re,enableHover:ie,showGrid:se,showLegend:ae,title:le,description:ce,summary:he,accessibleTable:de,xLabel:fe,yLabel:pe}=o,ye=(0,hl.useMemo)(()=>ue(r),[r]),me=Array.isArray(ye[0]?.[f])?ye[0][f]:ye;wc("LineChart",me,"xAccessor",u),wc("LineChart",me,"yAccessor",h);const{effectiveData:ge,statisticalAnnotations:xe}=Qc({data:ye,xAccessor:u,yAccessor:h,forecast:P,anomaly:R,groupBy:d}),be="__compoundGroup",ve=!(!P||!d),ke=ve?be:P?Gc:d,we=(0,hl.useMemo)(()=>{if(!ve)return ge;const e="function"==typeof d?d:e=>e[d];return ge.map(t=>{const n={...t};return n[be]=`${e(t)}__${t[Gc]||"observed"}`,n})},[ge,ve,d]),Ae=ve?we:ge,Se=p||d,Me=(0,hl.useMemo)(()=>{if(!P)return;const e=P.upperBounds,t=P.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=ge;for(const e of s){const t="function"==typeof h?h(e):+e[h];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[P,ge,h]),Ce=(0,hl.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],n="function"==typeof h?h(e):e[h];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[u,h]),je=void 0!==Ae[0]?.[f],_e=je?Jc:ke,Re=(0,hl.useMemo)(()=>{if(je)return Ae.map((e,t)=>{const n="function"==typeof d?d(e):"string"==typeof d?e[d]:void 0,o=null==n?"line-"+t:n+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[Jc]:o,[f]:r.map(t=>({...t,[Jc]:o,parentLine:e,..."string"==typeof d&&void 0!==e[d]?{[d]:e[d]}:{}}))}});if(ke){const e=Ae.reduce((e,t)=>{const n="function"==typeof ke?ke(t):t[ke];if(!e[n]){const o={[f]:[]};"string"==typeof ke&&(o[ke]=n),ve&&(o[Gc]=t[Gc],"string"==typeof d&&(o[d]=t[d])),e[n]=o}return e[n][f].push(t),e},{});return Object.values(e)}return[{[f]:Ae}]},[je,ke,f,Ae,d,ve]),{gapProcessedLineData:Pe,hasGaps:Le}=(0,hl.useMemo)(()=>{if("interpolate"===_){let e=!1;const t=[];for(const n of Re){const o=(n[f]||[]).filter(t=>!Ce(t)||(e=!0,!1));o.length>0&&t.push({...n,[f]:o})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===_){let e=!1;const t=[];for(const n of Re){const o=n[f]||[];let r=[],i=0;const s=_e&&"string"==typeof _e?n[_e]:void 0;for(const a of o)if(Ce(a))e=!0,r.length>0&&(t.push({...n,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...n,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===_){let e=!1;const t="string"==typeof h?h:"y",n=[];for(const o of Re){const r=o[f]||[],i=[];for(const n of r)Ce(n)?(e=!0,i.push({...n,[t]:0})):i.push(n);n.push({...o,[f]:i})}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Re,hasGaps:!1}},[Re,_,f,Ce,_e,h]),Ie="object"==typeof j?j:{},Te=Ie.position||"end",Ne=Ie.fontSize||11,Fe=(0,hl.useMemo)(()=>{if(!j||!Se)return[];const e="function"==typeof Se?Se:e=>e[Se],t=new Set;for(const n of Pe){const o=n[f]||[];if(0===o.length)continue;const r=e("end"===Te?o[o.length-1]:o[0])??e(n);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[j,Se,Pe,f,Te]),Oe=(0,hl.useMemo)(()=>{if(!j)return o.marginDefaults;const e=Fe.reduce((e,t)=>Math.max(e,t.length*(.6*Ne)),0)+10,t="end"===Te?"right":"left";return{...o.marginDefaults,[t]:Math.max(o.marginDefaults[t]||0,e)}},[j,Fe,Ne,Te,o.marginDefaults]),Be=Rc({data:ge,rawData:r,colorBy:Se,colorScheme:y,legendInteraction:G,legendPosition:q,selection:F,linkedHover:O,fallbackFields:Se?["string"==typeof Se?Se:""]:[],unwrapData:!1,onObservation:B,onClick:W,hoverHighlight:D,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LineChart",chartId:H,showLegend:(!j||void 0!==ae)&&ae,legend:ne,userMargin:i,marginDefaults:Oe,loading:E,loadingContent:$,emptyContent:Y,width:oe,height:re}),We=Be.colorScale,De=Be.effectiveSelectionHook,ze=Be.resolvedSelection,He=Be.customHoverBehavior,Ee=Be.customClickBehavior,$e=Be.crosshairProps,Ye=(0,hl.useMemo)(()=>{if(Se)return je?e=>{const t=e.parentLine||e;return"function"==typeof Se?Se(t):t[Se]}:Se},[Se,je]),Ge=(0,hl.useMemo)(()=>Tc(u,h),[u,h]),qe=Dc({lineWidth:w,colorBy:Ye,colorScale:We,color:K,fillArea:v,areaOpacity:k,stroke:Q,strokeWidth:Z,opacity:J,effectiveSelectionHook:De,resolvedSelection:ze,styleRules:m,ruleContext:Ge}),[Ve,Xe]=(0,hl.useState)(null);(0,hl.useEffect)(()=>{if(!P)return void Xe(null);let e=!1;return async function(...e){return(await Vc()).createSegmentLineStyle(...e)}(qe,P).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[qe,P]);const Ue=Ve||qe,Ke=(0,hl.useMemo)(()=>{if(x)return e=>{const t={r:b,fillOpacity:1};return Se?We&&(t.fill=it(e.parentLine||e,Se,We)):t.fill=K||nt,t}},[x,b,Se,We,K]),Qe=Array.isArray(v)?"mixed":v?"area":"line",Ze=(0,hl.useMemo)(()=>{if(!j||!Se)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof h?h:e=>e[h],n="function"==typeof Se?Se:e=>e[Se],o=new Map;for(const e of Pe){const t=e[f]||[];if(0===t.length)continue;const r="end"===Te?t[t.length-1]:t[0],i=n(r)??n(e);if(null==i)continue;const s=i+"";""===s||o.has(s)||o.set(s,r)}const r=Array.from(o.entries()).map(([n,o])=>({type:"text",label:n,["string"==typeof u?u:"x"]:e(o),["string"==typeof h?h:"y"]:t(o),dx:"end"===Te?6:-6,dy:0,color:We?We(n):nt,fontSize:Ne}));r.sort((e,t)=>{const n="string"==typeof h?h:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof h?h:"y",n=r[e-1],o=r[e];Ne+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Ne+2)}return r},[j,Se,We,Pe,f,u,h,Te,Ne]),Je=Be.margin,et=d||p,tt=(0,hl.useMemo)(()=>Ua([{label:fe||Ya(u),accessor:u,role:"x",format:a},{label:pe||Ya(h),accessor:h,role:"y",format:l},...et?[{label:Ya(et),accessor:et,role:"group"}]:[],...Xa(L,l)]),[u,h,fe,pe,et,a,l,L]),ot=Mc({componentName:"LineChart",data:je?ge[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:h}}),rt=(0,hl.useMemo)(()=>je||_e||Le?Pe.flatMap(e=>{const t=e[f]||[];return _e&&"string"==typeof _e?t.map(t=>({...t,[_e]:t[_e]??e[_e]})):t}):Ae,[Pe,f,je,_e,Ae,Le]),st={chartType:Qe,...Array.isArray(v)&&{areaGroups:v},...A&&{lineGradient:A},...null!=r&&{data:rt},xAccessor:u,yAccessor:h,xScaleType:X,yScaleType:U,...I&&{xExtent:I},...!T||null==T[0]&&null==T[1]?Me?{yExtent:Me}:{}:{yExtent:T},groupAccessor:"break"===_&&Le?"_gapSegment":_e||void 0,...L&&{band:L},curve:g,lineStyle:Ue,...x&&{pointStyle:Ke},size:[oe,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Je,showAxes:o.showAxes,xLabel:fe,yLabel:pe,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:ie,showGrid:se,...Be.legendBehaviorProps,...le&&{title:le},...ce&&{description:ce},...he&&{summary:he},...void 0!==de&&{accessibleTable:de},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?Es():$s(S)||tt,..."multi"===S&&{tooltipMode:"multi"},...$c({linkedHover:O,selection:F,onObservation:B,onClick:W,hoverRadius:z,hoverHighlight:D,mobileInteraction:Be.mobileInteraction,customHoverBehavior:He,customClickBehavior:Ee}),...M&&{pointIdAccessor:M},...(C?.length||xe.length||Ze.length)&&{annotations:[...C||[],...xe,...Ze]},...$e,...te};return Be.earlyReturn?Be.earlyReturn:ot?(0,Zc.jsx)(hc,{componentName:"LineChart",message:ot,width:oe,height:re}):(0,Zc.jsx)(gc,{componentName:"LineChart",width:oe,height:re,children:(0,Zc.jsx)(ul,{ref:n,...st})})});eu.displayName="LineChart";var tu=require("react"),nu=require("react");function ou(e){const{safeData:t,data:n,areaBy:o,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,areaOpacity:f,showLine:p,lineWidth:y,showPoints:m,pointRadius:g,xAccessor:x,yAccessor:b,xLabel:v,yLabel:k,xFormat:w,yFormat:A,groupField:S,styleRules:M,ruleContext:C}=e,j=(0,nu.useMemo)(()=>function({data:e,safeData:t,areaBy:n,lineDataAccessor:o}){if(null==e)return[];const r=void 0!==t[0]?.[o];if(!r&&!n)return t;let i;if(r)i=t;else{const e=t.reduce((e,t)=>{const r="function"==typeof n?n(t):t[n],i=r+"";if(!e[i]){const t={[o]:[]};"string"==typeof n&&(t[n]=r),e[i]=t}return e[i][o].push(t),e},{});i=Object.values(e)}return i.flatMap(e=>{const t=Array.isArray(e[o])?e[o]:[];return"string"==typeof n?t.map(t=>({...t,[n]:t[n]??e[n]})):t})}({data:n,safeData:t,areaBy:o,lineDataAccessor:r}),[n,t,o,r]),_=(0,nu.useMemo)(()=>e=>{const t={};if(i){if(s){const n=it(e,i,s);t.fill=n,p?(t.stroke=n,t.strokeWidth=y):t.stroke="none"}}else{const e=a||nt;t.fill=e,p?(t.stroke=e,t.strokeWidth=y):t.stroke="none"}return t.fillOpacity=f,M&&M.length>0&&Object.assign(t,Bc(e,M,C?C(e):{value:void 0})),t},[i,s,a,f,p,y,M,C]),R=(0,nu.useMemo)(()=>Lc(_,{stroke:l,strokeWidth:c,opacity:u}),[_,l,c,u]);return{flattenedData:j,lineStyle:(0,nu.useMemo)(()=>El(R,h??null,d),[R,h,d]),pointStyle:(0,nu.useMemo)(()=>{if(m)return e=>{const t={r:g,fillOpacity:1};return i?s&&(t.fill=it(e.parentLine||e,i,s)):t.fill=a||nt,t}},[m,g,i,s,a]),defaultTooltipContent:(0,nu.useMemo)(()=>Ua([{label:v||Ya(x),accessor:x,role:"x",format:w},{label:k||Ya(b),accessor:b,role:"y",format:A},...S?[{label:Ya(S),accessor:S,role:"group"}]:[],...Xa(e.band,A)]),[x,b,v,k,S,w,A,e.band])}}var ru=require("react/jsx-runtime");function iu(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var su=(0,tu.forwardRef)(function(e,t){const n=(0,tu.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,y0Accessor:d,gradientFill:f=!1,semanticGradient:p,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:g,styleRules:x,curve:b="monotoneX",areaOpacity:v=.7,lineGradient:k,showLine:w=!0,lineWidth:A=2,showPoints:S=!1,pointRadius:M=3,tooltip:C,annotations:j,forecast:_,anomaly:R,band:P,xExtent:L,yExtent:I,frameProps:T={},selection:N,linkedHover:F,onObservation:O,onClick:B,hoverHighlight:W,chartId:D,loading:z,loadingContent:H,emptyContent:E,legendInteraction:$,legendPosition:Y,color:G,stroke:q,strokeWidth:V,opacity:X}=e,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:re,yLabel:ie}=o,se=(0,tu.useMemo)(()=>ue(r),[r]),ae=m||h,le=(0,tu.useMemo)(()=>{return p&&p.length>0?{colorStops:(e=p,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:iu(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:f;var e},[p,f]);wc("AreaChart",se,"xAccessor",c),wc("AreaChart",se,"yAccessor",u);const ce=Rc({data:se,rawData:r,colorBy:ae,colorScheme:g,legendInteraction:$,legendPosition:Y,selection:N,linkedHover:F,fallbackFields:ae?["string"==typeof ae?ae:""]:[],unwrapData:!1,onObservation:O,onClick:B,hoverHighlight:W,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"AreaChart",chartId:D,showLegend:J,userMargin:i,marginDefaults:o.marginDefaults,loading:z,loadingContent:H,emptyContent:E,width:U,height:K}),{effectiveData:he,statisticalAnnotations:de}=Qc({data:se,xAccessor:c,yAccessor:u,forecast:_,anomaly:R,groupBy:h}),fe=(0,tu.useMemo)(()=>Tc(c,u),[c,u]),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ge}=ou({safeData:he,data:r,areaBy:h,lineDataAccessor:y,colorBy:ae,colorScale:ce.colorScale,color:G,stroke:q,strokeWidth:V,opacity:X,effectiveSelectionHook:ce.effectiveSelectionHook,resolvedSelection:ce.resolvedSelection,areaOpacity:v,showLine:w,lineWidth:A,showPoints:S,pointRadius:M,xAccessor:c,yAccessor:u,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,groupField:h||m,band:P,styleRules:x,ruleContext:fe}),xe=Mc({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),be={chartType:"area",...null!=r&&{data:pe},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,...d&&{y0Accessor:d},...P&&{band:P},...le&&{gradientFill:le},...k&&{lineGradient:k},curve:b,lineStyle:ye,...S&&me&&{pointStyle:me},size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce.margin,showAxes:o.showAxes,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,enableHover:Q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Z,...ce.legendBehaviorProps,...Ec({title:ee,description:te,summary:ne,accessibleTable:oe,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:Es(),tooltipMode:"multi"}:Yc({tooltip:C,defaultTooltipContent:ge}),...$c({linkedHover:F,selection:N,onObservation:O,onClick:B,hoverHighlight:W,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior}),...(j&&j.length>0||de.length>0)&&{annotations:[...j||[],...de]},...L&&{xExtent:L},...I&&{yExtent:I},...ce.crosshairProps,...T};return ce.earlyReturn?ce.earlyReturn:xe?(0,ru.jsx)(hc,{componentName:"AreaChart",message:xe,width:U,height:K}):(0,ru.jsx)(gc,{componentName:"AreaChart",width:U,height:K,children:(0,ru.jsx)(ul,{ref:n,...be})})});su.displayName="AreaChart";var au=require("react"),lu=require("react/jsx-runtime");function cu(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var uu=(0,au.forwardRef)(function(e,t){const n=(0,au.useRef)(null),o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:h="b",seriesALabel:d="A",seriesBLabel:f="B",seriesAColor:p="var(--semiotic-danger, #dc2626)",seriesBColor:y="var(--semiotic-info, #2563eb)",showLines:m=!0,lineWidth:g=1.5,showPoints:x=!1,pointRadius:b=3,curve:v="linear",areaOpacity:k=.6,gradientFill:w,tooltip:A,annotations:S,xExtent:M,yExtent:C,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:W,pointIdAccessor:D,windowSize:z}=e,{width:H,height:E,enableHover:$,showGrid:Y,showLegend:G,title:q,description:V,summary:X,accessibleTable:U,xLabel:K,yLabel:Q}=o,Z=(0,au.useMemo)(()=>"function"==typeof c?e=>cu(c(e)):e=>cu(e[c]),[c]),J=(0,au.useMemo)(()=>"function"==typeof u?e=>cu(u(e)):e=>cu(e[u]),[u]),ee=(0,au.useMemo)(()=>"function"==typeof h?e=>cu(h(e)):e=>cu(e[h]),[h]),[te,ne]=(0,au.useState)([]),oe=(0,au.useRef)([]),re=null==r,ie=(0,au.useMemo)(()=>ue(re?te:r),[re,te,r]),se=(0,au.useMemo)(()=>function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,h=e=>`seg-${s}-${e}`,d=e=>i.push(e),f=(e,t)=>{d({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:h(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],p=t(i),y=n(i),m=o(i);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(m))continue;const g=u(y,m);if(null!==g)if(null!=a){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=y-l.a-(m-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(p-l.x),t=l.a+o*(y-l.a)}else e=l.x,t=l.a}d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=g,d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],a)}else for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else{a=g;for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else c.push({x:p,y:y,datum:i})}for(const e of c)f(e,a??"A");return i}(ie,Z,J,ee),[ie,Z,J,ee]),ae=(0,au.useMemo)(()=>m?function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];for(const e of r){const r=t(e),s=n(e),a=o(e);Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-B"})}return i}(ie,Z,J,ee):[],[m,ie,Z,J,ee]),le=(0,au.useMemo)(()=>[...se,...ae],[se,ae]),ce=(0,au.useMemo)(()=>{const e=new Set;for(const t of se)e.add(t.__diffSegment);return Array.from(e)},[se]);(0,au.useImperativeHandle)(t,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;oe.current=t,ne(t)},t=D?"function"==typeof D?D:e=>e[D]:null;return{push:t=>e([...oe.current,t]),pushMany:t=>e([...oe.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],r=[],i=[];for(const e of oe.current)o.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(n,o)=>{if(!t)return[];const r=Array.isArray(n)?n:[n],i=[],s=oe.current.map(e=>{if(r.includes(t(e))){const t=o(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>re?oe.current:ie,getScales:()=>n.current?.getScales()??null}},[re,ie,D,z]);const he=Rc({data:ie,rawData:r,colorBy:"__diffWinner",colorScheme:[p,y],legendInteraction:B,legendPosition:W,selection:_,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DifferenceChart",chartId:T,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:H,height:E}),de=(0,au.useMemo)(()=>{if(!1!==G)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:d,color:p},{label:f,color:y}]}]}},[G,d,f,p,y]),fe=(0,au.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:y,stroke:"none",fillOpacity:k}},[p,y,k]),pe=(0,au.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,strokeWidth:g,fill:"none"}),[p,y,g]),ye=(0,au.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,r:b}),[p,y,b]),me=(0,au.useCallback)(e=>{const t=e.data,n=e.allSeries,o=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(n&&n.length>0){const e=n.find(e=>"line-A"===e.group),t=n.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=o&&(null==r||null==i)){const e=ie.find(e=>Z(e)===o);e&&(null==r&&(r=J(e)),null==i&&(i=ee(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=o?a(o):null!=o?o+"":"";return(0,lu.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[l&&(0,lu.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,lu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,lu.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,lu.jsxs)("span",{children:[d,": ",s(r)]})]}),(0,lu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,lu.jsx)("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),(0,lu.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,lu.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[ie,Z,J,ee,a,p,y,d,f]),ge="multi"===A,xe=(0,au.useMemo)(()=>!1===A?()=>null:ge?me:$s(A)||me,[A,ge,me]);if(he.earlyReturn)return he.earlyReturn;const be={chartType:"mixed",data:le,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ce,curve:v,areaStyle:fe,lineStyle:pe,...x&&{pointStyle:ye},size:[H,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:o.showAxes,xLabel:K,yLabel:Q,xFormat:a,yFormat:l,enableHover:$,showGrid:Y,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...de&&{legend:de,legendPosition:he.legendPosition},...Ec({title:q,description:V,summary:X,accessibleTable:U,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:xe,...ge&&{tooltipMode:"multi"},...$c({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...S&&S.length>0&&{annotations:S},...M&&{xExtent:M},...C&&{yExtent:C},...he.crosshairProps,...j};return(0,lu.jsx)(gc,{componentName:"DifferenceChart",width:H,height:E,children:(0,lu.jsx)(ul,{ref:n,...be})})});"function"==typeof uu&&(uu.displayName="DifferenceChart");var hu=require("react"),du=require("react/jsx-runtime"),fu=(0,hu.forwardRef)(function(e,t){const n=(0,hu.useRef)(null),o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,lineDataAccessor:d="coordinates",colorBy:f,colorScheme:p,styleRules:y,curve:m="monotoneX",areaOpacity:g=.7,showLine:x=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:k=3,normalize:w=!1,baseline:A="zero",stackOrder:S,tooltip:M,annotations:C,xExtent:j,yExtent:_,frameProps:R={},selection:P,linkedHover:L,onObservation:I,onClick:T,hoverHighlight:N,chartId:F,loading:O,loadingContent:B,emptyContent:W,legendInteraction:D,legendPosition:z,color:H,stroke:E,strokeWidth:$,opacity:Y}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=o,ne=(0,hu.useMemo)(()=>ue(r),[r]),oe=f||h;Hc(t,{variant:"xy",frameRef:n});const re=Rc({data:ne,rawData:r,colorBy:oe,colorScheme:p,legendInteraction:D,legendPosition:z,selection:P,linkedHover:L,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!1,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedAreaChart",chartId:F,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:O,loadingContent:B,emptyContent:W,width:G,height:q}),ie=(0,hu.useMemo)(()=>Tc(c,u),[c,u]),{flattenedData:se,lineStyle:ae,pointStyle:le,defaultTooltipContent:ce}=ou({safeData:ne,data:r,areaBy:h,lineDataAccessor:d,colorBy:oe,colorScale:re.colorScale,color:H,stroke:E,strokeWidth:$,opacity:Y,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,areaOpacity:g,showLine:x,lineWidth:b,showPoints:v,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,groupField:h||f,styleRules:y,ruleContext:ie}),he=Mc({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),de={chartType:"stackedarea",...null!=r&&{data:se},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,curve:m,normalize:w,baseline:w?"zero":A,stackOrder:S,lineStyle:ae,...v&&le&&{pointStyle:le},size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:o.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:X,...re.legendBehaviorProps,...Ec({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:Es(),tooltipMode:"multi"}:Yc({tooltip:M,defaultTooltipContent:ce}),...$c({linkedHover:L,selection:P,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...C&&C.length>0&&{annotations:C},...j&&{xExtent:j},..._&&{yExtent:_},...re.crosshairProps,...R};return re.earlyReturn?re.earlyReturn:he?(0,du.jsx)(hc,{componentName:"StackedAreaChart",message:he,width:G,height:q}):(0,du.jsx)(gc,{componentName:"StackedAreaChart",width:G,height:q,children:(0,du.jsx)(ul,{ref:n,...de})})});fu.displayName="StackedAreaChart";var pu=y(require("react")),yu=require("react"),mu=require("react");function gu(e){const{colorBy:t,colorScale:n,color:o,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:h,effectiveSelectionHook:d,resolvedSelection:f,colorDatumAccessor:p,styleRules:y,ruleContext:m}=e,g=(0,mu.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=it(o,t,n)}}else u.fill=a?a(e):o||nt;return void 0===u.r&&(u.r=i?i(e):r),y&&y.length>0&&Object.assign(u,Bc(e,y,m?m(e):{value:void 0})),u},[t,n,o,r,i,s,a,l,p,y,m]),x=(0,mu.useMemo)(()=>Lc(g,{stroke:c,strokeWidth:u,opacity:h}),[g,c,u,h]);return(0,mu.useMemo)(()=>El(x,d??null,f),[x,d,f])}var xu=require("react");function bu(e){const{accessor:t,data:n,isPushMode:o}=e,r=(0,xu.useRef)(null),[i,s]=(0,xu.useState)(0),a=(0,xu.useCallback)(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,n=!0),i>r.current[1]&&(r.current[1]=i,n=!0)):(r.current=[i,i],n=!0))}n&&s(e=>e+1)},[o,t]),l=(0,xu.useCallback)(()=>{o&&(r.current=null,s(e=>e+1))},[o]);return{domain:(0,xu.useMemo)(()=>{if(o)return r.current??void 0;if(!t||0===n.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of n){const n=e(t);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(i>o&&(i=o),o>s&&(s=o))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[n,t,o,i]),trackPushed:a,reset:l}}function vu(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var ku=require("react/jsx-runtime"),wu=(0,yu.forwardRef)(function(e,t){const n=(0,yu.useRef)(null),o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:h,yScaleType:d,colorBy:f,colorScheme:p,styleRules:y,sizeBy:m,sizeRange:g=[3,15],symbolBy:x,symbolMap:b,pointRadius:v=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:M,regression:C,forecast:j,anomaly:_,xExtent:R,yExtent:P,frameProps:L={},selection:I,linkedHover:T,linkedBrush:N,onObservation:F,onClick:O,hoverHighlight:B,chartId:W,loading:D,loadingContent:z,emptyContent:H,legendInteraction:E,legendPosition:$,color:Y,stroke:G,strokeWidth:q,opacity:V}=e,{width:X,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:re}=o,ie=(0,yu.useMemo)(()=>ue(r),[r]),se=void 0===r,{domain:ae,trackPushed:le,reset:ce}=bu({accessor:m,data:ie,isPushMode:se}),he=(0,yu.useCallback)(e=>{le([e]),n.current?.push(e)},[le]),de=(0,yu.useCallback)(e=>{le(e),n.current?.pushMany(e)},[le]);Hc(t,{variant:"xy",frameRef:n,overrides:{push:he,pushMany:de,clear:()=>{ce(),n.current?.clear()}}});const fe=Rc({data:ie,rawData:r,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:$,selection:I,linkedHover:T,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Scatterplot",chartId:W,showLegend:Z,userMargin:i,marginDefaults:o.marginDefaults,loading:D,loadingContent:z,emptyContent:H,width:X,height:U}),pe=zl(N),ye=jl({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),me=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,ge=pu.useRef(ye.brushInteraction);ge.current=ye.brushInteraction;const xe=(0,yu.useCallback)(e=>{const t=ge.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);wc("Scatterplot",ie,"xAccessor",c),wc("Scatterplot",ie,"yAccessor",u);const be=(0,yu.useMemo)(()=>m?ae??[0,1]:void 0,[m,ae]),ve=(0,yu.useMemo)(()=>m?e=>lt(e,m,g,be):void 0,[m,g,be]),ke=(0,yu.useMemo)(()=>Tc(c,u),[c,u]),we=gu({colorBy:f,colorScale:fe.colorScale,color:Y,pointRadius:v,fillOpacity:k,radiusFn:ve,stroke:G,strokeWidth:q,opacity:V,styleRules:y,ruleContext:ke,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Ae=(0,yu.useMemo)(()=>Ua([{label:oe||Ya(c),accessor:c,role:"x",format:a},{label:re||Ya(u),accessor:u,role:"y",format:l},...f?[{label:Ya(f),accessor:f,role:"color"}]:[],...m?[{label:Ya(m),accessor:m,role:"size"}]:[]]),[c,u,oe,re,f,m,a,l]),{effectiveData:Se,statisticalAnnotations:Me}=Qc({data:ie,xAccessor:c,yAccessor:u,forecast:j,anomaly:_}),Ce=(0,yu.useMemo)(()=>{const e=vu(C);return e||0!==Me.length?[...e?[e]:[],...M||[],...Me]:M},[C,M,Me]);if(fe.earlyReturn)return fe.earlyReturn;const je=Mc({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(je)return(0,ku.jsx)(hc,{componentName:"Scatterplot",message:je,width:X,height:U});const _e={chartType:"scatter",...null!=r&&{data:Se},xAccessor:c,yAccessor:u,xScaleType:h,yScaleType:d,colorAccessor:f||void 0,sizeAccessor:m||void 0,...x&&{symbolAccessor:x},...b&&{symbolMap:b},sizeRange:g,pointStyle:we,colorScheme:p,size:[X,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:o.showAxes,xLabel:oe,yLabel:re,xFormat:a,yFormat:l,enableHover:K,showGrid:Q,...fe.legendBehaviorProps,...Ec({title:J,description:ee,summary:te,accessibleTable:ne,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:w,defaultTooltipContent:Ae}),...$c({linkedHover:T,selection:I,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...A&&{marginalGraphics:A},...S&&{pointIdAccessor:S},...Ce&&Ce.length>0&&{annotations:Ce},...R&&{xExtent:R},...P&&{yExtent:P},...pe&&{brush:{dimension:me},onBrush:xe},...fe.crosshairProps,...L};return(0,ku.jsx)(gc,{componentName:"Scatterplot",width:X,height:U,children:(0,ku.jsx)(ul,{ref:n,..._e})})});wu.displayName="Scatterplot";var Au=require("react"),Su=require("react/jsx-runtime");function Mu(e,t){return qe(1===t?.5:e/(t-1))}var Cu=(0,Au.forwardRef)(function(e,t){const n=(0,Au.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:h,orderLabel:d,styleRules:f,pointRadius:p=4,tooltip:y,pointIdAccessor:m,annotations:g,regression:x,forecast:b,anomaly:v,xExtent:k,yExtent:w,frameProps:A={},selection:S,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,stroke:N,strokeWidth:F,opacity:O}=e,{width:B,height:W,enableHover:D,showGrid:z,title:H,description:E,summary:$,accessibleTable:Y,xLabel:G,yLabel:q}=o,{safeData:V,orderMap:X}=(0,Au.useMemo)(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],n="function"==typeof u?u:e=>e[u];let o=e;if(h&&e.length>0){const t="function"==typeof h?h:e=>e[h];o=[...e].sort((e,n)=>{const o=t(e),r=t(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let s=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&s++}let a=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i.set(e,{idx:a++,total:s})}return{safeData:o,orderMap:i}},[r,h,c,u]);wc("ConnectedScatterplot",V,"xAccessor",c),wc("ConnectedScatterplot",V,"yAccessor",u);const U=Rc({data:V,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:S,linkedHover:M,fallbackFields:[],unwrapData:!1,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:I,width:B,height:W}),K=U.resolvedSelection?.unselectedOpacity??Hl,Q=(0,Au.useMemo)(()=>(e,t)=>{const n=t.filter(e=>"point"===e.type);if(2>n.length)return;const o=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>n.length,s=n.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=n[t],l=n[t+1],c=Mu(t,s),u=!o||!r||r(a.datum??a)||r(l.datum??l),h=o?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*h,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=h,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Z=(0,Au.useMemo)(()=>[Q],[Q]),J=(0,Au.useMemo)(()=>(e,t,n)=>{const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const r=o.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=o[e],n=o[e+1],a=Mu(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof n.style?.opacity?n.style.opacity:1);i&&s.push((0,Su.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,Su.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,Su.jsx)(Su.Fragment,{children:s})},[p]),ee=(0,Au.useMemo)(()=>[J],[J]),te=gu({colorScale:void 0,baseStyleExtras:(0,Au.useMemo)(()=>e=>{const t=X.get(e),n=t?.idx??0,o=t?.total??1;return{fill:o>0?Mu(n,o):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:N,strokeWidth:F,opacity:O,styleRules:f,ruleContext:(0,Au.useMemo)(()=>Tc(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),ne=d||("string"==typeof h?h:"Order"),oe=(0,Au.useMemo)(()=>Ua([{label:G||Ya(c),accessor:c,role:"x",format:a},{label:q||Ya(u),accessor:u,role:"y",format:l},...h?[{label:ne,accessor:h,role:"group"}]:[]]),[c,u,G,q,h,ne,a,l]),re=Mc({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=Qc({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const ae=vu(x),le=ae||se.length>0?[...ae?[ae]:[],...g||[],...se]:g,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[B,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:o.showAxes,xLabel:G,yLabel:q,xFormat:a,yFormat:l,enableHover:D,showGrid:z,...Ec({title:H,description:E,summary:$,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:y,defaultTooltipContent:oe}),...$c({linkedHover:M,selection:S,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...m&&{pointIdAccessor:m},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...A};return re?(0,Su.jsx)(hc,{componentName:"ConnectedScatterplot",message:re,width:B,height:W}):(0,Su.jsx)(gc,{componentName:"ConnectedScatterplot",width:B,height:W,children:(0,Su.jsx)(ul,{ref:n,...ce})})});Cu.displayName="ConnectedScatterplot";var ju=require("react"),_u=require("react/jsx-runtime"),Ru=(0,ju.forwardRef)(function(e,t){const n=(0,ju.useRef)(null),o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:h,sizeRange:d=[5,40],colorBy:f,colorScheme:p,styleRules:y,bubbleOpacity:m=.6,bubbleStrokeWidth:g=1,bubbleStrokeColor:x="white",tooltip:b,marginalGraphics:v,pointIdAccessor:k,annotations:w,regression:A,xExtent:S,yExtent:M,frameProps:C={},selection:j,linkedHover:_,linkedBrush:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:W,color:D,stroke:z,strokeWidth:H,opacity:E}=e,{width:$,height:Y,enableHover:G,showGrid:q,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=o,ee=(0,ju.useMemo)(()=>ue(r),[r]),te=void 0===r,ne=Rc({data:ee,rawData:r,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:W,selection:j,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BubbleChart",chartId:T,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:$,height:Y}),{domain:oe,trackPushed:re,reset:ie}=bu({accessor:h,data:ee,isPushMode:te}),se=(0,ju.useCallback)(e=>{re([e]),n.current?.push(e)},[re]),ae=(0,ju.useCallback)(e=>{re(e),n.current?.pushMany(e)},[re]);Hc(t,{variant:"xy",frameRef:n,overrides:{push:se,pushMany:ae,clear:()=>{ie(),n.current?.clear()}}});const le=zl(R),ce=(jl({name:le?.name||"__unused_brush__",xField:le?.xField||("string"==typeof c?c:void 0),yField:le?.yField||("string"==typeof u?u:void 0)}),(0,ju.useMemo)(()=>({stroke:x,strokeWidth:g}),[x,g])),he=(0,ju.useMemo)(()=>oe??[0,1],[oe]),de=(0,ju.useCallback)(e=>lt(e,h,d,he),[h,d,he]),fe=(0,ju.useMemo)(()=>Tc(c,u),[c,u]),pe=gu({colorBy:f,colorScale:ne.colorScale,color:D,fillOpacity:m,radiusFn:de,baseStyleExtras:ce,stroke:z,strokeWidth:H,opacity:E,styleRules:y,ruleContext:fe,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ye=(0,ju.useMemo)(()=>Ua([{label:Z||Ya(c),accessor:c,role:"x",format:a},{label:J||Ya(u),accessor:u,role:"y",format:l},{label:Ya(h),accessor:h,role:"size"},...f?[{label:Ya(f),accessor:f,role:"color"}]:[]]),[c,u,Z,J,h,f,a,l]);if(ne.earlyReturn)return ne.earlyReturn;const me=Mc({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:h}});if(me)return(0,_u.jsx)(hc,{componentName:"BubbleChart",message:me,width:$,height:Y});const ge=vu(A),xe=ge?[ge,...w||[]]:w,be={chartType:"bubble",...null!=r&&{data:ee},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:h,sizeRange:d,pointStyle:pe,colorScheme:p,size:[$,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:o.showAxes,xLabel:Z,yLabel:J,xFormat:a,yFormat:l,enableHover:G,showGrid:q,...ne.legendBehaviorProps,...Ec({title:X,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:b,defaultTooltipContent:ye}),...$c({linkedHover:_,selection:j,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...v&&{marginalGraphics:v},...k&&{pointIdAccessor:k},...xe&&xe.length>0&&{annotations:xe},...S&&{xExtent:S},...M&&{yExtent:M},...ne.crosshairProps,...C};return(0,_u.jsx)(gc,{componentName:"BubbleChart",width:$,height:Y,children:(0,_u.jsx)(ul,{ref:n,...be})})});Ru.displayName="BubbleChart";var Pu=require("react"),Lu=require("d3-scale");M();var Iu=require("react/jsx-runtime"),Tu=(0,Pu.forwardRef)(function(e,t){const n=(0,Pu.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:u,yFormat:h,colorScheme:d,customColorScale:f,showValues:p=!1,valueFormat:y,cellBorderColor:m="#fff",cellBorderWidth:g=1,tooltip:x,annotations:b,xExtent:v,yExtent:k,frameProps:w={},selection:S,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,showLegend:T,legendPosition:N,legendInteraction:F}=e,{width:O,height:B,enableHover:W,title:D,description:z,summary:H,accessibleTable:E,xLabel:$,yLabel:Y}=o,G=kc(P,O,B,L),q=G?null:vc(r,O,B,I),V=(0,Pu.useMemo)(()=>ue(r),[r]),X=function(){const e=Yl();return e?.colors?.sequential||void 0}(),U=d??X??"blues",K=T??!1,Q=N??"right",{margin:Z}=ac({data:V,colorBy:K?"value":void 0,colorScale:void 0,showLegend:K,legendPosition:Q,userMargin:i,defaults:o.marginDefaults}),{customHoverBehavior:J,customClickBehavior:ee,crosshairSourceId:te}=ic({selection:S,linkedHover:M,fallbackFields:[],onObservation:C,onClick:j,chartType:"Heatmap",chartId:R,hoverHighlight:_,colorByField:void 0,mobileInteraction:o.mobileInteraction});_c(S);const ne=sc(M,te);lc(F,void 0,[]);const oe=(0,Pu.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),re=(0,Pu.useMemo)(()=>A(V.map(oe)),[V,oe]),ie=(0,Pu.useMemo)(()=>{if("custom"===U&&f)return f;const e=Je(U);return(0,Lu.scaleSequential)(e).domain(re)},[U,f,re]),se=(0,Pu.useMemo)(()=>{const e=Number.isFinite(g)?Math.max(0,g):1;return()=>({stroke:m,strokeWidth:e})},[m,g]),ae=(0,Pu.useMemo)(()=>Ua([{label:$||Ya(a),accessor:a,role:"x",format:u},{label:Y||Ya(l),accessor:l,role:"y",format:h},{label:Ya(c),accessor:c,role:"value",format:y}]),[a,l,$,Y,c,u,h,y]),le=Mc({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,Pu.useMemo)(()=>{if(K)return{gradient:{colorFn:e=>ie(e),domain:re,label:"string"==typeof c?c:"value",format:y}}},[K,ie,re,c,y]),he={chartType:"heatmap",...null!=r&&{data:V},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==U?U:void 0,areaStyle:se,showValues:p,heatmapValueFormat:y,size:[O,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,showAxes:o.showAxes,xLabel:$,yLabel:Y,xFormat:u,yFormat:h,enableHover:W,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Q},...Ec({title:D,description:z,summary:H,accessibleTable:E,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:x,defaultTooltipContent:ae}),...$c({linkedHover:M,selection:S,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,customHoverBehavior:J,customClickBehavior:ee}),...b&&b.length>0&&{annotations:b},...v&&{xExtent:v},...k&&{yExtent:k},...ne,...w};return G||q||(le?(0,Iu.jsx)(hc,{componentName:"Heatmap",message:le,width:O,height:B}):(0,Iu.jsx)(gc,{componentName:"Heatmap",width:O,height:B,children:(0,Iu.jsx)(ul,{ref:n,...he})}))});Tu.displayName="Heatmap";var Nu=y(require("react")),Fu=require("react");M();var Ou=y(require("react")),Bu=require("react/jsx-runtime"),Wu=null,Du=null;function zu(e){const[t,n]=Ou.useState(()=>Wu);return Ou.useEffect(()=>{if(t)return;let e=!1;return(Wu?Promise.resolve(Wu):(Du||(Du=Promise.resolve().then(()=>(K(),Y)).then(e=>Wu=e.ScatterplotMatrixBrushOverlay).catch(e=>{throw Du=null,e})),Du)).then(t=>{e||n(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?(0,Bu.jsx)(t,{...e}):null}var Hu=require("react/jsx-runtime"),Eu="__splomIdx",$u="splom-hover-source",Yu={top:4,bottom:4,left:4,right:4};function Gu({data:e,xField:t,yField:n,cellSize:o,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:h,mode:d,onPointHover:f,onPointClick:p}){const y=(0,Fu.useRef)(null),m=Ml({name:l,clientId:`splom-${t}-${n}`,fields:[t,n]}),g=jl({name:l,xField:t,yField:n}),x=Ml({name:c,clientId:$u,fields:[Eu]}),b=x.selectPoints,v=(0,Fu.useCallback)(e=>{e?g.brushInteraction.during(e):g.brushInteraction.end(null)},[g.brushInteraction]),k=(0,Fu.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data,n=t?.[Eu];void 0!==n&&(b({[Eu]:[n]}),f?.(t,e.x+Yu.left,e.y+Yu.top))},[b,f]),w=(0,Fu.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+Yu.left,e.y+Yu.top)},[p]),A=(0,Fu.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?it(e,s,a):nt,"hover"===d?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*i):m.isActive&&!m.predicate(e)&&(t.opacity=u),t},[i,r,s,d,a,x,m,u]);return(0,Hu.jsxs)("div",{style:{position:"relative",width:o,height:o},children:[(0,Hu.jsx)(ul,{ref:y,chartType:"scatter",data:e,size:[o,o],xAccessor:t,yAccessor:n,pointStyle:A,margin:Yu,showAxes:!1,enableHover:"hover"===d,...$c({forceHoverBehavior:"hover"===d,forceClickBehavior:!!p,mobileInteraction:h,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===d?()=>null:void 0}),"brush"===d&&(0,Hu.jsx)(zu,{frameRef:y,cellSize:o,onBrush:v})]})}function qu({data:e,field:t,label:n,cellSize:o,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const u=Ml({name:a,clientId:"splom-diag-"+t,fields:[t]}),h=Ml({name:l,clientId:`splom-diag-${t}-hover`,fields:[Eu]}),d="hover"===c?h:u,f=d.isActive,p=d.predicate,y=(0,Fu.useMemo)(()=>{const n="string"==typeof i?i:null,s=[],a=new Set;for(const o of e){const e=o[t];if(null==e||isNaN(e)||s.push(Number(e)),n){const e=o[n];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=A(s),u=(c-l)/r||1,h=Array.from(a),d=new Map(h.map((e,t)=>[e,t])),y=Array(r).fill(0),m=Array(r).fill(0),g=Array.from({length:r},()=>Array(h.length).fill(0)),x=Array.from({length:r},()=>Array(h.length).fill(0));for(const o of e){const e=o[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/u),r-1);if(y[i]++,f&&!p(o)||m[i]++,n){const e=d.get(o[n]+"");void 0!==e&&(g[i][e]++,f&&!p(o)||x[i][e]++)}}const b=S(y,1),v=g.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})}),k=x.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})});return{bars:y.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),selectedBars:m.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),categoryBars:v,selectedCategoryBars:k,max:b,categories:h}},[e,t,r,o,f,p,i]);return(0,Hu.jsxs)("svg",{width:o,height:o,style:{overflow:"hidden"},children:[(0,Hu.jsx)("text",{x:o/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:n}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,n)=>(0,Hu.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):nt,opacity:f?.3:.6},`bg-${t}-${n}`))):y.bars.map((e,t)=>(0,Hu.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:nt,opacity:f?.3:.6},"bg-"+t)),f&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,n)=>(0,Hu.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):nt,opacity:.7},`sel-${t}-${n}`))):y.selectedBars.map((e,t)=>(0,Hu.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:nt,opacity:.7},"sel-"+t)))]})}function Vu({label:e,cellSize:t}){return(0,Hu.jsx)("svg",{width:t,height:t,children:(0,Hu.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Xu(e){const{data:t,fields:n,fieldLabels:o={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:h=20,brushMode:d="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:m,showLegend:g,idAccessor:x,width:b,className:v,onObservation:k,onClick:w,chartId:A}=e,S="splom",M="splom-hover",C=Kl(e.mobileInteraction,{mode:e.mode,width:b??n.length*s,mobileSemantics:e.mobileSemantics}),j=f?"hover":d?"brush":"hover",_=Al(e=>e.clearSelection),[R,P]=(0,Fu.useState)(null),L=(0,Fu.useCallback)(()=>{_(M),P(null)},[_,M]),I=(0,Fu.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[Eu]?e:{...e,[Eu]:t}),[t]),T=rc(I,r,i),N=(0,Fu.useCallback)((e,t,n,o)=>[40+e*(s+a)+(n??0),t*(s+a)+(o??0)],[40,s,a]),F=void 0!==g?g:!!r,O=(0,Fu.useMemo)(()=>{if(!F||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(I.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:T?T(e+""):nt})):null},[F,r,I,T]),B=(0,Fu.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+n.map(()=>s+"px").join(" "),gridTemplateRows:n.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[n,s,a,40]);return(0,Hu.jsxs)("div",{className:v,style:{position:"relative"},children:[O&&(0,Hu.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:O.map(e=>(0,Hu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,Hu.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,Hu.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,Hu.jsxs)("div",{style:B,onMouseLeave:"hover"===j?L:void 0,children:[n.map((e,t)=>(0,Hu.jsxs)(Nu.Fragment,{children:[(0,Hu.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e}),n.map((n,i)=>t===i?"label"===u?(0,Hu.jsx)(Vu,{label:o[e]||e,cellSize:s},"diag-"+e):(0,Hu.jsx)(qu,{data:I,field:e,label:o[e]||e,cellSize:s,bins:h,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:M,unselectedOpacity:p,mode:j},"diag-"+e):(0,Hu.jsx)(Gu,{data:I,xField:n,yField:e,fieldLabels:o,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:M,unselectedOpacity:p,showGrid:y,tooltip:m,mobileInteraction:C,mode:j,onPointHover:"hover"===j?(o,r,s)=>{if(o){if(P({datum:o,xField:n,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),k){const[e,n]=N(i,t,r,s);k({type:"hover",datum:o,x:e,y:n,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}}else P(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0,onPointClick:w||k?(e,n,o)=>{if(!e)return;const[r,s]=N(i,t,n,o);w&&w(e,{x:r,y:s}),k&&k({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0},`cell-${e}-${n}`))]},"row-"+e)),(0,Hu.jsx)("div",{})," ",n.map(e=>(0,Hu.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e},"col-label-"+e))]}),R&&"hover"===j&&(()=>{const e=R.datum,t=o[R.xField]||R.xField,n=o[R.yField]||R.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=x?"function"==typeof x?x(e):e[x]:"Row "+e[Eu];return(0,Hu.jsxs)("div",{style:{position:"absolute",left:40+R.colIndex*(s+a)+R.px,top:R.rowIndex*(s+a)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,Hu.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,Hu.jsxs)("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),(0,Hu.jsxs)("div",{children:[n,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=i&&(0,Hu.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function Uu(e){const{brushMode:t="crossfilter",hoverMode:n=!0}=e,o={};return!n&&t&&(o.splom={resolution:t}),n&&(o["splom-hover"]={resolution:"union"}),(0,Hu.jsx)(Dl,{selections:o,children:(0,Hu.jsx)(Xu,{...e})})}Uu.displayName="ScatterplotMatrix";var Ku=require("react"),Qu=y(require("react")),Zu=require("react/jsx-runtime"),Ju=null,eh=null;function th(e){const[t,n]=Qu.useState(()=>Ju);return Qu.useEffect(()=>{if(t)return;let e=!1;return(Ju?Promise.resolve(Ju):(eh||(eh=Promise.resolve().then(()=>(ee(),Q)).then(e=>Ju=e.MinimapBrushOverlay).catch(e=>{throw eh=null,e})),eh)).then(t=>{e||n(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?(0,Zu.jsx)(t,{...e}):null}var nh=require("react/jsx-runtime");function oh(e){const{data:t,width:n=600,height:o=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:x,curve:b="linear",lineWidth:v=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:A=!1,pointRadius:S=3,enableHover:M=!0,showGrid:C=!1,showLegend:j,legendPosition:_,tooltip:R,minimap:P={},renderBefore:L=!1,onBrush:I,brushExtent:T,yExtent:N,frameProps:F={},loading:O,loadingContent:B,emptyContent:W}=e,D=kc(O,n,o,B),z=D?null:vc(t,n,o,W),H=(0,Ku.useMemo)(()=>ue(t),[t]),[E,$]=(0,Ku.useState)(null),Y=T??E,G=(0,Ku.useCallback)(e=>{T||$(e),I?.(e)},[T,I]),q=(0,Ku.useRef)(null),[V,X]=(0,Ku.useState)(null);(0,Ku.useEffect)(()=>{let e=0,t=!1;const n=()=>{if(t)return;const o=q.current?.getScales?.();o?X(o):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const U=void 0!==H[0]?.[m],K=(0,Ku.useMemo)(()=>{if(U)return H;if(y){const e=H.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[m]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:H}]},[H,y,m,U]),Q=(0,Ku.useMemo)(()=>U||y?K.flatMap(e=>{const t=e[m]||[];return y&&"string"==typeof y?t.map(t=>({...t,[y]:e[y]})):t}):H,[K,m,U,y,H]),Z=rc(H,g,x),J=Dc({lineWidth:v,colorBy:g,colorScale:Z,fillArea:k,areaOpacity:w}),ee=(0,Ku.useMemo)(()=>{if(P.lineStyle)return P.lineStyle},[P.lineStyle]),te=Dc({lineWidth:1,colorBy:g,colorScale:Z}),ne=ee??te,oe=(0,Ku.useMemo)(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return t.fill=g?it(e.parentLine||e,g,Z):nt,t}},[A,S,g,Z]),{legend:re,margin:ie,legendPosition:se}=ac({data:K,colorBy:g,colorScale:Z,showLegend:j,legendPosition:_,userMargin:r}),ae=P.height||60,le=(0,Ku.useMemo)(()=>({top:P.margin?.top??0,bottom:P.margin?.bottom??20,left:P.margin?.left??ie.left,right:P.margin?.right??ie.right}),[P.margin,ie]),ce=P.brushDirection||"x",he=(0,Ku.useMemo)(()=>Ua([{label:c||Ya(f),accessor:f,role:"x",format:h},{label:u||Ya(p),accessor:p,role:"y",format:d}]),[f,p,c,u,h,d]),de=Mc({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(de)return(0,nh.jsx)(hc,{componentName:"MinimapChart",message:de,width:n,height:o});const fe=k?"area":"line",pe={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:J,...A&&{pointStyle:oe},size:[n,o],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,showAxes:!0,xLabel:c,yLabel:u,xFormat:h,yFormat:d,enableHover:M,showGrid:C,...re&&{legend:re,legendPosition:se},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===R?()=>null:$s(R)||he,...Y&&{xExtent:Y},...N&&{yExtent:N},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...F},ye={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:ne,size:[n,ae+le.top+le.bottom],margin:le,showAxes:P.showAxes??!1,background:P.background,enableHover:!1,...N&&{yExtent:N}},me=(0,nh.jsxs)("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[(0,nh.jsx)(ul,{ref:q,...ye}),(0,nh.jsx)(th,{width:n-le.left-le.right,height:ae,margin:le,scales:V,brushDirection:ce,extent:Y,onBrush:G})]},"minimap"),ge=(0,nh.jsx)("div",{style:{overflow:"hidden"},children:(0,nh.jsx)(ul,{...pe})},"main");return D||z||(0,nh.jsx)(gc,{componentName:"MinimapChart",width:n,height:o,children:(0,nh.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[L?me:ge,L?ge:me]})})}oh.displayName="MinimapChart";var rh=require("react"),ih={label:"Low / High",color:"#E9C46A",opacity:.08},sh={label:"High / High",color:"#2A9D8F",opacity:.08},ah={label:"Low / Low",color:"#E76F51",opacity:.08},lh={label:"High / Low",color:"#86BBD8",opacity:.08};M();var ch=require("react/jsx-runtime");function uh(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var hh=(0,rh.forwardRef)(function(e,t){const n=(0,rh.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xCenter:h,yCenter:d,quadrants:f,centerlineStyle:p={},showQuadrantLabels:y=!0,quadrantLabelSize:m=12,colorBy:g,colorScheme:x,styleRules:b,sizeBy:v,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:S=.8,tooltip:M,pointIdAccessor:C,annotations:j,frameProps:_={},selection:R,linkedHover:P,onObservation:L,onClick:I,hoverHighlight:T,chartId:N,loading:F,loadingContent:O,emptyContent:B,legendInteraction:W,legendPosition:D,color:z,stroke:H,strokeWidth:E,opacity:$}=e,{width:Y,height:G,enableHover:q,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=o,te=(0,rh.useMemo)(()=>({topLeft:uh(ih,f?.topLeft),topRight:uh(sh,f?.topRight),bottomLeft:uh(ah,f?.bottomLeft),bottomRight:uh(lh,f?.bottomRight)}),[f]),ne=(0,rh.useMemo)(()=>ue(r),[r]),oe=Rc({data:ne,rawData:r,colorBy:g,colorScheme:x,legendInteraction:W,legendPosition:D,selection:R,linkedHover:P,fallbackFields:"string"==typeof g?[g]:[],unwrapData:!1,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"QuadrantChart",chartId:N,showLegend:X,userMargin:i,marginDefaults:o.marginDefaults,loading:F,loadingContent:O,emptyContent:B,width:Y,height:G});wc("QuadrantChart",ne,"xAccessor",c),wc("QuadrantChart",ne,"yAccessor",u);const re=(0,rh.useMemo)(()=>{if(!ne.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof u?u:e=>+e[u];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(n>h&&(n=h),h>o&&(o=h)),null!=d&&isFinite(d)&&(r>d&&(r=d),d>i&&(i=d)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[ne,c,u,h,d]),ie=(0,rh.useMemo)(()=>{if(!v||0===ne.length)return;const e=ne.map(e=>"function"==typeof v?v(e):e[v]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?A(e):void 0},[ne,v]),se=(0,rh.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),ae=(0,rh.useMemo)(()=>"function"==typeof u?u:e=>+e[u],[u]),le=(0,rh.useMemo)(()=>e=>{const t=se(e),n=ae(e),o=null!=h?t>=h:void 0,r=null!=d?n>=d:void 0;return void 0===r||void 0===o?z||nt:r&&o?te.topRight.color:r&&!o?te.topLeft.color:!r&&o?te.bottomRight.color:te.bottomLeft.color},[se,ae,h,d,te,z]),ce=(0,rh.useMemo)(()=>v?e=>lt(e,v,k,ie):void 0,[v,k,ie]),he=(0,rh.useMemo)(()=>Tc(c,u),[c,u]),de=gu({colorBy:g,colorScale:oe.colorScale,color:z,pointRadius:w,fillOpacity:S,radiusFn:ce,fallbackFill:le,stroke:H,strokeWidth:E,opacity:$,styleRules:b,ruleContext:he,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),fe=(0,rh.useMemo)(()=>{if(!ne.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof u&&e.add(u),"string"==typeof g&&e.add(g),"string"==typeof v&&e.add(v);const t=ne[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[ne,c,u,g,v]),pe=(0,rh.useMemo)(()=>Ua([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:J||Ya(c),accessor:c,role:"x",format:a},{label:ee||Ya(u),accessor:u,role:"y",format:l},...g?[{label:Ya(g),accessor:g,role:"color"}]:[],...v?[{label:Ya(v),accessor:v,role:"size"}]:[]]),[fe,c,u,J,ee,g,v,a,l]),ye=Mc({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),me=(0,rh.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray||[]};return[(t,n,o,r)=>{if(!o?.x||!o?.y)return;const i=r.width,s=r.height,a=null!=h?o.x(h):i/2,l=null!=d?o.y(d):s/2;if(null!=h&&!isFinite(a))return;if(null!=d&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),f=[{config:te.topLeft,x:0,y:0,w:c,h:u},{config:te.topRight,x:c,y:0,w:i-c,h:u},{config:te.bottomLeft,x:0,y:u,w:c,h:s-u},{config:te.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of f)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,d,te,p]),ge=(0,rh.useMemo)(()=>y?[...me,(e,t,n,o)=>{if(!n?.x||!n?.y)return;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;(null==h||isFinite(s))&&(null==d||isFinite(a))&&(e.font=`600 ${m}px sans-serif`,e.globalAlpha=.5,e.fillStyle=te.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(te.topLeft.label,8,8),e.fillStyle=te.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(te.topRight.label,r-8,8),e.fillStyle=te.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(te.bottomLeft.label,8,i-8),e.fillStyle=te.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(te.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:me,[me,y,m,te,h,d]),xe=(0,rh.useMemo)(()=>{const e=_.canvasPreRenderers||[];return[...ge,...e]},[ge,_.canvasPreRenderers]),be=(0,rh.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray?Array.isArray(p.strokeDasharray)?p.strokeDasharray.join(","):p.strokeDasharray:void 0};return[(t,n,o)=>{if(!n?.x||!n?.y)return null;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;if(null!=h&&!isFinite(s))return null;if(null!=d&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,ch.jsxs)(ch.Fragment,{children:[[{config:te.topLeft,x:0,y:0,w:l,h:c},{config:te.topRight,x:l,y:0,w:r-l,h:c},{config:te.bottomLeft,x:0,y:c,w:l,h:i-c},{config:te.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,ch.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,ch.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,ch.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),y&&(0,ch.jsxs)(ch.Fragment,{children:[(0,ch.jsx)("text",{x:8,y:8+m,fill:te.topLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:te.topLeft.label}),(0,ch.jsx)("text",{x:r-8,y:8+m,fill:te.topRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:te.topRight.label}),(0,ch.jsx)("text",{x:8,y:i-8,fill:te.bottomLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:te.bottomLeft.label}),(0,ch.jsx)("text",{x:r-8,y:i-8,fill:te.bottomRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:te.bottomRight.label})]})]})}]},[h,d,te,p,y,m]);if(oe.earlyReturn)return oe.earlyReturn;const ve={chartType:"scatter",...null!=r&&{data:ne},xAccessor:c,yAccessor:u,colorAccessor:g||void 0,sizeAccessor:v||void 0,sizeRange:k,pointStyle:de,colorScheme:x,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:o.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:q,showGrid:V,...re&&{xExtent:re.xExtent,yExtent:re.yExtent},...oe.legendBehaviorProps,...U&&{title:U},...K&&{description:K},...Q&&{summary:Q},...void 0!==Z&&{accessibleTable:Z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===M?()=>null:!0===M||void 0===M?pe:$s(M)||pe,...$c({linkedHover:P,selection:R,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...C&&{pointIdAccessor:C},...j&&j.length>0&&{annotations:j},canvasPreRenderers:xe,...oe.crosshairProps,..._,...xe.length>0&&{canvasPreRenderers:xe},svgPreRenderers:be};return ye?(0,ch.jsx)(hc,{componentName:"QuadrantChart",message:ye,width:Y,height:G}):(0,ch.jsx)(gc,{componentName:"QuadrantChart",width:Y,height:G,children:(0,ch.jsx)(ul,{ref:n,...ve})})});hh.displayName="QuadrantChart";var dh=y(require("react")),fh=require("react"),ph=require("react/jsx-runtime"),yh="__ma_unitized",mh="__ma_series";function gh(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function xh(e,t){return t[0]+e*(t[1]-t[0])}var bh=(0,fh.forwardRef)(function(e,t){const n=(0,fh.useRef)(null),o=(0,fh.useRef)([]),r=(0,fh.useRef)(e.series);r.current=e.series,(0,fh.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||o.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&n.current.push({...i,[yh]:gh(a,s),[mh]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const n=r[t],s=n.extent||o.current[t];if(!s)continue;const a=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[yh]:gh(a,s),[mh]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const i=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:h,colorScheme:d,curve:f="monotoneX",lineWidth:p=2,tooltip:y,annotations:m,frameProps:g={},selection:x,linkedHover:b,onObservation:v,onClick:k,hoverHighlight:w,chartId:A,loading:S,loadingContent:M,emptyContent:C,legendInteraction:j,legendPosition:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:N,showGrid:F,showLegend:O=!0,title:B,description:W,summary:D,accessibleTable:z,xLabel:H}=i,E=(0,fh.useMemo)(()=>ue(s),[s]),$=(0,fh.useMemo)(()=>ue(h),[h]),Y=$,G=2===$.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||G||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${$.length}. Rendering as a standard multi-line chart.`);const q=kc(S,I,T,M),V=q?null:vc(s,I,T,C),X=oc(),U=(0,fh.useMemo)(()=>{let e;if(Array.isArray(d))e=d;else if(X&&X.length>0)e=X;else{const t=et[d];e=Array.isArray(t)?t:tt}return Y.map((t,n)=>t.color||e[n%e.length])},[Y,d,X]),K=(0,fh.useMemo)(()=>$.map((e,t)=>e.label||"Series "+(t+1)),[$]),{unitizedData:Q,extents:Z}=(0,fh.useMemo)(()=>{if(0===E.length){const e=$.map(e=>e.extent||null).filter(Boolean);return e.length===$.length&&(o.current=e),{unitizedData:[],extents:e.length===$.length?e:[]}}const e=$.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(E,e.yAccessor));if(o.current=e,!G){const t=[];for(const e of E)for(let n=0;$.length>n;n++){const o=$[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push({...e,[yh]:r,[mh]:K[n]})}return{unitizedData:t,extents:e}}const t=[];for(const n of E)for(let o=0;2>o;o++){const r=$[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push({...n,[yh]:gh(i,e[o]),[mh]:K[o]})}return{unitizedData:t,extents:e}},[E,$,G,K]),J=(0,fh.useMemo)(()=>{if(G&&Z.length>=2)return[{orient:"left",label:K[0],tickFormat:$[0].format||(e=>{const t=xh(e,Z[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:K[1],tickFormat:$[1].format||(e=>{const t=xh(e,Z[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[G,Z,$,K]),ee=Rc({data:(0,fh.useMemo)(()=>Q.length>0?Q:K.map(e=>({[mh]:e})),[Q,K]),rawData:s,colorBy:mh,colorScheme:U,legendInteraction:j,legendPosition:_,selection:x,linkedHover:b,fallbackFields:[mh],unwrapData:!1,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:A,showLegend:O,userMargin:a,marginDefaults:G?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:S,loadingContent:M,emptyContent:C,width:I,height:T}),te=(0,fh.useMemo)(()=>{const e=new Map;return K.forEach((t,n)=>e.set(t,U[n])),e},[K,U]),ne=Dc({lineWidth:p,resolveStroke:(0,fh.useCallback)(e=>te.get(e[mh])||U[0],[te,U]),stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),oe=(0,fh.useMemo)(()=>{if(!1===y)return()=>null;return $s(y)||(e=>{const t=e.data||e,n=t[mh],o=K.indexOf(n),r=t[yh],i=G&&o>=0&&Z[o]?xh(r,Z[o]):r,s=o>=0&&$[o]?.format?$[o].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return dh.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},dh.createElement("div",{style:{fontWeight:600,marginBottom:4,color:U[o]||"inherit"}},n),dh.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),dh.createElement("div",null,`${n}: ${s(i)}`))})},[y,K,U,Z,G,$,u]);if(ee.earlyReturn)return ee.earlyReturn;const re=Mc({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),ie=G?[0,1]:void 0,se={chartType:"line",...null!=s&&{data:Q},xAccessor:u,yAccessor:yh,groupAccessor:mh,lineStyle:ne,colorScheme:U,size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,showAxes:i.showAxes,...J&&{axes:J},xLabel:H,...G?{}:{yLabel:K[0]},xFormat:c,...G&&ie&&{yExtent:ie},enableHover:N,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:F,curve:f,...ee.legendBehaviorProps,...B&&{title:B},...W&&{description:W},...D&&{summary:D},...void 0!==z&&{accessibleTable:z},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:oe,...m&&{annotations:m},...$c({linkedHover:b,selection:x,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...ee.crosshairProps,...g};return q||V||(re?(0,ph.jsx)(hc,{componentName:"MultiAxisLineChart",message:re,width:I,height:T}):(0,ph.jsx)(gc,{componentName:"MultiAxisLineChart",width:I,height:T,children:(0,ph.jsx)(ul,{ref:n,...se})}))});bh.displayName="MultiAxisLineChart";var vh=require("react");function kh(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}var wh=require("react/jsx-runtime"),Ah=(0,vh.forwardRef)(function(e,t){const n=(0,vh.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:h="low",openAccessor:d,closeAccessor:f,candlestickStyle:p,tooltip:y,annotations:m,xExtent:g,yExtent:x,frameProps:b={},selection:v,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:M,loadingContent:C,emptyContent:j}=e,{width:_,height:R,enableHover:P,showGrid:L,title:I,description:T,summary:N,accessibleTable:F,xLabel:O,yLabel:B}=o,W=kc(M,_,R,C),D=W?null:vc(r,_,R,j),z=(0,vh.useMemo)(()=>ue(r),[r]),H=null==d||null==f;wc("CandlestickChart",z,"xAccessor",c),wc("CandlestickChart",z,"highAccessor",u),wc("CandlestickChart",z,"lowAccessor",h),H||(wc("CandlestickChart",z,"openAccessor",d),wc("CandlestickChart",z,"closeAccessor",f));const{customHoverBehavior:E,customClickBehavior:$,crosshairSourceId:Y}=ic({selection:v,linkedHover:k,onObservation:w,onClick:A,chartType:"CandlestickChart",chartId:S,mobileInteraction:o.mobileInteraction}),G=sc(k,Y),q=(0,vh.useMemo)(()=>{const e=o.marginDefaults,t="sparkline"===o.mode?{...e,top:0,bottom:0}:e;return null==i?t:{...t,...kh(i)}},[i,o.marginDefaults,o.mode]),V=(0,vh.useMemo)(()=>{const e=[{label:O||Ya(c),accessor:c,role:"x",format:a}];return H?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:h,format:l})):(e.push({label:"Open",accessor:d,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:h,format:l}),e.push({label:"Close",accessor:f,format:l})),Ua(e)},[c,O,a,l,u,h,d,f,H]),X=Mc({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f}}}),U={chartType:"candlestick",...null!=r&&{data:z},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(_/40))),extentPadding:_>200?.1:.02,size:[_,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:q,showAxes:o.showAxes,xLabel:O,yLabel:B,xFormat:a,yFormat:l,enableHover:P,showGrid:L,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Ec({title:I,description:T,summary:N,accessibleTable:F,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:y,defaultTooltipContent:V}),...$c({linkedHover:k,selection:v,onObservation:w,onClick:A,mobileInteraction:o.mobileInteraction,customHoverBehavior:E,customClickBehavior:$}),...m&&m.length>0&&{annotations:m},...g&&{xExtent:g},...x&&{yExtent:x},...G,...b};return W||D||(X?(0,wh.jsx)(hc,{componentName:"CandlestickChart",message:X,width:_,height:R}):(0,wh.jsx)(gc,{componentName:"CandlestickChart",width:_,height:R,children:(0,wh.jsx)(ul,{ref:n,...U})}))});Ah.displayName="CandlestickChart";var Sh=require("react"),Mh=require("react");var Ch=require("react/jsx-runtime"),jh=(0,Sh.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:h,onObservation:d,onClick:f,selection:p,linkedHover:y,chartId:m,loading:g,loadingContent:x,emptyContent:b,colorBy:v,colorScheme:k,legend:w,frameProps:A={}}=e,{legend:S,...M}=A,C=(0,Sh.useMemo)(()=>er(S,w),[S,w]),{frameRef:j,resolved:_,safeData:R,setup:P,earlyReturn:L}=function(e){const t=function(e){const t=(0,Mh.useRef)(null);return Hc(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,Mh.useMemo)(()=>kh(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=Rc({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,legend:e.legend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorBy:v,colorScheme:k,legend:C,selection:p,linkedHover:y,onObservation:d,onClick:f,chartId:m,loading:g,loadingContent:x,emptyContent:b,margin:c,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),I=P.effectiveSelectionHook,T=(0,Sh.useMemo)(()=>I?.isActive?{isActive:!0,predicate:I.predicate}:null,[I?.isActive,I?.predicate]);if(L)return L;const{width:N,height:F,enableHover:O,showGrid:B,title:W,description:D,summary:z,accessibleTable:H,xLabel:E,yLabel:$}=_,Y={chartType:"custom",...null!=n&&{data:R},customLayout:o,layoutConfig:r,onLayoutError:i,...T&&{layoutSelection:T},xExtent:s,yExtent:a,colorAccessor:v,colorScheme:k,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P.margin,showAxes:l,xLabel:E,yLabel:$,enableHover:O,showGrid:B,...P.legendBehaviorProps,...Ec({title:W,description:D,summary:z,accessibleTable:H,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...$c({linkedHover:y,selection:p,onObservation:d,onClick:f,hoverHighlight:!1,mobileInteraction:P.mobileInteraction,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior}),...h&&h.length>0&&{annotations:h},...P.crosshairProps,...M};return(0,Ch.jsx)(gc,{componentName:"XYCustomChart",width:N,height:F,children:(0,Ch.jsx)(ul,{ref:j,...Y})})});jh.displayName="XYCustomChart";var _h={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Rh=8;function Ph(e){return null==e?void 0:e+""}function Lh(e){const t=Ph(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??Rh,style:{..._h},datum:e.datum,pointId:t,_transitionKey:t}}function Ih(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{..._h},datum:e.datum,group:e.group,_transitionKey:Ph(e.id)}}
2
+ var e,t,n,o,r,i,s=Object.create,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,d=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[c(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},f=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},p=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of c(t))h.call(e,r)||r===n||a(e,r,{get:()=>t[r],enumerable:!(o=l(t,r))||o.enumerable});return e},y=(e,t,n)=>(n=null!=e?s(u(e)):{},p(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),m=d({"src/components/stream/brushAccessibility.ts"(){e=y(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),g={};function x(e,t,n,o){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(o)0>n?a=Math.max(r,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(r,Math.min(i-e,a+n*s)),l=a+e}return[a,l]}function b(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function v(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function k({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,dimension:h,scales:d,onBrush:f,binSize:p,snap:y,binBoundaries:m,snapDuring:g,streaming:k}){const w=(0,n.useRef)(null),A=(0,n.useRef)(null),S=(0,n.useRef)(f);S.current=f;const M=(0,n.useRef)(d);M.current=d;const C=(0,n.useMemo)(()=>m?[...m].sort((e,t)=>e-t):void 0,[m]),_=(0,n.useRef)(C);_.current=C;const j=(0,n.useRef)(!1),R=(0,n.useRef)(null),P=function({label:n="Data range brush",description:o=t,onAction:r}={}){const i=e.useId().replace(/:/g,""),s=e.useRef(r);return s.current=r,{description:o,descriptionId:"semiotic-brush-description-"+i,svgProps:{role:"region",tabIndex:0,"aria-label":n,"aria-describedby":"semiotic-brush-description-"+i,onKeyDown:e.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),s.current?.(t))},[])}}}({label:"xy"===h?"Two-dimensional data range brush":h.toUpperCase()+" data range brush",onAction:e=>{const t=M.current,n=A.current;if(!t||!n||!w.current)return;const r=(0,o.select)(w.current).select(".brush-g");if("clear"===e.type)return j.current=!0,r.call(n.move,null),j.current=!1,R.current=null,void S.current(null);const i=t.x.domain(),s=t.y.domain(),a=R.current;let l=a?.x??[i[0]+.4*(i[1]-i[0]),i[0]+.6*(i[1]-i[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==h&&(l=x(l,i,d,e.resize)),u||"x"===h||(c=x(c,s,d,e.resize)),u&&"y"===h||!u&&"x"===h)return;const f={x:l,y:c};j.current=!0,r.call(n.move,"x"===h?[t.x(l[0]),t.x(l[1])]:"y"===h?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),j.current=!1,R.current=f,S.current(f)}});return(0,n.useEffect)(()=>{if(!w.current)return;const e=(0,o.select)(w.current).select(".brush-g"),t="x"===h?(0,r.brushX)():"y"===h?(0,r.brushY)():(0,r.brush)();return t.extent([[0,0],[s,a]]),t.on("brush end",n=>{if(j.current)return;const o=M.current;if(!o)return;if(!n.selection)return R.current=null,void S.current(null);let r,i;if("x"===h){const[e,t]=n.selection;r=[o.x.invert(e),o.x.invert(t)],i=[o.y.invert(a),o.y.invert(0)]}else if("y"===h){const[e,t]=n.selection;r=[o.x.invert(0),o.x.invert(s)],i=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[s,a]]=n.selection;r=[o.x.invert(e),o.x.invert(s)],i=[o.y.invert(a),o.y.invert(t)]}if("bin"===y&&"y"!==h&&("end"===n.type||"brush"===n.type&&g)){const i=_.current;i&&i.length>0?r=function(e,t){return 0===t.length?e:[b(e[0],t),v(e[1],t)]}(r,i):p&&p>0&&(r=[Math.floor(r[0]/p)*p,Math.ceil(r[1]/p)*p]);const s=o.x(r[0]),a=o.x(r[1]);if(j.current=!0,"x"===h)e.call(t.move,[s,a]);else if("xy"===h){const o=n.selection;e.call(t.move,[[s,o[0][1]],[a,o[1][1]]])}j.current=!1}const l={x:r,y:i};R.current=l,S.current(l)}),e.call(t),A.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),A.current=null}},[s,a,h,y,p,g]),(0,n.useEffect)(()=>{if(!(k&&d&&A.current&&R.current))return;if(!w.current)return;if("y"===h)return;const e=R.current,t=d.x.domain()[0],n=(0,o.select)(w.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,n.call(A.current.move,null),j.current=!1,R.current=null,void S.current(null);let r=e.x[0],i=!1;if(t>e.x[0]){if(r=t,"bin"===y){const e=_.current;e&&e.length>0?r=v(t,e):p&&p>0&&(r=Math.ceil(t/p)*p)}if(r>=e.x[1])return j.current=!0,n.call(A.current.move,null),j.current=!1,R.current=null,void S.current(null);i=!0}const s=d.x(r),a=d.x(e.x[1]);if(j.current=!0,"x"===h)n.call(A.current.move,[s,a]);else{const t=d.y(e.y[1]),o=d.y(e.y[0]);n.call(A.current.move,[[s,t],[a,o]])}if(j.current=!1,i){const t={x:[r,e.x[1]],y:e.y};R.current=t,S.current(t)}},[d,k,h,y,p]),(0,i.jsxs)("svg",{ref:w,width:l,height:c,...P.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,i.jsx)("title",{children:P.svgProps["aria-label"]}),(0,i.jsx)("desc",{id:P.descriptionId,children:P.description}),(0,i.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`})]})}f(g,{XYBrushOverlay:()=>k});var w=d({"src/components/stream/XYBrushOverlay.tsx"(){n=require("react"),o=require("d3-selection"),r=require("d3-brush"),m(),i=require("react/jsx-runtime")}});function A(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function S(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}var M=d({"src/components/charts/shared/minMax.ts"(){}});function C(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function _(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var j,R,P=d({"src/components/charts/shared/colorManipulation.ts"(){}}),L={};function T(e,t,n,o){const r=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!r&&!i)return;const s="object"==typeof r?r:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[R]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=n(e),r=o(e);return null!=t&&null!=r&&Number.isFinite(t)&&Number.isFinite(r)?Math.abs(t-r):NaN}),u=c.filter(e=>Number.isFinite(e));if(0===u.length)return;const[h,d]=A(u),f=d-h;e.forEach((e,t)=>{const n=c[t];Number.isFinite(n)&&(e[R]=l-(f>0?(n-h)/f:0)*(l-a))})}function I(e,t){return"function"==typeof t?t(e):!!e[t]}function N(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function O(e,t,n,o,r){return(i=o).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,n,o,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:h=.15,anomalyColor:d="#ef4444",anomalyRadius:f=6,label:p}=o,y=e.map(e=>{let t="observed";return s&&I(e,s)?t="forecast":i&&I(e,i)&&(t="training"),{...e,[j]:t}}),m=o._groupBy,g=[];if(m){const e=new Map;for(const t of y){const n=t[m]??"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][j]!==n[e+1][j]&&(t.push({...n[e+1],[j]:n[e][j]}),t.push({...n[e],[j]:n[e+1][j]}));g.push(...y,...t)}else for(let e=0;y.length>e;e++)g.push(y[e]),y.length-1>e&&y[e][j]!==y[e+1][j]&&(g.push({...y[e+1],[j]:y[e][j]}),g.push({...y[e],[j]:y[e+1][j]}));if(o.trainUnderline){const e=[];for(const t of g)"training"===t[j]&&e.push({...t,[j]:"training-base"});g.unshift(...e)}const x=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const n of g)"function"==typeof l&&(n[e]=l(n)),"function"==typeof c&&(n[t]=c(n));x.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:h,label:p})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};T(g.filter(e=>"forecast"===e[j]),o,e,t)}if(a){const e=o.anomalyStyle,t={type:"highlight",filter:e=>I(e,a)};e?(t.style=e,t.r=f):"function"==typeof d?(t.style=e=>{const t=d(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=d,t.r=f,t.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),x.push(t)}return r&&x.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:g,annotations:x}}(e,0,0,o,r):function(e,t,n,o,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=o;if(null==i)return{processedData:e,annotations:[]};const h=[],d=[];for(const n of e)n[t]>i?d.push({...n,[j]:"observed"}):h.push({...n,[j]:"training"});const f=h.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),p=[],y=[];if(f.length>=3){const r=f.length;let i=0,h=0,d=0,m=0;for(const[e,t]of f)i+=e,h+=t,d+=e*e,m+=e*t;const g=r*d-i*i;if(Math.abs(g)>1e-12){const d=(r*m-i*h)/g,x=(h-d*i)/r,b=e=>x+d*e,v=f.map(([e,t])=>t-b(e)).reduce((e,t)=>e+t*t,0),k=Math.sqrt(v/Math.max(r-2,1)),w=f.reduce((e,t)=>e+t[0],0)/r,A=f.reduce((e,t)=>e+(t[0]-w)**2,0),M=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,C=S(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),_=f.length>1?(f[r-1][0]-f[0][0])/(r-1):1;for(let e=1;s>=e;e++){const o=C+e*_,i=b(o),s=k*Math.sqrt(1+1/r+(A>0?(o-w)**2/A:0))*M;y.push({[t]:o,[n]:i,[j]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}T(y,o,e=>e.__forecastUpper,e=>e.__forecastLower),p.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}p.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&p.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label});const m=[];if(m.push(...h),h.length>0&&d.length>0&&m.push({...h[h.length-1],[j]:"observed"}),m.push(...d),y.length>0){const e=d.length>0?d[d.length-1]:h[h.length-1];e&&m.push({...e,[j]:"forecast"}),m.push(...y)}return{processedData:m,annotations:p}}(e,t,n,o,r);var i}function F(e,t){const n=t.trainDasharray??"8,4",o=t.forecastDasharray??"4,4",r=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),h=t[j];if("training"===h){let e=u.stroke;return"darken"===a?e=C(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:n,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===h){let e=u.stroke||"#666";return"lighten"===c&&(e=_(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===h){const e=t[R],n=null!=e?e:s;return{...u,stroke:r,strokeDasharray:o,...null!=n&&{strokeOpacity:n}}}return u}}f(L,{FORECAST_OPACITY_FIELD:()=>R,SEGMENT_FIELD:()=>j,buildAnomalyAnnotations:()=>N,buildForecast:()=>O,createSegmentLineStyle:()=>F,darkenColor:()=>C,lightenColor:()=>_,stampForecastOpacity:()=>T});var B,W,D,z,H,E=d({"src/components/charts/shared/statisticalOverlays.ts"(){M(),P(),P(),j="__forecastSegment",R="__forecastOpacity"}}),$=d({"src/components/charts/xy/scatterplotMatrixInteractionTypes.ts"(){}}),Y={};function G({frameRef:e,cellSize:t,onBrush:n}){const o=(0,B.useRef)(null),r=t-H.left-H.right,i=t-H.top-H.bottom;return(0,B.useEffect)(()=>{if(!o.current)return;const t=(0,D.select)(o.current).select(".brush-g"),s=(0,W.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const o=e.current?.getScales();if(!o)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void n(null);var r;const[[i,s],[a,l]]=t.selection,c=[[o.x.invert(i),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];n(c)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[r,i,e,n]),(0,z.jsx)("svg",{ref:o,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,z.jsx)("g",{className:"brush-g",transform:`translate(${H.left},${H.top})`})})}f(Y,{ScatterplotMatrixBrushOverlay:()=>G});var q,V,X,U,K=d({"src/components/charts/xy/scatterplotMatrixBrushOverlay.tsx"(){B=require("react"),W=require("d3-brush"),D=require("d3-selection"),$(),z=require("react/jsx-runtime"),H={top:4,bottom:4,left:4,right:4}}}),Q={};function Z({width:e,height:t,margin:n,scales:o,brushDirection:r,extent:i,onBrush:s}){const a=(0,q.useRef)(null),l=(0,q.useRef)(null),c=(0,q.useRef)(!1),u=e+n.left+n.right,h=t+n.top+n.bottom;return(0,q.useEffect)(()=>{if(!a.current||!o)return;const n=(0,X.select)(a.current).select(".brush-group"),i="x"===r?(0,V.brushX)().extent([[0,0],[e,t]]):(0,V.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const n=("x"===r?o.x:o.y).invert;if(!n)return;const i=[n(t[0]),n(t[1])];s(i)}),n.call(i),l.current=e=>{n.call(i.move,e)},n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[o,e,t,r,s]),(0,q.useEffect)(()=>{if(!l.current||!o||!a.current)return;const e="x"===r?o.x:o.y;if(c.current=!0,i){const t=[e(i[0]),e(i[1])];l.current(t)}else l.current(null);c.current=!1},[i,o,r]),(0,U.jsx)("svg",{ref:a,width:u,height:h,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,U.jsx)("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}f(Q,{MinimapBrushOverlay:()=>Z});var J,ee=d({"src/components/charts/xy/minimapBrushOverlay.tsx"(){q=require("react"),V=require("d3-brush"),X=require("d3-selection"),U=require("react/jsx-runtime")}}),te={};f(te,{AreaChart:()=>Xu,BubbleChart:()=>gh,BumpChart:()=>$u,CandlestickChart:()=>ud,ConnectedScatterplot:()=>ph,DEFAULT_HIT_RADIUS:()=>dd,DifferenceChart:()=>Zu,Heatmap:()=>kh,LineChart:()=>wu,MinimapChart:()=>Gh,MultiAxisLineChart:()=>ad,QuadrantChart:()=>Jh,Scatterplot:()=>uh,ScatterplotMatrix:()=>Bh,StackedAreaChart:()=>th,StreamXYFrame:()=>Rl,XYCustomChart:()=>ju,composeStyleRules:()=>su,glyphExtent:()=>Gn,glyphPlacement:()=>Yn,hatchFillId:()=>co,hatchPatternDef:()=>ho,hitTargetPoint:()=>pd,hitTargetRect:()=>yd,isHatchFill:()=>ao,makeRuleValueResolver:()=>eu,makeXYRuleContext:()=>tu,matchesThreshold:()=>ou,rankBumpData:()=>Bu,resolveResponsiveRules:()=>ec,resolveStyleRules:()=>iu,resolveSvgFill:()=>fo,responsiveRuleMatches:()=>Jl,ruleMatches:()=>ru,useCustomLayoutSelection:()=>On}),module.exports=(J=te,p(a({},"__esModule",{value:!0}),J));var ne=y(require("react")),oe=require("react"),re=y(require("react")),ie=require("react/jsx-runtime"),se=null,ae=null;function le(e){const[t,n]=re.useState(()=>se);return re.useEffect(()=>{if(t)return;let e=!1;return(se?Promise.resolve(se):(ae||(ae=Promise.resolve().then(()=>(w(),g)).then(e=>se=e.XYBrushOverlay).catch(e=>{throw ae=null,e})),ae)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,ie.jsx)(t,{...e}):null}var ce=Object.freeze([]);function ue(e){if(!e)return ce;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var he=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=ue(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=ue(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},de=require("react"),fe=require("react/jsx-runtime");function pe(e){let t=null;const n=()=>(t||(t=(0,de.createContext)(null)),t),o=ye(e);return[function({children:t,initialState:o}){const r=(0,de.useRef)(o),i=(0,de.useMemo)(()=>ye(e,r.current),[]),s=n();return(0,fe.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,de.useContext)(r)??o,s=(0,de.useRef)(e);s.current=e;const a=(0,de.useRef)({hasValue:!1,value:void 0}),l=(0,de.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,de.useCallback)(()=>s.current(i.getState()),[i]);return(0,de.useSyncExternalStore)(i.subscribe,l,c)}]}function ye(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function me(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function ge(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:xe}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var xe=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],be={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},ve={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},ke={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:xe,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function we(e,t){if("light"===t)return be;if("dark"===t)return ve;if("high-contrast"===t)return ke;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?ve:be;return ge({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return ge({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Ae,Se]=pe(e=>({theme:be,setTheme(t){e(e=>({theme:we(e.theme,t)}))}})),Me=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},Ce=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(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.isFinite(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 _e(e,t){return e===t}function je(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Re(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Pe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var Le=/^\d{4}-\d{1,2}$/;function Te(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=Le.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const o=Date.parse(n);return Number.isFinite(o)?o:NaN}function Ie(e){return e instanceof Date?e.getTime():"string"==typeof e?Te(e):+e}function Ne(e){return new Set(Array.isArray(e)?e:[e])}var Oe=require("d3-scale");function Fe(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Be(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function We(e){const t=e.map(Fe),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Be(e,n,o)}if(e>=1){const[e,o,r]=t[n];return Be(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,h]=t[r+1];return Be(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(h-l)*i))}}var De=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ze=We(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),He=We(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ee=We(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),$e=We(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Ye=We(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ge=We(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),qe=We(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Ve=We(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Xe=We(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Ue=We(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Ke=We(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Qe=We(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Ze={blues:ze,reds:He,greens:Ee,viridis:qe,oranges:$e,purples:Ye,greys:Ge,plasma:Ve,inferno:Xe,magma:Ue,cividis:Ke,turbo:Qe};function Je(e){return e&&Ze[e]||ze}We(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),We(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),We(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),We(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),We(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),We(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),We(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var et={category10:De,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Ze},tt=De,nt="#007bff",ot=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],rt=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function it(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||rt.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):tt[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))%tt.length]}function st(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function at(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>st(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,Oe.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=et[n]||et.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:tt;return(0,Oe.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function lt(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function ct(e,t,n){return e+(t-e)*n}function ut(){return"undefined"!=typeof performance?performance.now():Date.now()}function ht(e,t,n){if(1>=n)return 1;const o=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function dt(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}function ft(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function pt(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function yt(e,t,n){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+n;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function mt(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function gt(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u),rawY:s})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length),h=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY],h[e]=t.rawY}return{type:"area",topPath:c,bottomPath:u,rawValues:h,style:i,datum:e,group:s}}function xt(e,t,n,o){const r=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const r of t)e+=n(r,o)||0;r.set(o,-e/2)}else if("wiggle"===o){e.length>0&&r.set(e[0],0);for(let o=1;e.length>o;o++){const i=e[o-1],s=e[o];let a=0,l=0,c=0;for(const e of t){const t=n(e,s)||0;a+=(2*c+t)*(t-(n(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(r.get(i)??0)+e/2}const i=o/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function bt(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function vt(e,t,n,o,r,i,s,a){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function kt(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function wt(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function At(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function St(e,t,n,o){if(!e.scales)return null;const r=[],i=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,...e.config.curve&&"linear"!==e.config.curve&&{curve:e.config.curve},style:At(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Mt(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function Ct(e,t,n){const o=[];for(const r of n){const n=St(e,t,"__ribbon_aggregate",r);n&&o.push(n)}return o}function _t(e,t,n,o){const r=[];for(const i of o){const o=St(e,t,n,i);o&&r.push(o)}return r}function jt(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),r=o.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&n.push({y0:r,y1:t})}return 0===n.length?e:{...e,band:n[0],bands:n}}function Rt(e,t,n,o){if(!e.config.pointStyle)return;const r=o??e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const i of o.data){let o=e.config.pointStyle(i);!o.fill&&t&&(o={...o,fill:t});const s=o.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=bt(i,e.scales,e.getX,r,s,o,a);l&&n.push(l)}}}function Pt(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var Lt={stops:[{offset:0,opacity:.8},{offset:1,opacity:.05}]};function Tt(e,t=Lt){if(e)return!0===e?t:"stops"in e?Array.isArray(e.stops)?e:void 0:"colorStops"in e?Array.isArray(e.colorStops)?{stops:e.colorStops.map(({offset:e,color:t})=>({offset:e,color:t}))}:void 0:{stops:[{offset:0,opacity:e.topOpacity??t.stops[0]?.opacity??.8},{offset:1,opacity:e.bottomOpacity??t.stops.at(-1)?.opacity??.05}]}}function It(e){return e?Tt(e):void 0}function Nt(e){return Tt(e)}var Ot=require("d3-shape"),Ft={circle:Ot.symbolCircle,square:Ot.symbolSquare,triangle:Ot.symbolTriangle,diamond:Ot.symbolDiamond,star:Ot.symbolStar,cross:Ot.symbolCross,wye:Ot.symbolWye},Bt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function Wt(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*Dt(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,Ot.symbol)(Ft[o]??Ot.symbolCircle,Math.max(1,t))()??""}function Dt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var zt=new Map;function Ht(e,t,n){const o=n.config.areaStyle?.(t);return o&&(e.style=o),e}function Et(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function $t(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some($t))}function Yt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function Gt(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function qt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=Gt(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=je(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:Gt(e.y1Accessor,"y1"),getBottom:Gt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var Vt=require("d3-scale");function Xt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Ut(e,t,n){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,Vt.scaleLog)().domain(e).range(n).clamp(!0)}return"symlog"===e?(0,Vt.scaleSymlog)().domain(t).range(n):"time"===e?(0,Vt.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(n):(0,Vt.scaleLinear)().domain(t).range(n)}function Kt(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var Qt=new WeakMap;var Zt={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function Jt(e,t){const n={...e};for(const e of t)n[Zt[e]]++;return n}function en(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Jt(n,o)}}var tn=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=en({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=en(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},nn=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],on=["scene-style","data-paint","accessibility","evidence"],rn=(e,t)=>({retainedData:e,invalidations:t}),sn=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],an=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ln=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],cn=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],un=["scene-geometry","data-paint","accessibility","evidence"],hn=["scene-style","data-paint","accessibility","evidence"],dn=[],fn={chartType:rn("rebuild",sn),runtimeMode:rn("rebuild",sn),xAccessor:rn("rebuild",sn),yAccessor:rn("rebuild",sn),timeAccessor:rn("rebuild",sn),valueAccessor:rn("rebuild",sn),y0Accessor:rn("rebuild",sn),boundsAccessor:rn("rebuild",sn),band:rn("rebuild",sn),openAccessor:rn("rebuild",sn),highAccessor:rn("rebuild",sn),lowAccessor:rn("rebuild",sn),closeAccessor:rn("rebuild",sn),candlestickRangeMode:rn("rebuild",sn),accessorRevision:rn("rebuild",sn),groupAccessor:rn("rebuild",an),categoryAccessor:rn("rebuild",an),lineDataAccessor:rn("rebuild",an),colorAccessor:rn("rebuild",hn),sizeAccessor:rn("rebuild",un),symbolAccessor:rn("rebuild",un),pointIdAccessor:rn("rebuild",un),xScaleType:rn("preserve",ln),yScaleType:rn("preserve",ln),xExtent:rn("preserve",ln),yExtent:rn("preserve",ln),extentPadding:rn("preserve",ln),scalePadding:rn("preserve",ln),axisExtent:rn("preserve",ln),binSize:rn("preserve",ln),normalize:rn("preserve",ln),heatmapAggregation:rn("preserve",ln),heatmapXBins:rn("preserve",ln),heatmapYBins:rn("preserve",ln),arrowOfTime:rn("preserve",cn),baseline:rn("preserve",cn),stackOrder:rn("preserve",cn),sizeRange:rn("preserve",cn),curve:rn("preserve",cn),areaGroups:rn("preserve",cn),customLayout:rn("preserve",cn),layoutConfig:rn("preserve",cn),layoutMargin:rn("preserve",cn),symbolMap:rn("preserve",un),showValues:rn("preserve",un),heatmapValueFormat:rn("preserve",un),lineStyle:rn("preserve",hn),pointStyle:rn("preserve",hn),areaStyle:rn("preserve",hn),barStyle:rn("preserve",hn),swarmStyle:rn("preserve",hn),waterfallStyle:rn("preserve",hn),candlestickStyle:rn("preserve",hn),boundsStyle:rn("preserve",hn),gradientFill:rn("preserve",hn),lineGradient:rn("preserve",hn),semanticLineStops:rn("preserve",hn),colorScheme:rn("preserve",hn),themeCategorical:rn("preserve",hn),themeSemantic:rn("preserve",hn),themeSequential:rn("preserve",hn),themeDiverging:rn("preserve",hn),barColors:rn("preserve",hn),decay:rn("preserve",hn),pulse:rn("preserve",hn),staleness:rn("preserve",hn),layoutSelection:rn("preserve",hn),annotations:rn("preserve",["overlay","accessibility","evidence"]),windowSize:rn("preserve",dn),windowMode:rn("preserve",dn),maxCapacity:rn("preserve",dn),clock:rn("preserve",dn),transition:rn("preserve",dn),introAnimation:rn("preserve",dn),onLayoutError:rn("preserve",dn)},pn=rn("preserve",cn),yn=class{constructor(){this.tracker=new tn}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},nn)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},on):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=fn[o]??pn;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},mn=require("d3-quadtree"),gn=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let n=0,o=0;for(const e of t)"point"===e.type&&(n++,e.r>o&&(o=e.r));if(this.maxRadius=o,500>=n)return void(this.tree=null);const r=Array(n);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,mn.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},xn=class e{constructor(e){if(this.xExtent=new Ce,this.yExtent=new Ce,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new yn,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new gn,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=r??(()=>{const e=new Map;for(let t=0;n.length>t;t++)e.set(n[t],t);return e})();for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0,a=!1;for(const n of t){const t=c.get(n);if(null==t)continue;a=!0;const s=o.get(t);if(null==s)continue;const l=ft(e,s,i);l>r&&(r=l)}a&&(l=pt(n,r,s)||l);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);l=pt(n,null==r?0:ft(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),n),this.config=e,this.buffer=new Me(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=je(e.timeAccessor||e.xAccessor,"time"),this.getY=je(e.valueAccessor||e.yAccessor,"value")):(this.getX=je(e.xAccessor,"x"),this.getY=je(e.yAccessor,"y")),this.getGroup=Pe(e.groupAccessor),this.getCategory=Pe(e.categoryAccessor),this.getSize=e.sizeAccessor?je(e.sizeAccessor,"size"):void 0,this.getColor=Pe(e.colorAccessor),this.getSymbol=Pe(e.symbolAccessor),this.getY0=e.y0Accessor?je(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=qt(e),this.getPointId=Pe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?je(e.openAccessor,"open"):void 0,this.getHigh=je(e.highAccessor,"high"),this.getLow=je(e.lowAccessor,"low"),this.getClose=n?je(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Me(e.windowSize))}currentTime(){return this.config.clock?.()??ut()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=function(e,t){const n=new Me(e.capacity);return e.forEach(()=>n.push(t)),n}(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?je(this.config.timeAccessor||this.config.xAccessor,"time"):je(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&Number.isFinite(Te(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>Ie(t[e]):e=>Ie(n(e))}}r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)Kt(this.buffer,n,this.timestampBuffer,t),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=Kt(this.buffer,n,this.timestampBuffer,t);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}var n,o,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=Xt(this.xExtent.extent,t.xExtent),l=Xt(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&n.size>0){const e=function(e){const{config:t,groups:n,getX:o,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const n=[0,i?1:1+t.extentPadding];return{yDomain:n,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:n}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const e of n){const t=new Map;let n=0;for(const i of e.data){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),n+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),h.set(e.key,n)}const d=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,y;if("input"===d)p=n.map(e=>e.key);else if("insideOut"===d){const e=[...n].map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}),t=[],o=[];let r=0,i=0;for(const n of e)i>r?(t.push(n),r+=h.get(n)??0):(o.push(n),i+=h.get(n)??0);p=[...o.reverse(),...t]}else p="asc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(e,t)}):"desc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}):n.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),n=xt(e,p,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let o=1/0,r=-1/0;for(const t of e){const e=n.get(t)??0,i=u.get(t)??0;o>e&&(o=e),e+i>r&&(r=e+i)}Number.isFinite(o)&&Number.isFinite(r)||(o=0,r=0);const s=r-o,c=i?0:s>0?s*t.extentPadding:1;y=[o-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[n,o]=function(e,t,n){let o=0,r=0;for(const i of e){let e=0,s=0;for(const o of t){const t=n(o,i)||0;0>t?s+=t:e+=t}o>s&&(o=s),e>r&&(r=e)}return[o,r]}(e,p,(e,t)=>a.get(e)?.get(t)||0),r=o-n,s=i?0:r>0?r*t.extentPadding:1;y=[n-s,o+s]}else y=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:y,stackExtentCache:{key:s,yDomain:y}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&n.size>0?l=function(e,t,n,o,r,i,s){const[,a]=function(e,t,n,o,r){const i=Et(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,n,o,r);return[0,s?a:a+a*i]}(n,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,h):"waterfall"===t.chartType&&!c&&n.size>0?l=function(e,t,n,o){const[r,i]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(e,t),s=i-r,a=o?0:s>0?s*n:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(n,this.getY,t.extentPadding,h):c||l[0]===1/0||(l=function(e,t,n){if(!n.length)return e;let[o,r]=e;for(const e of t)for(const t of n){const n=t.getTop(e),i=t.getBottom(e);Number.isFinite(n)&&(o>n&&(o=n),n>r&&(r=n)),Number.isFinite(i)&&(o>i&&(o=i),i>r&&(r=i))}return[o,r]}(l,i,this.resolvedRibbons),l=function(e,t){const n=e[1]-e[0],o=t.exactMode?0:n>0?n*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-o,null!=t.userMax?e[1]:e[1]+o];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:h,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,n){if(!t||n)return e;const o=t[0],r=t[1];return null==o&&null==r?e:[null!=o?o:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,n){let o=e,r=t;if(o[0]===1/0||o[1]===-1/0)if("time"===n){const e=Date.now();o=[e-864e5,e]}else o=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:o,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:n,xDomain:o,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(n.width,n.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,n.width-s]:[n.width-s,s];return{x:(0,Vt.scaleLinear)().domain(o).range(e),y:Ut(t.yScaleType,r,[n.height-s,s])}}const e="down"===t.arrowOfTime?[s,n.height-s]:[n.height-s,s];return{x:Ut(t.yScaleType,r,[s,n.width-s]),y:(0,Vt.scaleLinear)().domain(o).range(e)}}var a;return{x:Ut(t.xScaleType,o,[s,n.width-s]),y:Ut(t.yScaleType,r,[n.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=r):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n}),e.strokeColorBands&&(e.strokeColorBands=e.strokeColorBands.map(e=>({...e,y:e.y*n,height:e.height*n})));break;case"point":case"glyph":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=Ut,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o)return[];if(n.customLayout){const r={data:t,scales:o,dimensions:{width:e.width,height:e.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??ot},resolveColor:(e,t)=>{const o=this.resolveGroupColor(e);if(o)return o;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let i;try{i=n.customLayout(r)}catch(e){const t=null!==this.lastCustomLayoutResult,o=function(e,t,n,o){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("xy",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{n.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,n.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;$t(o)&&0===n.length&&Yt(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Yt(r,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:o,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){const n=e.groupData(t),o=[],r=e.config.annotations?.filter(Pt).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(..._t(e,t.data,t.key,r))}for(const t of n){const n=e.resolveLineStyle(t.key,t.data[0]),i=mt(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Rt(e,n,o),o}(r,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(..._t(e,t.data,t.key,r))}const r=e.scales.y.domain(),i=r[0],s=e.config.semanticLineStops?.filter(e=>Number.isFinite(e.offset)).map(e=>({value:r[0]+Math.max(0,Math.min(1,e.offset))*(r[1]-r[0]),color:e.color,thresholdType:"greater"})).sort((e,t)=>e.value-t.value),a=s&&s.length>0?(()=>{const t=s.reduce((e,t)=>(e.at(-1)?.value===t.value?e[e.length-1]=t:e.push(t),e),[]),n=[{from:r[0],to:t[0].value}];for(let e=0;t.length>e;e++)n.push({from:t[e].value,to:t[e+1]?.value??r[1],color:t[e].color});return n.map(({from:t,to:n,color:o})=>{const r=e.scales.y(t),i=e.scales.y(n);return{y:Math.min(r,i),height:Math.abs(i-r),color:o}}).filter(e=>e.height>0)})():void 0,l=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),r=gt(t.data,e.scales,e.getX,e.getY,i,n,t.key,l),c=Nt(e.config.gradientFill);c&&(r.fillGradient=c),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),s&&s.length>0&&(r.colorThresholds=s,r.strokeColorBands=a),o.push(r)}return Rt(e,n,o),o}(r,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(..._t(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=gt(t.data,e.scales,e.getX,e.getY,i,n,t.key,s),a=Nt(e.config.gradientFill);a&&(r.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=mt(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return Rt(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t),o=e.config.stackOrder??"key",r=()=>n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===o);else if("key"===o)r();else if("asc"===o||"desc"===o||"insideOut"===o){const t=new Map;for(const o of n){let n=0;for(const t of o.data){const o=e.getX(t),r=e.getY(t);Number.isFinite(o)&&Number.isFinite(r)&&(n+=r)}t.set(o.key,n)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===o)n.sort((e,n)=>{const o=(t.get(e.key)??0)-(t.get(n.key)??0);return 0!==o?o:r(e.key,n.key)});else if("desc"===o)n.sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)});else{const e=[...n].sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)}),o=[],i=[];let s=0,a=0;for(const n of e)a>s?(o.push(n),s+=t.get(n.key)??0):(i.push(n),a+=t.get(n.key)??0);n.length=0,n.push(...i.reverse(),...o)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,n,o,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let h;if(i){h=new Map;for(const t of c){let n=0;for(const o of e)n+=u.get(o.key)?.get(t)||0;h.set(t,n||1)}}const d=xt(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,p=[],y=new Map,m=new Map,g=new Map,x=new Map;for(const e of c)m.set(e,d.get(e)??0),g.set(e,0),x.set(e,0);for(const n of e){const e=u.get(n.key),o=new Map;let a=[],l=[];const d=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(e.curve=s),p.push(e)}a=[],l=[]};for(const n of c){const r=e.has(n);let s,c,u=r?e.get(n):0;if(i&&r&&(u/=h.get(n)),!r||!Number.isFinite(u)||0===u){d();continue}f?u>0?(s=g.get(n),c=s+u,g.set(n,c)):(s=x.get(n),c=s+u,x.set(n,c)):(s=m.get(n),c=s+u,m.set(n,c));const p=t.x(n);l.push([p,t.y(s)]),a.push([p,t.y(c)]),o.set(n,c)}d(),y.set(n.key,o)}return{nodes:p,stackedTops:y}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=l.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>t.get(n)??e.getY(n);Rt(e,n,c,o)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let h=0;const d=e=>{const t=c?.[e];if(t)return t;let n=u.get(e);return n||(n=Bt[h%Bt.length],h++,u.set(e,n)),n};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},c=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t={...t,fill:s.get(n)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const o=d(l(r)+""),i=vt(r,e.scales,e.getX,e.getY,Math.PI*c*c,o,t,u);i&&n.push(i)}else{const o=bt(r,e.scales,e.getX,e.getY,c,t,u);o&&n.push(o)}}return n}(r,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){const o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=je(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),h=(l-a||1)/o,d=(u-c||1)/r,f=o*r;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let n=0;t.length>n;n++){const i=t[n],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/h),o-1),m=Math.min(Math.floor((u-c)/d),r-1);if(0>f||0>m)continue;const g=m*o+f;p[g]++;const x=s(i);y[g]+=isFinite(x)?x:0}let m=1/0,g=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=y[e];break;case"mean":t=y[e]/p[e];break;default:t=p[e]}m>t&&(m=t),t>g&&(g=t)}if(!isFinite(m))return[];const x=g-m||1,b=n.width/o,v=n.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,A=[];for(let t=0;r>t;t++){const n=t*o;for(let s=0;o>s;s++){const o=n+s;if(0===p[o])continue;let l;switch(i){case"sum":l=y[o];break;case"mean":l=y[o]/p[o];break;default:l=p[o]}const u=(l-m)/x,f={xi:s,yi:t,value:l,count:p[o],sum:y[o],xCenter:a+(s+.5)*h,yCenter:c+(t+.5)*d,agg:i};A.push(Ht(wt(s*b,(r-1-t)*v,b,v,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,k?{value:l,showValues:!0,valueFormat:w}:void 0),f,e))}}return A}(e,t,n);if(0===t.length)return[];const o=je(e.config.valueAccessor,"value"),r=Re(e.config.xAccessor,"x"),i=Re(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,h=a.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(a.keys()),p=d.every(e=>"number"==typeof e&&!isNaN(e)),y=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){d.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(y){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const m=new Float64Array(t.length),g=new Float64Array(t.length),x=Array(t.length),b=new Map;let v=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const h=o(n),d=i*u+r,f=b.get(d);let p;void 0!==f?p=f:(p=v++,b.set(d,p)),m[p]=d,g[p]=h,x[p]=n}let k=1/0,w=-1/0;for(let e=0;v>e;e++){const t=g[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Ze?e:"blues";let n=zt.get(t);if(n)return n;n=Array(256);const o=Je(t);for(let e=0;256>e;e++)n[e]=o(e/255);return zt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),M=n.width/u,C=n.height/h,_=e.config.showValues,j=e.config.heatmapValueFormat,R=[];for(let t=0;v>t;t++){const n=g[t];if(!isFinite(n))continue;const o=m[t],r=o%u,i=x[t];R.push(Ht(wt(r*M,(h-1-(o-r)/u)*C,M,C,A[Math.min((n-k)*S+.5|0,255)],i,_?{value:n,showValues:!0,valueFormat:j}:void 0),i,e))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const n=Et(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){const t=new Set;for(const e of n.values())for(const n of e.categories.keys())t.add(n);const r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=r.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?o=e.barCategoryCache.order:(o=[...a,...s],e.barCategoryCache={key:l,order:o})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const t of n.values()){const n=Math.max(t.start,s),u=Math.min(t.end,a);if(n>=u)continue;const f=i.x(n),p=i.x(u),y=Math.abs(p-f),m=y>h+1?h:0,g=Math.min(f,p)+m/2,x=Math.max(y-m,1);if(x>0)if(o&&t.categories.size>0){let n=0;for(const s of o){const o=t.categories.get(s)||0;if(0===o)continue;const a=i.y(n),u=i.y(n+o);r.push(kt(g,Math.min(a,u),x,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...d},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:o},s)),n+=o}}else{const e=i.y(0),n=i.y(t.total);r.push(kt(g,Math.min(e,n),x,Math.abs(e-n),{fill:l?.fill||c||"#007bff",...d},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of n.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const n=[],o=e.config.swarmStyle||{},r=o.radius??3,i=o.fill??e.config.themeSemantic?.primary??"#007bff",s=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of t){const t=e.getX(o),c=e.getY(o);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),h=e.scales.y(c);let d=i;if(e.getCategory){const t=e.getCategory(o);d=e.config.barColors?.[t]||d}const{r:f,...p}=e.config.pointStyle?.(o)??{},y={type:"point",x:u,y:h,r:f??r,style:{fill:d,opacity:s,stroke:a,strokeWidth:l,...p},datum:o};e.getPointId&&(y.pointId=e.getPointId(o)+""),n.push(y)}return n}(r,t);case"waterfall":return function(e,t,n){const o=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===s.length)return o;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,h=i?.strokeWidth,d=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const p=s[t],y=e.getX(p),m=e.getY(p),g=f+m;let x;x=s.length-1>t?e.getX(s[t+1])-y:t>0?y-e.getX(s[t-1]):0;const b=r.x(y),v=0!==x?r.x(y+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=g;continue}const A=r.y(f),S=r.y(g),M=Math.min(A,S),C=Math.abs(A-S),_={fill:0>m?l:a,stroke:u,strokeWidth:h};null!=d&&(_.opacity=d),o.push(kt(k,M,w,C,_,{...p,baseline:f,cumEnd:g,delta:m,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=g}return o}(r,t,e);case"candlestick":return function(e,t,n){if(!e.getHigh||!e.getLow||!e.scales)return[];const o=e.config.candlestickRangeMode??!1;if(!(o||e.getOpen&&e.getClose))return[];const r=[],i=e.config.candlestickStyle||{},s=i.rangeColor||"#6366f1",a=o?s:i.upColor||"#28a745",l=o?s:i.downColor||"#dc3545",c=o?s:i.wickColor||"#333",u=i.wickWidth||(o?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let d=i.bodyWidth??0;if(null==i.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}d=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else d=6;for(const i of t){const t=e.getX(i);if(null==t||Number.isNaN(t))continue;const s=e.getHigh(i),h=e.getLow(i);if(null==s||Number.isNaN(s)||null==h||Number.isNaN(h))continue;const f=o?s:e.getOpen(i),p=o?h:e.getClose(i);if(!o&&[f,p].some(e=>null==e||Number.isNaN(e)))continue;const y=p>=f,m={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(f),closeY:e.scales.y(p),highY:e.scales.y(s),lowY:e.scales.y(h),bodyWidth:d,upColor:a,downColor:l,wickColor:c,wickWidth:u,isUp:y,datum:i};o&&(m.isRange=!0,m.dotRadius=Math.max(2,Math.min(d/2,.12*n.height))),r.push(m)}return r}(r,t,e);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,n,o){const r=e.boundsStyle;return"function"==typeof r?r(n||{},t):r&&"object"==typeof r?r:{fill:o(t,n).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?ht(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=dt(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,n,o=dt(n)){const r=n.length;if(r>1)for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let n=0;t.length>n;n++){const a=o.get(t[n]);null!=a?(i[n]=ht(e,a,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let n=0;t.length>n;n++){const i=o.get(t[n]);null!=i?(s[n]=ht(e,i,r),1>s[n]&&(a=!0)):s[n]=1}a&&(n._decayOpacities=s)}else{let s=1;for(const n of t){const t=o.get(n);if(null!=t){const n=ht(e,t,r);s>n&&(s=n)}}if(1>s){const e=Array(i);e.fill(s),n._decayOpacities=e}}continue}const t=o.get(n.datum);if(null==t)continue;const i=ht(e,t,r);"heatcell"===n.type?n.style={opacity:i}:"candlestick"===n.type?n._decayOpacity=i:n.style={...n.style,opacity:(n.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){n.clear(),o.clear();for(let r=0;t.length>r;r++){const i=t[r],s=yt(e,i,r);s&&("point"===i.type?n.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?n.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?n.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?o.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&o.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=yt(this.transitionContext,n,t);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:e,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(o,{path:n.path.map(e=>[e[0],e[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(o,{topPath:n.topPath.map(e=>[e[0],e[1]]),bottomPath:n.bottomPath.map(e=>[e[0],e[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r,i=ut()){if(0===o.size&&0===r.size)return n;const s=t.duration??300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],s=yt(e,i,t);if(!s)continue;if(i._transitionKey=s,"line"===i.type||"area"===i.type){const e=r.get(s);if(e){if(c.add(s),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];a=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];a=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},a=!0;continue}const u=o.get(s);if("point"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("glyph"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("rect"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("heatcell"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){l.add(s);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0}for(const[e,t]of r)if(!c.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}for(const[e,t]of o)if(!l.has(e)){if(e.startsWith("p:"))n.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)n.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))n.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const o=t.openY??t.y;n.exitNodes.push({type:"candlestick",x:t.x,openY:o,closeY:t.closeY??o,highY:t.highY??o,lowY:t.lowY??o,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}a=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),a&&(n.activeTransition={startTime:i,duration:s}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){if(!n.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.r=ct(n.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.size=ct(n.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==n.w&&(e.w=ct(n.w,e._targetW,i)),void 0!==n.h&&(e.h=ct(n.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:ct(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==n.w&&(e.w=ct(n.w,e._targetW,i)),void 0!==n.h&&(e.h=ct(n.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:ct(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),void 0!==n.openY&&(e.openY=ct(n.openY,e._targetOpenY,i)),void 0!==n.closeY&&(e.closeY=ct(n.closeY,e._targetCloseY,i)),void 0!==n.highY&&(e.highY=ct(n.highY,e._targetHighY,i)),void 0!==n.lowY&&(e.lowY=ct(n.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:ct(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=ct(t[o][0],n[o][0],i),e.path[o][1]=ct(t[o][1],n[o][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:ct(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=ct(t[n][0],o[n][0],i),e.topPath[n][1]=ct(t[n][1],o[n][1],i);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=ct(n[t][0],r[t][0],i),e.bottomPath[t][1]=ct(n[t][1],r[t][1],i)}}if(r>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:n}=function(e,t,n,o){if(o&&o.version===n&&o.group===t&&o.data===e)return{result:o.result,cache:o};let r;if(t){const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}r=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:n,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,t}resolveColorMap(e){const{map:t,cache:n}=function(e,t,n,o,r){if(r&&r.version===o)return{map:r.map,cache:r};const i=new Set;if(t)for(const n of e){const e=t(n);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:o};return{map:e.map,cache:e}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||ot,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,t}resolveLineStyle(e,t){return function(e,t,n,o){const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.stroke&&t){const n=o(t);if(n)return{...e,stroke:n}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:o(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,n,o){if(e.areaStyle){const r=e.areaStyle(n||{});if(r&&!r.fill&&t){const e=o(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.fill&&t){const n=o(t);if(n)return{...e,fill:n,stroke:e.stroke||n}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const s=o(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:n,groupColorCounter:o}=function(e){const{group:t,colorMapCache:n,groupColorMap:o,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(n){const e=n.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=o.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||ot;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,o.set(t,c),o.size>r){const e=o.keys().next().value;void 0!==e&&o.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=Ne(e),n=this.getPointId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=Ne(e),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},n=Object.keys(e).filter(n=>e[n]!==t[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let o=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!_e(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!_e(n,s);(a||l)&&(e?(this.getX=je(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=je(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=je(this.config.xAccessor,"x"),this.getY=je(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=qt(this.config)),o=!0,r=!0)}if("groupAccessor"in e&&!_e(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Pe(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in e&&!_e(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Pe(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in e&&!_e(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?je(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in e&&!_e(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Pe(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in e&&!_e(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in e&&!_e(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?je(this.config.y0Accessor,"y0"):void 0,o=!0,r=!0),("boundsAccessor"in e&&!_e(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=qt(this.config),o=!0,r=!0),"pointIdAccessor"in e&&!_e(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Pe(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!_e(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!_e(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!_e(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!_e(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?je(this.config.openAccessor,"open"):void 0,this.getHigh=je(this.config.highAccessor,"high"),this.getLow=je(this.config.lowAccessor,"low"),this.getClose=t?je(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,o=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(o=!0,r=!0),!o){const n=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of n)if(e[r]!==t[r]){o=!0;break}}o&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};xn.GROUP_COLOR_MAP_CAP=1e3;var bn=xn;Object.assign(bn.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){Qt.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Qt.get(this);return Qt.delete(this),e}});var vn=require("react"),kn={sceneGeometry:0,layout:0,domain:0};function wn(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function An(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Sn="production"!==process.env.NODE_ENV,Mn={revisions:kn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Cn=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=kn,this.lastObserved=kn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Sn&&(this.lastObserved=An(this.lastObserved,wn(e)))}beforeCompute(e,t){if(!Sn)return Mn;const n=An(wn(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(Sn){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},_n=(0,vn.memo)(function({store:e,diagnostics:t}){return(0,vn.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),jn=y(require("react"));function Rn(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:jn.createElement(jn.Fragment,null,...t)}var Pn=y(require("react")),Ln=require("react/jsx-runtime"),Tn={isActive:!1,predicate:()=>!0},In=Pn.createContext(null);function Nn({value:e,children:t}){return(0,Ln.jsx)(In.Provider,{value:e,children:t})}function On(){return Pn.useContext(In)??Tn}function Fn(e,t){return null!=e?(0,Ln.jsx)(Nn,{value:t,children:e}):e}var Bn=require("react");function Wn(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}}function Dn(e,t=30){return Math.max((e??4)+5,12,t)}function zn(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Hn(e,t){const n=zn(e);if(!n)return!1;const o=zn(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var En=[40,40],$n=[.5,.5];function Yn(e,t){const[n,o]=e.viewBox??En,[r,i]=e.anchor??$n,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function Gn(e,t){const n=Yn(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function qn(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var Vn=null;function Xn(e){if("undefined"==typeof Path2D)return null;Vn||(Vn=new Map);const t=Vn.get(e);if(t)return t;const n=new Path2D(e);return Vn.size>1024&&Vn.clear(),Vn.set(e,n),n}function Un(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??En,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function Kn(e,t){const n=Yn(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function Qn(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=Xn(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:qn(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:qn(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}var Zn=new WeakMap,Jn=0,eo=!1,to=null,no=null;function oo(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),o=n.indexOf(",");if(-1===o){const e=n.trim();return e.startsWith("--")?{name:e}:null}const r=n.slice(0,o).trim(),i=n.slice(o+1).trim();return r.startsWith("--")?{name:r,fallback:i||void 0}:null}(t);if(!n)return t;const o=()=>n.fallback?oo(e,n.fallback):t,r=e.canvas;if(!r)return o();!function(){if(eo)return;if("undefined"==typeof window||"undefined"==typeof document)return;eo=!0;const e=()=>{Jn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"],subtree:!0}),"function"==typeof window.matchMedia)try{to=window.matchMedia("(prefers-color-scheme: dark)"),no=e,"function"==typeof to.addEventListener?to.addEventListener("change",no):"function"==typeof to.addListener&&to.addListener(no)}catch{}}();let i=Zn.get(r);i&&i.version===Jn||(i={version:Jn,map:new Map},Zn.set(r,i));const s=i.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(n.name).trim()||o()||t;return i.map.set(t,a),a}function ro(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var io=null;var so=require("react/jsx-runtime");function ao(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function lo(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function co(e,t){let n=2166136261;const o=lo(t);for(let e=0;o.length>e;e++)n^=o.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var uo=new Map;function ho(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,so.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,so.jsx)("rect",{width:l,height:l,fill:n}),(0,so.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,so.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function fo(e,t,n="#4e79a7"){if(ao(e)){const n=co(t,e);return{fill:`url(#${n})`,def:ho(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var po=require("d3-shape");function yo(e){switch(e){case"monotoneX":return po.curveMonotoneX;case"monotoneY":return po.curveMonotoneY;case"cardinal":return po.curveCardinal;case"catmullRom":return po.curveCatmullRom;case"step":return po.curveStep;case"stepBefore":return po.curveStepBefore;case"stepAfter":return po.curveStepAfter;case"basis":return po.curveBasis;case"natural":return po.curveNatural;default:return null}}function mo(e,t,n){if(null==t)return n;if(ao(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${lo(e)}@${n}`,r=uo.get(o);if(void 0!==r)return r;const i=function(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a={background:n,stroke:o,lineWidth:r,spacing:i,angle:s},l=Math.max(8,Math.ceil(2*i));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(io||(io=document.createElement("canvas")),io.width=e,io.height=e,io)}(l)}catch{return ro(a)}const u=c.getContext("2d");if(!u)return ro(a);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=o,u.lineWidth=r,u.lineCap="square";const h=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-l;2*l>=t;t+=i)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(h);const e=2*l;for(let t=-e;e>=t;t+=i)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),s=ao(i)?null:i;return uo.set(o,s),s}(t,e);return o||t.background&&oo(e,t.background)||n}return"string"!=typeof t?t:oo(e,t)||n}function go(e,t,n,o,r,i,s){const a=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>a.length)return null;const l=e.createLinearGradient(o,r,i,s);for(const t of a)l.addColorStop(Math.max(0,Math.min(1,t.offset)),xo(e,t,n));return l}function xo(e,t,n){const o=t.color??n,r=oo(e,o)||o;if(null==t.opacity)return r;const i=Math.max(0,Math.min(1,t.opacity)),[s,a,l]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,r);return`rgba(${s},${a},${l},${i})`}function bo(e,t,n,o,r,i,s){const a=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>a.length)return null;const l=e.createLinearGradient(o,r,i,s);for(const t of a)l.addColorStop(Math.max(0,Math.min(1,t.offset)),xo(e,t,n));return l}var vo=require("d3-shape"),ko=new WeakMap;function wo(e,t){const n=yo(t);if(!n)return e;const o=ko.get(e);if(o)return o;const r=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let r=null;const i={moveTo(e,t){r=[e,t],o.push([e,t])},lineTo(e,t){r=[e,t],o.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void o.push([a,l]);const[c,u]=r;for(let r=1;n>=r;r++){const h=r/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*i+h*h*h*a,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,i){r=[n,i],o.push([n,i])}};return(0,vo.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),o}(e,n);return ko.set(e,r),r}function Ao(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,y,m)=>{if(r>u||c>y||l>d||h>m)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Dn(a(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=Mo(i,t,n,o);break;case"symbol":e=Co(i,t,n,o);break;case"glyph":e=_o(i,t,n,o);break;case"line":e=jo(i,t,n,o);break;case"rect":if(null==i.datum)break;e=Po(i,t,n);break;case"heatcell":e=Lo(i,t,n);break;case"area":if(!1===i.interactive)break;e=Io(i,t,n);break;case"candlestick":e=To(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function So(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=No(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function Mo(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>Dn(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Co(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>Dn(Dt(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function _o(e,t,n,o=30){if(null==e.datum)return null;const r=Kn(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>Dn(r.radius,o)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function jo(e,t,n,o=30){if(0===e.path.length)return null;const r=No(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let o=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[a,l]=e.path[r+1],c=Ro(t,n,i,s,a,l);o>c&&(o=c)}a=o}else{const e=t-i,o=n-s;a=Math.sqrt(e*e+o*o)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function Ro(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*s+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(o+c*a))**2)}function Po(e,t,n){const o=Wn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Lo(e,t,n){const o=Wn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function To(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function Io(e,t,n){if(0===e.topPath.length)return null;const o=No(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function No(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}var Oo=require("react"),Fo={fresh:1,aging:.7,stale:.45,expired:.25},Bo={alpha:1,band:"fresh",isStale:!1};function Wo(e,t){if(!e||0>=t)return Bo;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...Fo,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Bo}var Do=require("react/jsx-runtime");function zo({isStale:e,position:t}){return(0,Do.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Ho=require("react"),Eo=y(require("react"));function $o(...e){let t;for(const n of e)n&&(t=Yo(t)&&Yo(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}function Yo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function Go(e){return"object"==typeof e&&null!==e&&"gradient"in e}var qo=16,Vo=6,Xo=10,Uo=22,Ko=100,Qo=10;function Zo(e){return Math.ceil(7*e.length)}function Jo(e,t){if(Yo(e)){const n=lr(t),o=e.legendGroups.flatMap(e=>[e.label?Zo(e.label):0,...e.items.map(e=>n.swatchSize+n.labelGap+Zo(e.label))]);return Math.max(Ko,...o)}if(Go(e)){const{gradient:t}=e,n=t.format||(e=>Math.round(100*e)/100+""),o=Math.max(Zo(n(t.domain[0])),Zo(n(t.domain[1]))),r=t.label?Zo(t.label):0;return Math.max(Ko,19+o,r)}return Ko}function er(e){return(Yo(e)||Go(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):Qo}function tr(e){return Math.max(0,e?.sideGutter??0)}var nr=22,or=46,rr=64;function ir(e,t){return null!=t?.axisGutter?Math.max(0,t.axisGutter):e?.hasAxis?e.hasAxisLabel?e.rotatedTicks?rr:or:nr:0}function sr(e){return{hasAxis:!1!==e.showAxes,hasAxisLabel:!!e.xLabel}}function ar(e,t,n){if(Go(e))return e.gradient.label?34:26;if(!Yo(e))return 20;const o=lr(n),r=Math.max(1,n?.maxWidth??t);let i=o.rowHeight;for(const t of e.legendGroups){let e=0,n=0;for(const i of t.items){const t=o.swatchSize+o.labelGap+Zo(i.label),s=0===n?t:n+o.itemGap+t;n>0&&s>r?(e+=1,n=t):n=s}t.items.length>0&&(e+=1),i=Math.max(i,e*o.rowHeight,t.label?Zo(t.label):0)}return i+(e.legendGroups.length>1?16:0)}function lr(e){const t=Math.max(1,e?.swatchSize??qo),n=Math.max(t,e?.rowHeight??Uo);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??Vo),itemGap:Math.max(0,e?.itemGap??Xo),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}var cr=require("react/jsx-runtime"),ur={fill:(e,t)=>(0,cr.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,cr.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function hr(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,ur[n])(o(e,t),r),i}function dr({swatchSize:e}){return(0,cr.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function fr(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var pr=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let y=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=r,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((e,c)=>{const u=hr(e,c,h,d,x),k=fr(e,o,r),w=r&&r.size>0&&r.has(e.label);p.push((0,cr.jsxs)("g",{transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?a===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?w||!1:void 0,"aria-current":m&&!g&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&(0,cr.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,cr.jsx)(dr,{swatchSize:x}),(0,cr.jsx)("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),y+=v}),p},yr=({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const h=[],d=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:o})=>{n+=5;const r=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const s=n;return n+=o*t+8,{lineY:r,labelY:i,itemsY:s,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const p=d[f];h.push((0,cr.jsx)("line",{stroke:"gray",x1:0,y1:p.lineY,x2:t,y2:p.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=p.labelY&&h.push((0,cr.jsx)("text",{y:p.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h.push((0,cr.jsx)("g",{className:"legend-item",transform:`translate(0,${p.itemsY})`,children:pr(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f))}),h},mr=({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const y=((e,t,n,o,r,i,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,y=[],{swatchSize:m,labelGap:g,itemGap:x,rowHeight:b,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=r,A=p.map(e=>m+g+7*e.label.length),S=[];let M=0,C=0;A.forEach((e,t)=>{const n=0===C?e:C+x+e;h&&h>0&&C>0&&n>h?(S.push({start:M,end:t,width:C}),M=t,C=e):C=n}),p.length>0&&S.push({start:M,end:p.length,width:C}),S.forEach((e,c)=>{let u="center"===v?Math.max(0,((h??e.width)-e.width)/2):"end"===v?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],v=hr(e,h,d,f,m),S=fr(e,o,r),M=r&&r.size>0&&r.has(e.label);y.push((0,cr.jsxs)("g",{transform:`translate(${u},${c*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===i&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?M||!1:void 0,"aria-current":k&&!w&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(h+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,cr.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,M&&(0,cr.jsx)(dr,{swatchSize:m}),(0,cr.jsx)("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=A[h]+x}});const _=Math.max(0,...S.map(e=>e.width)),j=S.length;return{items:y,offset:_,totalRows:j,totalHeight:j*b}})(e,o,r,i,s,a,l,t,c,u,h,h.maxWidth??n);p+=y.offset+5,f.push({label:e.label,...y,offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight}),d+=p+12});const p=h.maxWidth??n;let y=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const m=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(m.push((0,cr.jsx)("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),y+=16),m.push((0,cr.jsx)("g",{className:"legend-item",transform:`translate(${y},0)`,children:n.items},"legend-group-"+o)),y+=n.offset+5,e[o+1]&&m.push((0,cr.jsx)("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),(0,cr.jsx)("g",{children:m})};function gr({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Eo.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,cr.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,cr.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,cr.jsx)("defs",{children:(0,cr.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,cr.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,cr.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,cr.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,cr.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,cr.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,cr.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,cr.jsx)("text",{x:0,y:-6,textAnchor:"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,cr.jsx)("defs",{children:(0,cr.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,cr.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,cr.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,cr.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function xr(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=e,d=lr(h),[f,p]=Eo.useState(0),[y,m]=Eo.useState(0),g=Eo.useCallback((e,t)=>{p(e),m(t)},[]),x="vertical"===u?yr({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}):mr({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}),b=!(!n&&!o);return(0,cr.jsxs)("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,cr.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}var br=require("react/jsx-runtime");function vr(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,legendHoverBehavior:a,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:h}=e;if(!t)return null;const d="top"===i||"bottom"===i,f=Math.max(0,n-r.left-r.right),p=Math.max(1,d?s?.maxWidth??f:Jo(t,s)),y=er(t),m=tr(s),g=ir(e.axisChrome,s),x=ir(void 0,s),b=ar(t,f,s);let v,k;if("left"===i)v=r.left-m-p-y,k=r.top;else if("top"===i)v=r.left,k=r.top-x-y-b;else if("bottom"===i){v=r.left;const e=o-r.bottom;k=Math.max(e+y,Math.min(e+g+y,o-b))}else v=n-r.right+m+y,k=r.top;return(0,br.jsx)("g",{transform:`translate(${v}, ${k})`,children:Go(t)?(0,br.jsx)(gr,{config:t.gradient,orientation:d?"horizontal":"vertical",width:p}):Yo(t)?(0,br.jsx)(xr,{legendGroups:t.legendGroups,title:"",width:p,orientation:d?"horizontal":"vertical",legendLayout:s,customHoverBehavior:a,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:h}):t})}var kr=require("react"),wr=require("d3-array");M();var Ar=require("react/jsx-runtime");function Sr(e){return"string"==typeof e?{type:e}:e}function Mr({orient:e,config:t,values:n,scale:o,size:r,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,kr.useMemo)(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(n);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:h}=t,d=Math.min(.5*l,20),f=(l-d)/2+4;if(a){const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="top"===e?-1:1,m=0;return(0,Ar.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,Ar.jsx)("line",{x1:l,y1:m+y*(f+d/2),x2:p,y2:m+y*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ar.jsx)("line",{x1:l,y1:m+y*f,x2:l,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ar.jsx)("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ar.jsx)("rect",{x:Math.min(t,n),y:"top"===e?m-f-d:m+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,Ar.jsx)("line",{x1:a,y1:"top"===e?m-f-d:m+f,x2:a,y2:"top"===e?m-f:m+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="left"===e?-1:1,m=0;return(0,Ar.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,Ar.jsx)("line",{x1:m+y*(f+d/2),y1:l,x2:m+y*(f+d/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ar.jsx)("line",{x1:m+y*f,y1:l,x2:m+y*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ar.jsx)("line",{x1:m+y*f,y1:p,x2:m+y*(f+d),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ar.jsx)("rect",{x:"left"===e?m-f-d:m+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,Ar.jsx)("line",{x1:"left"===e?m-f-d:m+f,y1:a,x2:"left"===e?m-f:m+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,wr.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=S(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,Ar.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,Ar.jsx)("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,Ar.jsx)("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.type){const t=l/2+4,n=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),s=o((r.x0+r.x1)/2);n.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,Ar.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,Ar.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${r},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${s},${n}`),t.push("Z")}else{const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${n},${r}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${s}`),t.push("Z")}return(0,Ar.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,Ar.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,o,s,r,i,e,a,4]);return l?(0,Ar.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var Cr=y(require("react")),_r=require("react/jsx-runtime");function jr(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Rr(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 Pr(e,t,n,o){if(!e)return(0,_r.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,_r.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>t?"end":"start";const f=16,p=i?c?[i]:jr(i,l):[],y=r?c?[r]:jr(r,l):[],m="leftRight"===u?"end"===d?-4:4:0;let g=0;const x=[],b=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push((0,_r.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?m-l:"middle"===d?m-l/2:m,y:-16,width:l,height:Math.max(f,(p.length+y.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,_r.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,_r.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,_r.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(x.push((0,_r.jsx)("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>(0,_r.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),y.length>0&&x.push((0,_r.jsx)("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:g,children:y.map((e,t)=>(0,_r.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),v=(0,_r.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+y.length)*f+(y.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=(0,_r.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+y.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,_r.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,_r.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function Lr(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,_r.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,_r.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,_r.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,_r.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,_r.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,_r.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,_r.jsx)("path",{d:Rr(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,_r.jsx)("g",{className:"annotation-subject",children:i})}function Tr(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;a=r+s*d,l=i+c*d}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.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}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,p=o+h*f,y=i+d*f;s.push((0,_r.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${y} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(y-l,p-a)}else s.push((0,_r.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,_r.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,_r.jsx)("g",{className:"annotation-connector",children:s})}function Ir(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:p,strokeDasharray:y,events:m={},"data-testid":g}=e,x=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=o||0,w=r||0;null!=i&&(k=i-x),null!=s&&(w=s-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,_r.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":g,...null!=p&&{opacity:p},...y&&{strokeDasharray:y},...m,children:[!v.has("connector")&&Tr(k,w,l,h,A,c),!v.has("subject")&&Lr(A,c,h,x,b),!v.has("note")&&Pr(a,k,w,h)]})}function Nr(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,_r.jsx)(Ir,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,_r.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,_r.jsx)(Ir,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var Or=require("d3-hierarchy"),Fr=require("d3-shape");function Br(e){return Math.round(100*e)/100}function Wr(e,t=2){const n=[],o=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[n,o]of e)null!==o&&(i+=n**t*o);n.push(i);const s=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));s.push(o)}o.push(s)}o.push(n);const i=function(e,t){const n=e,o=e.length-1,r=[t];for(let e=0;o>e;e++){let t=e;for(let r=e+1;o>r;r++)Math.abs(n[e][r])>Math.abs(n[e][t])&&(t=r);for(let r=e;o+1>r;r++){const o=n[r][e];n[r][e]=n[r][t],n[r][t]=o}for(let t=e+1;o>t;t++)for(let r=o;r>=e;r--)n[r][t]-=n[r][e]*n[e][t]/n[e][e]}for(let e=o-1;e>=0;e--){let t=0;for(let i=e+1;o>i;i++)t+=n[i][e]*r[i];r[e]=(n[o][e]-t)/n[e][e]}return r}(o,r).map(Br);return{points:e.map(([e])=>[Br(e),Br(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function Dr(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function zr(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Hr(e){return null==e?null:e+""}function Er(e,t,n){return t.stickyPositionCache?.set(e,n),n}function $r(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return Er(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?Er(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return Hr(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>Hr(e.pointId)===o);if(r)return Er(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return Hr(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=Dr(i,n),a=zr(i,n);return null==s||null==a?null:Er(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=Dr(e,n),i=zr(e,n)),null!=r&&null!=i)return Er(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function Yr(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var Gr=require("react/jsx-runtime"),qr={secondary:0,primary:3};function Vr(e){return!0===e?._annotationDeferred}function Xr(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Ur(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Kr(e){return Math.max(.72,.95-.06*e)}M();var Qr=y(require("react")),[Zr,Jr]=pe(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 ei(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(o){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(o);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var ti=require("react/jsx-runtime"),ni="var(--semiotic-bg, #ffffff)";function oi(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:h}=e,d=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ti.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:h,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??ni,strokeWidth:d.haloWidth??3});const p=d.padding??{x:6,y:3},y="number"==typeof p?p:p.x,m="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(o,i),x=i+2*m;let b,v;return b="middle"===l?t-g/2-y:"end"===l?t-g-y:t-y,v="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,(0,ti.jsxs)("g",{className:h,children:[(0,ti.jsx)("rect",{x:b,y:v,width:g+2*y,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??ni,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}var ri=require("react/jsx-runtime"),ii={linear:Fr.curveLinear,monotoneX:Fr.curveMonotoneX,monotoneY:Fr.curveMonotoneY,step:Fr.curveStep,stepAfter:Fr.curveStepAfter,stepBefore:Fr.curveStepBefore,basis:Fr.curveBasis,cardinal:Fr.curveCardinal,catmullRom:Fr.curveCatmullRom};var si=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function ai(e){return!!e&&"object"==typeof e&&si.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function li(e){return"primary"===e?.emphasis||!0===e?.defensive}function ci(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function ui(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var hi=32,di=6,fi=4,pi=8,yi=72;var mi={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function gi(e){if(!xi(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function xi(e){return ai(e)}function bi(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function vi(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function ki(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function wi(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Ai(e,t,n,o,r,i,s,a){const l=ki(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*wi(l,e);for(const e of o)c+=4*wi(l,e);return c}function Si(e){const{annotations:t,context:n,defaultOffset:o=hi,notePadding:r=di,markPadding:i=fi,edgePadding:s=pi,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=yi,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:y,audience:m}=e,g=n.width||0,x=n.height||0,b="object"==typeof p?p:{},v=b.breakpoint??480,k=!!p&&v>=g,w=k&&!1!==b.preferShortText?t.map(gi):t,A=k&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,S=h||k&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),M=k&&!f?b.responsive??{minWidth:v}:f,C=k&&!y?b.cohesion:y;if(0===w.length||0>=g||0>=x)return w.slice();const _=[],j=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=w.map((e,t)=>{if(!xi(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?$r(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...bi("string"==typeof e.title?e.title:void 0,t),...bi("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(h=e).dx||"number"==typeof h.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return _.push(ki(vi(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var h;let d=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(o)){const t=Ai(vi(i.x,i.y,e.dx,e.dy,u),e,_,j,g,x,r,s);f>t&&(d=e,f=t)}if(!d)return e;const p=ki(vi(i.x,i.y,d.dx,d.dy,u),r);_.push(p);const y=Math.hypot(d.dx,d.dy),m=l&&y>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:d.dx,dy:d.dy,...m?{connector:m}:{}}}),L=R?P:w.slice();let T=L;if(d){let e=!1;const t=L.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});T=e?t:L}{let e=!1;const t=T.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?mi[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});T=e?t:T}const I=new Set;if(A){const e="object"==typeof A?A:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(m),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??ci(g,x,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=ci(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,ai(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>li(e.annotation)),c=a.filter(e=>!li(e.annotation)).sort((e,t)=>ui(t.annotation)-ui(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),h=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),d=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:T,width:g,height:x,...n});for(const e of o)I.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=g)for(const e of T)xi(e)&&"secondary"===e.emphasis&&I.add(e);if(I.size>0)for(const e of T)!0===e?.defensive&&I.delete(e);let N;return N=0===I.size?T:S?T.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):T.filter(e=>!I.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>xi(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(N,C):N}var Mi=require("react"),Ci={positions:new Map},_i=new Set;function ji(){for(const e of _i)e()}function Ri(e,t){const n=Ci.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Ci.positions);o.delete(e),Ci={positions:o},ji()}function Pi(e,t){const n=Ci.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(Ci.positions);o.delete(e),Ci={positions:o},ji()}function Li(){return Ci}function Ti(e){return _i.add(e),()=>_i.delete(e)}var Ii={positions:new Map};function Ni(){return()=>{}}function Oi(){return Ii}function Fi(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}function Bi(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function Wi(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function Di(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function zi(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Hi(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}var Ei=require("react/jsx-runtime");function $i(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=e,f=(0,Ho.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||u||Yi,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o),a=e?.tickValues??Fi(s.x,i,d),c=a.map(e=>e.valueOf()),h=a.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,c)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Gi(h,Math.max(55,f+8))},[s,l,u,t,d]),p=(0,Ho.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||h||Yi,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o);return Gi((e?.tickValues??Fi(s.y,i,d)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,h,n,d]),y=c&&s,m=a&&s;if(!y&&!m)return null;const g=l?.find(e=>"bottom"===e.orient),x=l?.find(e=>"left"===e.orient),b=m&&(!g||!1!==g.baseline),v=m&&(!x||!1!==x.baseline),k=g?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return(0,Ei.jsx)("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,Ei.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&(()=>{const e=zi(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=zi(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Ei.jsxs)("g",{className:"stream-grid",children:[f.map((t,o)=>(0,Ei.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),p.map((e,n)=>(0,Ei.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),b&&!k&&(0,Ei.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&(0,Ei.jsx)("path",{d:Hi("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&(0,Ei.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&(0,Ei.jsx)("path",{d:Hi("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function Yi(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Gi(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function qi(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:p,showGrid:y,title:m,legend:g,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:M,marginalGraphics:C,xValues:_,yValues:j,annotations:R,onAnnotationActivate:P,onObservation:L,chartId:T,chartType:I,autoPlaceAnnotations:N,svgAnnotationRules:O,xAccessor:F,yAccessor:B,annotationData:W,pointNodes:D,curve:z,underlayRendered:H,canvasObscuresUnderlay:E=!0,linkedCrosshairName:$,linkedCrosshairSourceId:Y,children:G}=e,q=function(e){const t=Jr(e=>e.pushObservation),n=Qr.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return Qr.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:P,onObservation:L,chartId:T,chartType:I}),V=tr(S),X=g&&"left"===w&&V>0?V:i.left,U=g&&"right"===w&&V>0?V:i.right,K=(0,Ho.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||d||Yi,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o),c=e?.tickValues??Fi(s.x,i,p),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,u)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),y=e?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let m=Gi(h,y);if(m.length>1&&(m=m.filter((e,t)=>0===t||e.label+""!=m[t-1].label+"")),e?.includeMax&&m.length>0&&"exact"!==p&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=m[m.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,m.length,u);y>t-o&&m.length>1&&(m=m.slice(0,-1)),m.push({value:e,pixel:t,label:r})}}return m},[a,s,l,d,t,p]),Q=(0,Ho.useMemo)(()=>{const e=l?.find(e=>"bottom"===e.orient);if(!e?.autoRotate||1>=K.length)return!1;const n=t/Math.max(K.length-1,1);return K.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>n},[l,K,t]),Z=(0,Ho.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||Yi,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o);let c=Gi((e?.tickValues??Fi(s.y,i,p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==p&&!e?.tickValues){const e=s.y.domain()[1],n=s.y(e),o=c[c.length-1].pixel;if(Math.abs(n-o)>1){const r=t(e);22>Math.abs(n-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:n,label:r})}}return c},[a,s,l,f,n,p]),J=(0,Ho.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||Yi,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return Gi((e.tickValues??Fi(s.y,"exact"===p?Math.max(2,r):Math.min(r,o),p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,f,n,p]),ee=(0,Ho.useRef)(new Map),te=(0,Ho.useRef)(R?.length??0),ne=R?.length??0;te.current!==ne&&(te.current=ne,ee.current=new Map);const oe=(0,Ho.useMemo)(()=>{if(!R||0===R.length)return null;const e=function(e,t={}){const n=!0===t.showRetractedAnnotations,o=!0===t.showSupersededAnnotations,r=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&r.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&r.has(t)&&!o)})}(R),o=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=$r(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!Yr(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,ri.jsx)(Nr,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Dr(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const a=t>.6*(o.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,ri.jsxs)("g",{opacity:e.opacity,children:[(0,ri.jsx)("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ri.jsx)(oi,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=zr(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=t)?Math.min((o.height||0)-4,s+16):s-4;return(0,ri.jsxs)("g",{opacity:e.opacity,children:[(0,ri.jsx)("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ri.jsx)(oi,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Dr({...e,type:"point"},o),y:zr({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,Or.packEnclose)(t),i=e.padding||10;return(0,ri.jsxs)("g",{children:[(0,ri.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,ri.jsx)(oi,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Dr({...e,type:"point"},o),y:zr({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=A(i),[c,u]=A(s),h=a-r,d=l+r,f=c-r;return(0,ri.jsxs)("g",{children:[(0,ri.jsx)("rect",{x:h,y:f,width:d-h,height:u+r-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,ri.jsx)(oi,{x:(h+d)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=o.data||[],r="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,ri.jsx)("g",{children:r.map((t,n)=>{const r=Dr(t,o),s=zr(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,ri.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Dr(e,o),r=zr(e,o);return(0,ri.jsx)(Nr,{noteData:{x:t??0,y:r??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}},"ann-"+n)}case"trend":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const h=[],d=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=d.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,p=o.scales?.y??o.scales?.value;if(!f||!p)return null;const y=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(h.length-1,n+1),r=t-n,i=e(h[n]);return i+(e(h[o])-i)*r},m=f,g=p;let x;if(s)if(a){const e=y(g);x=(t,n)=>[m(n),e(t)]}else{const e=y(m);x=(t,n)=>[e(t),g(n)]}else x=(e,t)=>[m(e),g(t)];const b=e.method||"linear";let v;if("loess"===b)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]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*r[e],d+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*f-h*h;if(1e-12>Math.abs(y))a.push([t,d/u]);else{const e=(u*p-h*d)/y;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===b?Wr(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[o,r]of e)null!==r&&(n++,t[0]+=o,t[1]+=r,t[2]+=o*o,t[3]+=o*r);const o=n*t[2]-t[0]*t[0],r=0===o?0:Br((n*t[3]-t[0]*t[1])/o),i=Br(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[Br(e),Br(r*e+i)]),equation:[r,i]}}(u);v=t.points}const k=v.map(([e,t])=>{const[n,o]=x(e,t);return`${n},${o}`}).join(" "),w=e.color||"#6366f1",A=v[v.length-1],[S,M]=x(A[0],A[1]);return(0,ri.jsxs)("g",{children:[(0,ri.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ri.jsx)("text",{x:S+4,y:M-4,fill:w,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,s=t?.domain?.(),a=e.y0??s?.[0],l=e.y1??s?.[1],c=null!=a&&t?t(a):0,u=null!=l&&t?t(l):o.height||0,h=fo(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,ri.jsxs)("g",{opacity:e.opacity,children:[h.def&&(0,ri.jsx)("defs",{children:h.def}),(0,ri.jsx)("rect",{x:0,y:Math.min(c,u),width:o.width||0,height:Math.abs(u-c),fill:h.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,ri.jsx)(oi,{x:(o.width||0)-4,y:(r=c,i=u,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=o.scales?.x??o.scales?.time,r=t?.domain?.(),i=e.x0??r?.[0],s=e.x1??r?.[1],a=null!=i&&t?t(i):null,l=null!=s&&t?t(s):null;if(null==a||null==l)return null;const c=fo(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,ri.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,ri.jsx)("defs",{children:c.def}),(0,ri.jsx)("rect",{x:Math.min(a,l),y:0,width:Math.abs(l-a),height:o.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,ri.jsx)(oi,{x:Math.min(a,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const h=ii[o.curve||"linear"]||Fr.curveLinear,d=(0,Fr.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,ri.jsxs)("g",{children:[(0,ri.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,ri.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",y=e.fillOpacity??.1,m=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,x=s(l+h*u),b=s(d),v=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return(0,ri.jsxs)("g",{children:[f&&(0,ri.jsx)("rect",{x:0,y:Math.min(x,b),width:o.width||0,height:Math.abs(b-x),fill:p,fillOpacity:y}),v.map((e,t)=>{const n=Dr(e,o),r=zr(e,o);return null==n||null==r?null:(0,ri.jsx)("circle",{cx:n,cy:r,r:g,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,ri.jsx)("text",{x:(o.width||0)-4,y:Math.min(x,b)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],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>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Wr(l,e.order||2).equation;c=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,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,h=l.map(([e,t])=>t-c(e)),d=h.reduce((e,t)=>e+t*t,0),f=Math.sqrt(d/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,y=l.reduce((e,t)=>e+(t[0]-p)**2,0),m=e.confidence??.95,g=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,x=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;x>=e;e++)k.push(b+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/u+(y>0?(e-p)**2/y:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(b)},${a(c(b))}`,C=e.strokeColor||"#6366f1";return(0,ri.jsxs)("g",{children:[(0,ri.jsx)("path",{d:A,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,ri.jsx)("polyline",{points:`${M} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,ri.jsx)("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=$r(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!Yr(r,i,o))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,ri.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,ri.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,ri.jsx)("div",{...ei(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=$r(e,n,o);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,ri.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Cr.cloneElement(c,{key:"ann-text-"+n}):(0,ri.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,ri.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Cr.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return(0,ri.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,ri.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&(0,ri.jsx)(oi,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,ri.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,ri.jsx)(oi,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,q),r={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:F,yAccessor:B,width:t,height:n,data:W,frameType:"xy",pointNodes:D,curve:z,stickyPositionCache:ee.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Ur(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>Vr(e.annotation)),r=e.some(e=>null!=Xr(e.annotation)),i=e.some(e=>"layer"===Xr(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=qr[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=Vr(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,Gr.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Kr(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=Xr(t.annotation);return a&&(s=(0,Gr.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,Gr.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,Gr.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&a.unshift((0,Gr.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(N?Si({annotations:e,context:r,..."object"==typeof N?N:{}}):e,o,O,r)},[R,N,O,t,n,F,B,W,s,D,z,q]),re=function(e){const t=(0,Mi.useSyncExternalStore)(e?Ti:Ni,e?Li:Oi,e?Li:Oi);return e?t.positions.get(e)??null:null}($);return(0,Ho.useEffect)(()=>{if(!re?.locked||!$)return;const e=e=>{"Escape"===e.key&&Pi($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[re?.locked,$]),a||m||g||M||C||oe&&oe.length>0||y||G||re?(0,Ei.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Ei.jsx)("title",{children:"string"==typeof m?m:"XY Chart"}),(0,Ei.jsx)("desc",{children:"string"==typeof m?m+" (XY data visualization)":"XY data visualization"}),(0,Ei.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&s&&(!H||E)&&(()=>{const e=zi(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=zi(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Ei.jsxs)("g",{className:"stream-grid",children:[K.map((t,o)=>(0,Ei.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),Z.map((e,n)=>(0,Ei.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,i=!o||!1!==o.baseline,s=e?.jaggedBase||!1,a=o?.jaggedBase||!1,d=o?.landmarkTicks,f=e?.landmarkTicks,p="var(--semiotic-border, #ccc)",y="var(--semiotic-text-secondary, var(--semiotic-text, #666))",m="var(--semiotic-text, #333)",g=Q,x=g?12:18,b=n+(g?58:40),v={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},w={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},A=o?.tickAnchor,S=e?.tickAnchor,M=Di(K),C=Di(Z);return(0,Ei.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,Ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||E)&&i&&!a&&(0,Ei.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:p,strokeWidth:1}),(!H||E)&&a&&(0,Ei.jsx)("path",{d:Hi("bottom",t,n),fill:"none",stroke:p,strokeWidth:1}),K.map((e,t)=>{const o=!!d&&("function"==typeof d?d(e.value,t):Hn(e.value,t>0?K[t-1].value:void 0));return(0,Ei.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,Ei.jsx)("line",{y2:5,stroke:p,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Ei.jsx)("text",{y:x,textAnchor:g?"end":Bi(A,e.pixel===M.min,e.pixel===M.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:v},transform:g?"rotate(-45)":void 0,children:e.label}):(0,Ei.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Ei.jsx)("div",{style:{textAlign:"center",userSelect:"none",...v},children:e.label})})]},"xtick-"+t)}),c&&(0,Ei.jsx)("text",{x:t/2,y:b,textAnchor:"middle",fill:m,className:"semiotic-axis-label",style:{userSelect:"none",...w},children:c})]}),(0,Ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||E)&&r&&!s&&(0,Ei.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:p,strokeWidth:1}),(!H||E)&&s&&(0,Ei.jsx)("path",{d:Hi("left",t,n),fill:"none",stroke:p,strokeWidth:1}),Z.map((e,t)=>{const n=!!f&&("function"==typeof f?f(e.value,t):Hn(e.value,t>0?Z[t-1].value:void 0));return(0,Ei.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,Ei.jsx)("line",{x2:-5,stroke:p,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Ei.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:Wi(S,e.pixel===C.min,e.pixel===C.max),fontWeight:n?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...n?k:v},children:e.label}):(0,Ei.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Ei.jsx)("div",{style:{textAlign:"right",userSelect:"none",...v},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,Ei.jsx)("text",{x:15-X,y:n/2,textAnchor:"middle",fill:m,transform:`rotate(-90, ${15-X}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...w},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===J.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,i=e.label||h,s=e.tickAnchor,a=Di(J);return(0,Ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&(0,Ei.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:p,strokeWidth:1}),J.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):Hn(e.value,n>0?J[n-1].value:void 0));return(0,Ei.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,Ei.jsx)("line",{x2:5,stroke:p,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Ei.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:Wi(s,e.pixel===a.min,e.pixel===a.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:v},children:e.label}):(0,Ei.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Ei.jsx)("div",{style:{textAlign:"left",userSelect:"none",...v},children:e.label})})]},"ytick-r-"+n)}),i&&(0,Ei.jsx)("text",{x:t+U-15,y:n/2,textAnchor:"middle",fill:m,transform:`rotate(90, ${t+U-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...w},children:i})]})})()]})})(),oe,C&&s&&_&&j&&(0,Ei.jsxs)(Ei.Fragment,{children:[C.top&&(0,Ei.jsx)("g",{transform:"translate(0, 0)",children:(0,Ei.jsx)(Mr,{orient:"top",config:Sr(C.top),values:_,scale:s.x,size:i.top,length:t})}),C.bottom&&(0,Ei.jsx)("g",{transform:`translate(0, ${n})`,children:(0,Ei.jsx)(Mr,{orient:"bottom",config:Sr(C.bottom),values:_,scale:s.x,size:i.bottom,length:t})}),C.left&&(0,Ei.jsx)("g",{transform:"translate(0, 0)",children:(0,Ei.jsx)(Mr,{orient:"left",config:Sr(C.left),values:j,scale:s.y,size:i.left,length:n})}),C.right&&(0,Ei.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,Ei.jsx)(Mr,{orient:"right",config:Sr(C.right),values:j,scale:s.y,size:i.right,length:n})})]}),M,re&&re.sourceId!==Y&&s?.x&&(()=>{const e=s.x(re.xValue);if(null==e||0>e||e>t)return null;const o=re.locked;return(0,Ei.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),G]}),m&&"string"==typeof m?(0,Ei.jsx)("text",{x:o/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?(0,Ei.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,vr({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:w,title:m,legendLayout:S,axisChrome:{hasAxis:!!a,hasAxisLabel:!!c,rotatedTicks:Q},legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k})]}):null}var Vi=y(require("react")),Xi=require("d3-shape");function Ui(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Ki(e,t,n,o){if(2>e.length||t.length!==e.length||0===n.length)return[];const r=[],i=(e,t,n)=>{const o=r[r.length-1];o?.color===e?o.path.push(n):r.push({color:e,path:[t,n]})};for(let r=1;e.length>r;r++){const[s,a]=e[r-1],[l,c]=e[r],u=t[r-1],h=t[r]-u,d=[0,...0===h?[]:n.map(({value:e})=>(e-u)/h).filter(e=>e>0&&1>e&&Number.isFinite(e)).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e!==n[t-1]),1];for(let e=1;d.length>e;e++){const t=d[e-1],r=d[e];i(Ui(u+h*((t+r)/2),n,o),[s+(l-s)*t,a+(c-a)*t],[s+(l-s)*r,a+(c-a)*r])}}return r}function Qi(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}var Zi=require("react/jsx-runtime");function Ji(e,t="#4e79a7"){return ao(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function es(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function ts(e,t){const n=e.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity))).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color??t,opacity:null==e.opacity?void 0:Math.max(0,Math.min(1,e.opacity))}));return 2>n.length?null:n.map((e,t)=>(0,Zi.jsx)("stop",{offset:e.offset,stopColor:e.color,stopOpacity:e.opacity},t))}var ns=require("react/jsx-runtime");function os(e,t,n,o){if(!e||2>t.length)return null;const r=ts(e.stops,o);return r?(0,ns.jsx)("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:r}):null}var rs="undefined"==typeof window||"undefined"==typeof document,is=require("react"),ss="undefined"!=typeof window?is.useLayoutEffect:is.useEffect,as=()=>()=>{},ls=()=>!1,cs=()=>!0,us=require("react");function hs(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function ds(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function fs(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function ps(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:o=""}=e;return"transparent"===t||n?null:t||(o&&"transparent"!==o?o:"")||null}var ys={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function ms(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}var gs=y(require("react")),xs=y(require("react")),bs=(require("react/jsx-runtime"),xs.createContext(null)),vs=require("react/jsx-runtime"),ks={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ws({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,vs.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:ks,children:t})}function As(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}function Ss(e){return e&&"object"==typeof e?e:{}}function Ms(e){return Ss(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Cs=require("react/jsx-runtime");function _s(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var js=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Rs="semiotic-accessible-data-table",Ps=Rs+" semiotic-accessible-data-table-hidden",Ls=Rs+" semiotic-accessible-data-table-visible",Ts={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Is={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Ns={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Os={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Fs={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Bs={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ws={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Ds={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function zs({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=gs.useState(!1),[s,a]=gs.useState(5),l=xs.useContext(bs),c=l?.visible??!1,u=r||c,h=gs.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;gs.useEffect(()=>{u||a(5)},[u]);const f=gs.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=gs.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Cs.jsx)("span",{id:n,tabIndex:-1,style:ks}):null;if(!u)return(0,Cs.jsx)("div",{id:n,className:Ps,tabIndex:-1,onFocus:f,style:ks,role:"region","aria-label":d,children:(0,Cs.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const y=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:As(Ms(o))});break;case"line":case"area":{const e=Ms(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:As(e)});break}case"rect":{const e=Ms(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=As(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=As(Ms(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Ms(o),n=As(e);if(null==n.category){const t=Ss(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:As(Ms(o))});break;case"arc":t.push({label:"Arc",values:As(Ms(o))});break;case"candlestick":t.push({label:"Candlestick",values:As(Ms(o))});break;case"geoarea":{const e=Ss(Ms(o)),n=As(e);if(null==n.name){const t=Ss(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${js(e.min)} to ${js(e.max)}, mean ${js(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),x=Math.min(s,y.length),b=y.slice(0,x),v=y.length-x,k=new Set;for(const e of b)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Cs.jsxs)("div",{ref:h,id:n,className:Ls,tabIndex:-1,onBlur:p,style:Ts,role:"region","aria-label":d,children:[(0,Cs.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Ns,children:"×"}),(0,Cs.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Is,children:g}),(0,Cs.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Os,children:[(0,Cs.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Ws,children:v>0?`First ${x} of ${y.length} data points`:`All ${y.length} data points`}),(0,Cs.jsx)("thead",{children:(0,Cs.jsxs)("tr",{children:[(0,Cs.jsx)("th",{style:Fs,children:"type"}),w.map(e=>(0,Cs.jsx)("th",{style:Fs,children:e},e))]})}),(0,Cs.jsx)("tbody",{children:b.map((e,t)=>(0,Cs.jsxs)("tr",{children:[(0,Cs.jsx)("td",{style:Bs,children:e.label}),w.map(t=>{return(0,Cs.jsx)("td",{style:Bs,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":js(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&(0,Cs.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:Ds,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function Hs({summary:e}){return e?(0,Cs.jsx)("div",{role:"note",style:ks,children:e}):null}function Es({tableId:e}){return(0,Cs.jsx)("a",{href:"#"+e,style:ks,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ks)},children:"Skip to data table"})}var $s=require("react/jsx-runtime"),Ys="var(--semiotic-focus, #005fcc)";function Gs({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,$s.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ys,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,$s.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Ys,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ys,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,$s.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,$s.jsx)("path",{d:a,fill:"none",stroke:Ys,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,$s.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var qs=y(require("react"));function Vs(e,t){return"touch"===t?Math.max(e,24):e}function Xs(e){return Array.isArray(e)?e[0]:e}function Us(e,t,n,o){return{data:Xs(e),x:t,y:n,__semioticHoverData:!0,...o}}var Ks=["name","label","title"],Qs=["type","kind","category","group","class","status","role","shape"],Zs=["value","amount","total","count","weight","score"],Js=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function ea(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function ta(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&Js.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Ks.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=ea(l,Qs),u=ea(l,Zs),h=new Set(Qs),d=new Set(Zs),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(h.has(e.lower)||d.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}var na=require("react/jsx-runtime"),oa={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function ra(e,t){return"function"==typeof t?t(e):e[t]}function ia(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function sa(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=ra(e,n);s=ia(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=ra(e,r);a.push({label:n,value:ia(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=ia(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=ia(e[t[0]],o))}}const l={...oa,...r};return(0,na.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,na.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,na.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,na.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function aa(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,na.jsx)("div",{className:"semiotic-tooltip",style:oa,children:(0,na.jsx)("div",{children:ia(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return(0,na.jsxs)("div",{className:"semiotic-tooltip",style:oa,children:[null!=n&&(0,na.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:ia(n)}),t.map((e,t)=>(0,na.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,na.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,na.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,na.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:ia(e.value)})]},t))]})}}function la(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Xs(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,na.jsx)("div",{className:"semiotic-tooltip",style:oa,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?sa(e):"multi"===e?("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip — prefer charts that set tooltipMode (LineChart, AreaChart, StackedAreaChart, DifferenceChart). Rendering MultiLineTooltip content as a fallback.'),function(e={}){const{fields:t=[],title:n,format:o,style:r={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=ra(e,n);l.push({value:ia(t,o)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=ia(ra(e,r),i);l.push({label:s?n:void 0,value:a})});else{const t=ta(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:ia(t.title,o),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:ia(e.value,o)})})}const c={...oa,...r};return Array.isArray(l)&&0!==l.length?(0,na.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,na.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,na.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}()):sa())}}var ca=require("react/jsx-runtime");function ua({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=qs.useRef(null),[u,h]=qs.useState(null);qs.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,o,l]);let d;d=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!qs.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),p=f?null:oa;return l?(0,ca.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var ha=y(require("react")),da=require("react"),fa=require("react");var pa=require("react");function ya(e,t,n){const o=(0,pa.useRef)(null),[r,i]=(0,pa.useState)(null);return(0,pa.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}var ma=()=>"undefined"!=typeof performance?performance.now():Date.now();function ga(e,t){const n=e();return Number.isFinite(n)?n:t}var xa=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??ma,this.lastWallTime=ga(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=ga(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??ma;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=ga(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},ba="undefined"==typeof window?da.useEffect:da.useLayoutEffect,va={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function ka(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function wa(e){const t=function(){const[e,t]=(0,fa.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,fa.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,da.useRef)(t);n.current=t;const[o,r]=ya(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,da.useMemo)(()=>function(e,t,n=!1){const o=n?t?58:34:t?36:0;return o>e.top?{...e,top:o}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=ka(e.foregroundGraphics,r,a),h=ka(e.backgroundGraphics,r,a),d=Se(e=>e.theme),{transition:f,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),y="semiotic-table-"+ha.useId(),m=(0,da.useRef)(null);if(!m.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;m.current=new xa({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=m.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,da.useRef)(null),b=(0,da.useRef)(e.frameScheduler??va);b.current=e.frameScheduler??va;const v=(0,da.useRef)(null),k=(0,da.useRef)(!1),w=(0,da.useRef)(()=>{}),A=(0,da.useCallback)(()=>{if(null!==x.current||k.current)return;const e=b.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(k.current=!0),x.current=null,v.current=null;try{w.current()}finally{e&&(k.current=!1)}});n=!0,t||(x.current=o,v.current=e)},[]),S=(0,da.useCallback)(()=>{null!==x.current&&((v.current??b.current).cancelAnimationFrame(x.current),x.current=null,v.current=null)},[]);ba(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,da.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,da.useEffect)(()=>()=>{S()},[S]);const M=(0,da.useRef)(()=>{}),C=(0,da.useRef)(()=>{}),_=(0,da.useRef)(null),j=(0,da.useRef)(null),R=(0,da.useRef)(null),P=(0,da.useCallback)(()=>{const e=_.current;_.current=null,e&&M.current(e)},[]),L=(0,da.useCallback)(e=>{if(_.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===j.current){const e=b.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,j.current=null,R.current=null,P()});t||(j.current=n,R.current=e)}},[P]),T=(0,da.useCallback)(()=>{_.current=null,null!==j.current&&((R.current??b.current).cancelAnimationFrame(j.current),j.current=null,R.current=null),C.current()},[]);(0,da.useEffect)(()=>()=>{_.current=null,null!==j.current&&((R.current??b.current).cancelAnimationFrame(j.current),j.current=null,R.current=null)},[]);const I=e.themeDirtyRef;return ba(()=>{I&&(Jn++,I.current=!0,A())},[d,A,I]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:h,currentTheme:d,transition:f,introEnabled:p,tableId:y,frameRuntime:g,rafRef:x,renderFnRef:w,scheduleRender:A,cancelRender:S,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:L,onPointerLeave:T}}var Aa=require("react"),Sa=require("react/jsx-runtime");function Ma({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,Sa.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,Sa.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function Ca(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function _a(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),s=Math.round(t[1]*o),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(n.left,n.top),r}var ja=require("react");function Ra(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var Pa=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],La=3156e7;function Ta(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:La>t?e=>{const t=new Date(e);return`${Pa[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*La>t?e=>{const t=new Date(e);return`${Pa[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Ia(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:Dt(n.size)});else if("glyph"===n.type){const e=Kn(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}var Na=require("d3-shape");function Oa(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}var Fa=(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const r=t.style.stroke||"#007bff",i=oo(e,r)||r,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Oa(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=yo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,h=t._decayOpacities;if(h&&h.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let o=0;t.path.length-1>o;o++)e.globalAlpha=.5*(h[o]+h[o+1])*n,e.beginPath(),e.moveTo(t.path[o][0],t.path[o][1]),e.lineTo(t.path[o+1][0],t.path[o+1][1]),e.stroke()}else if(u){const n=Ki(t.path,l,a,i);for(const t of n){e.beginPath(),e.strokeStyle=oo(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1]);e.stroke()}}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?bo(e,t.strokeGradient,i,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,Na.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=mo(e,t.style.fill,t.style.fill),c&&!u)(0,Na.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],o.height),e.lineTo(n,o.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Ba(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Wa(e,t,n=.3){Ba(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Da(e,t,n=.6){if(!Ba(t))return;const o=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function za(e,t,n,o=.35){Ba(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var Ha=require("d3-shape");function Ea(e,t){const n=yo(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=(0,Ha.area)().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}function $a(e,t){const n=yo(t.curve);if(e.beginPath(),n)(0,Ha.line)().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}}var Ya=(e,t,n,o)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,o.width*r,o.height),e.clip());const i=mo(e,t.style.fill,"#4e79a7"),s=t._decayOpacities,a=!(!t.colorThresholds?.length||!t.rawValues||t.rawValues.length!==t.topPath.length),l=!!t.strokeColorBands?.length;if(s&&s.length===t.topPath.length&&!a&&!l){const n=t.style.fillOpacity??.7;e.fillStyle=i;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const c=t.style.opacity??1;if(Ea(e,t),t.fillGradient&&t.fillGradient.stops.length>=2&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=go(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,n,0,o);e.fillStyle=r||i,e.globalAlpha=c}else e.globalAlpha=(t.style.fillOpacity??.7)*c,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Ea(e,t),za(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=c;const n=oo(e,t.style.stroke)||t.style.stroke,o=a||l||!t.strokeGradient||2>t.topPath.length?null:bo(e,t.strokeGradient,n,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);if(e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]),l){let o=1/0,r=-1/0;for(const[e]of t.topPath)o=Math.min(o,e),r=Math.max(r,e);const i=e.lineWidth;for(const s of t.strokeColorBands){e.save(),e.beginPath(),e.rect(o-i,s.y,r-o+2*i,s.height),e.clip();const a=s.color??n;e.strokeStyle=oo(e,a)||a,$a(e,t),e.stroke(),e.restore()}}else if(a){const o=Ki(t.topPath,t.rawValues,t.colorThresholds,n);for(const t of o){e.beginPath(),e.strokeStyle=oo(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1]);e.stroke()}}else e.strokeStyle=o||n,$a(e,t),e.stroke()}void 0!==r&&1>r&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Ga=(e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=mo(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&"none"!==n.style.stroke&&(e.strokeStyle=mo(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Da(e,n)}finally{e.restore()}}},qa=new Map;function Va(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=qa.get(t);return n||(n=new Path2D(Wt(e.symbolType,e.size)),qa.size>256&&qa.clear(),qa.set(t,n)),n}catch{return null}}var Xa=(e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=Va(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=n*i*(t.style.fillOpacity??1),e.fillStyle=mo(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=mo(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n};function Ua(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Yn(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=mo(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=Un(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Qn(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Qn(e,i,c,t.accent,void 0,l),e.restore()}function Ka(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Qa(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var Za=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Ja(e,t);else if(t.cornerRadii&&Qi(t.cornerRadii)){const n=mo(e,t.style.fill,oo(e,"var(--semiotic-primary, #007bff)")),o=Qa(t),r=t.fillGradient&&"string"==typeof n?go(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,Ka(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=mo(e,t.style.fill,oo(e,"var(--semiotic-primary, #007bff)")),o=Qa(t),r=t.fillGradient&&"string"==typeof n?go(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=mo(e,t.style.fill,oo(e,"var(--semiotic-primary, #007bff)")),o=Qa(t),r=t.fillGradient&&"string"==typeof n?go(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Wa(e,t),e.globalAlpha=1}};function Ja(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function el(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function tl(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var nl=(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h);const o=Math.max(0,n?.strokeWidth??1);if(o>0&&(e.strokeStyle=oo(e,n?.stroke??"var(--semiotic-surface, #fff)"),e.lineWidth=o,e.strokeRect(t.x,t.y,t.w,t.h)),Wa(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):tl(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=el(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}},ol=(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=oo(e,t.wickColor)||t.wickColor,s=60>o.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const n=t.dotRadius??Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=oo(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}s&&l(),e.restore()}},rl={line:[Ya,Fa,Ga],area:[Ya,Ga],stackedarea:[Ya,Ga],scatter:[Ga,Xa],bubble:[Ga,Xa],heatmap:[nl],bar:[Za],swarm:[Ga],waterfall:[(e,t,n,o)=>{Za(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=oo(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[ol],mixed:[Ya,Fa,Ga],custom:[Ya,Za,nl,Fa,Ga,Xa,(e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Ua(e,o,o.x,o.y,n);e.globalAlpha=n},ol]},il=new Set;function sl(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(o=n)&&"object"==typeof o&&"string"==typeof o.id&&"function"==typeof o.cacheKey&&"function"==typeof o.drawCanvas&&"function"==typeof o.renderStaticSVG?n:void 0;var o}function al(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;il.has(n)||(il.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var ll=require("react/jsx-runtime");function cl(e){return"string"==typeof e?e:"value"}function ul(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function hl(e,t){if(!t)return ul(e);try{const n=t(e);return null==n?ul(e):n}catch{return ul(e)}}function dl(e,t){return"function"==typeof t?t(e):e[t]}function fl(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";n.push({label:r,accessor:e=>e.bands?.[o]?.y0??(0===o?e.band?.y0:void 0),format:t}),n.push({label:i,accessor:e=>e.bands?.[o]?.y1??(0===o?e.band?.y1:void 0),format:t})}),n}function pl(e){const t=e.find(e=>"title"===e.role),n=e.filter(e=>"title"!==e.role);return e=>{const o=e.data;if(!o)return null;const r=t?hl(dl(o,t.accessor),t.format):null;return(0,ll.jsxs)("div",{className:"semiotic-tooltip",style:oa,children:[null!=r&&(0,ll.jsx)("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((e,t)=>{const n=hl(dl(o,e.accessor),e.format);return(0,ll.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,ll.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,ll.jsx)("span",{children:n})]},t)})]})}}var yl=require("react/jsx-runtime");function ml(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function gl({hover:e}){const t=e.data??{},n=t.y??t.value,o=t.x??t.time;if(void 0===n&&void 0===o){const e=ta(t);if(null!=e.title||e.entries.length>0)return(0,yl.jsxs)("div",{className:"semiotic-tooltip",style:oa,children:[null!=e.title&&(0,yl.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,yl.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,yl.jsx)("span",{style:{fontWeight:600},children:ml(e.value)})]},e.key))]})}return(0,yl.jsxs)("div",{className:"semiotic-tooltip",style:oa,children:[(0,yl.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:ml(n)}),(0,yl.jsx)("div",{style:{opacity:.7,fontSize:11},children:ml(o)})]})}function xl(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function bl(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}gl.ownsChrome=!0;var vl=require("react"),kl=require("react");function wl(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function Al(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=Kn(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n],shape:"circle",group:r});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n],shape:"circle",group:r});break}case"rect":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}var Sl=require("react/jsx-runtime"),Ml={top:20,right:20,bottom:30,left:40},Cl=ys;function _l(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var jl=(0,oe.memo)((0,oe.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p,lineDataAccessor:y,curve:m,normalize:g,baseline:x,stackOrder:b,binSize:v,valueAccessor:k,arrowOfTime:w="right",windowMode:A="sliding",windowSize:S=200,timeAccessor:M,xExtent:C,yExtent:_,extentPadding:j=.1,scalePadding:R,sizeRange:P,size:L=[500,300],responsiveWidth:T,responsiveHeight:I,margin:N,className:O,background:F,renderMode:B,lineStyle:W,pointStyle:D,areaStyle:z,barStyle:H,waterfallStyle:E,swarmStyle:$,barColors:Y,colorScheme:G,boundsAccessor:q,boundsStyle:V,y0Accessor:X,band:U,gradientFill:K,lineGradient:Q,semanticLineStops:Z,areaGroups:J,openAccessor:ee,highAccessor:te,lowAccessor:re,closeAccessor:ie,candlestickStyle:se,showAxes:ae=!0,axes:ce,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:ye,yFormat:ge,axisExtent:xe,tickFormatTime:be,tickFormatValue:ve,hoverAnnotation:ke,tooltipContent:we,customHoverBehavior:Ae,customClickBehavior:Se,onObservation:Me,annotationObservationCallback:Ce,chartId:_e,enableHover:je,hoverRadius:Re=30,tooltipMode:Pe,annotations:Le,onAnnotationActivate:Te,autoPlaceAnnotations:Ie,svgAnnotationRules:Ne,showGrid:Oe,legend:Fe,legendHoverBehavior:Be,legendClickBehavior:We,legendHighlightedCategory:De,legendIsolatedCategories:ze,legendPosition:He,legendLayout:Ee,legendCategoryAccessor:$e,onCategoriesChange:Ye,backgroundGraphics:Ge,foregroundGraphics:qe,canvasPreRenderers:Ve,svgPreRenderers:Xe,title:Ue,categoryAccessor:Ke,brush:Qe,onBrush:Ze,decay:Je,pulse:et,transition:tt,animate:nt,staleness:ot,frameScheduler:rt,clock:it,random:st,seed:at,paused:lt=!1,suspendWhenHidden:ct=!0,heatmapAggregation:ut,heatmapXBins:ht,heatmapYBins:dt,showValues:ft,heatmapValueFormat:pt,marginalGraphics:yt,pointIdAccessor:mt,xScaleType:gt,yScaleType:xt,accessibleTable:bt=!0,description:vt,summary:kt,linkedCrosshairName:wt,linkedCrosshairSourceId:At,customLayout:St,onLayoutError:Mt,layoutConfig:Ct,layoutSelection:_t}=e,{customHoverBehavior:Rt,customClickBehavior:Pt,hasClickBehavior:Lt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,vl.useCallback)((t,i)=>{e?.(t,i),xl({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:i})},[o,r,e,n]),customClickBehavior:(0,vl.useCallback)((e,i)=>{t?.(e,i),bl({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:i})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:Ae,customClickBehavior:Se,onObservation:Me,chartId:_e,chartType:"StreamXYFrame"}),Nt=(0,oe.useId)().replace(/:/g,""),Ot=(0,oe.useRef)(!1),Ft=(0,oe.useRef)({w:-1,h:-1}),Bt=(0,oe.useRef)(!1),Dt=wa({sizeProp:L,responsiveWidth:T,responsiveHeight:I,userMargin:N,marginDefault:Ml,title:Ue,legend:Fe,legendPosition:He,animate:nt,transitionProp:tt,frameScheduler:rt,clock:it,random:st,seed:at,paused:lt,suspendWhenHidden:ct,themeDirtyRef:Ot}),zt=function(){const[e,t]=(0,is.useState)(!1);return ss(()=>{t(!0)},[]),e}(),Ht=function(){const e=(0,is.useSyncExternalStore)(as,ls,cs);return(0,is.useRef)(e).current}(),{reducedMotionRef:Et,responsiveRef:$t,size:Yt,currentTheme:Gt,transition:qt,introEnabled:Vt,tableId:Xt,rafRef:Ut,renderFnRef:Kt,scheduleRender:Qt,frameRuntime:Zt}=Dt;let Jt=Dt.margin;if(yt){const e=60,t={...Dt.margin};yt.top&&e>t.top&&(t.top=e),yt.bottom&&e>t.bottom&&(t.bottom=e),yt.left&&e>t.left&&(t.left=e),yt.right&&e>t.right&&(t.right=e),Jt=t}const en=Yt[0]-Jt.left-Jt.right,tn=Yt[1]-Jt.top-Jt.bottom,nn=(0,oe.useMemo)(()=>ue(r),[r]),on=ke??je,[rn,sn]=(0,oe.useState)(0),an=(0,oe.useRef)(0),[ln,cn]=(0,oe.useState)(null),un=Ca(qe,Yt,Jt,ln),hn=Ca(Ge,Yt,Jt,ln),dn=(0,oe.useRef)(null),fn=(0,oe.useRef)(null),pn=(0,oe.useRef)(void 0),[yn,mn]=(0,oe.useState)(null),gn=(0,oe.useRef)(Cl.primary),xn=(0,oe.useRef)(function(){let e=-1,t=ys;return{resolve(n){if(!n)return ys;const o=Jn;return o===e||(t=function(e){if(!e)return ys;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||n||i?{axisStroke:l||ys.axisStroke,tickText:s||ys.tickText,crosshair:s?ms(s,"66"):ys.crosshair,hoverFill:c?ms(c,"4D"):ys.hoverFill,hoverStroke:s?ms(s,"99"):ys.hoverStroke,pointRing:c||ys.pointRing,primary:i||ys.primary,background:c||ys.background}:ys}(n),e=o),t},invalidate(){e=-1}}}()),kn=(0,oe.useRef)(!1),wn=(0,vn.useRef)(new Cn("StreamXYFrame")),[An,Sn]=(0,oe.useState)(!1),[Mn,jn]=(0,oe.useState)([]),[Pn,Ln]=(0,oe.useState)([]),Tn="streaming"===o||["bar","swarm","waterfall"].includes(n),In=function(e){const t=(0,us.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return ds(e,t);if(!fs(e)||!fs(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!ds(n,r))return!1}else{if(!fs(n)||!fs(r))return!1;if(!hs(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,oe.useMemo)(()=>({chartType:n,runtimeMode:Tn?"streaming":"bounded",windowSize:S,windowMode:A,arrowOfTime:Tn?w:"right",extentPadding:j,scalePadding:R,axisExtent:xe,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Tn?M:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p||(y?"_lineGroup":void 0),categoryAccessor:Ke,lineDataAccessor:y,xScaleType:gt,yScaleType:xt,xExtent:C,yExtent:_,sizeRange:P,binSize:v,normalize:g,baseline:x,stackOrder:b,boundsAccessor:q,boundsStyle:V,y0Accessor:X,band:U,gradientFill:Tt(K),areaGroups:J?new Set(J):void 0,lineGradient:It(Q),semanticLineStops:Z,openAccessor:ee,highAccessor:te,lowAccessor:re,closeAccessor:ie,candlestickStyle:se,lineStyle:W,pointStyle:D,areaStyle:z,swarmStyle:$,waterfallStyle:E,colorScheme:G,barColors:Y,barStyle:H,annotations:Le,decay:Je,pulse:et,transition:qt,introAnimation:Vt,staleness:ot,clock:Zt.now,heatmapAggregation:ut,heatmapXBins:ht,heatmapYBins:dt,showValues:ft,heatmapValueFormat:pt,pointIdAccessor:mt,curve:m,themeCategorical:Gt?.colors?.categorical,themeSemantic:me(Gt),themeSequential:Gt?.colors?.sequential,themeDiverging:Gt?.colors?.diverging,customLayout:St,onLayoutError:Mt,layoutConfig:Ct,layoutMargin:Jt}),[n,Tn,S,A,w,j,R,xe,a,l,c,M,k,u,h,d,f,p,y,Ke,gt,xt,C,_,P,v,g,x,b,q,V,X,U,K,J,Q,Z,ee,te,re,ie,se,W,D,z,$,E,G,Y,H,Le,Je,et,qt,Vt,ot,Zt.now,ut,ht,dt,ft,pt,mt,m,Gt,St,Mt,Ct,Jt])),Nn=(0,oe.useRef)(null);Nn.current||(Nn.current=new bn(In));const On=function(e,t,n,o){const r=(0,ja.useRef)({accessor:t,onChange:n,readData:o}),i=(0,ja.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,ja.useCallback)(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?o(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,i.current)||(i.current=s,n(s))},[e])}(Nn,$e,Ye,e=>e.getData());!function(e,t,n,o){(0,Bn.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(Nn,In,Ot,Qt),function(e,t,n,o){const r=(0,Bn.useRef)(null);(0,Bn.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(Nn,_t,Ot,Qt);const Wn=(0,oe.useRef)(null);Wn.current||(Wn.current=new he(e=>{const t=Nn.current;t&&t.ingest(e)&&(Ot.current=!0,Qt())},{chunkThreshold:i,chunkSize:s})),(0,oe.useEffect)(()=>{Wn.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const Dn=(0,oe.useCallback)(e=>{Wn.current?.push(e)},[]),zn=(0,oe.useCallback)(e=>{Wn.current?.pushMany(e)},[]),Hn=(0,oe.useCallback)(()=>{Wn.current?.clear(),Nn.current?.clear(),Ot.current=!0,Qt()},[Qt]);(0,oe.useImperativeHandle)(t,()=>({push:Dn,pushMany:zn,remove:e=>{Wn.current?.flush();const t=Nn.current?.remove(e)??[];return t.length>0&&(dn.current&&t.some(e=>e===dn.current?.data)&&(dn.current=null,mn(null)),Ot.current=!0,Qt()),t},update:(e,t)=>{Wn.current?.flush();const n=Nn.current?.update(e,t)??[];return n.length>0&&(Ot.current=!0,Qt()),n},clear:Hn,getData:()=>(Wn.current?.flush(),Nn.current?.getData()??[]),getScales:()=>Nn.current?.scales??null,getExtents:()=>Nn.current?.getExtents()??null,getCustomLayout:()=>Nn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Nn.current?.lastCustomLayoutFailure??null}),[Dn,zn,Hn,Qt]),(0,oe.useEffect)(()=>{if(r){if(y&&nn.length>0&&"object"==typeof nn[0]&&null!==nn[0]){const e="string"==typeof y?y:"coordinates";if(Array.isArray(nn[0][e])){const t=[];for(const n of nn){const o=n[e];if(Array.isArray(o)){const e=n.label||n.id||n.key;if(null!=e)for(const n of o)t.push({...n,_lineGroup:e});else for(const e of o)t.push(e)}}return void Wn.current?.setBoundedData(t)}}Wn.current?.setBoundedData(nn)}},[r,nn,y]);const{canvasRef:En,interactionCanvasRef:$n}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,Aa.useRef)(null),a=(0,Aa.useRef)(null),l=(0,Aa.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;ss(()=>{const e=o.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():r.current=!0,s?.(),i.current()},[t,n]);const l=(0,is.useRef)(a);l.current=a,(0,is.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,Aa.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,Aa.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(Dt,{storeRef:Nn,dirtyRef:Ot,hydrated:zt,wasHydratingFromSSR:Ht,cleanup:()=>Wn.current?.clear(),canvasPaintDependencies:[n,en,tn,ae,F,Ge,W,B,Ve,Qt]}),{hoverHandlerRef:Gn,hoverLeaveRef:Vn,onPointerMove:Xn,onPointerLeave:Kn}=Dt;Gn.current=e=>{if(!on)return;const t=En.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Jt.left,i=e.clientY-o.top-Jt.top;if(0>r||r>en||0>i||i>tn)return void(dn.current&&(dn.current=null,fn.current=null,mn(null),Rt&&(Rt(null),Ot.current=!0),Qt()));const s=Nn.current;if(!s||0===s.scene.length)return;const l=Vs(Re,e.pointerType),c=Ao(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Pe,h=()=>{dn.current&&(dn.current=null,fn.current=null,mn(null),Rt&&Rt(null),Qt())};if(!c&&!u)return void h();const d=u||!c?r:c.x,f=u||!c?i:c.y,p=c?.datum?jt(c.datum,s.resolvedRibbons):{},y=s.scales?.x?.invert,m="function"==typeof y?y(d):void 0;let g=Us(p,d,f,null!=m?{xValue:m,xPx:d}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=So(wo(e.path,e.curve),t,n);if(null===i)continue;const s=No(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=wo(e.topPath,e.curve),s=wo(e.bottomPath,e.curve),a=So(i,t,n);if(null===a)continue;const l=So(s,t,n),c=No(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(s.scene,d,Math.max(l,en));if(e.length>0){const t=s.scales.y.invert,o=gn.current,r=y?y(d):d;if(c)g.xValue=r,g.xPx=d;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),g=Us(e,d,f,{xValue:r,xPx:d})}g.allSeries=e.map(e=>{const r=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=i?r-i:r,valuePx:e.y,color:e.color||o,datum:jt(e.datum,s.resolvedRibbons)}})}}c||g.allSeries?.length?(dn.current=g,fn.current=c?.node??null,mn(g),Rt&&(Rt(g),Ot.current=!0),Qt()):h()},Vn.current=()=>{dn.current&&(dn.current=null,fn.current=null,mn(null),Rt&&(Rt(null),Ot.current=!0),Qt())};const Qn=(0,oe.useRef)(()=>{});Qn.current=e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Pt)return;const n=En.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Jt.left,i=e.clientY-o.top-Jt.top;if(0>r||r>en||0>i||i>tn)return void Pt(null);const s=Nn.current;if(!s||0===s.scene.length)return void Pt(null);const a=Vs(Re,pn.current),l=Ao(s.scene,r,i,a,s.quadtree,s.maxPointRadius);if(!l)return void Pt(null);const c=l.datum||{},u=s.scales?.x?.invert,h="function"==typeof u?u(l.x):void 0;var d;Pt(Us(c,l.x,l.y,null!=h?{xValue:h,xPx:l.x}:void 0),{type:"activate",inputType:(d=pn.current,"touch"===d?"touch":"pointer")})};const Zn=(0,oe.useCallback)(e=>Qn.current(e),[]),{kbFocusIndexRef:eo,focusedNavPointRef:to,onKeyDown:no}=(ro={storeRef:Nn,hoverRef:dn,hoveredNodeRef:fn,setHoverPoint:mn,customHoverBehavior:Rt,customClickBehavior:Pt,scheduleRender:Qt},function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,kl.useRef)(-1),u=(0,kl.useRef)(null),h=(0,kl.useRef)(null),d=(0,kl.useCallback)(d=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(d))return;const f=e.current;if(!f)return;const p=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||p());let y;if(h.current?.version===f.version)y=h.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||p());y=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),h.current={version:f.version,graph:y}}let m=c.current;if(y.flat.length>m||(p(),m=-1),("Enter"===d.key||" "===d.key)&&m>=0)return d.preventDefault(),void i(l(y.flat[m],f),{type:"activate",inputType:"keyboard"});if(0>m){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const e=y.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void s()}const g=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?wl(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?wl(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(d.key,function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(y,m),y);if(null===g)return;if(d.preventDefault(),0>g)return void p();c.current=g;const x=y.flat[g];u.current=x;const b=l(x,f);t.current=b,o(b),r(b,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...ro,extractPoints:Al,toHover:(e,t)=>function(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}({...e,datum:jt(e.datum,t.resolvedRibbons)})}));var ro;const io=(0,oe.useCallback)(e=>{pn.current=e.pointerType,eo.current=-1,to.current=null,Xn(e)},[to,eo,Xn]),so=(0,oe.useCallback)(e=>{pn.current="mouse",eo.current=-1,to.current=null,Xn({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[to,eo,Xn]),lo=(0,oe.useCallback)(e=>{pn.current=e.pointerType},[]);Kt.current=()=>{if(Ut.current=null,!Zt.isActive)return;const e=En.current,t=$n.current;if(!e||!t)return;const o=Nn.current;if(!o)return;const r=Zt.now(),i=o.advanceTransition(Et.current?r+1e6:r),s=!Et.current&&i,c=Ft.current.w!==en||Ft.current.h!==tn,u=Ot.current||i||c,h=o.consumeStylePaintPending();let d=!1;const f=o.getLastUpdateResult(),p=wn.current.beforeCompute(f,s);!u||s&&!c||(o.computeScene({width:en,height:tn}),Ft.current={w:en,h:tn},d=!0,On()),wn.current.afterCompute(p,d,c);const y=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,d,Bt),m=function(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}(),g=xn.current.resolve(e);gn.current=g.primary;const x=Wo(ot,o.lastIngestTime>0?r-o.lastIngestTime:0),b=ot&&x.isStale;if(u||h||y.changed){const t=_a(e,Yt,Jt,m);if(t){if(t.clearRect(-Jt.left,-Jt.top,Yt[0],Yt[1]),ot&&1>x.alpha&&(t.globalAlpha=x.alpha),function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t,c=ps({background:n,hasBackgroundGraphics:o,themeBackground:r});if(!c)return!1;const u=oo(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:F,hasBackgroundGraphics:!!Ge,themeBackground:g.background,x:-Jt.left,y:-Jt.top,width:Yt[0],height:Yt[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,en,tn),t.clip()),Ve&&o.scales)for(const e of Ve)t.save(),e(t,o.scene,o.scales,{width:en,height:tn}),t.restore();const e=St?rl.custom:rl[n];!function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=sl(o,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(al(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:B,pixelRatio:m,paintBuiltIn:n=>{if(e&&o.scales)for(const r of e)r(t,n,o.scales,{width:en,height:tn})}}),t.restore(),ot&&1>x.alpha&&(t.globalAlpha=1)}}const v=!!(on&&dn.current&&o.scales),k=!!(fn.current&&Array.isArray(ke)&&ke.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=v||k;if(w||kn.current){const e=_a(t,Yt,Jt,m);if(e&&(e.clearRect(-Jt.left,-Jt.top,Yt[0],Yt[1]),v&&dn.current&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,o),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,dn.current,en,tn,"object"==typeof on?on:{},fn.current,g),k&&fn.current&&Array.isArray(ke))){const t=ke.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,r){if(!n)return;const i="group"in n?n.group:void 0;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,o.scene,fn.current,t,g)}kn.current=w}u&&e&&e.setAttribute("aria-label",_s(o.scene,n+" chart"));const A=Ot.current;if(Ot.current=A&&s&&!d,A&&o.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!ln||e(ln.x.domain()[0])!==e(o.scales.x.domain()[0])||e(ln.x.domain()[1])!==e(o.scales.x.domain()[1])||e(ln.y.domain()[0])!==e(o.scales.y.domain()[0])||e(ln.y.domain()[1])!==e(o.scales.y.domain()[1])||ln.x.range()[0]!==o.scales.x.range()[0]||ln.x.range()[1]!==o.scales.x.range()[1]||ln.y.range()[0]!==o.scales.y.range()[0]||ln.y.range()[1]!==o.scales.y.range()[1])&&cn(o.scales),yt){const e=o.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];jn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Ln(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Le&&Le.length>0||St)&&(d||s))||!d&&33>r-an.current||(sn(e=>e+1),an.current=r),ot?.showBadge&&Sn(!!b),(s||null!=o.activeTransition||y.pending)&&Qt()},function(e,t,n,o,r,i){const s=(0,Oo.useRef)("fresh");(0,Oo.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=Wo(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,i,n])}(ot,Nn,Ot,Qt,An,Sn);const co=(0,oe.useMemo)(()=>{if(ye||be)return;const e=Nn.current;return e?.xIsDate&&ln?Ta(ln.x.domain()):void 0},[ye,be,ln]),uo=ye||be||co,fo=on&&yn?we?we(yn):(0,Sl.jsx)(gl,{hover:yn}):null,po=fo?(0,Sl.jsx)(ua,{x:yn.x,y:yn.y,containerWidth:en,containerHeight:tn,margin:Jt,className:"stream-frame-tooltip",children:fo}):null,mo=to.current,go=(0,Sl.jsx)(Gs,{active:eo.current>=0,hoverPoint:yn,margin:Jt,size:Yt,shape:mo?.shape,width:mo?.w,height:mo?.h}),xo=Ra(a,M,"__semiotic_resolvedX","__semiotic_resolvedTime"),bo=Ra(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),vo=xo.key,ko=bo.key,Mo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(xo,bo,Le&&Le.length>0||!1);if(rs||!zt&&Ht){const e=Nn.current;e&&r&&(e.ingest({inserts:nn,bounded:!0}),e.computeScene({width:en,height:tn}));const t=e?.scene??[],n=e?.scales??null,o=Ca(qe,Yt,Jt,n),i=Ca(Ge,Yt,Jt,n),s=uo||(()=>{if(e?.xIsDate&&n)return Ta(n.x.domain())})();return(0,Sl.jsxs)("div",{ref:$t,className:"stream-xy-frame"+(O?" "+O:""),role:"img","aria-label":vt||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:T?"100%":Yt[0],height:I?"100%":Yt[1]},children:[(0,Sl.jsx)(Hs,{summary:kt}),(0,Sl.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Yt[0],height:Yt[1],style:{position:"absolute",left:0,top:0},children:[(0,Sl.jsx)("g",{transform:`translate(${Jt.left},${Jt.top})`,children:i}),(0,Sl.jsxs)("g",{transform:`translate(${Jt.left},${Jt.top})`,children:[F&&(0,Sl.jsx)("rect",{x:0,y:0,width:en,height:tn,fill:F}),Xe&&n&&Xe.map((e,o)=>(0,Sl.jsx)(ne.Fragment,{children:e(t,n,{width:en,height:tn})},"svgpre-"+o)),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=sl(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(al(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:B,fallback:()=>function(e,t,n){switch(e.type){case"line":{const o=e;if(0===o.path.length)return null;const r=yo(o.curve),i=r?(0,Xi.line)().x(([e])=>e).y(([,e])=>e).curve(r)(o.path)??"":"M"+o.path.map(([e,t])=>`${e},${t}`).join("L"),s=es(`${n?n+"-":""}line-${t}-stroke-gradient`),a=os(o.strokeGradient,o.path,s,o.style.stroke||"#4e79a7");return(0,ns.jsxs)(Vi.Fragment,{children:[a&&(0,ns.jsx)("defs",{children:a}),(0,ns.jsx)("path",{d:i,fill:"none",stroke:a?`url(#${s})`:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})]},"line-"+t)}case"area":{const o=e;if(0===o.topPath.length)return null;const r=yo(o.curve),i=!r||2>o.topPath.length||2>o.bottomPath.length?`M${o.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...o.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:(0,Xi.area)().x(([e])=>e).y0((e,t)=>o.bottomPath[t][1]).y1(([,e])=>e).curve(r)(o.topPath)??"",s=`${n?n+"-":""}area-${t}-hatch`,a=ao(o.style.fill)?ho(o.style.fill,s):void 0,l=es(`${n?n+"-":""}area-${t}-gradient`),c=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let o=1/0;for(const[,t]of e.topPath)o=Math.min(o,t);let r=-1/0;for(const[,t]of e.bottomPath)r=Math.max(r,t);if(!Number.isFinite(o)||!Number.isFinite(r))return null;const i=ts(n.stops,Ji(e.style.fill));return i?(0,ns.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:o,x2:0,y2:r,children:i}):null}(o,l),u=c?`url(#${l})`:a?`url(#${s})`:Ji(o.style.fill),h=c?void 0:o.style.fillOpacity??o.style.opacity??.7,d=r?(0,Xi.line)().x(([e])=>e).y(([,e])=>e).curve(r)(o.topPath)??"":"M"+o.topPath.map(([e,t])=>`${e},${t}`).join("L"),f=es(`${n?n+"-":""}area-${t}-stroke-gradient`),p=!(!o.colorThresholds?.length||!o.rawValues||o.rawValues.length!==o.topPath.length),y=!!o.strokeColorBands?.length,m=p||y?null:os(o.strokeGradient,o.topPath,f,o.style.stroke||"#4e79a7"),g=o.style.strokeWidth||2;let x=1/0,b=-1/0;for(const[e]of o.topPath)x>e&&(x=e),e>b&&(b=e);const v=y?o.strokeColorBands.map((e,o)=>es(`${n?n+"-":""}area-${t}-stroke-band-${o}`)):[],k=y?o.strokeColorBands.map((e,t)=>(0,ns.jsx)("clipPath",{id:v[t],children:(0,ns.jsx)("rect",{x:x-g,y:e.y,width:b-x+2*g,height:e.height})},v[t])):null,w=o.style.stroke&&"none"!==o.style.stroke?y?o.strokeColorBands.map((e,n)=>(0,ns.jsx)("path",{d:d,fill:"none",stroke:e.color??Ji(o.style.stroke),strokeWidth:g,opacity:o.style.opacity,clipPath:`url(#${v[n]})`},`area-${t}-stroke-band-${n}`)):p?Ki(o.topPath,o.rawValues,o.colorThresholds,Ji(o.style.stroke)).map((e,n)=>(0,ns.jsx)("path",{d:"M"+e.path.map(([e,t])=>`${e},${t}`).join("L"),fill:"none",stroke:e.color,strokeWidth:g,opacity:o.style.opacity},`area-${t}-threshold-${n}`)):(0,ns.jsx)("path",{d:d,fill:"none",stroke:m?`url(#${f})`:Ji(o.style.stroke),strokeWidth:g,opacity:o.style.opacity}):null;if(o.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return(0,ns.jsxs)("g",{children:[(0,ns.jsxs)("defs",{children:[c,!c&&a,m,k,(0,ns.jsx)("clipPath",{id:e,children:(0,ns.jsx)("rect",{x:o.clipRect.x,y:o.clipRect.y,width:o.clipRect.width,height:o.clipRect.height})})]}),(0,ns.jsxs)("g",{clipPath:`url(#${e})`,children:[(0,ns.jsx)("path",{d:i,fill:u,fillOpacity:h,opacity:c?o.style.opacity:void 0,stroke:"none"}),w]})]},"area-"+t)}return(0,ns.jsxs)(Vi.Fragment,{children:[(c||a||m||k)&&(0,ns.jsxs)("defs",{children:[c,!c&&a,m,k]}),(0,ns.jsx)("path",{d:i,fill:u,fillOpacity:h,opacity:c?o.style.opacity:void 0,stroke:"none"}),w]},"area-"+t)}case"point":{const o=e,r=`${n?n+"-":""}point-${t}-hatch`,i=ao(o.style.fill)?ho(o.style.fill,r):void 0;return(0,ns.jsxs)(Vi.Fragment,{children:[i&&(0,ns.jsx)("defs",{children:i}),(0,ns.jsx)("circle",{cx:o.x,cy:o.y,r:o.r,fill:i?`url(#${r})`:Ji(o.style.fill),opacity:o.style.opacity??o.style.fillOpacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"point-"+t)}case"symbol":return function(e,t){const n=Wt(e.symbolType,e.size,e.path);return(0,Zi.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Ji(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"symbol-"+t)}(e,t);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=Yn(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=Un(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?es(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),h=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:qn(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:qn(n.stroke??"none",a,e.accent);return r||i?(0,Zi.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,Zi.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Zi.jsx)("clipPath",{id:c,children:(0,Zi.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Zi.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,Zi.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const o=e,r=`${n?n+"-":""}xyrect-${t}-hatch`,i=ao(o.style.fill)?ho(o.style.fill,r):void 0;return(0,ns.jsxs)(Vi.Fragment,{children:[i&&(0,ns.jsx)("defs",{children:i}),(0,ns.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:i?`url(#${r})`:Ji(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e,o={x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth,...null!=n.style?.opacity&&{opacity:n.style.opacity}};if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[r,i,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),a=.299*r+.587*i+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return(0,ns.jsxs)("g",{children:[(0,ns.jsx)("rect",{...o}),(0,ns.jsx)("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:e})]},"heatcell-"+t)}return(0,ns.jsx)("rect",{...o},"heatcell-"+t)}case"candlestick":{const n=e;if(n.isRange){const e=n.dotRadius??Math.max(2,n.bodyWidth/2);return(0,ns.jsxs)("g",{children:[(0,ns.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,ns.jsx)("circle",{cx:n.x,cy:n.highY,r:e,fill:n.wickColor}),(0,ns.jsx)("circle",{cx:n.x,cy:n.lowY,r:e,fill:n.wickColor})]},"candle-"+t)}const o=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return(0,ns.jsxs)("g",{children:[(0,ns.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,ns.jsx)("rect",{x:n.x-n.bodyWidth/2,y:o,width:n.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,Nt)})).filter(Boolean)]})]}),(0,Sl.jsx)(qi,{width:en,height:tn,totalWidth:Yt[0],totalHeight:Yt[1],margin:Jt,scales:n,showAxes:ae,axes:ce,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:s,yFormat:ge||ve,axisExtent:xe,showGrid:Oe,title:Ue,legend:Fe,legendHoverBehavior:Be,legendClickBehavior:We,legendHighlightedCategory:De,legendIsolatedCategories:ze,legendPosition:He,legendLayout:Ee,foregroundGraphics:Rn(o,Fn(Nn.current?.customLayoutOverlays,_t??null)),marginalGraphics:yt,xValues:[],yValues:[],annotations:Le,onAnnotationActivate:Te,onObservation:Ce??Me,chartId:_e,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Ne,annotationFrame:0,xAccessor:vo,yAccessor:ko,annotationData:Mo(Nn.current?.getData()),pointNodes:Ia(Nn.current?.scene),curve:"string"==typeof m?m:void 0,linkedCrosshairName:wt,linkedCrosshairSourceId:At})]})}return(0,Sl.jsxs)("div",{ref:$t,className:"stream-xy-frame"+(O?" "+O:""),role:"group","aria-label":vt||("string"==typeof Ue?Ue:"XY chart"),tabIndex:0,style:{position:"relative",width:T?"100%":Yt[0],height:I?"100%":Yt[1],overflow:"visible",touchAction:_l(Qe)},onKeyDown:no,children:["production"!==process.env.NODE_ENV&&Nn.current&&(0,Sl.jsx)(_n,{store:Nn.current,diagnostics:wn.current}),bt&&(0,Sl.jsx)(Es,{tableId:Xt}),bt&&(0,Sl.jsx)(zs,{scene:Nn.current?.scene??[],chartType:n+" chart",tableId:Xt,chartTitle:"string"==typeof Ue?Ue:void 0}),(0,Sl.jsx)(Hs,{summary:kt}),(0,Sl.jsx)(ws,{hoverPoint:yn}),(0,Sl.jsxs)("div",{role:"img","aria-label":vt||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:on?io:void 0,onMouseMove:on?so:void 0,onPointerLeave:on?Kn:void 0,onMouseLeave:on?Kn:void 0,onPointerDown:on||Lt?lo:void 0,onClick:Lt?Zn:void 0,children:[(0,Sl.jsx)(Ma,{size:Yt,margin:Jt,children:hn}),(0,Sl.jsx)($i,{width:en,height:tn,totalWidth:Yt[0],totalHeight:Yt[1],margin:Jt,scales:ln,showAxes:ae,axes:ce,showGrid:Oe,xFormat:uo,yFormat:ge||ve,axisExtent:xe}),(0,Sl.jsx)("canvas",{ref:En,"aria-label":_s(Nn.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),(0,Sl.jsx)("canvas",{ref:$n,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Sl.jsx)(qi,{width:en,height:tn,totalWidth:Yt[0],totalHeight:Yt[1],margin:Jt,scales:ln,showAxes:ae,axes:ce,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:uo,yFormat:ge||ve,axisExtent:xe,showGrid:Oe,title:Ue,legend:Fe,legendHoverBehavior:Be,legendClickBehavior:We,legendHighlightedCategory:De,legendIsolatedCategories:ze,legendPosition:He,legendLayout:Ee,foregroundGraphics:Rn(un,Fn(Nn.current?.customLayoutOverlays,_t??null)),marginalGraphics:yt,xValues:Mn,yValues:Pn,annotations:Le,onAnnotationActivate:Te,onObservation:Ce??Me,chartId:_e,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Ne,annotationFrame:rn,xAccessor:vo,yAccessor:ko,annotationData:Mo(Nn.current?.getData()),pointNodes:Ia(Nn.current?.scene),curve:"string"==typeof m?m:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!ps({background:F,hasBackgroundGraphics:!!Ge,themeBackground:Gt?.colors.background}),linkedCrosshairName:wt,linkedCrosshairSourceId:At}),(Qe||Ze)&&(0,Sl.jsx)(le,{width:en,height:tn,totalWidth:Yt[0],totalHeight:Yt[1],margin:Jt,dimension:Qe?.dimension??"xy",scales:ln,onBrush:Ze??(()=>{}),binSize:v,snap:Qe?.snap,binBoundaries:Qe?.binBoundaries??("bar"===n?Nn.current?.getBinBoundaries():void 0),snapDuring:Qe?.snapDuring,streaming:"streaming"===o}),ot?.showBadge&&(0,Sl.jsx)(zo,{isStale:An,position:ot.badgePosition}),go,po]})]})}));jl.displayName="StreamXYFrame";var Rl=jl,Pl=require("react"),Ll=require("react"),Tl=require("react"),Il=require("react/jsx-runtime"),Nl=(0,Tl.createContext)(null);function Ol({colors:e,categories:t,colorScheme:n="category10",children:o}){const r=(0,Tl.useMemo)(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,o={};let r=0;for(const n of t)o[n]=st(e,n)??tt[r++%tt.length];return o}const e=Array.isArray(n)?n:et[n]||tt,o={};for(let n=0;t.length>n;n++)o[t[n]]=e[n%e.length];return o}return{}},[e,t,n]);return(0,Il.jsx)(Nl.Provider,{value:r,children:o})}function Fl(){return(0,Tl.useContext)(Nl)}function Bl(e){return e?"string"==typeof e?{name:e}:e:null}Ol.displayName="CategoryColorProvider";var Wl=.5;function Dl(e,t,n){return t?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??Wl;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var zl=require("react");function Hl(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function El(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function $l(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Yl,Gl]=pe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!$l(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=El(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=El(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}}));function ql(e){const t=(0,zl.useId)(),n=e.clientId||t,{name:o}=e,r=Gl(e=>e.selections.get(o)),i=Gl(e=>e.setClause),s=Gl(e=>e.clearClause),a=(0,zl.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,zl.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Hl(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,zl.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,zl.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,zl.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function Vl(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Xl(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=ql({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,zl.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&Vl(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Vl(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Ul(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,zl.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function Ul(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Kl=y(require("react"));function Ql(){return Se(e=>e.theme)}function Zl(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Jl(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function ec(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>Jl(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])Zl(e[o])&&Zl(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}require("react/jsx-runtime"),Kl.createContext(void 0);var tc=44,nc={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:tc,snap:"nearestDatum",brushHandleSize:tc,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function oc(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return nc;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??tc,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??tc,standardControls:a.standardControls??!1}}var rc={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}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function ic(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function sc(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function ac(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function lc(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var cc=require("react"),uc=require("react"),hc=require("react/jsx-runtime"),dc=(0,uc.createContext)(!1),fc=(0,uc.createContext)(!1),pc=(0,uc.createContext)(null),yc="undefined"==typeof window?uc.useEffect:uc.useLayoutEffect;function mc(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function gc(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}var xc="__linked-legend-isolate__",bc="__linked-legend-highlight__";function vc({categoryColors:e,interaction:t,selectionName:n,field:o}){const r=Object.entries(e),i=r.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=ql({name:n,fields:[o],clientId:xc}),{selectPoints:c,clear:u}=ql({name:n,fields:[o],clientId:bc}),h=Gl(e=>e.selections.get(n)),{isolatedCategories:d,highlightedCategory:f}=(0,uc.useMemo)(()=>{const e=new Set;let t=null;const n=h?.clauses.get(xc)?.fields[o];if("point"===n?.type)for(const t of n.values)e.add(t+"");const r=h?.clauses.get(bc)?.fields[o];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[h,o]),p=(0,uc.useCallback)(e=>{"highlight"===t&&(e?c({[o]:[e.label]}):u())},[t,o,c,u]),y=(0,uc.useCallback)(e=>{if("isolate"!==t)return;const n=new Set(d);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():a({[o]:Array.from(n)})},[t,o,d,i.length,a,l]),[m,[g]]=ya([0,0],!0,!1),x=(0,uc.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(r.map(([e])=>e),g),[r,g]);return 0===r.length?null:(0,hc.jsx)("div",{ref:m,style:{width:"100%",display:"block"},children:(0,hc.jsx)("svg",{width:"100%",height:Math.max(30,22*x+8),style:{display:"block",overflow:"visible"},children:(0,hc.jsx)(xr,{legendGroups:s,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?y:void 0,highlightedCategory:f,isolatedCategories:d})})})}function kc({children:e,selections:t,showLegend:n,legendPosition:o="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,uc.useMemo)(()=>{if(!t)return;const e=new Map;for(const[n,o]of Object.entries(t))o.resolution&&e.set(n,{name:n,resolution:o.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=Fl(),[c,u]=(0,uc.useState)({}),h=(0,uc.useRef)({}),d=(0,uc.useMemo)(()=>({registerCategories:(e,t)=>{const n=mc(t);u(t=>gc(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=(0,uc.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return mc(e)},[c]),p=(0,uc.useMemo)(()=>{const e=l??{},t=h.current;let n=Object.keys(e).length+Object.keys(t).length;for(const o of f)e[o]||t[o]||(t[o]=tt[n%tt.length],n++);const o={...e};for(const n of f)o[n]=e[n]??t[n];return o},[l,f]),y=void 0===n||n,m=Object.keys(p).length>0;return(0,hc.jsx)(Yl,{initialState:a,children:(0,hc.jsx)(Zr,{children:(0,hc.jsx)(fc.Provider,{value:!0,children:(0,hc.jsx)(pc.Provider,{value:d,children:(0,hc.jsx)(Ol,{colors:p,children:(0,hc.jsxs)(dc.Provider,{value:y&&m,children:[y&&"top"===o&&(0,hc.jsx)(vc,{categoryColors:p,interaction:r,selectionName:i,field:s}),e,y&&"bottom"===o&&(0,hc.jsx)(vc,{categoryColors:p,interaction:r,selectionName:i,field:s})]})})})})})})}function wc({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:l,chartWidth:c,legendLayout:u,hasTitle:h=!1,axisChrome:d}){const f=(0,uc.useContext)(dc),p=null!==(0,uc.useContext)(pc),y=void 0!==o?o:!f&&!!t,m=!!t&&(y||p),g=(0,cc.useMemo)(()=>{if(!m)return[];if(void 0!==a)return a;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,m]);!function(e){const t=(0,uc.useContext)(pc),n=(0,uc.useId)(),o=mc(e),r=(0,uc.useRef)([]);gc(r.current,o)||(r.current=o);const i=r.current;yc(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),yc(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(p&&t?g:[]);const x=(0,cc.useMemo)(()=>{if(!y||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):ot[i%ot.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:it,categories:g});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[y,t,e,n,g]),b=(0,cc.useMemo)(()=>$o(x,l),[x,l]),{hasAxis:v,hasAxisLabel:k,rotatedTicks:w}=d??{},A=(0,cc.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];if(b){const e=function(e,t){return Jo(e,t)+er(e)+tr(t)}(b,u),t=void 0===v?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:v,hasAxisLabel:k,rotatedTicks:w},i=ar(b,Math.max(1,(c??600)-n.left-n.right),u)+er(b)+ir("bottom"===r?t:void 0,u)+("top"===r&&h?24:0);"right"===r&&!o("right")&&e>n.right?n.right=e:"left"===r&&!o("left")&&e>n.left?n.left=e:"top"!==r||o("top")?"bottom"!==r||o("bottom")||(n.bottom=Math.max(n.bottom,80,i)):n.top=Math.max(n.top,50,i)}return n},[s,i,b,r,c,u,h,v,k,w]);return{legend:b,margin:A,legendPosition:r}}function Ac(e,t,n){const[o,r]=(0,cc.useState)(null),[i,s]=(0,cc.useState)(new Set),a=(0,cc.useMemo)(()=>new Set,[]),l=(0,cc.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,cc.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,cc.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var Sc=[];function Mc(){const e=Ql(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Cc(e,t,n,o,r){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=st(n,o);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=et[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:nt}function _c(e,t,n){const o=Fl(),r=Mc();return(0,Ll.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&lc(i)){const e=at(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return at(n.map(e=>({_cat:e})),"_cat",s)}if(i&&lc(i)){const n=at(e,t,s);return e=>i[e]||n(e)}return at(e,t,s)}if(i&&lc(i)){const e=at([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}function jc({selection:e,linkedHover:t,fallbackFields:n=Sc,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,Ll.useId)(),d=(0,Ll.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,Ll.useMemo)(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n,[d,c,n]),p=ql({name:e?.name||"__unused__",fields:f}),y=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=ql({name:t,fields:n});return{onHover:(0,zl.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Ul(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:d?.name||"hover",fields:f}),m=Jr(e=>e.pushObservation),g=(0,Ll.useCallback)(e=>{r?.(e),m?.(e)},[r,m]),x=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,v]=(0,Ll.useState)(null),k=(0,Ll.useRef)(!1),w=c||n[0],A=(0,Ll.useMemo)(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,w]),S=(0,Ll.useCallback)((e,n)=>{const o=!e&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===d?.mode&&d.xField){const n=sc(e,t,d.xField);null!=n&&function(e,t,n){const o=Ci.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(Ci={positions:new Map(Ci.positions).set(e,{xValue:t,sourceId:n})},ji())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&y.onHover(t)}else"x-position"!==d?.mode||o||Ri(d.name||"hover",h),"x-position"===d?.mode||o||y.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else o||v(null);(r||m)&&xl({onObservation:g,datum:e?ac(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,y,d,h,r,i,s,m,g,l,w,u]),M=(0,Ll.useCallback)((n=!0)=>{k.current=!1,t&&"x-position"!==d?.mode&&y.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&v(null),"x-position"===d?.mode&&(Pi(d.name||"hover",h),Ri(d.name||"hover",h))},[t,d,y,e,u,p,l,h]),C=(0,Ll.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=sc(n,e,d.xField);null!=t&&function(e,t,n){const o=Ci.positions.get(e);if(o?.locked){const t=new Map(Ci.positions);return t.delete(e),Ci={positions:t},ji(),!1}Ci={positions:new Map(Ci.positions).set(e,{xValue:t,sourceId:n,locked:!0})},ji()}(d.name||"hover",t,h)}if(c)if(n){k.current=!0;const o=ac(n);if(t&&"x-position"!==d?.mode&&y.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}lc(e)&&p.selectPoints(e)}if(l&&w){const e=o?.[w];v(null!=e?e+"":null)}}else x&&M();if(n||x){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(r||m)&&bl({onObservation:g,datum:n?ac(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,m,g,i,s,d,h,u,t,y,e,p,f,l,w,M]);return(0,Ll.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,Ll.useEffect)(()=>()=>{k.current&&M(!1)},[M]),(0,Ll.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{Pi(e,h),Ri(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:A,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:h}}function Rc(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Pc(e,t,n){return function(e,t,n){const o=rc[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=ec({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e||"primary",l=rc[a],c="context"===a||"sparkline"===a,u="primary"===a&&n?.width?n.width:l.width;return{mode:a,width:s.width??u,height:s.height??("primary"===a&&n?.height?n.height:l.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:ic(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:oc(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}var Lc=require("react/jsx-runtime");function Tc({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,Lc.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,Lc.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,Lc.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,Lc.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,Lc.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var Ic=y(require("react")),Nc=require("react/jsx-runtime"),Oc=class extends Ic.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(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:(0,Nc.jsx)(Tc,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},Fc=require("react/jsx-runtime"),Bc="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Wc({componentName:e,width:t,height:n,children:o}){return(0,Fc.jsx)(Oc,{fallback:o=>(0,Fc.jsx)(Tc,{componentName:e,message:o.message,width:t,height:n}),children:o})}var Dc={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},zc={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Hc(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,Fc.jsx)("div",{style:{...Dc,width:t,height:n},children:o||"No data available"}):null}function Ec(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,Fc.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,Fc.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,Fc.jsx)("div",{className:"semiotic-loading-bar",style:{...zc,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function $c(e,t,n,o){if(!Bc)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Yc(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Gc(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=Yc(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function qc(e){return` Or use a function: ${e}={d => d.myValue}.`}function Vc({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"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(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";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[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Gc(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`+qc(r)}}}return null}var Xc=require("react"),Uc=require("react");function Kc(e){const t=Se(e=>e.theme.colors.selectionOpacity);return(0,Uc.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function Qc(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,legend:y,legendLayout:m,userMargin:g,marginDefaults:x,onClick:b,hoverHighlight:v,mobileInteraction:k,mobileSemantics:w,loading:A,loadingContent:S,emptyContent:M,width:C,height:_,hasTitle:j,axisChrome:R}=e,P=void 0===n,L=(0,Xc.useMemo)(()=>ue(t),[t]),[T,I]=(0,Xc.useState)([]),N=(0,Xc.useCallback)(e=>{I(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),O="string"==typeof e.colorBy?e.colorBy:void 0,F=(0,Xc.useMemo)(()=>oc(k,{width:C,mobileSemantics:w}),[k,C,w]),{activeSelectionHook:B,hoverSelectionHook:W,customHoverBehavior:D,customClickBehavior:z,crosshairSourceId:H}=jc({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:b,hoverHighlight:v,colorByField:O,mobileInteraction:F}),E=Rc(l,H),$=_c(L,o,r),Y=(0,Xc.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of L){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[L,o]),G=(0,Xc.useMemo)(()=>P&&T.length>0?T:Y,[P,T,Y]),q=Ac(i,o,G),V=(0,Xc.useMemo)(()=>W||(q.legendSelectionHook?q.legendSelectionHook:B),[W,q.legendSelectionHook,B]),X=Kc(a),U=Mc(),K=Fl(),Q=(0,Xc.useMemo)(()=>{if($)return $;if(!o||0===G.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:U&&U.length>0?U:ot,t="__streamCat",n=at(G.map(e=>({[t]:e})),t,e);return e=>K?.[e]||n(e)||"#999"},[$,o,G,r,U,K]),{legend:Z,margin:J,legendPosition:ee}=wc({data:L,colorBy:o,colorScale:Q,showLegend:p,legendPosition:s,userMargin:g,defaults:x,categories:G,additionalLegend:y,chartWidth:C,legendLayout:m,hasTitle:j,axisChrome:R}),te=(0,Xc.useMemo)(()=>{const e={};return Z&&(e.legend=Z,e.legendPosition=ee,m&&(e.legendLayout=m)),i&&"none"!==i&&(e.legendHoverBehavior=q.onLegendHover,e.legendClickBehavior=q.onLegendClick,e.legendHighlightedCategory=q.highlightedCategory,e.legendIsolatedCategories=q.isolatedCategories),P&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=N),e},[Z,ee,m,i,q.onLegendHover,q.onLegendClick,q.highlightedCategory,q.isolatedCategories,P,o,N]),ne=Array.isArray(n)?ue(n):n,oe=Ec(A,C,_,S),re=oe?null:Hc(ne,C,_,M);return{data:L,colorScale:$,allCategories:G,legendState:q,effectiveSelectionHook:V,activeSelectionHook:B,customHoverBehavior:D,customClickBehavior:z,mobileInteraction:F,legend:Z,margin:J,legendPosition:ee,earlyReturn:oe||re||null,legendBehaviorProps:te,crosshairProps:E,resolvedSelection:X}}var Zc=require("react");function Jc(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function eu(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>nu(t(e))}function tu(e,t){const n=eu(e),o=eu(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function nu(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function ou(e,t,n){const o=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&o!==e.eq)return!1;if(void 0!==e.ne&&o===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(o))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=nu(o);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>r||r>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(r>=t&&n>=r)return!1}return!0}function ru(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):ou(o,t,n))}function iu(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!ru(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function su(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=o(e),a={...r(e,i)};return Object.assign(a,iu(s,t,n(s,i))),a}:r}function au(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,styleRules:f,ruleContext:p}=e,y=(0,Zc.useMemo)(()=>function(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,styleRules:l,ruleContext:c}=e;return(e,u)=>{const h={strokeWidth:t},d=!0===s||Array.isArray(s)&&null!=u&&s.includes(u);let f;return i?f=i(e,u):n?o&&(f=it(e,n,o)):f=r||nt,void 0!==f&&(h.stroke=f,d&&(h.fill=f,h.fillOpacity=a)),l?.length&&Object.assign(h,iu(e,l,c?c(e,u):{value:void 0,category:u})),h}}({lineWidth:t,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a,styleRules:f,ruleContext:p}),[t,n,o,r,i,s,a,f,p]),m=(0,Zc.useMemo)(()=>Jc(y,{stroke:l,strokeWidth:c,opacity:u}),[y,l,c,u]);return(0,Zc.useMemo)(()=>Dl(m,h??null,d),[m,h,d])}var lu=require("react");function cu(e,t){const{variant:n,frameRef:o,overrides:r}=t,i=(0,lu.useRef)(r);i.current=r,(0,lu.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return new Proxy(e,{get(e,t,n){if("string"==typeof t){const e=i.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,n)},has:(e,t)=>!("string"!=typeof t||!i.current||!(t in i.current))||Reflect.has(e,t)})},[])}function uu(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function hu(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={};o&&(f.annotationObservationCallback=o);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}function du(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:la(t)||n}}var fu="__forecastSegment",pu=null;async function yu(){return pu||(pu=await Promise.resolve().then(()=>(E(),L))),pu}var mu=require("react"),gu="__semiotic_resolvedX",xu="__semiotic_resolvedY";function bu(e){const{data:t,xAccessor:n,yAccessor:o,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof n?n:gu,l="string"==typeof o?o:xu,c=(0,mu.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof n,s="function"==typeof o;return e||s?t.map(t=>{const r={...t};return e&&(r[gu]=n(t)),s&&(r[xu]=o(t)),r}):t},[t,r,i,n,o]),[u,h]=(0,mu.useState)(null),[d,f]=(0,mu.useState)([]),p=(0,mu.useRef)(r),y=(0,mu.useRef)(i);return(0,mu.useEffect)(()=>{if(!r&&!i)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=i));let e=!1;const t=r!==p.current||i!==y.current;if(p.current=r,y.current=i,t&&(h(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await yu()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else i&&async function(...e){return(await yu()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:d,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var vu=require("react/jsx-runtime"),ku="__lineObjectSeries",wu=(0,Pl.forwardRef)(function(e,t){const n=(0,Pl.useRef)(null);cu(t,{variant:"xy",frameRef:n});const o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:h="y",lineBy:d,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,styleRules:m,curve:g="linear",showPoints:x=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:A,tooltip:S,pointIdAccessor:M,annotations:C,directLabel:_,gapStrategy:j="break",anomaly:R,forecast:P,band:L,xExtent:T,yExtent:I,frameProps:N={},selection:O,linkedHover:F,onObservation:B,onClick:W,hoverHighlight:D,hoverRadius:z,chartId:H,loading:E,loadingContent:$,emptyContent:Y,legendInteraction:G,legendPosition:q,legend:V,xScaleType:X,yScaleType:U,color:K,stroke:Q,strokeWidth:Z,opacity:J}=e,{legend:ee,...te}=N,ne=(0,Pl.useMemo)(()=>$o(ee,V),[ee,V]),{width:oe,height:re,enableHover:ie,showGrid:se,showLegend:ae,title:le,description:ce,summary:he,accessibleTable:de,xLabel:fe,yLabel:pe}=o,ye=(0,Pl.useMemo)(()=>ue(r),[r]),me=Array.isArray(ye[0]?.[f])?ye[0][f]:ye;$c("LineChart",me,"xAccessor",u),$c("LineChart",me,"yAccessor",h);const{effectiveData:ge,statisticalAnnotations:xe}=bu({data:ye,xAccessor:u,yAccessor:h,forecast:P,anomaly:R,groupBy:d}),be="__compoundGroup",ve=!(!P||!d),ke=ve?be:P?fu:d,we=(0,Pl.useMemo)(()=>{if(!ve)return ge;const e="function"==typeof d?d:e=>e[d];return ge.map(t=>{const n={...t};return n[be]=`${e(t)}__${t[fu]||"observed"}`,n})},[ge,ve,d]),Ae=ve?we:ge,Se=p||d,Me=(0,Pl.useMemo)(()=>{if(!P)return;const e=P.upperBounds,t=P.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=ge;for(const e of s){const t="function"==typeof h?h(e):+e[h];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[P,ge,h]),Ce=(0,Pl.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],n="function"==typeof h?h(e):e[h];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[u,h]),_e=void 0!==Ae[0]?.[f],je=_e?ku:ke,Re=(0,Pl.useMemo)(()=>{if(_e)return Ae.map((e,t)=>{const n="function"==typeof d?d(e):"string"==typeof d?e[d]:void 0,o=null==n?"line-"+t:n+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[ku]:o,[f]:r.map(t=>({...t,[ku]:o,parentLine:e,..."string"==typeof d&&void 0!==e[d]?{[d]:e[d]}:{}}))}});if(ke){const e=Ae.reduce((e,t)=>{const n="function"==typeof ke?ke(t):t[ke];if(!e[n]){const o={[f]:[]};"string"==typeof ke&&(o[ke]=n),ve&&(o[fu]=t[fu],"string"==typeof d&&(o[d]=t[d])),e[n]=o}return e[n][f].push(t),e},{});return Object.values(e)}return[{[f]:Ae}]},[_e,ke,f,Ae,d,ve]),{gapProcessedLineData:Pe,hasGaps:Le}=(0,Pl.useMemo)(()=>{if("interpolate"===j){let e=!1;const t=[];for(const n of Re){const o=(n[f]||[]).filter(t=>!Ce(t)||(e=!0,!1));o.length>0&&t.push({...n,[f]:o})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===j){let e=!1;const t=[];for(const n of Re){const o=n[f]||[];let r=[],i=0;const s=je&&"string"==typeof je?n[je]:void 0;for(const a of o)if(Ce(a))e=!0,r.length>0&&(t.push({...n,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...n,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===j){let e=!1;const t="string"==typeof h?h:"y",n=[];for(const o of Re){const r=o[f]||[],i=[];for(const n of r)Ce(n)?(e=!0,i.push({...n,[t]:0})):i.push(n);n.push({...o,[f]:i})}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Re,hasGaps:!1}},[Re,j,f,Ce,je,h]),Te="object"==typeof _?_:{},Ie=Te.position||"end",Ne=Te.fontSize||11,Oe=(0,Pl.useMemo)(()=>{if(!_||!Se)return[];const e="function"==typeof Se?Se:e=>e[Se],t=new Set;for(const n of Pe){const o=n[f]||[];if(0===o.length)continue;const r=e("end"===Ie?o[o.length-1]:o[0])??e(n);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[_,Se,Pe,f,Ie]),Fe=(0,Pl.useMemo)(()=>{if(!_)return o.marginDefaults;const e=Oe.reduce((e,t)=>Math.max(e,t.length*(.6*Ne)),0)+10,t="end"===Ie?"right":"left";return{...o.marginDefaults,[t]:Math.max(o.marginDefaults[t]||0,e)}},[_,Oe,Ne,Ie,o.marginDefaults]),Be=Qc({data:ge,rawData:r,colorBy:Se,colorScheme:y,legendInteraction:G,legendPosition:q,selection:O,linkedHover:F,fallbackFields:Se?["string"==typeof Se?Se:""]:[],unwrapData:!1,onObservation:B,onClick:W,hoverHighlight:D,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LineChart",chartId:H,showLegend:(!_||void 0!==ae)&&ae,legend:ne,userMargin:i,marginDefaults:Fe,loading:E,loadingContent:$,emptyContent:Y,width:oe,height:re,hasTitle:!!le,axisChrome:sr({showAxes:o.showAxes,xLabel:fe})}),We=Be.colorScale,De=Be.effectiveSelectionHook,ze=Be.resolvedSelection,He=Be.customHoverBehavior,Ee=Be.customClickBehavior,$e=Be.crosshairProps,Ye=(0,Pl.useMemo)(()=>{if(Se)return _e?e=>{const t=e.parentLine||e;return"function"==typeof Se?Se(t):t[Se]}:Se},[Se,_e]),Ge=(0,Pl.useMemo)(()=>tu(u,h),[u,h]),qe=au({lineWidth:w,colorBy:Ye,colorScale:We,color:K,fillArea:v,areaOpacity:k,stroke:Q,strokeWidth:Z,opacity:J,effectiveSelectionHook:De,resolvedSelection:ze,styleRules:m,ruleContext:Ge}),[Ve,Xe]=(0,Pl.useState)(null);(0,Pl.useEffect)(()=>{if(!P)return void Xe(null);let e=!1;return async function(...e){return(await yu()).createSegmentLineStyle(...e)}(qe,P).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[qe,P]);const Ue=Ve||qe,Ke=(0,Pl.useMemo)(()=>{if(x)return e=>{const t={r:b,fillOpacity:1};return Se?We&&(t.fill=it(e.parentLine||e,Se,We)):t.fill=K||nt,t}},[x,b,Se,We,K]),Qe=Array.isArray(v)?"mixed":v?"area":"line",Ze=(0,Pl.useMemo)(()=>{if(!_||!Se)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof h?h:e=>e[h],n="function"==typeof Se?Se:e=>e[Se],o=new Map;for(const e of Pe){const t=e[f]||[];if(0===t.length)continue;const r="end"===Ie?t[t.length-1]:t[0],i=n(r)??n(e);if(null==i)continue;const s=i+"";""===s||o.has(s)||o.set(s,r)}const r=Array.from(o.entries()).map(([n,o])=>({type:"text",label:n,["string"==typeof u?u:"x"]:e(o),["string"==typeof h?h:"y"]:t(o),dx:"end"===Ie?6:-6,dy:0,color:We?We(n):nt,fontSize:Ne}));r.sort((e,t)=>{const n="string"==typeof h?h:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof h?h:"y",n=r[e-1],o=r[e];Ne+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Ne+2)}return r},[_,Se,We,Pe,f,u,h,Ie,Ne]),Je=Be.margin,et=d||p,tt=(0,Pl.useMemo)(()=>pl([{label:fe||cl(u),accessor:u,role:"x",format:a},{label:pe||cl(h),accessor:h,role:"y",format:l},...et?[{label:cl(et),accessor:et,role:"group"}]:[],...fl(L,l)]),[u,h,fe,pe,et,a,l,L]),ot=Vc({componentName:"LineChart",data:_e?ge[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:h}}),rt=(0,Pl.useMemo)(()=>_e||je||Le?Pe.flatMap(e=>{const t=e[f]||[];return je&&"string"==typeof je?t.map(t=>({...t,[je]:t[je]??e[je]})):t}):Ae,[Pe,f,_e,je,Ae,Le]),st=It(A),at={chartType:Qe,...Array.isArray(v)&&{areaGroups:v},...st&&{lineGradient:st},...null!=r&&{data:rt},xAccessor:u,yAccessor:h,xScaleType:X,yScaleType:U,...T&&{xExtent:T},...!I||null==I[0]&&null==I[1]?Me?{yExtent:Me}:{}:{yExtent:I},groupAccessor:"break"===j&&Le?"_gapSegment":je||void 0,...L&&{band:L},curve:g,lineStyle:Ue,...x&&{pointStyle:Ke},size:[oe,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Je,showAxes:o.showAxes,xLabel:fe,yLabel:pe,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:ie,showGrid:se,...Be.legendBehaviorProps,...le&&{title:le},...ce&&{description:ce},...he&&{summary:he},...void 0!==de&&{accessibleTable:de},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?aa():la(S)||tt,..."multi"===S&&{tooltipMode:"multi"},...hu({linkedHover:F,selection:O,onObservation:B,onClick:W,hoverRadius:z,hoverHighlight:D,mobileInteraction:Be.mobileInteraction,customHoverBehavior:He,customClickBehavior:Ee}),...M&&{pointIdAccessor:M},...(C?.length||xe.length||Ze.length)&&{annotations:[...C||[],...xe,...Ze]},...$e,...te};return Be.earlyReturn?Be.earlyReturn:ot?(0,vu.jsx)(Tc,{componentName:"LineChart",message:ot,width:oe,height:re}):(0,vu.jsx)(Wc,{componentName:"LineChart",width:oe,height:re,children:(0,vu.jsx)(Rl,{ref:n,...at})})});wu.displayName="LineChart";var Au=require("react"),Su=require("react"),Mu=require("react");function Cu(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}var _u=require("react/jsx-runtime"),ju=(0,Su.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:h,onObservation:d,onClick:f,selection:p,linkedHover:y,hoverHighlight:m,chartId:g,loading:x,loadingContent:b,emptyContent:v,colorBy:k,colorScheme:w,legend:A,legendInteraction:S,legendPosition:M,frameProps:C={}}=e,{legend:_,...j}=C,R=(0,Su.useMemo)(()=>$o(_,A),[_,A]),{frameRef:P,resolved:L,safeData:T,setup:I,earlyReturn:N}=function(e){const t=function(e){const t=(0,Mu.useRef)(null);return cu(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,Mu.useMemo)(()=>Cu(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=Qc({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:e.legendInteraction,legendPosition:e.legendPosition,selection:e.selection,linkedHover:e.linkedHover,hoverHighlight:e.hoverHighlight,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,legend:e.legend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorBy:k,colorScheme:w,legend:R,legendInteraction:S,legendPosition:M,selection:p,linkedHover:y,hoverHighlight:m,onObservation:d,onClick:f,chartId:g,loading:x,loadingContent:b,emptyContent:v,margin:c,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),O=I.effectiveSelectionHook,F=(0,Su.useMemo)(()=>O?.isActive?{isActive:!0,predicate:O.predicate}:null,[O?.isActive,O?.predicate]);if(N)return N;const{width:B,height:W,enableHover:D,showGrid:z,title:H,description:E,summary:$,accessibleTable:Y,xLabel:G,yLabel:q}=L,V={chartType:"custom",...null!=n&&{data:T},customLayout:o,layoutConfig:r,onLayoutError:i,...F&&{layoutSelection:F},xExtent:s,yExtent:a,colorAccessor:k,colorScheme:w,size:[B,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:I.margin,showAxes:l,xLabel:G,yLabel:q,enableHover:D,showGrid:z,...I.legendBehaviorProps,...uu({title:H,description:E,summary:$,accessibleTable:Y,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...hu({linkedHover:y,selection:p,onObservation:d,onClick:f,hoverRadius:e.hoverRadius,hoverHighlight:m,mobileInteraction:I.mobileInteraction,customHoverBehavior:I.customHoverBehavior,customClickBehavior:I.customClickBehavior}),...h&&h.length>0&&{annotations:h},...I.crosshairProps,...j};return(0,_u.jsx)(Wc,{componentName:"XYCustomChart",width:B,height:W,children:(0,_u.jsx)(Rl,{ref:P,...V})})});function Ru(e,t,n,o,r){const i=1-r;return i*i*i*e+3*i*i*r*t+3*i*r*r*n+r*r*r*o}function Pu(e,t,n,o,r){const i=1-r;return 3*i*i*(t-e)+6*i*r*(n-t)+3*r*r*(o-n)}function Lu(e,t,n,o,r){const i=[],s=(e.x+t.x)/2;for(let a=0;r>=a;a++){const l=a/r;let c,u,h,d;"linear"===o?(c=e.x+(t.x-e.x)*l,u=e.y+(t.y-e.y)*l,h=t.x-e.x,d=t.y-e.y):(c=Ru(e.x,s,s,t.x,l),u=Ru(e.y,e.y,t.y,t.y,l),h=Pu(e.x,s,s,t.x,l),d=Pu(e.y,e.y,t.y,t.y,l)),i.push({x:c,y:u,dx:h,dy:d,radius:e.radius+(t.radius-e.radius)*l,datumIndex:.5>l?n:n+1})}return i}function Tu(e,t={}){const n=[],o=[],r=[];if(2>e.length)return{topPath:n,bottomPath:o,datumIndices:r};const i=t.curve??"smooth",s=Math.max(2,Math.floor(t.samplesPerSegment??12));for(let t=0;e.length-1>t;t++){const a=Lu(e[t],e[t+1],t,i,s);for(let e=0===t?0:1;a.length>e;e++){const t=a[e],i=Math.hypot(t.dx,t.dy)||1,s=-t.dy/i,l=t.dx/i,c=Math.max(0,t.radius);n.push([t.x+s*c,t.y+l*c]),o.push([t.x-s*c,t.y-l*c]),r.push(t.datumIndex)}}return{topPath:n,bottomPath:o,datumIndices:r}}ju.displayName="XYCustomChart";var Iu=require("react/jsx-runtime"),Nu="Other";function Ou(e,t,n){return"function"==typeof e?e(t,n):t[e]}function Fu(e){return e instanceof Date?"date:"+e.getTime():`${typeof e}:${e+""}`}function Bu(e,t={}){const n=t.xAccessor??"x",o=t.yAccessor??"y",r=t.lineBy??"series",i=t.rankDirection??"descending",s=[],a=new Map,l=new Map,c=[],u=new Map;let h=1/0,d=-1/0;e.forEach((e,t)=>{const i=Ou(n,e,t),f=Fu(i);let p=a.get(f);null==p&&(p=s.length,a.set(f,p),s.push(i),l.set(p,[]));const y=Ou(r,e,t)+"";u.has(y)||(u.set(y,c.length),c.push(y));const m=Number(Ou(o,e,t));Number.isFinite(m)&&(h=Math.min(h,m),d=Math.max(d,m),l.get(p)?.push({datum:e,inputIndex:t,series:y,value:m}))});const f=[],p=new Map,y=new Map;for(let e=0;s.length>e;e++){const t=l.get(e)??[];t.sort((e,t)=>("descending"===i?t.value-e.value:e.value-t.value)||(u.get(e.series)??0)-(u.get(t.series)??0)),t.forEach((t,n)=>{const o=n+1;f.push({datum:t.datum,xIndex:e,xValue:s[e],series:t.series,value:t.value,rank:o}),p.set(t.series,(p.get(t.series)??0)+o),y.set(t.series,(y.get(t.series)??0)+1)})}const m=c.length+1,g=[...c].sort((e,t)=>{const n=y.get(e)??0,o=y.get(t)??0;return((p.get(e)??0)+(s.length-n)*m)/Math.max(1,s.length)-((p.get(t)??0)+(s.length-o)*m)/Math.max(1,s.length)||(u.get(e)??0)-(u.get(t)??0)}),x=new Set(g.slice(0,null==t.highlightTop?g.length:Math.max(0,Math.floor(t.highlightTop))));return{data:f.map(e=>{const t=x.has(e.series);return{...e.datum,x:e.xIndex,y:e.rank,__bumpRaw:e.datum,__bumpSeries:e.series,__bumpColorGroup:t?e.series:Nu,__bumpValue:e.value,__bumpRank:e.rank,__bumpXValue:e.xValue,__bumpHighlighted:t}}),xValues:s,seriesOrder:c,overallOrder:g,valueExtent:h===1/0?[0,0]:[h,d]}}function Wu({datum:e,x:t,y:n,side:o,color:r,highlighted:i,labelStyle:s}){const a=On(),l=a.isActive&&!a.predicate(e),c="function"==typeof s?s(e.__bumpRaw):s;return(0,Iu.jsx)("text",{className:"semiotic-bump-label",x:t+("end"===o?8:-8),y:n,dy:"0.35em",textAnchor:"end"===o?"start":"end",fill:r,fillOpacity:l?.16:1,fontWeight:i?650:450,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-axis-label-font-size, 11px)",...c},children:e.__bumpSeries})}function Du(e,t,n){const[o,r]=t,[i,s]=n;return r===o?(i+s)/2:i+(s-i)*Math.max(0,Math.min(1,(e-o)/(r-o)))}function zu(e){const t=e instanceof Date?e.getTime():Number(e);return Number.isFinite(t)?t:void 0}function Hu(e){return{value:e.__bumpValue,x:zu(e.__bumpXValue),y:e.__bumpValue,category:e.__bumpSeries}}function Eu(e){const t=e.config,n=new Map;for(const t of e.data){const e=n.get(t.__bumpSeries)??[];e.push(t),n.set(t.__bumpSeries,e)}const o=t.seriesOrder.filter(e=>n.has(e)).sort((e,o)=>(n.get(e)?.[0]?.__bumpHighlighted?1:0)-(n.get(o)?.[0]?.__bumpHighlighted?1:0)||t.seriesOrder.indexOf(e)-t.seriesOrder.indexOf(o)),r=[],i=[];for(const s of o){const o=(n.get(s)??[]).sort((e,t)=>e.x-t.x);if(2>o.length)continue;const a=o[0].__bumpHighlighted,l=e.resolveColor(o[0].__bumpSeries,o[0]),c=t.color??(a?l:t.neutralColor??e.theme.semantic.textSecondary??e.theme.semantic.border??l),u=o.map(n=>({x:e.scales.x(n.x),y:e.scales.y(n.y),radius:t.ribbon?Du(n.__bumpValue,t.valueExtent,t.ribbonSizeRange)/2:Math.max(.5,t.lineWidth/2)})),h=Tu(u,{curve:t.curve,samplesPerSegment:t.samplesPerSegment}),d=h.datumIndices.map(e=>o[e]),f={fill:c,fillOpacity:1,opacity:a?t.ribbon?t.ribbonOpacity:t.lineOpacity:Math.min(t.ribbon?t.ribbonOpacity:t.lineOpacity,.58)};t.styleRules?.length&&Object.assign(f,iu(o[0].__bumpRaw,t.styleRules,Hu(o[0]))),t.areaStyle&&Object.assign(f,t.areaStyle(o[0].__bumpRaw)??{}),void 0!==t.stroke&&(f.stroke=t.stroke),void 0!==t.strokeWidth&&(f.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(f.opacity=t.opacity),r.push({type:"area",topPath:h.topPath,bottomPath:h.bottomPath,style:f,datum:d,accessibleDatum:o.map(e=>e.__bumpRaw),accessibility:{label:s+" ranking trajectory",tableFields:o.map(e=>e.__bumpRaw)},group:s,interactive:!0}),t.showPoints&&o.forEach((e,n)=>{const o={fill:c,stroke:"none",opacity:a?1:.75};t.styleRules?.length&&Object.assign(o,iu(e.__bumpRaw,t.styleRules,Hu(e))),t.pointStyle&&Object.assign(o,t.pointStyle(e.__bumpRaw)??{}),void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),r.push({type:"point",x:u[n].x,y:u[n].y,r:o.r??t.pointRadius,style:o,datum:e,accessibleDatum:e.__bumpRaw,accessibility:{label:`${s}, rank ${e.__bumpRank}, value ${e.__bumpValue}`},pointId:`${s}:${e.x}`})});const p=!0===t.showLabels?"end":t.showLabels,y=(e,n,o)=>{i.push((0,Iu.jsx)(Wu,{datum:e,x:u[n].x,y:u[n].y,side:o,color:"string"==typeof f.fill?f.fill:c,highlighted:a,labelStyle:t.labelStyle},`${s}-${o}`))};"start"!==p&&"both"!==p||y(o[0],0,"start"),"end"!==p&&"both"!==p||y(o.at(-1),o.length-1,"end")}return{nodes:r,overlays:i.length?(0,Iu.jsx)("g",{className:"semiotic-bump-labels",children:i}):void 0,restyle:(e,t)=>{const n=function(e){const t=Array.isArray(e.datum)?e.datum[0]:e.datum;return t&&"object"==typeof t&&"__bumpSeries"in t?t:void 0}(e);if(t?.isActive&&n&&!t.predicate(n))return{opacity:.14}}}}var $u=(0,Au.forwardRef)(function(e,t){const n=Mc(),o=Ql(),{data:r,xAccessor:i,yAccessor:s,lineBy:a,rankDirection:l="descending",ribbon:c=!1,curve:u="smooth",ribbonSizeRange:h=[4,28],samplesPerSegment:d=12,lineWidth:f=3,highlightTop:p,neutralColor:y,styleRules:m,labelStyle:g,colorScheme:x,ribbonOpacity:b=.82,lineOpacity:v=.9,showPoints:k=!1,pointRadius:w=3,showLabels:A=!0,showAxes:S=!0,showGrid:M=!0,showLegend:C=!1,enableHover:_=!0,hoverHighlight:j=!0,tooltip:R,frameProps:P={},xFormat:L,yFormat:T,onClick:I}=e,N=(0,Au.useMemo)(()=>Bu(r,{xAccessor:i,yAccessor:s,lineBy:a,rankDirection:l,highlightTop:p}),[r,i,s,a,l,p]),{axes:O,areaStyle:F,pointStyle:B,...W}=P,D=(0,Au.useMemo)(()=>function(e){const{seriesOrder:t,overallOrder:n,highlightTop:o,color:r,colorScheme:i,neutralColor:s,themeCategorical:a,themeNeutral:l}=e;if(null==o&&null==r)return i;const c=new Set(n.slice(0,null==o?n.length:Math.max(0,Math.floor(o)))),u=new Map,h={};for(const e of t)h[e]=r??(c.has(e)?Cc(void 0,a,i,e,u):s??l??"#b8bec8");return h}({seriesOrder:N.seriesOrder,overallOrder:N.overallOrder,highlightTop:p,color:e.color,colorScheme:x,neutralColor:y,themeCategorical:n,themeNeutral:o.colors.textSecondary}),[N.seriesOrder,N.overallOrder,p,e.color,x,y,n,o.colors.textSecondary]),z=(0,Au.useMemo)(()=>({ribbon:c,curve:u,samplesPerSegment:d,ribbonSizeRange:h,valueExtent:N.valueExtent,seriesOrder:N.seriesOrder,lineWidth:f,ribbonOpacity:b,lineOpacity:v,neutralColor:y,color:e.color,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity,styleRules:m,areaStyle:F,pointStyle:B,labelStyle:g,showPoints:k,pointRadius:w,showLabels:A}),[c,u,d,h,N.valueExtent,N.seriesOrder,f,b,v,y,e.color,e.stroke,e.strokeWidth,e.opacity,m,F,B,g,k,w,A]),H=(0,Au.useCallback)((e,t)=>{if(0===N.xValues.length)return"";const n=N.xValues[Math.max(0,Math.min(N.xValues.length-1,Math.round(Number(e))))];return L?L(n,t):(n instanceof Date?n.toLocaleDateString():n)+""},[N.xValues,L]),E=(0,Au.useCallback)(e=>T?T(e):e.toLocaleString(),[T]),$=(0,Au.useMemo)(()=>"multi"===R?void 0:la(R),[R]),Y=(0,Au.useCallback)(e=>{const t=e?.data??e;return t?!1===R?null:$?$({...e,data:t.__bumpRaw,__semioticHoverData:!0}):(0,Iu.jsxs)("div",{className:"semiotic-tooltip",style:oa,children:[(0,Iu.jsx)("div",{style:{fontWeight:700},children:t.__bumpSeries}),(0,Iu.jsxs)("div",{children:[H(t.x)," · Rank ",t.__bumpRank]}),(0,Iu.jsxs)("div",{children:["Value: ",E(t.__bumpValue)]})]}):null},[E,H,$,R]),G=(0,Au.useMemo)(()=>{if(I)return(e,t)=>{I(e.__bumpRaw??e,t)}},[I]),q=Math.max(1,N.seriesOrder.length),V=N.xValues.map((e,t)=>t),X=Array.from({length:q},(e,t)=>t+1),U=O??[{orient:"left",tickValues:X,tickFormat:e=>e+"",label:e.yLabel??"Rank",baseline:!1},{orient:"bottom",tickValues:V,tickFormat:H,label:e.xLabel,tickAnchor:"edges"}],K=(0,Au.useMemo)(()=>function(e,t){if(!e?.length)return;const n=new Map(t.map((e,t)=>[Fu(e),t]));return e.map(e=>{const t={...e},o=o=>{if(!(o in e))return;const r=n.get(Fu(e[o]));void 0!==r&&(t[o]=r)};return o("x"),o("x0"),o("x1"),"string"!=typeof e.type||"x-threshold"!==e.type&&"x"!==e.type||o("value"),t})}(e.annotations,N.xValues),[e.annotations,N.xValues]);return(0,Iu.jsx)(ju,{ref:t,data:N.data,layout:Eu,layoutConfig:z,xExtent:[0,Math.max(1,N.xValues.length-1)],yExtent:[q+.5,.5],showAxes:S,showGrid:M,showLegend:C,enableHover:_,hoverHighlight:j,colorBy:"__bumpSeries",colorScheme:D,tooltip:Y,onClick:G,hoverRadius:e.hoverRadius,width:e.width,height:e.height,responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,responsiveRules:e.responsiveRules,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,mode:e.mode,margin:e.margin??{top:20,right:A?110:24,bottom:48,left:48},className:e.className,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,selection:e.selection,linkedHover:e.linkedHover,legend:e.legend,legendInteraction:e.legendInteraction,legendPosition:e.legendPosition,onObservation:e.onObservation,chartId:e.chartId,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations,annotations:K,xLabel:e.xLabel,yLabel:e.yLabel??"Rank",frameProps:{axes:U,axisExtent:"exact",...W}})});$u.displayName="BumpChart";var Yu=require("react"),Gu=require("react");function qu(e){const{safeData:t,data:n,areaBy:o,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,areaOpacity:f,showLine:p,lineWidth:y,showPoints:m,pointRadius:g,xAccessor:x,yAccessor:b,xLabel:v,yLabel:k,xFormat:w,yFormat:A,groupField:S,styleRules:M,ruleContext:C}=e,_=(0,Gu.useMemo)(()=>function({data:e,safeData:t,areaBy:n,lineDataAccessor:o}){if(null==e)return[];const r=void 0!==t[0]?.[o];if(!r&&!n)return t;let i;if(r)i=t;else{const e=t.reduce((e,t)=>{const r="function"==typeof n?n(t):t[n],i=r+"";if(!e[i]){const t={[o]:[]};"string"==typeof n&&(t[n]=r),e[i]=t}return e[i][o].push(t),e},{});i=Object.values(e)}return i.flatMap(e=>{const t=Array.isArray(e[o])?e[o]:[];return"string"==typeof n?t.map(t=>({...t,[n]:t[n]??e[n]})):t})}({data:n,safeData:t,areaBy:o,lineDataAccessor:r}),[n,t,o,r]),j=(0,Gu.useMemo)(()=>e=>{const t={};if(i){if(s){const n=it(e,i,s);t.fill=n,p?(t.stroke=n,t.strokeWidth=y):t.stroke="none"}}else{const e=a||nt;t.fill=e,p?(t.stroke=e,t.strokeWidth=y):t.stroke="none"}return t.fillOpacity=f,M&&M.length>0&&Object.assign(t,iu(e,M,C?C(e):{value:void 0})),t},[i,s,a,f,p,y,M,C]),R=(0,Gu.useMemo)(()=>Jc(j,{stroke:l,strokeWidth:c,opacity:u}),[j,l,c,u]);return{flattenedData:_,lineStyle:(0,Gu.useMemo)(()=>Dl(R,h??null,d),[R,h,d]),pointStyle:(0,Gu.useMemo)(()=>{if(m)return e=>{const t={r:g,fillOpacity:1};return i?s&&(t.fill=it(e.parentLine||e,i,s)):t.fill=a||nt,t}},[m,g,i,s,a]),defaultTooltipContent:(0,Gu.useMemo)(()=>pl([{label:v||cl(x),accessor:x,role:"x",format:w},{label:k||cl(b),accessor:b,role:"y",format:A},...S?[{label:cl(S),accessor:S,role:"group"}]:[],...fl(e.band,A)]),[x,b,v,k,S,w,A,e.band])}}var Vu=require("react/jsx-runtime"),Xu=(0,Yu.forwardRef)(function(e,t){const n=(0,Yu.useRef)(null);cu(t,{variant:"xy",frameRef:n});const o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,y0Accessor:d,gradientFill:f=!1,semanticGradient:p,semanticLine:y=!0,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:x,styleRules:b,curve:v="monotoneX",areaOpacity:k=.7,lineGradient:w,showLine:A=!0,lineWidth:S=2,showPoints:M=!1,pointRadius:C=3,tooltip:_,annotations:j,forecast:R,anomaly:P,band:L,xExtent:T,yExtent:I,frameProps:N={},selection:O,linkedHover:F,onObservation:B,onClick:W,hoverHighlight:D,chartId:z,loading:H,loadingContent:E,emptyContent:$,legendInteraction:Y,legendPosition:G,color:q,stroke:V,strokeWidth:X,opacity:U}=e,{width:K,height:Q,enableHover:Z,showGrid:J,showLegend:ee,title:te,description:ne,summary:oe,accessibleTable:re,xLabel:ie,yLabel:se}=o,ae=(0,Yu.useMemo)(()=>ue(r),[r]),le=g||h,ce=(0,Yu.useMemo)(()=>function(e){if(e)return Array.isArray(e)?{stops:e.map(({at:e,color:t,opacity:n})=>({offset:e/100,color:t,...null!=n&&{opacity:n}}))}:Array.isArray(e.stops)?e:void 0}(p),[p]),he=(0,Yu.useMemo)(()=>ce?.stops.length?{stops:ce.stops.map(e=>({...e,offset:1-e.offset})).sort((e,t)=>e.offset-t.offset)}:Tt(f),[ce,f]),de=(0,Yu.useMemo)(()=>It(w),[w]),fe=(0,Yu.useMemo)(()=>y&&ce?.stops.length?ce.stops.flatMap(({offset:e,color:t})=>t?[{offset:e,color:t}]:[]):void 0,[ce,y]);$c("AreaChart",ae,"xAccessor",c),$c("AreaChart",ae,"yAccessor",u);const pe=Qc({data:ae,rawData:r,colorBy:le,colorScheme:x,legendInteraction:Y,legendPosition:G,selection:O,linkedHover:F,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!1,onObservation:B,onClick:W,hoverHighlight:D,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"AreaChart",chartId:z,showLegend:ee,userMargin:i,marginDefaults:o.marginDefaults,loading:H,loadingContent:E,emptyContent:$,width:K,height:Q,hasTitle:!!te,axisChrome:sr({showAxes:o.showAxes,xLabel:ie})}),{effectiveData:ye,statisticalAnnotations:me}=bu({data:ae,xAccessor:c,yAccessor:u,forecast:R,anomaly:P,groupBy:h}),ge=(0,Yu.useMemo)(()=>tu(c,u),[c,u]),{flattenedData:xe,lineStyle:be,pointStyle:ve,defaultTooltipContent:ke}=qu({safeData:ye,data:r,areaBy:h,lineDataAccessor:m,colorBy:le,colorScale:pe.colorScale,color:q,stroke:V,strokeWidth:X,opacity:U,effectiveSelectionHook:pe.effectiveSelectionHook,resolvedSelection:pe.resolvedSelection,areaOpacity:k,showLine:A,lineWidth:S,showPoints:M,pointRadius:C,xAccessor:c,yAccessor:u,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,groupField:h||g,band:L,styleRules:b,ruleContext:ge}),we=Vc({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),Ae={chartType:"area",...null!=r&&{data:xe},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,...d&&{y0Accessor:d},...L&&{band:L},...he&&{gradientFill:he},...de&&{lineGradient:de},...fe&&{semanticLineStops:fe},curve:v,lineStyle:be,...M&&ve&&{pointStyle:ve},size:[K,Q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:pe.margin,showAxes:o.showAxes,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,enableHover:Z,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:J,...pe.legendBehaviorProps,...uu({title:te,description:ne,summary:oe,accessibleTable:re,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===_?{tooltipContent:aa(),tooltipMode:"multi"}:du({tooltip:_,defaultTooltipContent:ke}),...hu({linkedHover:F,selection:O,onObservation:B,onClick:W,hoverHighlight:D,mobileInteraction:pe.mobileInteraction,customHoverBehavior:pe.customHoverBehavior,customClickBehavior:pe.customClickBehavior}),...(j&&j.length>0||me.length>0)&&{annotations:[...j||[],...me]},...T&&{xExtent:T},...I&&{yExtent:I},...pe.crosshairProps,...N};return pe.earlyReturn?pe.earlyReturn:we?(0,Vu.jsx)(Tc,{componentName:"AreaChart",message:we,width:K,height:Q}):(0,Vu.jsx)(Wc,{componentName:"AreaChart",width:K,height:Q,children:(0,Vu.jsx)(Rl,{ref:n,...Ae})})});Xu.displayName="AreaChart";var Uu=require("react"),Ku=require("react/jsx-runtime");function Qu(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var Zu=(0,Uu.forwardRef)(function(e,t){const n=(0,Uu.useRef)(null),o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:h="b",seriesALabel:d="A",seriesBLabel:f="B",seriesAColor:p="var(--semiotic-danger, #dc2626)",seriesBColor:y="var(--semiotic-info, #2563eb)",showLines:m=!0,lineWidth:g=1.5,showPoints:x=!1,pointRadius:b=3,curve:v="linear",areaOpacity:k=.6,gradientFill:w,tooltip:A,annotations:S,xExtent:M,yExtent:C,frameProps:_={},selection:j,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:T,chartId:I,loading:N,loadingContent:O,emptyContent:F,legendInteraction:B,legendPosition:W,pointIdAccessor:D,windowSize:z}=e,{width:H,height:E,enableHover:$,showGrid:Y,showLegend:G,title:q,description:V,summary:X,accessibleTable:U,xLabel:K,yLabel:Q}=o,Z=(0,Uu.useMemo)(()=>"function"==typeof c?e=>Qu(c(e)):e=>Qu(e[c]),[c]),J=(0,Uu.useMemo)(()=>"function"==typeof u?e=>Qu(u(e)):e=>Qu(e[u]),[u]),ee=(0,Uu.useMemo)(()=>"function"==typeof h?e=>Qu(h(e)):e=>Qu(e[h]),[h]),[te,ne]=(0,Uu.useState)([]),oe=(0,Uu.useRef)([]),re=null==r,ie=(0,Uu.useMemo)(()=>ue(re?te:r),[re,te,r]),se=(0,Uu.useMemo)(()=>function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,h=e=>`seg-${s}-${e}`,d=e=>i.push(e),f=(e,t)=>{d({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:h(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],p=t(i),y=n(i),m=o(i);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(m))continue;const g=u(y,m);if(null!==g)if(null!=a){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=y-l.a-(m-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(p-l.x),t=l.a+o*(y-l.a)}else e=l.x,t=l.a}d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=g,d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],a)}else for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else{a=g;for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else c.push({x:p,y:y,datum:i})}for(const e of c)f(e,a??"A");return i}(ie,Z,J,ee),[ie,Z,J,ee]),ae=(0,Uu.useMemo)(()=>m?function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];for(const e of r){const r=t(e),s=n(e),a=o(e);Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-B"})}return i}(ie,Z,J,ee):[],[m,ie,Z,J,ee]),le=(0,Uu.useMemo)(()=>[...se,...ae],[se,ae]),ce=(0,Uu.useMemo)(()=>{const e=new Set;for(const t of se)e.add(t.__diffSegment);return Array.from(e)},[se]);(0,Uu.useImperativeHandle)(t,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;oe.current=t,ne(t)},t=D?"function"==typeof D?D:e=>e[D]:null;return{push:t=>e([...oe.current,t]),pushMany:t=>e([...oe.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],r=[],i=[];for(const e of oe.current)o.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(n,o)=>{if(!t)return[];const r=Array.isArray(n)?n:[n],i=[],s=oe.current.map(e=>{if(r.includes(t(e))){const t=o(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>re?oe.current:ie,getScales:()=>n.current?.getScales()??null}},[re,ie,D,z]);const he=Qc({data:ie,rawData:r,colorBy:"__diffWinner",colorScheme:[p,y],legendInteraction:B,legendPosition:W,selection:j,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DifferenceChart",chartId:I,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:O,emptyContent:F,width:H,height:E,hasTitle:!!q,axisChrome:sr({showAxes:o.showAxes,xLabel:K})}),de=(0,Uu.useMemo)(()=>{if(!1!==G)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:d,color:p},{label:f,color:y}]}]}},[G,d,f,p,y]),fe=(0,Uu.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:y,stroke:"none",fillOpacity:k}},[p,y,k]),pe=(0,Uu.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,strokeWidth:g,fill:"none"}),[p,y,g]),ye=(0,Uu.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,r:b}),[p,y,b]),me=(0,Uu.useCallback)(e=>{const t=e.data,n=e.allSeries,o=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(n&&n.length>0){const e=n.find(e=>"line-A"===e.group),t=n.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=o&&(null==r||null==i)){const e=ie.find(e=>Z(e)===o);e&&(null==r&&(r=J(e)),null==i&&(i=ee(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=o?a(o):null!=o?o+"":"";return(0,Ku.jsxs)("div",{className:"semiotic-tooltip",style:oa,children:[l&&(0,Ku.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,Ku.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,Ku.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,Ku.jsxs)("span",{children:[d,": ",s(r)]})]}),(0,Ku.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,Ku.jsx)("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),(0,Ku.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,Ku.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[ie,Z,J,ee,a,p,y,d,f]),ge="multi"===A,xe=(0,Uu.useMemo)(()=>!1===A?()=>null:ge?me:la(A)||me,[A,ge,me]),be=(0,Uu.useMemo)(()=>Tt(w,{stops:[{offset:0,opacity:.85},{offset:1,opacity:.15}]}),[w]);if(he.earlyReturn)return he.earlyReturn;const ve={chartType:"mixed",data:le,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ce,curve:v,areaStyle:fe,lineStyle:pe,...x&&{pointStyle:ye},size:[H,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:o.showAxes,xLabel:K,yLabel:Q,xFormat:a,yFormat:l,enableHover:$,showGrid:Y,...be&&{gradientFill:be},...de&&{legend:de,legendPosition:he.legendPosition},...uu({title:q,description:V,summary:X,accessibleTable:U,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:xe,...ge&&{tooltipMode:"multi"},...hu({linkedHover:R,selection:j,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...S&&S.length>0&&{annotations:S},...M&&{xExtent:M},...C&&{yExtent:C},...he.crosshairProps,..._};return(0,Ku.jsx)(Wc,{componentName:"DifferenceChart",width:H,height:E,children:(0,Ku.jsx)(Rl,{ref:n,...ve})})});"function"==typeof Zu&&(Zu.displayName="DifferenceChart");var Ju=require("react"),eh=require("react/jsx-runtime"),th=(0,Ju.forwardRef)(function(e,t){const n=(0,Ju.useRef)(null),o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,lineDataAccessor:d="coordinates",colorBy:f,colorScheme:p,styleRules:y,curve:m="monotoneX",areaOpacity:g=.7,showLine:x=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:k=3,normalize:w=!1,baseline:A="zero",stackOrder:S,tooltip:M,annotations:C,xExtent:_,yExtent:j,frameProps:R={},selection:P,linkedHover:L,onObservation:T,onClick:I,hoverHighlight:N,chartId:O,loading:F,loadingContent:B,emptyContent:W,legendInteraction:D,legendPosition:z,color:H,stroke:E,strokeWidth:$,opacity:Y}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=o,ne=(0,Ju.useMemo)(()=>ue(r),[r]),oe=f||h;cu(t,{variant:"xy",frameRef:n});const re=Qc({data:ne,rawData:r,colorBy:oe,colorScheme:p,legendInteraction:D,legendPosition:z,selection:P,linkedHover:L,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!1,onObservation:T,onClick:I,hoverHighlight:N,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedAreaChart",chartId:O,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:F,loadingContent:B,emptyContent:W,width:G,height:q,hasTitle:!!K,axisChrome:sr({showAxes:o.showAxes,xLabel:ee})}),ie=(0,Ju.useMemo)(()=>tu(c,u),[c,u]),{flattenedData:se,lineStyle:ae,pointStyle:le,defaultTooltipContent:ce}=qu({safeData:ne,data:r,areaBy:h,lineDataAccessor:d,colorBy:oe,colorScale:re.colorScale,color:H,stroke:E,strokeWidth:$,opacity:Y,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,areaOpacity:g,showLine:x,lineWidth:b,showPoints:v,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,groupField:h||f,styleRules:y,ruleContext:ie}),he=Vc({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),de={chartType:"stackedarea",...null!=r&&{data:se},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,curve:m,normalize:w,baseline:w?"zero":A,stackOrder:S,lineStyle:ae,...v&&le&&{pointStyle:le},size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:o.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:X,...re.legendBehaviorProps,...uu({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:aa(),tooltipMode:"multi"}:du({tooltip:M,defaultTooltipContent:ce}),...hu({linkedHover:L,selection:P,onObservation:T,onClick:I,hoverHighlight:N,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...C&&C.length>0&&{annotations:C},..._&&{xExtent:_},...j&&{yExtent:j},...re.crosshairProps,...R};return re.earlyReturn?re.earlyReturn:he?(0,eh.jsx)(Tc,{componentName:"StackedAreaChart",message:he,width:G,height:q}):(0,eh.jsx)(Wc,{componentName:"StackedAreaChart",width:G,height:q,children:(0,eh.jsx)(Rl,{ref:n,...de})})});th.displayName="StackedAreaChart";var nh=y(require("react")),oh=require("react"),rh=require("react");function ih(e){const{colorBy:t,colorScale:n,color:o,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:h,effectiveSelectionHook:d,resolvedSelection:f,colorDatumAccessor:p,styleRules:y,ruleContext:m}=e,g=(0,rh.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=it(o,t,n)}}else u.fill=a?a(e):o||nt;return void 0===u.r&&(u.r=i?i(e):r),y&&y.length>0&&Object.assign(u,iu(e,y,m?m(e):{value:void 0})),u},[t,n,o,r,i,s,a,l,p,y,m]),x=(0,rh.useMemo)(()=>Jc(g,{stroke:c,strokeWidth:u,opacity:h}),[g,c,u,h]);return(0,rh.useMemo)(()=>Dl(x,d??null,f),[x,d,f])}var sh=require("react");function ah(e){const{accessor:t,data:n,isPushMode:o}=e,r=(0,sh.useRef)(null),[i,s]=(0,sh.useState)(0),a=(0,sh.useCallback)(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,n=!0),i>r.current[1]&&(r.current[1]=i,n=!0)):(r.current=[i,i],n=!0))}n&&s(e=>e+1)},[o,t]),l=(0,sh.useCallback)(()=>{o&&(r.current=null,s(e=>e+1))},[o]);return{domain:(0,sh.useMemo)(()=>{if(o)return r.current??void 0;if(!t||0===n.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of n){const n=e(t);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(i>o&&(i=o),o>s&&(s=o))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[n,t,o,i]),trackPushed:a,reset:l}}function lh(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var ch=require("react/jsx-runtime"),uh=(0,oh.forwardRef)(function(e,t){const n=(0,oh.useRef)(null),o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:h,yScaleType:d,colorBy:f,colorScheme:p,styleRules:y,sizeBy:m,sizeRange:g=[3,15],symbolBy:x,symbolMap:b,pointRadius:v=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:M,regression:C,forecast:_,anomaly:j,xExtent:R,yExtent:P,frameProps:L={},selection:T,linkedHover:I,linkedBrush:N,onObservation:O,onClick:F,hoverHighlight:B,chartId:W,loading:D,loadingContent:z,emptyContent:H,legendInteraction:E,legendPosition:$,color:Y,stroke:G,strokeWidth:q,opacity:V}=e,{width:X,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:re}=o,ie=(0,oh.useMemo)(()=>ue(r),[r]),se=void 0===r,{domain:ae,trackPushed:le,reset:ce}=ah({accessor:m,data:ie,isPushMode:se}),he=(0,oh.useCallback)(e=>{le([e]),n.current?.push(e)},[le]),de=(0,oh.useCallback)(e=>{le(e),n.current?.pushMany(e)},[le]);cu(t,{variant:"xy",frameRef:n,overrides:{push:he,pushMany:de,clear:()=>{ce(),n.current?.clear()}}});const fe=Qc({data:ie,rawData:r,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:$,selection:T,linkedHover:I,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:O,onClick:F,hoverHighlight:B,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Scatterplot",chartId:W,showLegend:Z,userMargin:i,marginDefaults:o.marginDefaults,loading:D,loadingContent:z,emptyContent:H,width:X,height:U,hasTitle:!!J,axisChrome:sr({showAxes:o.showAxes,xLabel:oe})}),pe=Bl(N),ye=Xl({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),me=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,ge=nh.useRef(ye.brushInteraction);ge.current=ye.brushInteraction;const xe=(0,oh.useCallback)(e=>{const t=ge.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);$c("Scatterplot",ie,"xAccessor",c),$c("Scatterplot",ie,"yAccessor",u);const be=(0,oh.useMemo)(()=>m?ae??[0,1]:void 0,[m,ae]),ve=(0,oh.useMemo)(()=>m?e=>lt(e,m,g,be):void 0,[m,g,be]),ke=(0,oh.useMemo)(()=>tu(c,u),[c,u]),we=ih({colorBy:f,colorScale:fe.colorScale,color:Y,pointRadius:v,fillOpacity:k,radiusFn:ve,stroke:G,strokeWidth:q,opacity:V,styleRules:y,ruleContext:ke,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Ae=(0,oh.useMemo)(()=>pl([{label:oe||cl(c),accessor:c,role:"x",format:a},{label:re||cl(u),accessor:u,role:"y",format:l},...f?[{label:cl(f),accessor:f,role:"color"}]:[],...m?[{label:cl(m),accessor:m,role:"size"}]:[]]),[c,u,oe,re,f,m,a,l]),{effectiveData:Se,statisticalAnnotations:Me}=bu({data:ie,xAccessor:c,yAccessor:u,forecast:_,anomaly:j}),Ce=(0,oh.useMemo)(()=>{const e=lh(C);return e||0!==Me.length?[...e?[e]:[],...M||[],...Me]:M},[C,M,Me]);if(fe.earlyReturn)return fe.earlyReturn;const _e=Vc({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(_e)return(0,ch.jsx)(Tc,{componentName:"Scatterplot",message:_e,width:X,height:U});const je={chartType:"scatter",...null!=r&&{data:Se},xAccessor:c,yAccessor:u,xScaleType:h,yScaleType:d,colorAccessor:f||void 0,sizeAccessor:m||void 0,...x&&{symbolAccessor:x},...b&&{symbolMap:b},sizeRange:g,pointStyle:we,colorScheme:p,size:[X,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:o.showAxes,xLabel:oe,yLabel:re,xFormat:a,yFormat:l,enableHover:K,showGrid:Q,...fe.legendBehaviorProps,...uu({title:J,description:ee,summary:te,accessibleTable:ne,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...du({tooltip:w,defaultTooltipContent:Ae}),...hu({linkedHover:I,selection:T,onObservation:O,onClick:F,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...A&&{marginalGraphics:A},...S&&{pointIdAccessor:S},...Ce&&Ce.length>0&&{annotations:Ce},...R&&{xExtent:R},...P&&{yExtent:P},...pe&&{brush:{dimension:me},onBrush:xe},...fe.crosshairProps,...L};return(0,ch.jsx)(Wc,{componentName:"Scatterplot",width:X,height:U,children:(0,ch.jsx)(Rl,{ref:n,...je})})});uh.displayName="Scatterplot";var hh=require("react"),dh=require("react/jsx-runtime");function fh(e,t){return qe(1===t?.5:e/(t-1))}var ph=(0,hh.forwardRef)(function(e,t){const n=(0,hh.useRef)(null);cu(t,{variant:"xy",frameRef:n});const o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:h,orderLabel:d,styleRules:f,pointRadius:p=4,tooltip:y,pointIdAccessor:m,annotations:g,regression:x,forecast:b,anomaly:v,xExtent:k,yExtent:w,frameProps:A={},selection:S,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:j,chartId:R,loading:P,loadingContent:L,emptyContent:T,legendInteraction:I,stroke:N,strokeWidth:O,opacity:F}=e,{width:B,height:W,enableHover:D,showGrid:z,title:H,description:E,summary:$,accessibleTable:Y,xLabel:G,yLabel:q}=o,{safeData:V,orderMap:X}=(0,hh.useMemo)(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],n="function"==typeof u?u:e=>e[u];let o=e;if(h&&e.length>0){const t="function"==typeof h?h:e=>e[h];o=[...e].sort((e,n)=>{const o=t(e),r=t(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let s=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&s++}let a=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i.set(e,{idx:a++,total:s})}return{safeData:o,orderMap:i}},[r,h,c,u]);$c("ConnectedScatterplot",V,"xAccessor",c),$c("ConnectedScatterplot",V,"yAccessor",u);const U=Qc({data:V,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:S,linkedHover:M,fallbackFields:[],unwrapData:!1,onObservation:C,onClick:_,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:B,height:W,hasTitle:!!H,axisChrome:sr({showAxes:o.showAxes,xLabel:G})}),K=U.resolvedSelection?.unselectedOpacity??Wl,Q=(0,hh.useMemo)(()=>(e,t)=>{const n=t.filter(e=>"point"===e.type);if(2>n.length)return;const o=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>n.length,s=n.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=n[t],l=n[t+1],c=fh(t,s),u=!o||!r||r(a.datum??a)||r(l.datum??l),h=o?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*h,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=h,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Z=(0,hh.useMemo)(()=>[Q],[Q]),J=(0,hh.useMemo)(()=>(e,t,n)=>{const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const r=o.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=o[e],n=o[e+1],a=fh(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof n.style?.opacity?n.style.opacity:1);i&&s.push((0,dh.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,dh.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,dh.jsx)(dh.Fragment,{children:s})},[p]),ee=(0,hh.useMemo)(()=>[J],[J]),te=ih({colorScale:void 0,baseStyleExtras:(0,hh.useMemo)(()=>e=>{const t=X.get(e),n=t?.idx??0,o=t?.total??1;return{fill:o>0?fh(n,o):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:N,strokeWidth:O,opacity:F,styleRules:f,ruleContext:(0,hh.useMemo)(()=>tu(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),ne=d||("string"==typeof h?h:"Order"),oe=(0,hh.useMemo)(()=>pl([{label:G||cl(c),accessor:c,role:"x",format:a},{label:q||cl(u),accessor:u,role:"y",format:l},...h?[{label:ne,accessor:h,role:"group"}]:[]]),[c,u,G,q,h,ne,a,l]),re=Vc({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=bu({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const ae=lh(x),le=ae||se.length>0?[...ae?[ae]:[],...g||[],...se]:g,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[B,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:o.showAxes,xLabel:G,yLabel:q,xFormat:a,yFormat:l,enableHover:D,showGrid:z,...uu({title:H,description:E,summary:$,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...du({tooltip:y,defaultTooltipContent:oe}),...hu({linkedHover:M,selection:S,onObservation:C,onClick:_,hoverHighlight:j,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...m&&{pointIdAccessor:m},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...A};return re?(0,dh.jsx)(Tc,{componentName:"ConnectedScatterplot",message:re,width:B,height:W}):(0,dh.jsx)(Wc,{componentName:"ConnectedScatterplot",width:B,height:W,children:(0,dh.jsx)(Rl,{ref:n,...ce})})});ph.displayName="ConnectedScatterplot";var yh=require("react"),mh=require("react/jsx-runtime"),gh=(0,yh.forwardRef)(function(e,t){const n=(0,yh.useRef)(null),o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:h,sizeRange:d=[5,40],colorBy:f,colorScheme:p,styleRules:y,bubbleOpacity:m=.6,bubbleStrokeWidth:g=1,bubbleStrokeColor:x="white",tooltip:b,marginalGraphics:v,pointIdAccessor:k,annotations:w,regression:A,xExtent:S,yExtent:M,frameProps:C={},selection:_,linkedHover:j,linkedBrush:R,onObservation:P,onClick:L,hoverHighlight:T,chartId:I,loading:N,loadingContent:O,emptyContent:F,legendInteraction:B,legendPosition:W,color:D,stroke:z,strokeWidth:H,opacity:E}=e,{width:$,height:Y,enableHover:G,showGrid:q,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=o,ee=(0,yh.useMemo)(()=>ue(r),[r]),te=void 0===r,ne=Qc({data:ee,rawData:r,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:W,selection:_,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BubbleChart",chartId:I,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:O,emptyContent:F,width:$,height:Y,hasTitle:!!X,axisChrome:sr({showAxes:o.showAxes,xLabel:Z})}),{domain:oe,trackPushed:re,reset:ie}=ah({accessor:h,data:ee,isPushMode:te}),se=(0,yh.useCallback)(e=>{re([e]),n.current?.push(e)},[re]),ae=(0,yh.useCallback)(e=>{re(e),n.current?.pushMany(e)},[re]);cu(t,{variant:"xy",frameRef:n,overrides:{push:se,pushMany:ae,clear:()=>{ie(),n.current?.clear()}}});const le=Bl(R),ce=(Xl({name:le?.name||"__unused_brush__",xField:le?.xField||("string"==typeof c?c:void 0),yField:le?.yField||("string"==typeof u?u:void 0)}),(0,yh.useMemo)(()=>({stroke:x,strokeWidth:g}),[x,g])),he=(0,yh.useMemo)(()=>oe??[0,1],[oe]),de=(0,yh.useCallback)(e=>lt(e,h,d,he),[h,d,he]),fe=(0,yh.useMemo)(()=>tu(c,u),[c,u]),pe=ih({colorBy:f,colorScale:ne.colorScale,color:D,fillOpacity:m,radiusFn:de,baseStyleExtras:ce,stroke:z,strokeWidth:H,opacity:E,styleRules:y,ruleContext:fe,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ye=(0,yh.useMemo)(()=>pl([{label:Z||cl(c),accessor:c,role:"x",format:a},{label:J||cl(u),accessor:u,role:"y",format:l},{label:cl(h),accessor:h,role:"size"},...f?[{label:cl(f),accessor:f,role:"color"}]:[]]),[c,u,Z,J,h,f,a,l]);if(ne.earlyReturn)return ne.earlyReturn;const me=Vc({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:h}});if(me)return(0,mh.jsx)(Tc,{componentName:"BubbleChart",message:me,width:$,height:Y});const ge=lh(A),xe=ge?[ge,...w||[]]:w,be={chartType:"bubble",...null!=r&&{data:ee},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:h,sizeRange:d,pointStyle:pe,colorScheme:p,size:[$,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:o.showAxes,xLabel:Z,yLabel:J,xFormat:a,yFormat:l,enableHover:G,showGrid:q,...ne.legendBehaviorProps,...uu({title:X,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...du({tooltip:b,defaultTooltipContent:ye}),...hu({linkedHover:j,selection:_,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...v&&{marginalGraphics:v},...k&&{pointIdAccessor:k},...xe&&xe.length>0&&{annotations:xe},...S&&{xExtent:S},...M&&{yExtent:M},...ne.crosshairProps,...C};return(0,mh.jsx)(Wc,{componentName:"BubbleChart",width:$,height:Y,children:(0,mh.jsx)(Rl,{ref:n,...be})})});gh.displayName="BubbleChart";var xh=require("react"),bh=require("d3-scale");M();var vh=require("react/jsx-runtime"),kh=(0,xh.forwardRef)(function(e,t){const n=(0,xh.useRef)(null);cu(t,{variant:"xy",frameRef:n});const o=Pc(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:u,yFormat:h,colorScheme:d,customColorScale:f,showValues:p=!1,valueFormat:y,cellBorderColor:m="#fff",cellBorderWidth:g=1,tooltip:x,annotations:b,xExtent:v,yExtent:k,frameProps:w={},selection:S,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:j,chartId:R,loading:P,loadingContent:L,emptyContent:T,showLegend:I,legendPosition:N,legend:O,legendInteraction:F}=e,{width:B,height:W,enableHover:D,title:z,description:H,summary:E,accessibleTable:$,xLabel:Y,yLabel:G}=o,q=Ec(P,B,W,L),V=q?null:Hc(r,B,W,T),X=(0,xh.useMemo)(()=>ue(r),[r]),U=function(){const e=Ql();return e?.colors?.sequential||void 0}(),K=d??U??"blues",Q=I??!1,Z=N??"right",{customHoverBehavior:J,customClickBehavior:ee,crosshairSourceId:te}=jc({selection:S,linkedHover:M,fallbackFields:[],onObservation:C,onClick:_,chartType:"Heatmap",chartId:R,hoverHighlight:j,colorByField:void 0,mobileInteraction:o.mobileInteraction});Kc(S);const ne=Rc(M,te);Ac(F,void 0,[]);const oe=(0,xh.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),re=(0,xh.useMemo)(()=>A(X.map(oe)),[X,oe]),ie=(0,xh.useMemo)(()=>{if("custom"===K&&f)return f;const e=Je(K);return(0,bh.scaleSequential)(e).domain(re)},[K,f,re]),se=(0,xh.useMemo)(()=>{const e=Number.isFinite(g)?Math.max(0,g):1;return()=>({stroke:m,strokeWidth:e})},[m,g]),ae=(0,xh.useMemo)(()=>pl([{label:Y||cl(a),accessor:a,role:"x",format:u},{label:G||cl(l),accessor:l,role:"y",format:h},{label:cl(c),accessor:c,role:"value",format:y}]),[a,l,Y,G,c,u,h,y]),le=Vc({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,xh.useMemo)(()=>{if(Q)return{gradient:{colorFn:e=>ie(e),domain:re,label:"string"==typeof c?c:"value",format:y},legendDistance:O?.legendDistance}},[Q,ie,re,c,y,O?.legendDistance]),{margin:he}=wc({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:Z,userMargin:i,defaults:o.marginDefaults,additionalLegend:ce,chartWidth:B,legendLayout:w.legendLayout,hasTitle:!!z,axisChrome:{hasAxis:!1!==o.showAxes,hasAxisLabel:!!Y}}),de={chartType:"heatmap",...null!=r&&{data:X},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,areaStyle:se,showValues:p,heatmapValueFormat:y,size:[B,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he,showAxes:o.showAxes,xLabel:Y,yLabel:G,xFormat:u,yFormat:h,enableHover:D,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...uu({title:z,description:H,summary:E,accessibleTable:$,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...du({tooltip:x,defaultTooltipContent:ae}),...hu({linkedHover:M,selection:S,onObservation:C,onClick:_,hoverHighlight:j,mobileInteraction:o.mobileInteraction,customHoverBehavior:J,customClickBehavior:ee}),...b&&b.length>0&&{annotations:b},...v&&{xExtent:v},...k&&{yExtent:k},...ne,...w};return q||V||(le?(0,vh.jsx)(Tc,{componentName:"Heatmap",message:le,width:B,height:W}):(0,vh.jsx)(Wc,{componentName:"Heatmap",width:B,height:W,children:(0,vh.jsx)(Rl,{ref:n,...de})}))});kh.displayName="Heatmap";var wh=y(require("react")),Ah=require("react");M();var Sh=y(require("react")),Mh=require("react/jsx-runtime"),Ch=null,_h=null;function jh(e){const[t,n]=Sh.useState(()=>Ch);return Sh.useEffect(()=>{if(t)return;let e=!1;return(Ch?Promise.resolve(Ch):(_h||(_h=Promise.resolve().then(()=>(K(),Y)).then(e=>Ch=e.ScatterplotMatrixBrushOverlay).catch(e=>{throw _h=null,e})),_h)).then(t=>{e||n(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?(0,Mh.jsx)(t,{...e}):null}var Rh=require("react/jsx-runtime"),Ph="__splomIdx",Lh="splom-hover-source",Th={top:4,bottom:4,left:4,right:4};function Ih({data:e,xField:t,yField:n,cellSize:o,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:h,mode:d,onPointHover:f,onPointClick:p}){const y=(0,Ah.useRef)(null),m=ql({name:l,clientId:`splom-${t}-${n}`,fields:[t,n]}),g=Xl({name:l,xField:t,yField:n}),x=ql({name:c,clientId:Lh,fields:[Ph]}),b=x.selectPoints,v=(0,Ah.useCallback)(e=>{e?g.brushInteraction.during(e):g.brushInteraction.end(null)},[g.brushInteraction]),k=(0,Ah.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data,n=t?.[Ph];void 0!==n&&(b({[Ph]:[n]}),f?.(t,e.x+Th.left,e.y+Th.top))},[b,f]),w=(0,Ah.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+Th.left,e.y+Th.top)},[p]),A=(0,Ah.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?it(e,s,a):nt,"hover"===d?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*i):m.isActive&&!m.predicate(e)&&(t.opacity=u),t},[i,r,s,d,a,x,m,u]);return(0,Rh.jsxs)("div",{style:{position:"relative",width:o,height:o},children:[(0,Rh.jsx)(Rl,{ref:y,chartType:"scatter",data:e,size:[o,o],xAccessor:t,yAccessor:n,pointStyle:A,margin:Th,showAxes:!1,enableHover:"hover"===d,...hu({forceHoverBehavior:"hover"===d,forceClickBehavior:!!p,mobileInteraction:h,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===d?()=>null:void 0}),"brush"===d&&(0,Rh.jsx)(jh,{frameRef:y,cellSize:o,onBrush:v})]})}function Nh({data:e,field:t,label:n,cellSize:o,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const u=ql({name:a,clientId:"splom-diag-"+t,fields:[t]}),h=ql({name:l,clientId:`splom-diag-${t}-hover`,fields:[Ph]}),d="hover"===c?h:u,f=d.isActive,p=d.predicate,y=(0,Ah.useMemo)(()=>{const n="string"==typeof i?i:null,s=[],a=new Set;for(const o of e){const e=o[t];if(null==e||isNaN(e)||s.push(Number(e)),n){const e=o[n];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=A(s),u=(c-l)/r||1,h=Array.from(a),d=new Map(h.map((e,t)=>[e,t])),y=Array(r).fill(0),m=Array(r).fill(0),g=Array.from({length:r},()=>Array(h.length).fill(0)),x=Array.from({length:r},()=>Array(h.length).fill(0));for(const o of e){const e=o[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/u),r-1);if(y[i]++,f&&!p(o)||m[i]++,n){const e=d.get(o[n]+"");void 0!==e&&(g[i][e]++,f&&!p(o)||x[i][e]++)}}const b=S(y,1),v=g.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})}),k=x.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})});return{bars:y.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),selectedBars:m.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),categoryBars:v,selectedCategoryBars:k,max:b,categories:h}},[e,t,r,o,f,p,i]);return(0,Rh.jsxs)("svg",{width:o,height:o,style:{overflow:"hidden"},children:[(0,Rh.jsx)("text",{x:o/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:n}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,n)=>(0,Rh.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):nt,opacity:f?.3:.6},`bg-${t}-${n}`))):y.bars.map((e,t)=>(0,Rh.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:nt,opacity:f?.3:.6},"bg-"+t)),f&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,n)=>(0,Rh.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):nt,opacity:.7},`sel-${t}-${n}`))):y.selectedBars.map((e,t)=>(0,Rh.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:nt,opacity:.7},"sel-"+t)))]})}function Oh({label:e,cellSize:t}){return(0,Rh.jsx)("svg",{width:t,height:t,children:(0,Rh.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Fh(e){const{data:t,fields:n,fieldLabels:o={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:h=20,brushMode:d="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:m,showLegend:g,idAccessor:x,width:b,className:v,onObservation:k,onClick:w,chartId:A}=e,S="splom",M="splom-hover",C=oc(e.mobileInteraction,{mode:e.mode,width:b??n.length*s,mobileSemantics:e.mobileSemantics}),_=f?"hover":d?"brush":"hover",j=Gl(e=>e.clearSelection),[R,P]=(0,Ah.useState)(null),L=(0,Ah.useCallback)(()=>{j(M),P(null)},[j,M]),T=(0,Ah.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[Ph]?e:{...e,[Ph]:t}),[t]),I=_c(T,r,i),N=(0,Ah.useCallback)((e,t,n,o)=>[40+e*(s+a)+(n??0),t*(s+a)+(o??0)],[40,s,a]),O=void 0!==g?g:!!r,F=(0,Ah.useMemo)(()=>{if(!O||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(T.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:I?I(e+""):nt})):null},[O,r,T,I]),B=(0,Ah.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+n.map(()=>s+"px").join(" "),gridTemplateRows:n.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[n,s,a,40]);return(0,Rh.jsxs)("div",{className:v,style:{position:"relative"},children:[F&&(0,Rh.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:F.map(e=>(0,Rh.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,Rh.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,Rh.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,Rh.jsxs)("div",{style:B,onMouseLeave:"hover"===_?L:void 0,children:[n.map((e,t)=>(0,Rh.jsxs)(wh.Fragment,{children:[(0,Rh.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e}),n.map((n,i)=>t===i?"label"===u?(0,Rh.jsx)(Oh,{label:o[e]||e,cellSize:s},"diag-"+e):(0,Rh.jsx)(Nh,{data:T,field:e,label:o[e]||e,cellSize:s,bins:h,colorBy:r,colorScale:I,brushSelectionName:S,hoverSelectionName:M,unselectedOpacity:p,mode:_},"diag-"+e):(0,Rh.jsx)(Ih,{data:T,xField:n,yField:e,fieldLabels:o,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:I,brushSelectionName:S,hoverSelectionName:M,unselectedOpacity:p,showGrid:y,tooltip:m,mobileInteraction:C,mode:_,onPointHover:"hover"===_?(o,r,s)=>{if(o){if(P({datum:o,xField:n,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),k){const[e,n]=N(i,t,r,s);k({type:"hover",datum:o,x:e,y:n,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}}else P(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0,onPointClick:w||k?(e,n,o)=>{if(!e)return;const[r,s]=N(i,t,n,o);w&&w(e,{x:r,y:s}),k&&k({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0},`cell-${e}-${n}`))]},"row-"+e)),(0,Rh.jsx)("div",{})," ",n.map(e=>(0,Rh.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e},"col-label-"+e))]}),R&&"hover"===_&&(()=>{const e=R.datum,t=o[R.xField]||R.xField,n=o[R.yField]||R.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=x?"function"==typeof x?x(e):e[x]:"Row "+e[Ph];return(0,Rh.jsxs)("div",{style:{position:"absolute",left:40+R.colIndex*(s+a)+R.px,top:R.rowIndex*(s+a)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,Rh.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,Rh.jsxs)("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),(0,Rh.jsxs)("div",{children:[n,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=i&&(0,Rh.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function Bh(e){const{brushMode:t="crossfilter",hoverMode:n=!0}=e,o={};return!n&&t&&(o.splom={resolution:t}),n&&(o["splom-hover"]={resolution:"union"}),(0,Rh.jsx)(kc,{selections:o,children:(0,Rh.jsx)(Fh,{...e})})}Bh.displayName="ScatterplotMatrix";var Wh=require("react"),Dh=y(require("react")),zh=require("react/jsx-runtime"),Hh=null,Eh=null;function $h(e){const[t,n]=Dh.useState(()=>Hh);return Dh.useEffect(()=>{if(t)return;let e=!1;return(Hh?Promise.resolve(Hh):(Eh||(Eh=Promise.resolve().then(()=>(ee(),Q)).then(e=>Hh=e.MinimapBrushOverlay).catch(e=>{throw Eh=null,e})),Eh)).then(t=>{e||n(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?(0,zh.jsx)(t,{...e}):null}var Yh=require("react/jsx-runtime");function Gh(e){const{data:t,width:n=600,height:o=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:x,curve:b="linear",lineWidth:v=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:A=!1,pointRadius:S=3,enableHover:M=!0,showGrid:C=!1,showLegend:_,legendPosition:j,tooltip:R,minimap:P={},renderBefore:L=!1,onBrush:T,brushExtent:I,yExtent:N,frameProps:O={},loading:F,loadingContent:B,emptyContent:W}=e,D=Ec(F,n,o,B),z=D?null:Hc(t,n,o,W),H=(0,Wh.useMemo)(()=>ue(t),[t]),[E,$]=(0,Wh.useState)(null),Y=I??E,G=(0,Wh.useCallback)(e=>{I||$(e),T?.(e)},[I,T]),q=(0,Wh.useRef)(null),[V,X]=(0,Wh.useState)(null);(0,Wh.useEffect)(()=>{let e=0,t=!1;const n=()=>{if(t)return;const o=q.current?.getScales?.();o?X(o):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const U=void 0!==H[0]?.[m],K=(0,Wh.useMemo)(()=>{if(U)return H;if(y){const e=H.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[m]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:H}]},[H,y,m,U]),Q=(0,Wh.useMemo)(()=>U||y?K.flatMap(e=>{const t=e[m]||[];return y&&"string"==typeof y?t.map(t=>({...t,[y]:e[y]})):t}):H,[K,m,U,y,H]),Z=_c(H,g,x),J=au({lineWidth:v,colorBy:g,colorScale:Z,fillArea:k,areaOpacity:w}),ee=(0,Wh.useMemo)(()=>{if(P.lineStyle)return P.lineStyle},[P.lineStyle]),te=au({lineWidth:1,colorBy:g,colorScale:Z}),ne=ee??te,oe=(0,Wh.useMemo)(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return t.fill=g?it(e.parentLine||e,g,Z):nt,t}},[A,S,g,Z]),{legend:re,margin:ie,legendPosition:se}=wc({data:K,colorBy:g,colorScale:Z,showLegend:_,legendPosition:j,userMargin:r,chartWidth:n,hasTitle:!!s,axisChrome:{hasAxis:!0,hasAxisLabel:!!c}}),ae=P.height||60,le=(0,Wh.useMemo)(()=>({top:P.margin?.top??0,bottom:P.margin?.bottom??20,left:P.margin?.left??ie.left,right:P.margin?.right??ie.right}),[P.margin,ie]),ce=P.brushDirection||"x",he=(0,Wh.useMemo)(()=>pl([{label:c||cl(f),accessor:f,role:"x",format:h},{label:u||cl(p),accessor:p,role:"y",format:d}]),[f,p,c,u,h,d]),de=Vc({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(de)return(0,Yh.jsx)(Tc,{componentName:"MinimapChart",message:de,width:n,height:o});const fe=k?"area":"line",pe={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:J,...A&&{pointStyle:oe},size:[n,o],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,showAxes:!0,xLabel:c,yLabel:u,xFormat:h,yFormat:d,enableHover:M,showGrid:C,...re&&{legend:re,legendPosition:se},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===R?()=>null:la(R)||he,...Y&&{xExtent:Y},...N&&{yExtent:N},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...O},ye={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:ne,size:[n,ae+le.top+le.bottom],margin:le,showAxes:P.showAxes??!1,background:P.background,enableHover:!1,...N&&{yExtent:N}},me=(0,Yh.jsxs)("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[(0,Yh.jsx)(Rl,{ref:q,...ye}),(0,Yh.jsx)($h,{width:n-le.left-le.right,height:ae,margin:le,scales:V,brushDirection:ce,extent:Y,onBrush:G})]},"minimap"),ge=(0,Yh.jsx)("div",{style:{overflow:"hidden"},children:(0,Yh.jsx)(Rl,{...pe})},"main");return D||z||(0,Yh.jsx)(Wc,{componentName:"MinimapChart",width:n,height:o,children:(0,Yh.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[L?me:ge,L?ge:me]})})}Gh.displayName="MinimapChart";var qh=require("react"),Vh={label:"Low / High",color:"#E9C46A",opacity:.08},Xh={label:"High / High",color:"#2A9D8F",opacity:.08},Uh={label:"Low / Low",color:"#E76F51",opacity:.08},Kh={label:"High / Low",color:"#86BBD8",opacity:.08};M();var Qh=require("react/jsx-runtime");function Zh(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Jh=(0,qh.forwardRef)(function(e,t){const n=(0,qh.useRef)(null);cu(t,{variant:"xy",frameRef:n});const o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xCenter:h,yCenter:d,quadrants:f,centerlineStyle:p={},showQuadrantLabels:y=!0,quadrantLabelSize:m=12,colorBy:g,colorScheme:x,styleRules:b,sizeBy:v,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:S=.8,tooltip:M,pointIdAccessor:C,annotations:_,frameProps:j={},selection:R,linkedHover:P,onObservation:L,onClick:T,hoverHighlight:I,chartId:N,loading:O,loadingContent:F,emptyContent:B,legendInteraction:W,legendPosition:D,color:z,stroke:H,strokeWidth:E,opacity:$}=e,{width:Y,height:G,enableHover:q,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=o,te=(0,qh.useMemo)(()=>({topLeft:Zh(Vh,f?.topLeft),topRight:Zh(Xh,f?.topRight),bottomLeft:Zh(Uh,f?.bottomLeft),bottomRight:Zh(Kh,f?.bottomRight)}),[f]),ne=(0,qh.useMemo)(()=>ue(r),[r]),oe=Qc({data:ne,rawData:r,colorBy:g,colorScheme:x,legendInteraction:W,legendPosition:D,selection:R,linkedHover:P,fallbackFields:"string"==typeof g?[g]:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"QuadrantChart",chartId:N,showLegend:X,userMargin:i,marginDefaults:o.marginDefaults,loading:O,loadingContent:F,emptyContent:B,width:Y,height:G,hasTitle:!!U,axisChrome:sr({showAxes:o.showAxes,xLabel:J})});$c("QuadrantChart",ne,"xAccessor",c),$c("QuadrantChart",ne,"yAccessor",u);const re=(0,qh.useMemo)(()=>{if(!ne.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof u?u:e=>+e[u];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(n>h&&(n=h),h>o&&(o=h)),null!=d&&isFinite(d)&&(r>d&&(r=d),d>i&&(i=d)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[ne,c,u,h,d]),ie=(0,qh.useMemo)(()=>{if(!v||0===ne.length)return;const e=ne.map(e=>"function"==typeof v?v(e):e[v]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?A(e):void 0},[ne,v]),se=(0,qh.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),ae=(0,qh.useMemo)(()=>"function"==typeof u?u:e=>+e[u],[u]),le=(0,qh.useMemo)(()=>e=>{const t=se(e),n=ae(e),o=null!=h?t>=h:void 0,r=null!=d?n>=d:void 0;return void 0===r||void 0===o?z||nt:r&&o?te.topRight.color:r&&!o?te.topLeft.color:!r&&o?te.bottomRight.color:te.bottomLeft.color},[se,ae,h,d,te,z]),ce=(0,qh.useMemo)(()=>v?e=>lt(e,v,k,ie):void 0,[v,k,ie]),he=(0,qh.useMemo)(()=>tu(c,u),[c,u]),de=ih({colorBy:g,colorScale:oe.colorScale,color:z,pointRadius:w,fillOpacity:S,radiusFn:ce,fallbackFill:le,stroke:H,strokeWidth:E,opacity:$,styleRules:b,ruleContext:he,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),fe=(0,qh.useMemo)(()=>{if(!ne.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof u&&e.add(u),"string"==typeof g&&e.add(g),"string"==typeof v&&e.add(v);const t=ne[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[ne,c,u,g,v]),pe=(0,qh.useMemo)(()=>pl([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:J||cl(c),accessor:c,role:"x",format:a},{label:ee||cl(u),accessor:u,role:"y",format:l},...g?[{label:cl(g),accessor:g,role:"color"}]:[],...v?[{label:cl(v),accessor:v,role:"size"}]:[]]),[fe,c,u,J,ee,g,v,a,l]),ye=Vc({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),me=(0,qh.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray||[]};return[(t,n,o,r)=>{if(!o?.x||!o?.y)return;const i=r.width,s=r.height,a=null!=h?o.x(h):i/2,l=null!=d?o.y(d):s/2;if(null!=h&&!isFinite(a))return;if(null!=d&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),f=[{config:te.topLeft,x:0,y:0,w:c,h:u},{config:te.topRight,x:c,y:0,w:i-c,h:u},{config:te.bottomLeft,x:0,y:u,w:c,h:s-u},{config:te.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of f)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,d,te,p]),ge=(0,qh.useMemo)(()=>y?[...me,(e,t,n,o)=>{if(!n?.x||!n?.y)return;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;(null==h||isFinite(s))&&(null==d||isFinite(a))&&(e.font=`600 ${m}px sans-serif`,e.globalAlpha=.5,e.fillStyle=te.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(te.topLeft.label,8,8),e.fillStyle=te.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(te.topRight.label,r-8,8),e.fillStyle=te.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(te.bottomLeft.label,8,i-8),e.fillStyle=te.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(te.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:me,[me,y,m,te,h,d]),xe=(0,qh.useMemo)(()=>{const e=j.canvasPreRenderers||[];return[...ge,...e]},[ge,j.canvasPreRenderers]),be=(0,qh.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray?Array.isArray(p.strokeDasharray)?p.strokeDasharray.join(","):p.strokeDasharray:void 0};return[(t,n,o)=>{if(!n?.x||!n?.y)return null;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;if(null!=h&&!isFinite(s))return null;if(null!=d&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,Qh.jsxs)(Qh.Fragment,{children:[[{config:te.topLeft,x:0,y:0,w:l,h:c},{config:te.topRight,x:l,y:0,w:r-l,h:c},{config:te.bottomLeft,x:0,y:c,w:l,h:i-c},{config:te.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,Qh.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,Qh.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Qh.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),y&&(0,Qh.jsxs)(Qh.Fragment,{children:[(0,Qh.jsx)("text",{x:8,y:8+m,fill:te.topLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:te.topLeft.label}),(0,Qh.jsx)("text",{x:r-8,y:8+m,fill:te.topRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:te.topRight.label}),(0,Qh.jsx)("text",{x:8,y:i-8,fill:te.bottomLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:te.bottomLeft.label}),(0,Qh.jsx)("text",{x:r-8,y:i-8,fill:te.bottomRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:te.bottomRight.label})]})]})}]},[h,d,te,p,y,m]);if(oe.earlyReturn)return oe.earlyReturn;const ve={chartType:"scatter",...null!=r&&{data:ne},xAccessor:c,yAccessor:u,colorAccessor:g||void 0,sizeAccessor:v||void 0,sizeRange:k,pointStyle:de,colorScheme:x,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:o.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:q,showGrid:V,...re&&{xExtent:re.xExtent,yExtent:re.yExtent},...oe.legendBehaviorProps,...U&&{title:U},...K&&{description:K},...Q&&{summary:Q},...void 0!==Z&&{accessibleTable:Z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===M?()=>null:!0===M||void 0===M?pe:la(M)||pe,...hu({linkedHover:P,selection:R,onObservation:L,onClick:T,hoverHighlight:I,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...C&&{pointIdAccessor:C},..._&&_.length>0&&{annotations:_},canvasPreRenderers:xe,...oe.crosshairProps,...j,...xe.length>0&&{canvasPreRenderers:xe},svgPreRenderers:be};return ye?(0,Qh.jsx)(Tc,{componentName:"QuadrantChart",message:ye,width:Y,height:G}):(0,Qh.jsx)(Wc,{componentName:"QuadrantChart",width:Y,height:G,children:(0,Qh.jsx)(Rl,{ref:n,...ve})})});Jh.displayName="QuadrantChart";var ed=y(require("react")),td=require("react"),nd=require("react/jsx-runtime"),od="__ma_unitized",rd="__ma_series";function id(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function sd(e,t){return t[0]+e*(t[1]-t[0])}var ad=(0,td.forwardRef)(function(e,t){const n=(0,td.useRef)(null),o=(0,td.useRef)([]),r=(0,td.useRef)(e.series);r.current=e.series,(0,td.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||o.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&n.current.push({...i,[od]:id(a,s),[rd]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const n=r[t],s=n.extent||o.current[t];if(!s)continue;const a=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[od]:id(a,s),[rd]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const i=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:h,colorScheme:d,curve:f="monotoneX",lineWidth:p=2,tooltip:y,annotations:m,frameProps:g={},selection:x,linkedHover:b,onObservation:v,onClick:k,hoverHighlight:w,chartId:A,loading:S,loadingContent:M,emptyContent:C,legendInteraction:_,legendPosition:j,stroke:R,strokeWidth:P,opacity:L}=e,{width:T,height:I,enableHover:N,showGrid:O,showLegend:F=!0,title:B,description:W,summary:D,accessibleTable:z,xLabel:H}=i,E=(0,td.useMemo)(()=>ue(s),[s]),$=(0,td.useMemo)(()=>ue(h),[h]),Y=$,G=2===$.length,q=(0,td.useMemo)(()=>G?{...g.legendLayout,sideGutter:g.legendLayout?.sideGutter??70}:g.legendLayout,[g.legendLayout,G]);"undefined"==typeof process||"production"===process.env?.NODE_ENV||G||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${$.length}. Rendering as a standard multi-line chart.`);const V=Ec(S,T,I,M),X=V?null:Hc(s,T,I,C),U=Mc(),K=(0,td.useMemo)(()=>{let e;if(Array.isArray(d))e=d;else if(U&&U.length>0)e=U;else{const t=et[d];e=Array.isArray(t)?t:tt}return Y.map((t,n)=>t.color||e[n%e.length])},[Y,d,U]),Q=(0,td.useMemo)(()=>$.map((e,t)=>e.label||"Series "+(t+1)),[$]),{unitizedData:Z,extents:J}=(0,td.useMemo)(()=>{if(0===E.length){const e=$.map(e=>e.extent||null).filter(Boolean);return e.length===$.length&&(o.current=e),{unitizedData:[],extents:e.length===$.length?e:[]}}const e=$.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(E,e.yAccessor));if(o.current=e,!G){const t=[];for(const e of E)for(let n=0;$.length>n;n++){const o=$[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push({...e,[od]:r,[rd]:Q[n]})}return{unitizedData:t,extents:e}}const t=[];for(const n of E)for(let o=0;2>o;o++){const r=$[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push({...n,[od]:id(i,e[o]),[rd]:Q[o]})}return{unitizedData:t,extents:e}},[E,$,G,Q]),ee=(0,td.useMemo)(()=>{if(G&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:$[0].format||(e=>{const t=sd(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:$[1].format||(e=>{const t=sd(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[G,J,$,Q]),te=Qc({data:(0,td.useMemo)(()=>Z.length>0?Z:Q.map(e=>({[rd]:e})),[Z,Q]),rawData:s,colorBy:rd,colorScheme:K,legendInteraction:_,legendPosition:j,selection:x,linkedHover:b,fallbackFields:[rd],unwrapData:!1,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:A,showLegend:F,legendLayout:q,userMargin:a,marginDefaults:G?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:S,loadingContent:M,emptyContent:C,width:T,height:I,hasTitle:!!B,axisChrome:sr({showAxes:i.showAxes,xLabel:H})}),ne=(0,td.useMemo)(()=>{const e=new Map;return Q.forEach((t,n)=>e.set(t,K[n])),e},[Q,K]),oe=au({lineWidth:p,resolveStroke:(0,td.useCallback)(e=>ne.get(e[rd])||K[0],[ne,K]),stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=(0,td.useMemo)(()=>{if(!1===y)return()=>null;return la(y)||(e=>{const t=e.data||e,n=t[rd],o=Q.indexOf(n),r=t[od],i=G&&o>=0&&J[o]?sd(r,J[o]):r,s=o>=0&&$[o]?.format?$[o].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return ed.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},ed.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[o]||"inherit"}},n),ed.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),ed.createElement("div",null,`${n}: ${s(i)}`))})},[y,Q,K,J,G,$,u]);if(te.earlyReturn)return te.earlyReturn;const ie=Vc({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=G?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Z},xAccessor:u,yAccessor:od,groupAccessor:rd,lineStyle:oe,colorScheme:K,size:[T,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:H,...G?{}:{yLabel:Q[0]},xFormat:c,...G&&se&&{yExtent:se},enableHover:N,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:O,curve:f,...te.legendBehaviorProps,...B&&{title:B},...W&&{description:W},...D&&{summary:D},...void 0!==z&&{accessibleTable:z},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:re,...m&&{annotations:m},...hu({linkedHover:b,selection:x,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...g,...q&&{legendLayout:q}};return V||X||(ie?(0,nd.jsx)(Tc,{componentName:"MultiAxisLineChart",message:ie,width:T,height:I}):(0,nd.jsx)(Wc,{componentName:"MultiAxisLineChart",width:T,height:I,children:(0,nd.jsx)(Rl,{ref:n,...ae})}))});ad.displayName="MultiAxisLineChart";var ld=require("react"),cd=require("react/jsx-runtime"),ud=(0,ld.forwardRef)(function(e,t){const n=(0,ld.useRef)(null);cu(t,{variant:"xy",frameRef:n});const o=Pc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:h="low",openAccessor:d,closeAccessor:f,candlestickStyle:p,tooltip:y,annotations:m,xExtent:g,yExtent:x,frameProps:b={},selection:v,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:M,loadingContent:C,emptyContent:_}=e,{width:j,height:R,enableHover:P,showGrid:L,title:T,description:I,summary:N,accessibleTable:O,xLabel:F,yLabel:B}=o,W=Ec(M,j,R,C),D=W?null:Hc(r,j,R,_),z=(0,ld.useMemo)(()=>ue(r),[r]),H=null==d||null==f;$c("CandlestickChart",z,"xAccessor",c),$c("CandlestickChart",z,"highAccessor",u),$c("CandlestickChart",z,"lowAccessor",h),H||($c("CandlestickChart",z,"openAccessor",d),$c("CandlestickChart",z,"closeAccessor",f));const{customHoverBehavior:E,customClickBehavior:$,crosshairSourceId:Y}=jc({selection:v,linkedHover:k,onObservation:w,onClick:A,chartType:"CandlestickChart",chartId:S,mobileInteraction:o.mobileInteraction}),G=Rc(k,Y),q=(0,ld.useMemo)(()=>{const e=o.marginDefaults,t="sparkline"===o.mode?{...e,top:0,bottom:0}:e;return null==i?t:{...t,...Cu(i)}},[i,o.marginDefaults,o.mode]),V=(0,ld.useMemo)(()=>{const e=[{label:F||cl(c),accessor:c,role:"x",format:a}];return H?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:h,format:l})):(e.push({label:"Open",accessor:d,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:h,format:l}),e.push({label:"Close",accessor:f,format:l})),pl(e)},[c,F,a,l,u,h,d,f,H]),X=Vc({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f}}}),U={chartType:"candlestick",...null!=r&&{data:z},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(j/40))),extentPadding:j>200?.1:.02,size:[j,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:q,showAxes:o.showAxes,xLabel:F,yLabel:B,xFormat:a,yFormat:l,enableHover:P,showGrid:L,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...uu({title:T,description:I,summary:N,accessibleTable:O,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...du({tooltip:y,defaultTooltipContent:V}),...hu({linkedHover:k,selection:v,onObservation:w,onClick:A,mobileInteraction:o.mobileInteraction,customHoverBehavior:E,customClickBehavior:$}),...m&&m.length>0&&{annotations:m},...g&&{xExtent:g},...x&&{yExtent:x},...G,...b};return W||D||(X?(0,cd.jsx)(Tc,{componentName:"CandlestickChart",message:X,width:j,height:R}):(0,cd.jsx)(Wc,{componentName:"CandlestickChart",width:j,height:R,children:(0,cd.jsx)(Rl,{ref:n,...U})}))});ud.displayName="CandlestickChart";var hd={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},dd=8;function fd(e){return null==e?void 0:e+""}function pd(e){const t=fd(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??dd,style:{...hd},datum:e.datum,pointId:t,_transitionKey:t}}function yd(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...hd},datum:e.datum,group:e.group,_transitionKey:fd(e.id)}}