semiotic 3.8.1 → 3.8.3

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 (178) hide show
  1. package/CLAUDE.md +3 -1
  2. package/README.md +54 -52
  3. package/ai/behaviorContracts.cjs +9 -0
  4. package/ai/dist/mcp-server.js +142 -13
  5. package/ai/schema.json +616 -42
  6. package/ai/surface-manifest.json +1 -1
  7. package/ai/system-prompt.md +5 -2
  8. package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
  9. package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
  10. package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
  11. package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
  12. package/dist/chunk-chunk-2CCFBTQC.module.min.js +2 -0
  13. package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
  14. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
  15. package/dist/chunk-chunk-2RXP3FS3.module.min.js +1 -0
  16. package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
  17. package/dist/chunk-chunk-4TMZXLCR.module.min.js +1 -0
  18. package/dist/chunk-chunk-5APBQXZA.module.min.js +1 -0
  19. package/dist/chunk-chunk-5RKXZQ2P.module.min.js +1 -0
  20. package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
  21. package/dist/chunk-chunk-6HSGDMTA.module.min.js +2 -0
  22. package/dist/chunk-chunk-7FW6EGLP.module.min.js +2 -0
  23. package/dist/chunk-chunk-7OEOSCBP.module.min.js +1 -0
  24. package/dist/chunk-chunk-A63CTACR.module.min.js +2 -0
  25. package/dist/chunk-chunk-ANYDWOZF.module.min.js +1 -0
  26. package/dist/chunk-chunk-AZJUDQRM.module.min.js +2 -0
  27. package/dist/chunk-chunk-B6V35LMY.module.min.js +2 -0
  28. package/dist/chunk-chunk-BOSVL645.module.min.js +2 -0
  29. package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
  30. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
  31. package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
  32. package/dist/chunk-chunk-EMO5NUGE.module.min.js +2 -0
  33. package/dist/chunk-chunk-F25UA5HT.module.min.js +1 -0
  34. package/dist/chunk-chunk-FRIO6MCV.module.min.js +1 -0
  35. package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
  36. package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
  37. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
  38. package/dist/chunk-chunk-GWSWSPXN.module.min.js +1 -0
  39. package/dist/chunk-chunk-I6C3KR5H.module.min.js +2 -0
  40. package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
  41. package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
  42. package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
  43. package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
  44. package/dist/chunk-chunk-J5RL6GXU.module.min.js +2 -0
  45. package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
  46. package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
  47. package/dist/chunk-chunk-JNCHKRIR.module.min.js +2 -0
  48. package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
  49. package/dist/chunk-chunk-L3H6DQCR.module.min.js +2 -0
  50. package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
  51. package/dist/chunk-chunk-M7VYYHCE.module.min.js +2 -0
  52. package/dist/chunk-chunk-MC35ILYP.module.min.js +2 -0
  53. package/dist/chunk-chunk-N72SWNBV.module.min.js +1 -0
  54. package/dist/chunk-chunk-OBQRFTIL.module.min.js +2 -0
  55. package/dist/chunk-chunk-OQTLSTGI.module.min.js +2 -0
  56. package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
  57. package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
  58. package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
  59. package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
  60. package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
  61. package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
  62. package/dist/chunk-chunk-SA3D43RA.module.min.js +2 -0
  63. package/dist/chunk-chunk-SANERMIZ.module.min.js +2 -0
  64. package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
  65. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  66. package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
  67. package/dist/chunk-chunk-UHSZEB74.module.min.js +1 -0
  68. package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
  69. package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
  70. package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
  71. package/dist/chunk-chunk-XQYVEKEJ.module.min.js +2 -0
  72. package/dist/chunk-chunk-Y6AXCRVO.module.min.js +1 -0
  73. package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
  74. package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
  75. package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
  76. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
  77. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
  78. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  79. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
  80. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -6
  81. package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +11 -0
  82. package/dist/components/charts/shared/areaSeriesData.d.ts +15 -0
  83. package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
  84. package/dist/components/charts/shared/chartMode.d.ts +67 -0
  85. package/dist/components/charts/shared/colorUtils.d.ts +8 -0
  86. package/dist/components/charts/shared/geoStyleDefaults.d.ts +3 -0
  87. package/dist/components/charts/shared/hooks.d.ts +13 -80
  88. package/dist/components/charts/shared/useChartSetup.d.ts +3 -0
  89. package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
  90. package/dist/components/charts/shared/useXYLineStyle.d.ts +3 -2
  91. package/dist/components/charts/shared/xyLineStyle.d.ts +21 -0
  92. package/dist/components/charts/xy/LineChart.d.ts +3 -0
  93. package/dist/components/legendLayout.d.ts +31 -0
  94. package/dist/components/server/serverChartConfigShared.d.ts +29 -0
  95. package/dist/components/server/serverChartConfigs.d.ts +2 -13
  96. package/dist/components/server/serverChartConfigsXY.d.ts +3 -0
  97. package/dist/components/server/serverGaugeOverlay.d.ts +28 -0
  98. package/dist/components/server/staticLegend.d.ts +7 -1
  99. package/dist/components/server/staticSVGChrome.d.ts +60 -2
  100. package/dist/components/stream/GeoPipelineStore.d.ts +2 -0
  101. package/dist/components/stream/GeoSVGOverlay.d.ts +2 -0
  102. package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
  103. package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
  104. package/dist/components/stream/SceneToSVG.d.ts +8 -6
  105. package/dist/components/stream/SceneToSVGGeo.d.ts +10 -0
  106. package/dist/components/stream/SceneToSVGNetwork.d.ts +12 -0
  107. package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
  108. package/dist/components/stream/canvasBackground.d.ts +7 -0
  109. package/dist/components/stream/networkTypes.d.ts +2 -4
  110. package/dist/components/stream/renderBackend.d.ts +14 -0
  111. package/dist/components/stream/sceneToSVGShared.d.ts +51 -0
  112. package/dist/components/types/legendTypes.d.ts +16 -3
  113. package/dist/controls.min.js +1 -1
  114. package/dist/controls.module.min.js +1 -1
  115. package/dist/geo.min.js +1 -1
  116. package/dist/geo.module.min.js +1 -1
  117. package/dist/network.min.js +1 -1
  118. package/dist/network.module.min.js +1 -1
  119. package/dist/ordinal.min.js +1 -1
  120. package/dist/ordinal.module.min.js +1 -1
  121. package/dist/physics-matter.min.js +1 -1
  122. package/dist/physics-matter.module.min.js +1 -1
  123. package/dist/physics-rapier.min.js +1 -1
  124. package/dist/physics-rapier.module.min.js +1 -1
  125. package/dist/physics.min.js +1 -1
  126. package/dist/physics.module.min.js +1 -1
  127. package/dist/realtime.min.js +1 -1
  128. package/dist/realtime.module.min.js +1 -1
  129. package/dist/rough.min.js +1 -1
  130. package/dist/rough.module.min.js +1 -1
  131. package/dist/semiotic-ai-core.min.js +1 -1
  132. package/dist/semiotic-ai-core.module.min.js +1 -1
  133. package/dist/semiotic-ai.min.js +1 -1
  134. package/dist/semiotic-ai.module.min.js +1 -1
  135. package/dist/semiotic-data.min.js +1 -1
  136. package/dist/semiotic-data.module.min.js +1 -1
  137. package/dist/semiotic-experimental.min.js +1 -1
  138. package/dist/semiotic-experimental.module.min.js +1 -1
  139. package/dist/semiotic-realtime-core.min.js +1 -1
  140. package/dist/semiotic-realtime-core.module.min.js +1 -1
  141. package/dist/semiotic-realtime-react.min.js +1 -1
  142. package/dist/semiotic-realtime-react.module.min.js +1 -1
  143. package/dist/semiotic-recipes-core.min.js +1 -1
  144. package/dist/semiotic-recipes-core.module.min.js +1 -1
  145. package/dist/semiotic-recipes-react.min.js +1 -1
  146. package/dist/semiotic-recipes-react.module.min.js +1 -1
  147. package/dist/semiotic-recipes.min.js +1 -1
  148. package/dist/semiotic-recipes.module.min.js +1 -1
  149. package/dist/semiotic-server-edge.min.js +1 -1
  150. package/dist/semiotic-server-edge.module.min.js +1 -1
  151. package/dist/semiotic-server-node.min.js +1 -1
  152. package/dist/semiotic-server-node.module.min.js +1 -1
  153. package/dist/semiotic-themes-core.min.js +1 -1
  154. package/dist/semiotic-themes-core.module.min.js +1 -1
  155. package/dist/semiotic-themes-react.min.js +1 -1
  156. package/dist/semiotic-themes-react.module.min.js +1 -1
  157. package/dist/semiotic-themes.min.js +1 -1
  158. package/dist/semiotic-themes.module.min.js +1 -1
  159. package/dist/semiotic-utils-core.min.js +1 -1
  160. package/dist/semiotic-utils-core.module.min.js +1 -1
  161. package/dist/semiotic-utils-react.min.js +1 -1
  162. package/dist/semiotic-utils-react.module.min.js +1 -1
  163. package/dist/semiotic-utils.min.js +1 -1
  164. package/dist/semiotic-utils.module.min.js +1 -1
  165. package/dist/semiotic-value.min.js +1 -1
  166. package/dist/semiotic-value.module.min.js +1 -1
  167. package/dist/semiotic.min.js +1 -1
  168. package/dist/semiotic.module.min.js +1 -1
  169. package/dist/server.min.js +1 -1
  170. package/dist/server.module.min.js +1 -1
  171. package/dist/xy.min.js +1 -1
  172. package/dist/xy.module.min.js +1 -1
  173. package/package.json +4 -4
  174. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
  175. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
  176. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
  177. package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
  178. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{useRef as e,useState as t,useEffect as n,useMemo as o,useCallback as r,useImperativeHandle as i,forwardRef as a,memo as s}from"react";var l=Object.freeze([]);function c(e){if(!e)return l;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 u=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=c(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=c(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}};import{scaleBand as d,scaleLinear as h}from"d3-scale";var f=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,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},n.push(e),this.buffer[i]=t(a)}}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}},m=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 g(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function p(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 y(e,t,n){return e+(t-e)*n}function b(e,t){return e===t}function v(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function x(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function w(e){return new Set(Array.isArray(e)?e:[e])}import{scaleOrdinal as k}from"d3-scale";function S(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function A(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function M(e){const t=e.map(S),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return A(e,n,o)}if(e>=1){const[e,o,r]=t[n];return A(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[a,s,l]=t[r],[c,u,d]=t[r+1];return A(Math.round(a+(c-a)*i),Math.round(s+(u-s)*i),Math.round(l+(d-l)*i))}}var C=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],_=M(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),R=M(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),P=M(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),I=M(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),L=M(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),T=M(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),$={blues:_,reds:R,greens:P,viridis:M(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:I,purples:L,greys:T,plasma:M(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:M(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:M(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:M(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:M(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},B=M(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),H=M(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),O=M(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),j=M(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),F=M(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),D=M(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),W=M(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),E={category10:C,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...$},N=C,z=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],G=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 q(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")||G.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):N[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))%N.length]}function V(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 X(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>V(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 k().domain(o).range(n).unknown("#999");const i=E[n]||E.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:N;return k().domain(o).range(e).unknown("#999")}}function Y(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,a]=o,[s,l]=n;if(a===i)return(s+l)/2;let c=(r-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}var U=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,n){if(t&&"function"==typeof e.pieceStyle){const o=e.pieceStyle(t,n);return o&&!o.fill&&n?{...o,fill:this.getColorFromScheme(e,n)}:o}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&n?{fill:e.barColors[n]||"#007bff"}:{fill:n?this.getColorFromScheme(e,n):"#007bff"}}resolveSummaryStyle(e,t,n){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,n):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const n=this.colorSchemeMap.get(t);if(n)return n;const o=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||z,r=o[this.colorSchemeIndex%o.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function K(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}import{symbol as Q,symbolCircle as Z,symbolCross as J,symbolDiamond as ee,symbolSquare as te,symbolStar as ne,symbolTriangle as oe,symbolWye as re}from"d3-shape";var ie={circle:Z,square:te,triangle:oe,diamond:ee,star:ne,cross:J,wye:re},ae=["circle","triangle","diamond","star","square","chevron","cross","wye"];function se(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*le(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):Q(ie[o]??Z,Math.max(1,t))()??""}function le(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function ce(e){const t=e.getSymbol;if(!t)return null;const n=e.config.symbolMap,o=new Map;let r=0;return e=>{const i=t(e)+"",a=n?.[i];if(a)return a;let s=o.get(i);return s||(s=ae[r%ae.length],r++,o.set(i,s)),s}}function ue(e,t,n,o,r,i,a){e.push(t?{type:"symbol",x:o,y:r,size:Math.PI*i*i,symbolType:t(n),style:a,datum:n}:{type:"point",x:o,y:r,r:i,style:a,datum:n})}function de(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI,u=null!=o.sweepAngle&&360>o.sweepAngle,d=Object.values(n),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!h&&d.length>1&&(o.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],n=t.pieceData[0],u="number"==typeof n?._pctStart?n._pctStart:t.pctStart,h=l+u*c,m=l+(u+("number"==typeof n?._pct?n._pct:t.pct))*c,g=r(t.pieceData[0],t.name),p=0===e,y=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:h,endAngle:m,...o.cornerRadius&&{cornerRadius:o.cornerRadius},style:g,datum:n?._nonInteractive?null:t.pieceData,category:t.name};n?._roundedEnds?b.roundedEnds=n._roundedEnds:f&&(b.roundedEnds={start:p,end:y}),n?._gradientBand&&(b._gradientBand=n._gradientBand),i.push(b)}return i}import{quantile as he}from"d3-array";function fe(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 me(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function ge(e){const t=e.length,n=e[0],o=e[t-1];return{n:t,min:n,q1:he(e,.25)??n,median:he(e,.5)??(n+o)/2,q3:he(e,.75)??o,max:o,mean:e.reduce((e,t)=>e+t,0)/t}}import{scaleLinear as pe}from"d3-scale";var ye={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,m=[];if(a){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=a(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of m){const c=t.get(i);if(!c)continue;let m=c.total;f&&n>0&&(m/=n);const g=s(c.pieces[0],a?i:e.name),p={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>m?r:o+m),n=0>m?l(r+m)-l(r):l(o)-l(o+m);u.push(K(e.x,t,e.width,Math.abs(n),g,p,i)),0>m?r+=m:o+=m}else if(h){const t=l(0>m?r+m:o),n=0>m?l(r)-l(r+m):l(o+m)-l(o);u.push(K(t,e.x,Math.abs(n),e.width,g,p,i)),0>m?r+=m:o+=m}}}const g="vertical"===c,p=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=g?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(p>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const n=t.datum?.category||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),n=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(g?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=p),n.length>0&&(n.reduce(g?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=p)}}return u},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=a?a(t):"_default";f.has(e)||(f.add(e),h.push(e))}const m=h.length||1;for(const e of Object.values(o)){const t=e.width/m,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let a=0;h.length>a;a++){const c=r.get(h[a])||[];for(const r of c){const c=i(r),f=s(r,h[a]);if(d){const i=e.x+a*t+n/2,s=l(0),d=l(c);u.push(K(i,Math.min(s,d),o,Math.abs(s-d),f,r,h[a]))}else{const i=e.x+a*t+n/2,s=l(0),d=l(c);u.push(K(Math.min(s,d),i,Math.abs(d-s),o,f,r,h[a]))}}}}const g=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);g>0&&(e.roundedTop=g),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:n,columns:o,getR:r,multiScales:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=ce(e),m=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(o))for(const t of e.pieceData){const n=t.__rIndex??0,o=t.__rValue??r(t),l=h&&i[n]||s,p=a(t,e.name),y=p.r||5;let b,v;if(d){const t=g+(e.pctStart+e.pct/2)*m,n=l(o);b=Math.cos(t)*n,v=Math.sin(t)*n}else u?(b=e.middle,v=l(o)):(b=l(o),v=e.middle);ue(c,f,t,b,v,y,p)}return c},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s,u=ce(e);for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),d=i(o,e.name),h=d.r||4,f=(7919*n%100/100-.5)*t*.8;ue(l,u,o,c?e.middle+f:a(s),c?a(s):e.middle+f,h,d)}}return l},pie:de,donut:de,boxplot:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(o)){const n=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===n.length)continue;const o=n[0],r=n[n.length-1],l=he(n,.25)??o,h=he(n,.5)??(o+r)/2,f=he(n,.75)??r,m=f-l,g=l-1.5*m,p=f+1.5*m,y=n.find(e=>e>=g)??o,b=[...n].reverse().find(e=>p>=e)??r,v=a(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const n=i(e);if(g>n||n>p){const o=u?t.middle:s(n),r=u?s(n):t.middle;x.push({px:o,py:r,value:n,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:s(y),q1Pos:s(l),medianPos:s(h),q3Pos:s(f),maxPos:s(b),stats:{n:n.length,min:y,q1:l,median:h,q3:f,max:b,mean:n.reduce((e,t)=>e+t,0)/n.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=r.bins||20,h=!1!==r.showIQR;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],o=t[t.length-1],r=(o-n)/d||1,l=Array(d).fill(0);for(const e of t)l[Math.min(Math.floor((e-n)/r),d-1)]++;const f=me(l,1),m=e.width/2*.9;let g;if(u){g=`M ${e.middle} ${s(n)}`;for(let t=0;d>t;t++){const o=s(n+(t+.5)*r);g+=` L ${e.middle+l[t]/f*m} ${o}`}g+=` L ${e.middle} ${s(o)}`;for(let t=d-1;t>=0;t--){const o=s(n+(t+.5)*r);g+=` L ${e.middle-l[t]/f*m} ${o}`}g+=" Z"}else{g=`M ${s(n)} ${e.middle}`;for(let t=0;d>t;t++)g+=` L ${s(n+(t+.5)*r)} ${e.middle-l[t]/f*m}`;g+=` L ${s(o)} ${e.middle}`;for(let t=d-1;t>=0;t--)g+=` L ${s(n+(t+.5)*r)} ${e.middle+l[t]/f*m}`;g+=" Z"}const p=a(e.pieceData[0],e.name);let y;if(h&&t.length>=4){const r=he(t,.25)??n,i=he(t,.5)??(n+o)/2,a=he(t,.75)??o;y={q1Pos:s(r),medianPos:s(i),q3Pos:s(a),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(s(o),s(n)),width:e.width,height:Math.abs(s(o)-s(n))}:{x:Math.min(s(n),s(o)),y:e.x,width:Math.abs(s(o)-s(n)),height:e.width};c.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:b,iqrLine:y,stats:ge(t),style:p,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=n,l=[],c=r.bins||25,u=r.normalize,d=s.domain?.(),h=d?+d[0]:void 0,f=d?+d[1]:void 0;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[n,o]=fe(t),r=null!=h&&isFinite(h)?h:n,d=null!=f&&isFinite(f)?f:o,m=(d-r)/c||1,g=Array(c).fill(0);for(const e of t)r>e||e>d||g[Math.min(Math.floor((e-r)/m),c-1)]++;const p=t.length,y=me(g,1),b=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===g[t])continue;const n=(u?g[t]/p:g[t]/y)*e.width*.9,o=s(r+t*m),i=s(r+(t+1)*m);l.push(K(Math.min(o,i),e.x+e.width-n,Math.abs(i-o),n,b,{bin:t,count:g[t],range:[r+t*m,r+(t+1)*m],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s,projection:l}=n,c=[],u=r.bins||20,d="horizontal"===l,h=r.amplitude||1.5;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],o=t[t.length-1],r=(o-n)/u||1,l=Array(u).fill(0);for(const e of t)n>e||e>o||l[Math.min(Math.floor((e-n)/r),u-1)]++;const f=me(l,1),m=a(e.pieceData[0],e.name),g=e.width*h;let p;if(d){const t=e.x+e.width;p=`M ${s(n)} ${t}`;for(let e=0;u>e;e++)p+=` L ${s(n+(e+.5)*r)} ${t-l[e]/f*g}`;p+=` L ${s(o)} ${t} Z`}else{const t=e.x;p=`M ${t} ${s(n)}`;for(let e=0;u>e;e++){const o=s(n+(e+.5)*r);p+=` L ${t+l[e]/f*g} ${o}`}p+=` L ${t} ${s(o)} Z`}const y=d?{x:Math.min(s(n),s(o)),y:e.x,width:Math.abs(s(o)-s(n)),height:e.width}:{x:e.x,y:Math.min(s(o),s(n)),width:e.width,height:Math.abs(s(o)-s(n))};c.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:y,stats:ge(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(K(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(K(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i}=e,a=[],s=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>n[e]).filter(Boolean);if(0===c.length)return a;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let m=0;for(const e of c){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const a=t.get(e),s=o(i);a.total+=s,a.pieces.push(i),n+=s}f.push({col:e,groups:t,stepTotal:n}),h||n>m&&(m=n)}if(h)for(const e of f){let t=0,n=0;for(let o=0;u.length>o;o++){const r=e.groups.get(u[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>m&&(m=o)}if(0===m)return a;const g=new Map;for(const e of u){const t=f[0].groups.get(e);g.set(e,t?.total??0)}const p=f[0].stepTotal,y=h?.95*s:.9*t.width,b=pe().domain([0,m]).range([0,y]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const n=f[t],o=n.col,r=0===t,c=o.width,d=.55*c,m=o.x+(c-d)/2,y=new Map;if(h){let e=0;for(const t of u){const o=n.groups.get(t);o&&(e+=b(o.total))}let t=s,c=s;for(let h=0;u.length>h;h++){const f=u[h],p=n.groups.get(f);if(!p)continue;const v=b(p.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(p.pieces[0],f),S=g.get(f)??p.total,A={...p.pieces[0],__funnelValue:p.total,__funnelPercent:S>0?p.total/S*100:0,__funnelStep:o.name,__funnelIsFirstStep:r,__aggregateValue:p.total,__pieceCount:p.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=s,A.__funnelStepLabelY=m,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=m,A.__funnelBarW=v),a.push(K(w,m,v,d,k,A,f)),y.set(f,{x:w,y:m,w:v,h:d})}}else{const e=n.stepTotal,t=b(e),c=s-t/2,h=u[0],f="_default"!==h,g=n.groups.get(h)?.pieces[0]??o.pieceData[0],v=f?h:o.name,x=i(g,v),w=p>0?e/p*100:0,k={...g,__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:r,category:f?h:o.name};l&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=s,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=s,k.__funnelValueLabelY=m,k.__funnelBarW=t),a.push(K(c,m,t,d,x,k,v)),y.set(h,{x:c,y:m,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),s=y.get(r);if(!t||!s)continue;const l=(()=>{const e=n.groups.get(r);return i(e?e.pieces[0]:o.pieceData[0],"_default"===r?o.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[s.x+s.w,s.y],[s.x,s.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:n.groups.get(r)?.pieces[0]??o.pieceData[0],category:"_default"===r?o.name:r};a.push(c)}}x=y}return a},"bar-funnel":function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i,scales:a}=e,s=[],l=a.o.domain().map(e=>n[e]).filter(Boolean);if(0===l.length)return s;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const a=t.get(e),s=o(i);a.total+=s,a.pieces.push(i),n+=s}h.push({col:e,groups:t,stepTotal:n})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const m=a.r,g=d?c.length:1,p=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],n=t.col,o=0===e,r=e>0?h[e-1]:null,a=n.width/g,l=a*p,u=a-l;for(let e=0;c.length>e;e++){const h=c[e],g=t.groups.get(h);if(!g)continue;const p=g.total,y=f.get(h)??p,b=y>0?p/y*100:0,v=r?.groups.get(h),x=o?0:Math.max(0,(v?.total??p)-p),w=n.x+e*a+l/2,k=m(p),S=m(0)-k,A=i(g.pieces[0],d?h:n.name),M={...g.pieces[0],__barFunnelValue:p,__barFunnelPercent:b,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name,__barFunnelLabelX:w+u/2,__barFunnelLabelY:m(p+x)};if(s.push(K(w,k,u,S,A,M,d?h:n.name)),x>0){const e=m(p+x),t=k-e,o={...A},r={...g.pieces[0],__barFunnelValue:x,__barFunnelPercent:y>0?x/y*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name};s.push(K(w,e,u,t,o,r,d?h:n.name))}}}return s},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[n,r]=s.range(),i=Math.min(n,r),a=Math.abs(r-n);for(const n of Object.values(o)){const o={fill:e,opacity:t},r=u?K(i,n.x,a,n.width,o,null,"__track__"):K(n.x,i,n.width,a,o,null,"__track__");c.push(r)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(o)){let t=0;const n=c.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,f=a(n,l);let m;if(u){const r=s(t),i=s(t+o);m=K(r,e.x,i-r,e.width,f,n,l)}else{const r=s(t+o),i=s(t);m=K(e.x,r,e.width,i-r,f,n,l)}d&&(m.fillGradient=d,m.roundedEdge=h),c.push(m),t+=o}if(m>0&&c.length>n){const e=c.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:u?(t.cornerRadii={tl:m,bl:m},o.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},o.cornerRadii={tl:m,tr:m})}}return c}};function be(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&V(n,e)||"#4e79a7":t=>{if(n){const e=V(n,t);if(e)return e}let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return e[Math.abs(o)%e.length]??"#4e79a7"}}function ve(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(ve))}function xe(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function we(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var ke=new WeakMap;var Se={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 Ae(e,t){const n={...e};for(const e of t)n[Se[e]]++;return n}function Me(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Ae(n,o)}}var Ce=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=Me({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=Me(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},_e=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Re=["scene-style","data-paint","accessibility","evidence"],Pe=(e,t)=>({retainedData:e,invalidations:t}),Ie=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Le=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Te=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],$e=["scene-geometry","data-paint","accessibility","evidence"],Be=["scene-style","data-paint","accessibility","evidence"],He=[],Oe={chartType:Pe("rebuild",Ie),runtimeMode:Pe("rebuild",Ie),categoryAccessor:Pe("rebuild",Ie),valueAccessor:Pe("rebuild",Ie),oAccessor:Pe("rebuild",Ie),rAccessor:Pe("rebuild",Ie),stackBy:Pe("rebuild",Ie),groupBy:Pe("rebuild",Ie),timeAccessor:Pe("rebuild",Ie),accessorRevision:Pe("rebuild",Ie),colorAccessor:Pe("rebuild",Be),symbolAccessor:Pe("rebuild",$e),connectorAccessor:Pe("rebuild",$e),dataIdAccessor:Pe("rebuild",$e),projection:Pe("preserve",Le),extentPadding:Pe("preserve",Le),axisExtent:Pe("preserve",Le),rExtent:Pe("preserve",Le),oExtent:Pe("preserve",Le),multiAxis:Pe("preserve",Le),normalize:Pe("preserve",Le),bins:Pe("preserve",Le),oSort:Pe("preserve",Te),barPadding:Pe("preserve",Te),roundedTop:Pe("preserve",Te),baselinePadding:Pe("preserve",Te),innerRadius:Pe("preserve",Te),cornerRadius:Pe("preserve",Te),startAngle:Pe("preserve",Te),sweepAngle:Pe("preserve",Te),trackFill:Pe("preserve",Te),showOutliers:Pe("preserve",Te),showIQR:Pe("preserve",Te),amplitude:Pe("preserve",Te),connectorOpacity:Pe("preserve",Te),showLabels:Pe("preserve",Te),dynamicColumnWidth:Pe("rebuild",Te),customLayout:Pe("preserve",Te),layoutConfig:Pe("preserve",Te),layoutMargin:Pe("preserve",Te),symbolMap:Pe("preserve",$e),pieceStyle:Pe("preserve",Be),summaryStyle:Pe("preserve",Be),connectorStyle:Pe("preserve",Be),gradientFill:Pe("preserve",Be),colorScheme:Pe("preserve",Be),themeCategorical:Pe("preserve",Be),themeSemantic:Pe("preserve",Be),themeSequential:Pe("preserve",Be),themeDiverging:Pe("preserve",Be),barColors:Pe("preserve",Be),decay:Pe("preserve",Be),pulse:Pe("preserve",Be),staleness:Pe("preserve",Be),layoutSelection:Pe("preserve",Be),windowSize:Pe("preserve",He),windowMode:Pe("preserve",He),clock:Pe("preserve",He),transition:Pe("preserve",He),introAnimation:Pe("preserve",He),onLayoutError:Pe("preserve",He)},je=Pe("preserve",Te),Fe=class{constructor(){this.tracker=new Ce}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}},_e)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Re):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=Oe[o]??je;"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)}};import{quadtree as De}from"d3-quadtree";var We=class{constructor(e){this.rExtent=new m,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Fe,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new U,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.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.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new f(e.windowSize),this.getO=x(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>v(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new m)):(this.getR=v(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=x(e.stackBy),this.getGroup=x(e.groupBy),this.getColor=x(e.colorAccessor),this.getSymbol=x(e.symbolAccessor),this.getConnector=x(e.connectorAccessor),this.getDataId=x(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new f(e.windowSize))}syncPulseTimestampBuffer(){var e,t,n,o;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,n=this.timestampBuffer,o=this.currentTime(),e?null!=n&&n.capacity===t.capacity&&n.size===t.size?n:function(e,t){const n=new f(e.capacity);return e.forEach(()=>n.push(t)),n}(t,o):null)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}ingest(e){const t=this.currentTime();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),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)we(this.buffer,n,this.timestampBuffer,t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=we(this.buffer,n,this.timestampBuffer,t);this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(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}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.multiScales,i=this.columns;if(0===n.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const a=this.getBufferArray(),s=t.projection||"vertical",l=t.oExtent||this.resolveCategories(a),c=this.computeValueDomain(a,l),u="horizontal"===s,f="radial"===s,m=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===s?e.width:e.height):.1));let g,p;if(f){g=d().domain(l).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;p=h().domain(c).range([o,n])}else u?(g=d().domain(l).range([0,e.height]).padding(m),p=h().domain(c).range([0,e.width])):(g=d().domain(l).range([0,e.width]).padding(m),p=h().domain(c).range([e.height,0]));this.scales={o:g,r:p,projection:s},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[a,s]=i.extent;a===1/0&&(a=0,s=1);const l=s-a,c=l>0?l*(t.extentPadding??.05):1;return a-=c,s+=c,a>0&&(a=0),u?h().domain([a,s]).range([0,e.width]):h().domain([a,s]).range([e.height,0])}):[];let y=a;this.rAccessors.length>1&&(y=a.flatMap(e=>this.rAccessors.map((t,n)=>({...e,__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(y,l,g,s,e),this._customLayoutFailedThisBuild=!1;const b=this.buildSceneNodes(y,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=b,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,a),this.config.pulse&&this.applyPulse(this.scene,a),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let r=null;if(n){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===o)return i;if("function"==typeof o)return i.sort(o);const a=new Map;for(const t of e){const e=this.getO(t);a.set(e,(a.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===o?(e,t)=>(a.get(e)||0)-(a.get(t)||0):(e,t)=>(a.get(t)||0)-(a.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:n,projection:o,normalize:r,rExtent:i,extentPadding:a=.05,baselinePadding:s,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=a;if("radial"===o&&("pie"===n||"donut"===n))return[0,1];let m=0,g=0;if("bar"===n&&d&&r)m=0,g=1;else if("bar"===n&&d){const e=new Map,n=new Map;for(const o of t){const t=c(o),r=u(o);0>r?n.set(t,(n.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t);for(const e of n.values())m>e&&(m=e)}else if("bar"===n){const e=new Map;for(const n of t){const t=c(n),o=u(n);e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t),m>t&&(m=t)}else if("swimlane"===n){const e=new Map;for(const n of t){const t=c(n),o=Math.abs(u(n));e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t)}else if("clusterbar"===n||"bar-funnel"===n)for(const e of t){const t=u(e);t>g&&(g=t),m>t&&(m=t)}else{const e=h[0],t=h[1];e!==1/0&&(m=e),t!==-1/0&&(g=t)}i&&(null!=i[0]&&(m=i[0]),null!=i[1]&&(g=i[1]));const p="bar"===n||"clusterbar"===n||"bar-funnel"===n||"swimlane"===n;if(p&&null==i?.[0]&&null==i?.[1]&&(m>0&&(m=0),0>g&&(g=0)),"bar-funnel"!==n&&"exact"!==l){const e=g-m,t=e>0?e*f:1,o=p&&!s&&0===m,r=p&&!s&&0===g||"swimlane"===n;null!=i?.[0]||o||(m-=t),null!=i?.[1]||r||(g+=t)}return[m,g]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,n,o,r){return function(e){const{data:t,oExtent:n,oScale:o,projection:r,layout:i,dynamicColumnWidth:a,getO:s,getR:l}=e,c={},u=new Map;for(const e of t){const t=s(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(a&&"radial"!==r){h=new Map;let e=0;for(const t of n){const n=u.get(t)||[];let o;o="string"==typeof a?n.reduce((e,t)=>e+(Number(t[a])||0),0):a(n),h.set(t,o),e+=o}const t=("horizontal"===r?i.height:i.width)-o.padding()*o.step()*n.length;if(e>0)for(const[n,o]of h)h.set(n,o/e*t)}let f=0,m=0;for(const e of n){const t=u.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?n/d:0;let i,a;h?(i=m,a=h.get(e)||o.bandwidth(),m+=a+o.padding()*o.step()):(i=o(e)??0,a=o.bandwidth()),c[e]={name:e,x:i,y:0,width:a,middle:i+a/2,padding:o.padding()*o.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:n,projection:o,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const n=this.buildLayoutContext(e,t);let o;try{o=this.config.customLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,n=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}}("ordinal",e,t,this.version);this.lastCustomLayoutFailure=n,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(n)}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=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null;const r=o.nodes??[];if(this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;ve(o)&&0===n.length&&xe(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)&&xe(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:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const n=this.getSceneContext(),o=ye[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[t,n]of l)if(n.length>=2){n.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let o=0;n.length-1>o;o++){const r=n[o],i=n[o+1],s="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:s,datum:r.datum,group:t})}}return a}(n,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const n=this.config,o=n.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=E[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(n.colorScheme,n.themeCategorical,z),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:o,plot:"radial"===i.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:n.themeSemantic??{},categorical:[...r]},resolveColor:be(r,n.colorScheme),config:n.layoutConfig??{},selection:n.layoutSelection??null}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(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})}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=function(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const n="function"==typeof t,o=n?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const a=e[i],s=n?t(a):a[o],l=r.get(s);l?l.push(i):r.set(s,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,n=0;for(const o of e)"point"===o.type&&(t++,o.r>n&&(n=o.r));if(500>=t)return{quadtree:null,maxRadius:n};const o=Array(t);let r=0;for(const t of e)"point"===t.type&&(o[r++]=t);return{maxRadius:n,quadtree:De().x(e=>e.x).y(e=>e.y).addAll(o)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const n=t.length;if(1>=n)return;const o=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=o.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,n);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,n=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i){const a=e.color??"rgba(255,255,255,0.6)",s=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let o=0;for(const a of r(t)??[]){const t=n.get(a);null!=t&&(o=Math.max(o,g(e,t,i)))}l=p(c,o,a)||l;continue}if(null==c.datum)continue;const t=o.get(c.datum);if(null==t)continue;const u=n.get(t);l=p(c,null==u?0:g(e,u,i),a,s)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),n)}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())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,n="horizontal"!==this.scales?.projection;let o;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],a=this.getNodeKey(i,e);a&&("rect"===i.type?this.prevPositionMap.set(a,n?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(a,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===o&&(o=i.startAngle),this.prevPositionMap.set(a,{x:i.cx,y:i.cy,startAngle:o,endAngle:o,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(o,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:n.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const n=new Set,o=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,o);if(!i)continue;r._transitionKey=i;const a=this.prevPositionMap.get(i);if("point"===r.type)a?(n.add(i),r._targetOpacity=r.style.opacity??1,(a.x!==r.x||a.y!==r.y||void 0!==a.r&&a.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=a.x,r.y=a.y,void 0!==a.r&&(r.r=a.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)a?(n.add(i),r._targetOpacity=r.style.opacity??1,a.x===r.x&&a.y===r.y&&a.w===r.w&&a.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=a.x,r.y=a.y,r.w=a.w??r.w,r.h=a.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(a)n.add(i),r._targetOpacity=r.style.opacity??1,a.startAngle===r.startAngle&&a.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=a.startAngle,r.endAngle=a.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,o]of this.prevPositionMap)if(!n.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:o.x,y:o.y,r:o.r??3,style:{opacity:o.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:o.x,y:o.y,w:o.w??0,h:o.h??0,style:{opacity:o.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((o.startAngle??0)+(o.endAngle??0))/2,n={type:"wedge",cx:o.x,cy:o.y,innerRadius:o.innerRadius??0,outerRadius:o.outerRadius??100,startAngle:o.startAngle??0,endAngle:o.endAngle??0,style:{opacity:o.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style.opacity=y(o?o.opacity??1:0,e._targetOpacity,n)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=y(o.x,e._targetX,n),e.y=y(o.y,e._targetY,n)),void 0!==e._targetR&&void 0!==o?.r&&(e.r=y(o.r,e._targetR,n))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style.opacity=y(o?o.opacity??1:0,e._targetOpacity,n)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=y(o.x,e._targetX,n),e.y=y(o.y,e._targetY,n),void 0!==o.w&&(e.w=y(o.w,e._targetW,n),e.h=y(o.h,e._targetH,n))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style={...e.style,opacity:y(o?o.opacity??1:0,e._targetOpacity,n)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=y(o.startAngle,e._targetStartAngle,n),e.endAngle=y(o.endAngle,e._targetEndAngle,n))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=w(e),n=this.getDataId,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.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=w(e),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}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.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}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&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!b(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!b(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!b(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let o=!1;("categoryAccessor"in e||"oAccessor"in e)&&(b(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=x(this.config.categoryAccessor||this.config.oAccessor,"category"),o=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,n=t.valueAccessor||t.rAccessor,o=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];if(r=o.length!==i.length||o.some((e,t)=>!b(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>v(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new m)):(this.getR=v(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!b(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?x(this.config.stackBy):void 0),"groupBy"in e&&!b(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?x(this.config.groupBy):void 0),"colorAccessor"in e&&!b(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?x(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!b(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?x(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!b(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?x(this.config.connectorAccessor):void 0),(o||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Object.assign(We.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(){ke.set(this,!0)},consumeStylePaintPending:function(){const e=!0===ke.get(this);return ke.delete(this),e}});import{memo as Ee,useEffect as Ne,useRef as ze}from"react";var Ge={sceneGeometry:0,layout:0,domain:0};function qe(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function Ve(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 Xe="production"!==process.env.NODE_ENV,Ye={revisions:Ge,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Ue=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Ge,this.lastObserved=Ge,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Xe&&(this.lastObserved=Ve(this.lastObserved,qe(e)))}beforeCompute(e,t){if(!Xe)return Ye;const n=Ve(qe(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;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(Xe){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="")}}},Ke=Ee(function({store:e,diagnostics:t}){return Ne(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});import*as Qe from"react";function Ze(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Qe.createElement(Qe.Fragment,null,...t)}import*as Je from"react";import{jsx as et}from"react/jsx-runtime";var tt={isActive:!1,predicate:()=>!0},nt=Je.createContext(null);function ot({value:e,children:t}){return et(nt.Provider,{value:e,children:t})}function rt(){return Je.useContext(nt)??tt}function it(e,t){return null!=e?et(ot,{value:t,children:e}):e}import{useEffect as at,useRef as st}from"react";function lt(e,t=30){return Math.max((e??4)+5,12,t)}function ct(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var ut=[40,40],dt=[.5,.5];function ht(e,t){const[n,o]=e.viewBox??ut,[r,i]=e.anchor??dt,a=o>0?o:1,s=Math.max(0,t)/a,l=(n>0?n:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-r*l,offsetY:-i*c}}function ft(e,t){const n=ht(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 mt(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var gt=null;function pt(e){if("undefined"==typeof Path2D)return null;gt||(gt=new Map);const t=gt.get(e);if(t)return t;const n=new Path2D(e);return gt.size>1024&&gt.clear(),gt.set(e,n),n}function yt(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??ut,a=Math.min(1,Math.max(0,n)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===o?{x:0,y:i*(1-s),width:r,height:i*(s-a)}:{x:r*a,y:0,width:r*(s-a),height:i}:null:{x:0,y:0,width:0,height:0}}function bt(e,t){const n=ht(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 vt(e,t,n,o,r,i=e=>e){for(const a of t.parts){const t=pt(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=r?"none"===a.fill?void 0:r:mt(a.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?a.stroke&&"none"!==a.stroke?r:void 0:mt(a.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function xt(e,t,n,o=30,r,i=0){let a=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,m=1/0;return e.visit((e,r,l,g,p)=>{if(r>u||c>g||l>h||d>p)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=a(e)-n,u=Math.sqrt(l*l+c*c);lt(s(e),o)>=u&&m>u&&(f=e,m=u),r=r.next}while(r)}return!1}),f?{node:f,distance:m}:null}(r,t,n,o,i);e&&(a={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=wt(i,t,n);break;case"point":if(r)break;e=kt(i,t,n,o);break;case"symbol":e=St(i,t,n,o);break;case"glyph":e=At(i,t,n,o);break;case"wedge":if(null===i.datum)break;e=Mt(i,t,n);break;case"boxplot":e=Ct(i,t,n);break;case"violin":e=_t(i,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function wt(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function kt(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>lt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function St(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>lt(le(e.size),o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function At(e,t,n,o=30){if(null==e.datum)return null;const r=bt(e.glyph,e.size),i=e.x+r.centerDx,a=e.y+r.centerDy,s=t-i,l=n-a,c=Math.sqrt(s*s+l*l);return c>lt(r.radius,o)?null:{datum:e.datum,x:i,y:a,distance:c}}function Mt(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=ct(Math.atan2(r,o)),s=ct(e.startAngle),l=ct(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Ct(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function _t(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}import{useEffect as Rt,useRef as Pt}from"react";var It={fresh:1,aging:.7,stale:.45,expired:.25},Lt={alpha:1,band:"fresh",isStale:!1};import{jsx as Tt}from"react/jsx-runtime";function $t({isStale:e,position:t}){return Tt("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"})}import{useMemo as Bt,useRef as Ht}from"react";import*as Ot from"react";import{jsx as jt,jsxs as Ft}from"react/jsx-runtime";var Dt={fill:(e,t)=>jt("rect",{style:e,width:t,height:t}),line:(e,t)=>jt("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Wt(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Dt[n])(o(e,t),r),i}function Et({swatchSize:e}){return jt("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 Nt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var zt=(e,t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,m=[];let g=0;const p=!(!t&&!n),y="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=Wt(e,c,d,h,b),w=Nt(e,o,r),k=r&&r.size>0&&r.has(e.label);m.push(Ft("g",{transform:`translate(0,${g})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:p?s===i&&c===a?0:-1:void 0,role:p?"option":void 0,"aria-selected":p&&y?k||!1:void 0,"aria-current":p&&!y&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:p?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(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:p?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:p?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:p?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[p&&jt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&jt(Et,{swatchSize:b}),jt("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),g+=x}),m};function Gt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ot.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(jt("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return Ft("g",{"aria-label":i||"Gradient legend",children:[jt("defs",{children:jt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&jt("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),jt("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),jt("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])}),jt("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(jt("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return Ft("g",{"aria-label":i||"Gradient legend",children:[i&&jt("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),jt("defs",{children:jt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),jt("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),jt("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])}),jt("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])})]})}function qt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,m]=Ot.useState(0),[g,p]=Ot.useState(0),y=Ot.useCallback((e,t)=>{m(e),p(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push(jt("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push(jt("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push(jt("g",{className:"legend-item",transform:`translate(0,${d})`,children:zt(e,n,o,r,i,a,s,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let m=0;e.label&&(m+=16);const g=((e,t,n,o,r,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:m}=e,g=[],{swatchSize:p,labelGap:y,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=r,S=m.map(e=>p+y+7*e.label.length),A=[];let M=0,C=0;S.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(A.push({start:M,end:t,width:C}),M=t,C=e):C=n}),m.length>0&&A.push({start:M,end:m.length,width:C}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=m[d],x=Wt(e,d,h,f,p),A=Nt(e,o,r),M=r&&r.size>0&&r.has(e.label);g.push(Ft("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?s===i&&d===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+m.length)%m.length;l(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(s,d),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&jt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:p+y+2+7*e.label.length,height:p+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&jt(Et,{swatchSize:p}),jt("text",{y:p/2,x:p+y,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const _=Math.max(0,...A.map(e=>e.width)),R=A.length;return{items:g,offset:_,totalRows:R,totalHeight:R*v}})(e,o,r,i,a,s,l,t,c,u,d,d.maxWidth??n);m+=g.offset+5,f.push({label:e.label,...g,offset:m,totalRows:g.totalRows,totalHeight:g.totalHeight}),h+=m+12});const m=d.maxWidth??n;let g=h>m?0:"center"===d.align?Math.max(0,(m-h)/2):"end"===d.align?Math.max(0,m-h):0;const p=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(p.push(jt("text",{transform:`translate(${g},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)),g+=16),p.push(jt("g",{className:"legend-item",transform:`translate(${g},0)`,children:n.items},"legend-group-"+o)),g+=n.offset+5,e[o+1]&&p.push(jt("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),g+=12}),jt("g",{children:p})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:a,metrics:h}),v=!(!n&&!o);return Ft("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&jt("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:s}),b]})}function Vt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}import{jsx as Xt}from"react/jsx-runtime";function Yt(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,m=!!s,g=Math.max(0,n-r.left-r.right),p=Math.max(1,f?a?.maxWidth??g:100);let y,b;return"left"===i?(y=Math.max(4,r.left-p-10),b=r.top):"top"===i?(y=r.left,b=m?32:8):"bottom"===i?(y=r.left,b=o-r.bottom+38):(y=n-r.right+10,b=r.top),Xt("g",{transform:`translate(${y}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?Xt(Gt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:p}):Vt(t)?Xt(qt,{legendGroups:t.legendGroups,title:"",width:p,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}import*as Ut from"react";import{jsx as Kt,jsxs as Qt}from"react/jsx-runtime";function Zt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Jt(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 en(e,t,n,o){if(!e)return Kt("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return Kt("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,m=i?c?[i]:Zt(i,l):[],g=r?c?[r]:Zt(r,l):[],p="leftRight"===u?"end"===h?-4:4:0;let y=0;const b=[],v=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Kt("foreignObject",{className:"annotation-note-html",x:"end"===h?p-l:"middle"===h?p-l/2:p,y:-16,width:l,height:Math.max(f,(m.length+g.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:Qt("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Kt("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&Kt("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(m.length>0&&(b.push(Kt("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:m.map((e,t)=>Kt("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-title")),y=m.length*f),g.length>0&&b.push(Kt("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:y,children:g.map((e,t)=>Kt("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=Kt("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(m.length+g.length)*f+(g.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=Kt("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,m.length+g.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(g.length>0&&m.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),Qt("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[Kt("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function tn(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Kt("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(Kt("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,a=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push(Kt("line",{x1:o,y1:(t.y1||0)-a,x2:o,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-a;i.push(Kt("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(Kt("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(Kt("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,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(Kt("path",{d:Jt(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Kt("g",{className:"annotation-subject",children:i})}function nn(e,t,n,o,r,i){const a=[];let s=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,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;s=r+a*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=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);s=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-s)**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-s);if(i){const o=(s+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-s)/c,f=(n?.curve??.25)*c,m=o+d*f,g=i+h*f;a.push(Kt("path",{className:"connector-curve",d:`M${s},${l}Q${m},${g} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(g-l,m-s)}else a.push(Kt("line",{x1:s,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(Kt("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return Kt("g",{className:"annotation-connector",children:a})}function on(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:m,strokeDasharray:g,events:p={},"data-testid":y}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=o||0,k=r||0;null!=i&&(w=i-b),null!=a&&(k=a-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return Qt("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=m&&{opacity:m},...g&&{strokeDasharray:g},...p,children:[!x.has("connector")&&nn(w,k,l,d,S,c),!x.has("subject")&&tn(S,c,d,b,v),!x.has("note")&&en(s,w,k,d)]})}function rn(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 a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return Kt(on,{"data-testid":"semiotic-annotation",...a,type:o},"multi-annotation-"+i)});return Kt("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Kt(on,{"data-testid":"semiotic-annotation",events:r,...t,type:o},a)}import{packEnclose as an}from"d3-hierarchy";import{area as sn,curveLinear as ln,curveMonotoneX as cn,curveMonotoneY as un,curveStep as dn,curveStepAfter as hn,curveStepBefore as fn,curveBasis as mn,curveCardinal as gn,curveCatmullRom as pn}from"d3-shape";function yn(e){return Math.round(100*e)/100}function bn(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 a=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));a.push(o)}o.push(a)}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(yn);return{points:e.map(([e])=>[yn(e),yn(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function vn(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 xn(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 wn(e){return null==e?null:e+""}function kn(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Sn(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 kn(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"],a=n[e.yAccessor||"y"];return null==i||null==a?null:{x:o(i),y:r(a)}}(n);return o?kn(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return wn(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>wn(e.pointId)===o);if(r)return kn(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return wn(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const a=vn(i,n),s=xn(i,n);return null==a||null==s?null:kn(t,n,{x:a,y:s})}(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=vn(e,n),i=xn(e,n)),null!=r&&null!=i)return kn(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function An(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}import{jsx as Mn}from"react/jsx-runtime";var Cn={secondary:0,primary:3};function _n(e){return!0===e?._annotationDeferred}function Rn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Pn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function In(e){return Math.max(.72,.95-.06*e)}import*as Ln from"react";import{createContext as Tn,useCallback as $n,useContext as Bn,useMemo as Hn,useRef as On,useSyncExternalStore as jn}from"react";import{jsx as Fn}from"react/jsx-runtime";function Dn(e){let t=null;const n=()=>(t||(t=Tn(null)),t),o=Wn(e);return[function({children:t,initialState:o}){const r=On(o),i=Hn(()=>Wn(e,r.current),[]),a=n();return Fn(a.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=Bn(r)??o,a=On(e);a.current=e;const s=On({hasValue:!1,value:void 0}),l=$n(()=>{const e=a.current(i.getState()),n=s.current;return n.hasValue&&t&&t(n.value,e)?n.value:(s.current={hasValue:!0,value:e},e)},[i,t]),c=$n(()=>a.current(i.getState()),[i]);return jn(i.subscribe,l,c)}]}function Wn(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)}}}}var[En,Nn]=Dn(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 zn(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})}}}import{jsx as Gn,jsxs as qn}from"react/jsx-runtime";var Vn="var(--semiotic-bg, #ffffff)";function Xn(e,t){return(e+"").length*t*.6}function Yn(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=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=>Gn("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:a,fontFamily:s,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??Vn,strokeWidth:h.haloWidth??3});const m=h.padding??{x:6,y:3},g="number"==typeof m?m:m.x,p="number"==typeof m?m:m.y,y=Xn(o,i),b=i+2*p;let v,x;return v="middle"===l?t-y/2-g:"end"===l?t-y-g:t-g,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-p:n-.8*i-p,qn("g",{className:d,children:[Gn("rect",{x:v,y:x,width:y+2*g,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??Vn,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var Un=null;function Kn(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Un||(Un=document.createElement("canvas")),Un.width=e,Un.height=e,Un)}(s)}catch{return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}import{jsx as Qn,jsxs as Zn}from"react/jsx-runtime";function Jn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function eo(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function to(e,t){let n=2166136261;const o=eo(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 no=new Map;function oo(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45,lineOpacity:s=1}=e,l=Math.max(8,Math.ceil(2*i));return Zn("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==a?`rotate(${a})`:void 0,children:[n&&"transparent"!==n&&Qn("rect",{width:l,height:l,fill:n}),Qn("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:s}),Qn("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:s})]},t)}function ro(e,t,n="#4e79a7"){if(Jn(e)){const n=to(t,e);return{fill:`url(#${n})`,def:oo(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}import{jsx as io,jsxs as ao}from"react/jsx-runtime";var so={linear:ln,monotoneX:cn,monotoneY:un,step:dn,stepAfter:hn,stepBefore:fn,basis:mn,cardinal:gn,catmullRom:pn};var lo=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function co(e){return!!e&&"object"==typeof e&&lo.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function uo(e){return"primary"===e?.emphasis||!0===e?.defensive}function ho(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 fo(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 mo=32,go=6,po=4,yo=8,bo=72;var vo={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function xo(e){if(!wo(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 wo(e){return co(e)}function ko(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 So(e,t,n,o,r){const i=e+n,a=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?a-r.height:a,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?a-r.height-4:a+4,width:r.width,height:r.height}}function Ao(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Mo(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 Co(e,t,n,o,r,i,a,s){const l=Ao(e,a);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,s);for(const e of n)c+=12*Mo(l,e);for(const e of o)c+=4*Mo(l,e);return c}function _o(e){const{annotations:t,context:n,defaultOffset:o=mo,notePadding:r=go,markPadding:i=po,edgePadding:a=yo,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=bo,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:g,audience:p}=e,y=n.width||0,b=n.height||0,v="object"==typeof m?m:{},x=v.breakpoint??480,w=!!m&&x>=y,k=w&&!1!==v.preferShortText?t.map(xo):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!g?v.cohesion:g;if(0===k.length||0>=y||0>=b)return k.slice();const _=[],R=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 P=!1;const I=k.map((e,t)=>{if(!wo(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?Sn(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=[...ko("string"==typeof e.title?e.title:void 0,t),...ko("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(s&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return _.push(Ao(So(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var d;let h=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=Co(So(i.x,i.y,e.dx,e.dy,u),e,_,R,y,b,r,a);f>t&&(h=e,f=t)}if(!h)return e;const m=Ao(So(i.x,i.y,h.dx,h.dy,u),r);_.push(m);const g=Math.hypot(h.dx,h.dy),p=l&&g>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return P=!0,{...e,dx:h.dx,dy:h.dy,...p?{connector:p}:{}}}),L=P?I:k.slice();let T=L;if(h){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?vo[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 $=new Set;if(S){const e="object"==typeof S?S:{},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}(p),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??ho(y,b,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=ho(n,o,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,co(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const l=s.filter(e=>uo(e.annotation)),c=s.filter(e=>!uo(e.annotation)).sort((e,t)=>fo(t.annotation)-fo(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))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:T,width:y,height:b,...n});for(const e of o)$.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=y)for(const e of T)wo(e)&&"secondary"===e.emphasis&&$.add(e);if($.size>0)for(const e of T)!0===e?.defensive&&$.delete(e);let B;return B=0===$.size?T:A?T.map(e=>$.has(e)?{...e,_annotationDeferred:!0}:e):T.filter(e=>!$.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>wo(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(B,C):B}function Ro(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,a=o instanceof Date?o.getTime():o,s=r instanceof Date?r.getTime():r;if(2>t||a===s)return i?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:a+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}import{Fragment as Po,jsx as Io,jsxs as Lo}from"react/jsx-runtime";function To(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:a,showAxes:s,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===a?.projection,f="horizontal"===a?.projection,m=Bt(()=>!a||h?[]:(u||Ro(a.r,5,d)).map(e=>({value:e,pixel:a.r(e),label:(c||$o)(e)})),[a,c,h,u,d]),g=l&&a&&!h,p=s&&a&&!h;return g||p?Io("svg",{width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:Lo("g",{transform:`translate(${i.left},${i.top})`,children:[g&&Io("g",{className:"ordinal-grid",children:m.map((e,o)=>Io("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),p&&Io(Po,{children:Lo(Po,f?{children:[Io("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Io("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[Io("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Io("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function $o(e){return Math.round(100*e)/100+""}function Bo(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:a,showAxes:s,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:m,legend:g,legendHoverBehavior:p,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,onAnnotationActivate:A,onObservation:M,chartId:C,chartType:_,autoPlaceAnnotations:R,svgAnnotationRules:P,xAccessor:I,yAccessor:L,annotationData:T,underlayRendered:$,canvasObscuresUnderlay:B=!0,children:H}=e,O=function(e){const t=Nn(e=>e.pushObservation),n=Ln.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return Ln.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:A,onObservation:M,chartId:C,chartType:_}),j="radial"===a?.projection,F="horizontal"===a?.projection,D=!1!==l,W=!$||B,E=Bt(()=>{if(!s||!D||!a||j)return[];const e=a.o.bandwidth(),t=a.o.domain().map((t,n)=>({value:t,pixel:(a.o(t)??0)+e/2,label:d?d(t,n):t}));if(2>=t.length)return t;const n=Math.abs(t[1].pixel-t[0].pixel)||e,o=t.map(e=>{return t=e.label,F?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=F?0:6;if(o.every((e,t)=>0===t||n>=(o[t-1]+e)/2+r))return t;const i=Math.max(...o)+r,l=Math.max(1,Math.ceil(i/n));return 1===l?t:t.filter((e,t)=>t%l===0)},[s,D,a,d,j,F]),N=e.rTickValues,z=e.tickLabelEdgeAlign,G=e.axisExtent,q=Bt(()=>s&&a&&!j?(N||Ro(a.r,5,G)).map(e=>({value:e,pixel:a.r(e),label:(h||$o)(e)})):[],[s,a,h,j,N,G]),V=Ht(new Map),X=Ht(S?.length??0),Y=S?.length??0;X.current!==Y&&(X.current=Y,V.current=new Map);const U=Bt(()=>{if(!S||0===S.length)return null;const e=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Sn(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!An(r,i,o))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return io(rn,{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:a,...s?{subject:s}:{},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=vn(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const s=t>.6*(o.width||0),l=s?t-4:t+4,c=s?"end":"start";return ao("g",{opacity:e.opacity,children:[io("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&&io(Yn,{x:l,y:a,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=xn(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let s,l;"left"===i?(s=4,l="start"):"center"===i?(s=(o.width||0)/2,l="middle"):(s=(o.width||0)-4,l="end");const c=20>(a=t)?Math.min((o.height||0)-4,a+16):a-4;return ao("g",{opacity:e.opacity,children:[io("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&&io(Yn,{x:s,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:vn({...e,type:"point"},o),y:xn({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=an(t),i=e.padding||10;return ao("g",{children:[io("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&&io(Yn,{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:vn({...e,type:"point"},o),y:xn({...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),a=t.map(e=>e.y),[s,l]=fe(i),[c,u]=fe(a),d=s-r,h=l+r,f=c-r;return ao("g",{children:[io("rect",{x:d,y:f,width:h-d,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&&io(Yn,{x:(d+h)/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 io("g",{children:r.map((t,n)=>{const r=vn(t,o),a=xn(t,o);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return io("circle",{cx:r,cy:a,r:s,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=vn(e,o),r=xn(e,o);return io(rn,{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",a="ordinal"===o.frameType,s="horizontal"===o.projection,l=a?r:null,c=a?i:null;let u;const d=[],h=new Map;if(a&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=h.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,m=o.scales?.y??o.scales?.value;if(!f||!m)return null;const g=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(d.length-1,n+1),r=t-n,i=e(d[n]);return i+(e(d[o])-i)*r},p=f,y=m;let b;if(a)if(s){const e=g(y);b=(t,n)=>[p(n),e(t)]}else{const e=g(p);b=(t,n)=>[e(t),y(n)]}else b=(e,t)=>[p(e),y(t)];const v=e.method||"linear";let x;if("loess"===v)x=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]),a=Math.max(2,Math.ceil(t*n)),s=[];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(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],m+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))s.push([t,h/u]);else{const e=(u*m-d*h)/g;s.push([t,(h-e*d)/u+e*t])}}return s}(u,e.bandwidth??.3);else{const t="polynomial"===v?bn(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:yn((n*t[3]-t[0]*t[1])/o),i=yn(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[yn(e),yn(r*e+i)]),equation:[r,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,o]=b(e,t);return`${n},${o}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[A,M]=b(S[0],S[1]);return ao("g",{children:[io("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&io("text",{x:A+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,a=t?.(e.y0)??0,s=t?.(e.y1)??(o.height||0),l=ro(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return ao("g",{opacity:e.opacity,children:[l.def&&io("defs",{children:l.def}),io("rect",{x:0,y:Math.min(a,s),width:o.width||0,height:Math.abs(s-a),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&io(Yn,{x:(o.width||0)-4,y:(r=a,i=s,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=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==r||null==i)return null;const a=ro(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return ao("g",{opacity:e.opacity,children:[a.def&&io("defs",{children:a.def}),io("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:o.height||0,fill:a.fill,fillOpacity:e.fillOpacity??.1}),e.label&&io(Yn,{x:Math.min(r,i)+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,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=so[o.curve||"linear"]||ln,h=sn().x(e=>i(e[r])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return ao("g",{children:[io("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&io("text",{x:i(u[u.length-1][r])+4,y:a(u[u.length-1][s])-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,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,m=e.fill||"#6366f1",g=e.fillOpacity??.1,p=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,b=a(l+d*u),v=a(h),x=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return ao("g",{children:[f&&io("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:m,fillOpacity:g}),x.map((e,t)=>{const n=vn(e,o),r=xn(e,o);return null==n||null==r?null:io("circle",{cx:n,cy:r,r:y,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5},"anomaly-"+t)}),e.label&&io("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:m,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",a=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!a||!s)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=bn(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 a=(e*r-t*n)/i,s=(n-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),m=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+(t[0]-m)**2,0),p=e.confidence??.95,y=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(g>0?(e-m)**2/g:0))*y;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,A=k.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),M=`${a(v)},${s(c(v))}`,C=e.strokeColor||"#6366f1";return ao("g",{children:[io("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),io("polyline",{points:`${M} ${A}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&io("text",{x:a(k[k.length-1].x)+4,y:s(k[k.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=Sn(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!An(r,i,o))return null;const a=e.dx??0,s=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??io("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return io("foreignObject",{x:r+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:io("div",{...zn(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Sn(e,n,o);if(!t)return null;const{x:r,y:i}=t,a=r+(e.dx||0),s=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=io("text",{x:a,y:s,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Ut.cloneElement(c,{key:"ann-text-"+n}):ao("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[io("line",{x1:r,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Ut.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,a=o.scales?.x,s=o.scales?.y,l=r(i)?i:r(a)?a:r(s)?s:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return ao("g",(o.projection?"vertical"===o.projection:l===a)?{children:[io("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&io(Yn,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[io("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&io(Yn,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,a}}(0,O),o="horizontal"===a?.projection,r=a?.o?e=>(a.o(e)??0)+a.o.bandwidth()/2:null,i={scales:a?{x:o?a.r:r||a.r,y:o&&r||a.r,time:a.r,value:a.r,o:a.o}:null,timeAxis:"x",xAccessor:I,yAccessor:L,width:t,height:n,data:T,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:V.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let a;if(n){const r=n(e,i,o);a=null!=r?r:t(e,i,o)}else a=t(e,i,o);a&&r.push({node:a,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:Pn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>_n(e.annotation)),r=e.some(e=>null!=Rn(e.annotation)),i=e.some(e=>"layer"===Rn(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=Cn[e.emphasis]);const s=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=_n(t.annotation);let a=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;a=Mn("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:In(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const s=Rn(t.annotation);return s&&(a=Mn("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),i&&(a=Mn("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return o&&s.unshift(Mn("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&&s.unshift(Mn("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")),s}(r)}(R?_o({annotations:S,context:i,..."object"==typeof R?R:{}}):S,e,P,i)},[S,R,P,t,n,a,I,L,T,O]);return s||m||g||k||U&&U.length>0||f||H?Lo("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Io("title",{children:"string"==typeof m?m:"Ordinal Chart"}),Io("desc",{children:"string"==typeof m?m+" — ordinal data visualization":"Ordinal data visualization"}),Lo("g",{transform:`translate(${i.left},${i.top})`,children:[f&&a&&!j&&W&&Io("g",{className:"ordinal-grid",children:q.map((e,o)=>Io("line",{x1:F?e.pixel:0,y1:F?0:e.pixel,x2:F?e.pixel:t,y2:F?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),s&&a&&!j&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},o={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return Io("g",{className:"ordinal-axes",children:Lo(Po,F?{children:[Lo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[W&&Io("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((t,n)=>Lo("g",{transform:`translate(0,${t.pixel})`,children:[Io("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Io("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):Io("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:Io("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&Io("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),Lo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[W&&Io("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W&&a?.r&&(()=>{const e=a.r(0);return e>1&&t-1>e?Io("line",{x1:e,y1:0,x2:e,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((t,o)=>{const r=z?0===o?"start":o===q.length-1?"end":"middle":"middle";return Lo("g",{transform:`translate(${t.pixel},${n})`,children:[Io("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Io("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)}),u&&Io("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]}:{children:[Lo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[W&&(()=>{const e=a?.r?a.r(0):n,o=0>e||e>n?n:e;return Io("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),E.map((t,o)=>Lo("g",{transform:`translate(${t.pixel},${n})`,children:[Io("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Io("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):Io("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:Io("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&Io("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),Lo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[W&&Io("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((t,n)=>Lo("g",{transform:`translate(0,${t.pixel})`,children:[Io("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Io("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)),u&&Io("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]})})})(),U,k,H]}),m&&"string"==typeof m?Io("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?Io("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,Yt({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:x,title:m,legendLayout:w,legendHoverBehavior:p,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}function Ho(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}}import{useRef as Oo,useEffect as jo}from"react";import{select as Fo}from"d3-selection";import{brushX as Do,brushY as Wo}from"d3-brush";import*as Eo from"react";import{jsx as No,jsxs as zo}from"react/jsx-runtime";function Go({width:e,height:t,totalWidth:n,totalHeight:o,margin:r,scales:i,onBrush:a}){const s=Oo(null),l=Oo(null),c=Oo(a);c.current=a;const u=Oo(i);u.current=i;const d=Oo(!1),h=Oo(null),f="horizontal"===i?.projection,m=Oo(f);m.current=f;const g=function({label:e="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:n}={}){const o=Eo.useId().replace(/:/g,""),r=Eo.useRef(n);return r.current=n,{description:t,descriptionId:"semiotic-brush-description-"+o,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+o,onKeyDown:Eo.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(),r.current?.(t))},[])}}}({label:"Ordinal value range brush",onAction:e=>{const t=u.current,n=l.current;if(!t||!n||!s.current)return;const o=Fo(s.current).select(".brush-g");if("clear"===e.type)return d.current=!0,o.call(n.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!m.current)return;const r=t.r.domain(),[i,a]=[Math.min(...r),Math.max(...r)],f=(a-i)/20,g=h.current?.r??[i+.4*(a-i),i+.6*(a-i)],p="left"===e.direction||"down"===e.direction?-1:1;let[y,b]=g;if(e.resize)0>p?y=Math.max(i,y-f):b=Math.min(a,b+f);else{const e=b-y;y=Math.max(i,Math.min(a-e,y+p*f)),b=y+e}const v={r:[y,b]};d.current=!0,o.call(n.move,m.current?[t.r(y),t.r(b)]:[t.r(b),t.r(y)]),d.current=!1,h.current=v,c.current(v)}});return jo(()=>{if(!s.current)return;const n=Fo(s.current).select(".brush-g"),o=f?Do():Wo();return o.extent([[0,0],[e,t]]),o.on("brush end",e=>{if(d.current)return;const t=u.current;if(!t)return;if(!e.selection)return h.current=null,void c.current(null);const[n,o]=e.selection;let r;r=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};h.current=i,c.current(i)}),n.call(o),l.current=o,n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),l.current=null}},[e,t,f]),jo(()=>{if(!i||!l.current||!h.current)return;if(!s.current)return;const e=h.current,t=Fo(s.current).select(".brush-g"),n=i.r(e.r[0]),o=i.r(e.r[1]);f?(d.current=!0,t.call(l.current.move,[n,o]),d.current=!1):(d.current=!0,t.call(l.current.move,[o,n]),d.current=!1)},[i,f]),zo("svg",{ref:s,width:n,height:o,...g.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[No("title",{children:g.svgProps["aria-label"]}),No("desc",{id:g.descriptionId,children:g.description}),No("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`,style:{pointerEvents:"all"}})]})}import*as qo from"react";import{arc as Vo}from"d3-shape";function Xo(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Yo(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)}}var Uo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function Ko(e){const{innerRadius:t,outerRadius:n,startAngle:o,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=Uo(n,o),t=Uo(n,r);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${r-o>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Uo(n,o),a=Uo(n,r),s=Uo(t,r),l=Uo(t,o),c=r-o>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${a.x},${a.y} L${s.x},${s.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===a)return Ko({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const s=Math.asin(Math.min(1,a/Math.max(1e-9,n-a))),l=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=r-o,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>s,h=!!e.roundEnd&&u>s;if(!d&&!h)return Ko({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=o+(d?s:0),m=r-(h?s:0),g=o+(d?l:0),p=r-(h?l:0),y=Uo(n,f),b=Uo(n,m),v=(n-a)*Math.cos(s),x=Uo(v,o),w=Uo(v,r),k=i?null:Uo(t,p),S=i?null:Uo(t,g),A=i?0:(t+a)*Math.cos(l),M=i?null:Uo(A,o),C=i?null:Uo(A,r),_=m-f>Math.PI?1:0,R=i?0:p-g>Math.PI?1:0;let P="";if(d)P+=`M${x.x},${x.y}`,P+=` A${a},${a} 0 0 1 ${y.x},${y.y}`;else{const e=Uo(n,o);P+=`M${e.x},${e.y}`}if(h)P+=` A${n},${n} 0 ${_} 1 ${b.x},${b.y}`,P+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=Uo(n,r);P+=` A${n},${n} 0 ${_} 1 ${e.x},${e.y}`}if(i)P+=" L0,0";else{if(h)P+=` L${C.x},${C.y}`,P+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=Uo(t,r);P+=` L${e.x},${e.y}`}if(d)P+=` A${t},${t} 0 ${R} 0 ${S.x},${S.y}`,P+=` A${a},${a} 0 0 1 ${M.x},${M.y}`;else{const e=Uo(t,o);P+=` A${t},${t} 0 ${R} 0 ${e.x},${e.y}`}}return P+=" Z",P}function Qo(e){const t=Ko({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let r=0;o.length>r;r++)n.push({d:Ko({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:o[r]})}return{clipPath:t,slices:n}}import{jsx as Zo,jsxs as Jo}from"react/jsx-runtime";var er={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function tr(e,t="#4e79a7"){return Jn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function nr(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var or="undefined"==typeof window||"undefined"==typeof document;import{useEffect as rr,useLayoutEffect as ir,useRef as ar,useState as sr,useSyncExternalStore as lr}from"react";var cr="undefined"!=typeof window?ir:rr,ur=()=>()=>{},dr=()=>!1,hr=()=>!0;import{useRef as fr}from"react";function mr(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 gr(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 pr(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}import*as yr from"react";import*as br from"react";import{jsx as vr}from"react/jsx-runtime";var xr=br.createContext(null);import{jsx as wr}from"react/jsx-runtime";var kr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Sr({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 wr("div",{"aria-live":"polite","aria-atomic":"true",style:kr,children:t})}function Ar(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 Mr(e){return e&&"object"==typeof e?e:{}}function Cr(e){return Mr(e.accessibility).tableFields??e.accessibleDatum??e.datum}import{jsx as _r,jsxs as Rr}from"react/jsx-runtime";function Pr(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"],a=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 a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var Ir=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Lr="semiotic-accessible-data-table",Tr=Lr+" semiotic-accessible-data-table-hidden",$r=Lr+" semiotic-accessible-data-table-visible",Br={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"},Hr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Or={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)"},jr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Fr={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))"},Dr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Wr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Er={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 Nr({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=yr.useState(!1),[a,s]=yr.useState(5),l=br.useContext(xr),c=l?.visible??!1,u=r||c,d=yr.useRef(null),h=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;yr.useEffect(()=>{u||s(5)},[u]);const f=yr.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),m=yr.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?_r("span",{id:n,tabIndex:-1,style:kr}):null;if(!u)return _r("div",{id:n,className:Tr,tabIndex:-1,onFocus:f,style:kr,role:"region","aria-label":h,children:Rr("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const g=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:Ar(Cr(o))});break;case"line":case"area":{const e=Cr(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Ar(e)});break}case"rect":{const e=Cr(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,a=Ar(n);null==a.category&&""!==r&&(a.category=r+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=Ar(Cr(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=Cr(o),n=Ar(e);if(null==n.category){const t=Mr(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:Ar(Cr(o))});break;case"arc":t.push({label:"Arc",values:Ar(Cr(o))});break;case"candlestick":t.push({label:"Candlestick",values:Ar(Cr(o))});break;case"geoarea":{const e=Mr(Cr(o)),n=Ar(e);if(null==n.name){const t=Mr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),p=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}(g),y=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ir(e.min)} to ${Ir(e.max)}, mean ${Ir(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(" ")}(g.length,p),b=Math.min(a,g.length),v=g.slice(0,b),x=g.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return Rr("div",{ref:d,id:n,className:$r,tabIndex:-1,onBlur:m,style:Br,role:"region","aria-label":h,children:[_r("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Or,children:"×"}),_r("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Hr,children:y}),Rr("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:jr,children:[_r("caption",{className:"semiotic-accessible-data-table-caption",style:Wr,children:x>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),_r("thead",{children:Rr("tr",{children:[_r("th",{style:Fr,children:"type"}),k.map(e=>_r("th",{style:Fr,children:e},e))]})}),_r("tbody",{children:v.map((e,t)=>Rr("tr",{children:[_r("td",{style:Dr,children:e.label}),k.map(t=>{return _r("td",{style:Dr,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Ir(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&Rr("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Er,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function zr({summary:e}){return e?_r("div",{role:"note",style:kr,children:e}):null}function Gr({tableId:e}){return _r("a",{href:"#"+e,style:kr,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,kr)},children:"Skip to data table"})}import{jsx as qr}from"react/jsx-runtime";var Vr="var(--semiotic-focus, #005fcc)";function Xr({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!s)if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=qr("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Vr,strokeWidth:2,strokeDasharray:"4,2"})}else u=qr("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Vr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Vr,strokeWidth:2,strokeDasharray:"4,2"});else u=qr("g",{transform:`translate(${n.left},${n.top})`,children:qr("path",{d:s,fill:"none",stroke:Vr,strokeWidth:2.5,strokeDasharray:"6,3"})});return qr("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as Yr from"react";function Ur(e){return Array.isArray(e)?e[0]:e}function Kr(e,t,n,o){return{data:Ur(e),x:t,y:n,__semioticHoverData:!0,...o}}var Qr=["name","label","title"],Zr=["type","kind","category","group","class","status","role","shape"],Jr=["value","amount","total","count","weight","score"],ei=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 ti(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}import{jsx as ni,jsxs as oi}from"react/jsx-runtime";var ri={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 ii(e,t){return"function"==typeof t?t(e):e[t]}function ai(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 si(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=ii(e,n);a=ai(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 a=ii(e,r);s.push({label:n,value:ai(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=ai(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=ai(e[t[0]],o))}}const l={...ri,...r};return oi("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&ni("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>oi("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&oi("span",{children:[e.label,": "]}),e.value]},t))]})}}function li(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Ur(!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:ni("div",{className:"semiotic-tooltip",style:ri,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?si(e):si())}}import{jsx as ci}from"react/jsx-runtime";function ui({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Yr.useRef(null),[u,d]=Yr.useState(null);Yr.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(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()},[a,n,o,l]);let h;h=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(!Yr.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),m=f?null:ri;return l?ci("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import*as di from"react";import{useCallback as hi,useEffect as fi,useLayoutEffect as mi,useMemo as gi,useRef as pi}from"react";function yi(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 bi(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:vi}}),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 vi=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],xi={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}},wi={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}},ki={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:vi,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 Si(e,t){if("light"===t)return xi;if("dark"===t)return wi;if("high-contrast"===t)return ki;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?wi:xi;return bi({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return bi({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Ai,Mi]=Dn(e=>({theme:xi,setTheme(t){e(e=>({theme:Si(e.theme,t)}))}}));import{useState as Ci,useEffect as _i}from"react";import{useRef as Ri,useState as Pi,useEffect as Ii}from"react";var Li=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ti=new WeakMap,$i=0,Bi=!1,Hi=null,Oi=null;function ji(e,t){if(!t)return t;const n=Li.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(Bi)return;if("undefined"==typeof window||"undefined"==typeof document)return;Bi=!0;const e=()=>{$i++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{Hi=window.matchMedia("(prefers-color-scheme: dark)"),Oi=e,"function"==typeof Hi.addEventListener?Hi.addEventListener("change",Oi):"function"==typeof Hi.addListener&&Hi.addListener(Oi)}catch{}}();let r=Ti.get(o);r&&r.version===$i||(r={version:$i,map:new Map},Ti.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const a=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,a),a}var Fi=()=>"undefined"!=typeof performance?performance.now():Date.now();function Di(e,t){const n=e();return Number.isFinite(n)?n:t}var Wi=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Fi,this.lastWallTime=Di(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=Di(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??Fi;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Di(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)))}},Ei="undefined"==typeof window?fi:mi,Ni={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function zi(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Gi(e){const t=function(){const[e,t]=Ci(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return _i(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){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=pi(t);n.current=t;const[o,r]=function(e,t,n){const o=Ri(null),[r,i]=Pi(null);return Ii(()=>{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]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,a=!!e.legend&&"top"===e.legendPosition,s=gi(()=>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,a),[e.marginDefault,e.userMargin,i,a]),l=r[0]-s.left-s.right,c=r[1]-s.top-s.bottom,u=zi(e.foregroundGraphics,r,s),d=zi(e.backgroundGraphics,r,s),h=Mi(e=>e.theme),{transition:f,introEnabled:m}=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),g="semiotic-table-"+di.useId(),p=pi(null);if(!p.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;p.current=new Wi({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const y=p.current;y.configure({clock:e.clock,random:e.random,seed:e.seed});const b=pi(null),v=pi(e.frameScheduler??Ni);v.current=e.frameScheduler??Ni;const x=pi(null),w=pi(!1),k=pi(()=>{}),S=hi(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=o,x.current=e)},[]),A=hi(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);Ei(()=>{y.setPaused(!0===e.paused)},[y,e.paused]),fi(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void y.setVisible(!0);const t=()=>y.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[y,e.suspendWhenHidden]),fi(()=>()=>{A()},[A]);const M=pi(()=>{}),C=pi(()=>{}),_=pi(null),R=pi(null),P=pi(null),I=hi(()=>{const e=_.current;_.current=null,e&&M.current(e)},[]),L=hi(e=>{if(_.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===R.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,R.current=null,P.current=null,I()});t||(R.current=n,P.current=e)}},[I]),T=hi(()=>{_.current=null,null!==R.current&&((P.current??v.current).cancelAnimationFrame(R.current),R.current=null,P.current=null),C.current()},[]);fi(()=>()=>{_.current=null,null!==R.current&&((P.current??v.current).cancelAnimationFrame(R.current),R.current=null,P.current=null)},[]);const $=e.themeDirtyRef;return Ei(()=>{$&&($i++,$.current=!0,S())},[h,S,$]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:s,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:m,tableId:g,frameRuntime:y,rafRef:b,renderFnRef:k,scheduleRender:S,cancelRender:A,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:L,onPointerLeave:T}}import{useEffect as qi,useRef as Vi}from"react";import{jsx as Xi}from"react/jsx-runtime";function Yi({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?Xi("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:Xi("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}import{useCallback as Ui,useRef as Ki}from"react";function Qi(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function Zi(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Ji(e,t,n=.3){Zi(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 ea(e,t,n=.6){if(!Zi(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 ta(e,t,n,o=.35){Zi(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function na(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]}import{curveMonotoneX as oa,curveMonotoneY as ra,curveCardinal as ia,curveCatmullRom as aa,curveStep as sa,curveStepBefore as la,curveStepAfter as ca,curveBasis as ua,curveNatural as da}from"d3-shape";function ha(e,t,n){if(null==t)return n;if(Jn(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${eo(e)}@${n}`,r=no.get(o);if(void 0!==r)return r;const i=Kn({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return no.set(o,i),i}(t,e);return o||t.background&&ji(e,t.background)||n}return"string"!=typeof t?t:ji(e,t)||n}function fa(e,t){if(null==t)return;const n=ha(e,t,"");return""===n?void 0:n}function ma(e,t,n,o,r,i,a){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 s=e.createLinearGradient(o,r,i,a);for(const e of n)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,r,i,a),[h,f,m]=na(e,n);return d.addColorStop(0,`rgba(${h},${f},${m},${c})`),d.addColorStop(1,`rgba(${h},${f},${m},${u})`),d}function ga(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:a,tr:s,br:l,bl:c}=Yo(t);e.beginPath(),e.moveTo(n+a,o),e.lineTo(n+r-s,o),s>0&&e.arcTo(n+r,o,n+r,o+s,s),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+a),a>0&&e.arcTo(n,o,n+a,o,a),e.closePath()}function pa(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}}}function ya(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,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}var ba=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=ba.get(t);return n||(n=new Path2D(se(e.symbolType,e.size)),ba.size>256&&ba.clear(),ba.set(t,n)),n}catch{return null}}function xa(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const a=ht(i,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const l=t=>{const n=ha(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(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=r*s*(t.style.fillOpacity??1);const u=yt(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&vt(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),vt(e,i,c,t.accent,void 0,l),e.restore()}import{arc as wa}from"d3-shape";function ka(e,t){const n=t._gradientBand.colors;if(0===n.length)return;const{clipPath:o,slices:r}=Qo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:n}),i=new Path2D(o);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=ji(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Sa(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Aa(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=wa().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(o);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Ma=(e,t,n,o)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)ka(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Sa(e,t),ta(e,t)),e.globalAlpha=1;else{if(e.fillStyle=ha(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=Ko({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Aa(e,t)):(Sa(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Sa(e,t),ta(e,t)),e.globalAlpha=1}},Ca=(e,t,n,o)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const n=t.columnWidth/2,o="vertical"===t.projection,r=ji(e,"var(--semiotic-primary, #007bff)"),i=ji(e,"var(--semiotic-text, #333)"),a=ha(e,t.style.fill,r),s=t.style.stroke,l="string"==typeof s?ji(e,s)||s:i,c=t.style.strokeWidth||1,u=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=u,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},_a=(e,t,n,o)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=ha(e,t.style.fill,"#007bff"),e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Ra=(e,t,n,o)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const i=new Map;for(const e of r){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=n.fillOpacity??n.opacity??.3,e.fillStyle=fa(e,n.fill)??"#999",e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=ji(e,n.style.stroke)||ha(e,n.style.fill,"")||ji(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=n.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Pa=(e,t,n,o)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const n=t.points;if(n.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=fa(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Ia(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function La(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Ta=new Map;function $a(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Ta.get(n);if(void 0!==o)return o;const r=Kn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ta.set(n,r),r}function Ba(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Ha(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Oa(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function ja(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function Fa(e){return(t,n,o,r)=>{e(t,n.filter(ja),{x:o.r,y:o.r},r)}}var Da=Fa((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)ya(e,t);else if(t.cornerRadii&&Xo(t.cornerRadii)){const n=ha(e,t.style.fill,ji(e,"var(--semiotic-primary, #007bff)")),o=pa(t),r=t.fillGradient&&"string"==typeof n?ma(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,ga(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=ha(e,t.style.fill,ji(e,"var(--semiotic-primary, #007bff)")),o=pa(t),r=t.fillGradient&&"string"==typeof n?ma(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:a,y:s,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(a,s),e.lineTo(a+l-i,s),e.arcTo(a+l,s,a+l,s+i,i),e.lineTo(a+l,s+c-i),e.arcTo(a+l,s+c,a+l-i,s+c,i),e.lineTo(a,s+c);break;case"left":e.moveTo(a+l,s),e.lineTo(a+i,s),e.arcTo(a,s,a,s+i,i),e.lineTo(a,s+c-i),e.arcTo(a,s+c,a+i,s+c,i),e.lineTo(a+l,s+c);break;case"bottom":e.moveTo(a,s),e.lineTo(a+l,s),e.lineTo(a+l,s+c-i),e.arcTo(a+l,s+c,a+l-i,s+c,i),e.lineTo(a+i,s+c),e.arcTo(a,s+c,a,s+c-i,i);break;default:e.moveTo(a,s+c),e.lineTo(a,s+i),e.arcTo(a,s,a+i,s,i),e.lineTo(a+l-i,s),e.arcTo(a+l,s,a+l,s+i,i),e.lineTo(a+l,s+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=ha(e,t.style.fill,ji(e,"var(--semiotic-primary, #007bff)")),o=pa(t),r=t.fillGradient&&"string"==typeof n?ma(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=ji(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Ji(e,t),e.globalAlpha=1}}),Wa=Fa((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=ha(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=ha(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),ea(e,n)}finally{e.restore()}}}),Ea=Fa((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=ha(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=ha(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n}),Na=Fa((e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&xa(e,o,o.x,o.y,n);e.globalAlpha=n}),za=e=>[Ra,...e],Ga={bar:za([Da]),clusterbar:za([Da]),point:za([Wa,Ea]),swarm:za([Wa,Ea]),pie:[Ma],donut:[Ma],boxplot:za([Ca,Wa]),violin:za([_a]),histogram:za([Da]),ridgeline:za([_a]),timeline:za([Da]),funnel:[Da,Pa,(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(n.__funnelRowWidth??n.__funnelBarW??0))continue;const r=n.__funnelStepLabelX,i=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,r,i),e.fillStyle="#fff",e.fillText(o,r,i)}e.font="bold 13px sans-serif";for(const t of r){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=n.__funnelBarW??0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,a=!0===n.__funnelIsFirstStep;let s;if(s=a?Ia(r):null!=i?`${Ia(r)} (${La(i)})`:Ia(r),e.measureText(s).width+16>o){if(a||null==i)continue;if(s=Ia(r),e.measureText(s).width+16>o)continue}const l=n.__funnelValueLabelX,c=(n.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(s,l,c),e.fillStyle="#fff",e.fillText(s,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Da,(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const n=("string"==typeof t.style.fill?t.style.fill:null)||ji(e,"var(--semiotic-border, #999)"),o=$a(n,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const i=function(e,t){const[n,o,r]=na(e,t);return(.2126*n+.7152*o+.0722*r)/255>.6}(e,ji(e,"var(--semiotic-text, #333)")),a=i?"#1f2937":"#ffffff",s=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,u=i?Oa(r):"",d=Ha(o);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,m=Math.max(h,f)+12,g=i?32:17,p=n.__barFunnelLabelX,y=p-m/2,b=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=a,e.beginPath(),Ba(e,y,b,m,g,4),e.fill(),e.restore(),e.strokeStyle=s,e.lineWidth=.5,e.beginPath(),Ba(e,y,b,m,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,p,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,p,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,p,b+3))}e.lineWidth=1}],swimlane:za([Da]),custom:za([Da,Wa,Ea,Na,Ma,Ca,_a,Pa])},qa=new Set;function Va(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 Xa(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;qa.has(n)||(qa.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}import{jsx as Ya,jsxs as Ua}from"react/jsx-runtime";function Ka(e){const t=function(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&&ei.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=>Qr.includes(e.lower));const a=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=ti(l,Zr),u=ti(l,Jr),d=new Set(Zr),h=new Set(Jr),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&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:f}}(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:Ua("div",{className:"semiotic-tooltip",style:ri,children:[null!=t.title&&Ya("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>Ua("div",{children:[Ua("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Qa({hover:e}){const t=e.data||{},n=e.stats,o=e.category;if(Array.isArray(t)){const e=o||t[0]?.category||"";if(n)return Ua("div",{className:"semiotic-tooltip",style:ri,children:[e&&Ya("div",{style:{fontWeight:"bold"},children:e+""}),Ua("div",{children:["n = ",n.n]}),Ua("div",{children:["Min: ",n.min.toLocaleString()]}),Ua("div",{children:["Q1: ",n.q1.toLocaleString()]}),Ua("div",{children:["Median: ",n.median.toLocaleString()]}),Ua("div",{children:["Q3: ",n.q3.toLocaleString()]}),Ua("div",{children:["Max: ",n.max.toLocaleString()]}),Ua("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return Ua("div",{className:"semiotic-tooltip",style:ri,children:[e&&Ya("div",{style:{fontWeight:"bold"},children:e+""}),Ua("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return Ua("div",{className:"semiotic-tooltip",style:ri,children:[t.category&&Ya("div",{style:{fontWeight:"bold"},children:t.category+""}),Ua("div",{children:["Count: ",t.count]}),2===e.length&&Ua("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,a=e.__chartType;if("swarm"===a||"point"===a)return Ka(t);const s=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return s||""!==l?Ua("div",{className:"semiotic-tooltip",style:ri,children:[s&&Ya("div",{style:{fontWeight:"bold"},children:s+""}),""!==l&&Ya("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):Ka(t)}function Za(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:i,chartId:a})):t({type:"hover-end",timestamp:l,chartType:i,chartId:a}))}function Ja(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:i,chartId:a})):t({type:"click-end",timestamp:l,chartType:i,chartId:a}))}Qa.ownsChrome=!0;import{useCallback as es}from"react";import{useCallback as ts,useRef as ns}from"react";function os(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 rs(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;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??n.datum?.category??""})}else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=bt(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"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function is(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}import{jsx as as,jsxs as ss}from"react/jsx-runtime";var ls={top:50,right:40,bottom:60,left:70},cs=s(a(function(a,s){const{chartType:l,runtimeMode:d,data:h,oAccessor:f="category",rAccessor:m="value",colorAccessor:g,symbolAccessor:p,symbolMap:y,stackBy:b,groupBy:v,multiAxis:x,timeAccessor:w,valueAccessor:k,categoryAccessor:S,accessorRevision:A,projection:M="vertical",size:C=[600,400],responsiveWidth:_,responsiveHeight:R,margin:P,barPadding:I,roundedTop:L,gradientFill:T,trackFill:$,baselinePadding:B,innerRadius:H,cornerRadius:O,normalize:j,startAngle:F,sweepAngle:D,dynamicColumnWidth:W,bins:E,showOutliers:N,showIQR:z,amplitude:G,connectorOpacity:q,showLabels:V,connectorAccessor:X,connectorStyle:Y,dataIdAccessor:U,rExtent:K,oExtent:Q,extentPadding:Z=.05,oSort:J,windowMode:ee="sliding",windowSize:te=200,pieceStyle:ne,summaryStyle:oe,renderMode:re,colorScheme:ie,barColors:ae,showAxes:le=!0,showCategoryTicks:ce,categoryLabel:ue,valueLabel:de,categoryFormat:he,valueFormat:fe,oLabel:me,rLabel:ge,oFormat:pe,rFormat:ye,rTickValues:be,tickLabelEdgeAlign:ve,axisExtent:xe,enableHover:we=!0,hoverAnnotation:ke,tooltipContent:Se,customHoverBehavior:Ae,customClickBehavior:Me,onObservation:Ce,annotationObservationCallback:_e,chartId:Re,annotations:Pe,onAnnotationActivate:Ie,autoPlaceAnnotations:Le,svgAnnotationRules:Te,showGrid:$e=!1,legend:Be,legendHoverBehavior:He,legendClickBehavior:Oe,legendHighlightedCategory:je,legendIsolatedCategories:Fe,legendPosition:De,legendLayout:Ee,legendCategoryAccessor:Ne,onCategoriesChange:Ge,backgroundGraphics:qe,foregroundGraphics:Ve,title:Xe,className:Ye,background:Qe,centerContent:Je,decay:et,pulse:tt,transition:nt,animate:ot,staleness:rt,frameScheduler:lt,clock:ct,random:ut,seed:dt,paused:ft=!1,suspendWhenHidden:gt=!0,brush:pt,onBrush:bt,accessibleTable:vt=!0,description:wt,summary:kt,customLayout:St,onLayoutError:At,layoutConfig:Mt,layoutSelection:Ct}=a,{customHoverBehavior:_t,customClickBehavior:Tt,hasClickBehavior:Bt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:es((t,i)=>{e?.(t,i),Za({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:es((e,i)=>{t?.(e,i),Ja({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:Me,onObservation:Ce,chartId:Re,chartType:"StreamOrdinalFrame"}),Ht=S??f,Ot=k??m,jt=e(!0),Ft=Gi({sizeProp:C,responsiveWidth:_,responsiveHeight:R,userMargin:P,marginDefault:ls,title:Xe,legend:Be,legendPosition:De,animate:ot,transitionProp:nt,frameScheduler:lt,clock:ct,random:ut,seed:dt,paused:ft,suspendWhenHidden:gt,themeDirtyRef:jt}),{reducedMotionRef:Dt,responsiveRef:Wt,size:Et,margin:Nt,adjustedWidth:zt,adjustedHeight:Gt,currentTheme:qt,transition:Vt,introEnabled:Xt,tableId:Yt,rafRef:Ut,renderFnRef:Kt,scheduleRender:Qt,frameRuntime:Zt}=Ft,Jt=function(){const[e,t]=sr(!1);return cr(()=>{t(!0)},[]),e}(),en=function(){const e=lr(ur,dr,hr);return ar(e).current}(),tn=o(()=>c(h),[h]),nn=ue??me,on=de??ge,rn=he??pe,an=fe??ye,sn=e(null),[ln,cn]=t(null),[un,dn]=t(null),hn=Qi(Ve,Et,Nt,un),fn=Qi(qe,Et,Nt,un),mn=qe||"transparent"===Qe?null:as("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-Nt.left,y:-Nt.top,width:Et[0],height:Et[1],fill:Qe||"var(--semiotic-bg, transparent)"}),[gn,pn]=t(0),yn=e(0),[bn,vn]=t(!1),xn=e({w:-1,h:-1}),wn=e(!1),kn=ze(new Ue("StreamOrdinalFrame")),Sn=we||ke,An="streaming"===d,Mn=function(e){const t=fr(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return gr(e,t);if(!pr(e)||!pr(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(!gr(n,r))return!1}else{if(!pr(n)||!pr(r))return!1;if(!mr(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(o(()=>({chartType:l,runtimeMode:An?"streaming":"bounded",windowSize:te,windowMode:ee,extentPadding:Z,projection:M,oAccessor:An?void 0:Ht,rAccessor:An?void 0:Ot,accessorRevision:A,colorAccessor:g,symbolAccessor:p,symbolMap:y,stackBy:b,groupBy:v,multiAxis:x,timeAccessor:An?w:void 0,valueAccessor:An?k||("string"==typeof Ot||"function"==typeof Ot?Ot:void 0):void 0,categoryAccessor:An?Ht:void 0,rExtent:K,oExtent:Q,axisExtent:xe,barPadding:I,roundedTop:L,gradientFill:T,trackFill:$,baselinePadding:B,innerRadius:H,cornerRadius:O,normalize:j,startAngle:F,sweepAngle:D,dynamicColumnWidth:W,bins:E,showOutliers:N,showIQR:z,amplitude:G,connectorOpacity:q,showLabels:V,connectorAccessor:X,connectorStyle:Y,dataIdAccessor:U,oSort:J,pieceStyle:ne,summaryStyle:oe,colorScheme:ie,themeCategorical:qt?.colors?.categorical,themeSemantic:yi(qt),themeSequential:qt?.colors?.sequential,themeDiverging:qt?.colors?.diverging,barColors:ae,decay:et,pulse:tt,transition:Vt,introAnimation:Xt,staleness:rt,clock:Zt.now,customLayout:St,onLayoutError:At,layoutConfig:Mt,layoutMargin:Nt}),[l,An,te,ee,Z,M,Ht,Ot,A,g,p,y,b,v,x,w,k,K,Q,xe,I,L,T,$,B,H,O,j,F,D,W,E,N,z,G,q,V,X,Y,U,J,ne,oe,ie,qt,ae,et,tt,Vt,Xt,rt,Zt.now,St,At,Mt,Nt])),Cn=e(null);Cn.current||(Cn.current=new We(Mn));const _n=function(e,t,n,o){const r=Ki({accessor:t,onChange:n,readData:o}),i=Ki([]);return r.current={accessor:t,onChange:n,readData:o},Ui(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const a=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})(a,i.current)||(i.current=a,n(a))},[e])}(Cn,Ne,Ge,e=>e.getData());!function(e,t,n,o){at(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(Cn,Mn,jt,Qt),function(e,t,n,o){const r=st(null);at(()=>{const i=e.current;if(!i)return;const a=t??null;r.current!==a&&(r.current=a,i.setLayoutSelection(a),i.hasCustomRestyle?i.restyleScene(a):n.current=!0,o())},[t,o,e,n])}(Cn,Ct,jt,Qt);const Rn=e(null);Rn.current||(Rn.current=new u(e=>{const t=Cn.current;t&&t.ingest(e)&&(jt.current=!0,Qt())}));const Pn=r(e=>{Rn.current?.push(e)},[]),In=r(e=>{Rn.current?.pushMany(e)},[]),Ln=r(()=>{Rn.current?.clear(),Cn.current?.clear(),jt.current=!0,Qt()},[Qt]),Tn=r(e=>{Rn.current?.clearLastData(),Rn.current?.setReplacementData(e)},[]);i(s,()=>({push:Pn,pushMany:In,replace:Tn,remove:e=>{Rn.current?.flush();const t=Cn.current?.remove(e)??[];if(t.length>0){const e=sn.current?.data;!!sn.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(sn.current=null,cn(null)),jt.current=!0,Qt()}return t},update:(e,t)=>{Rn.current?.flush();const n=Cn.current?.update(e,t)??[];return n.length>0&&(jt.current=!0,Qt()),n},clear:Ln,getData:()=>(Rn.current?.flush(),Cn.current?.getData()??[]),getScales:()=>Cn.current?.scales??null,getCustomLayout:()=>Cn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Cn.current?.lastCustomLayoutFailure??null}),[Pn,In,Tn,Ln,Qt]),n(()=>{h&&Rn.current?.setBoundedData(tn)},[h,tn]);const{canvasRef:$n}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,a=Vi(null),s=Vi(null),l=Vi(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:a,cleanup:s}=e;cr(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,a?.(),i.current()},[t,n]);const l=ar(s);l.current=s,rr(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),qi(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),qi(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:s}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(Ft,{storeRef:Cn,dirtyRef:jt,hydrated:Jt,wasHydratingFromSSR:en,cleanup:()=>Rn.current?.clear(),canvasPaintDependencies:[l,zt,Gt,le,Qe,qe,re,Qt]}),{hoverHandlerRef:Bn,hoverLeaveRef:Hn,onPointerMove:On,onPointerLeave:jn}=Ft;Bn.current=e=>{if(!Sn)return;const t=$n.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Nt.left,r=e.clientY-n.top-Nt.top;if(0>o||o>zt||0>r||r>Gt)return void(sn.current&&(sn.current=null,cn(null),_t&&_t(null),Qt()));const i=Cn.current;if(!i||0===i.scene.length)return;const a="radial"===M,s=xt(i.scene,a?o-zt/2:o,a?r-Gt/2:r,30,i.pointQuadtree,i.maxPointRadius);if(!s)return void(sn.current&&(sn.current=null,cn(null),_t&&_t(null),Qt()));const c=Kr(s.datum||{},s.x,s.y,{...s.stats&&{stats:s.stats},...s.category&&{category:s.category},__oAccessor:"string"==typeof Ht?Ht:void 0,__rAccessor:"string"==typeof Ot?Ot:void 0,__chartType:l});sn.current=c,cn(c),_t&&(_t(c),jt.current=!0),Qt()},Hn.current=()=>{sn.current&&(sn.current=null,cn(null),_t&&(_t(null),jt.current=!0),Qt())};const Fn=r(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Tt)return;const n=$n.current;if(!n)return Tt(null),jt.current=!0,void Qt();const o=n.getBoundingClientRect(),r=e.clientX-o.left-Nt.left,i=e.clientY-o.top-Nt.top;if(0>r||r>zt||0>i||i>Gt)return Tt(null),jt.current=!0,void Qt();const a=Cn.current;if(!a||0===a.scene.length)return Tt(null),jt.current=!0,void Qt();const s="radial"===M,c=xt(a.scene,s?r-zt/2:r,s?i-Gt/2:i,30,a.pointQuadtree,a.maxPointRadius);if(!c)return Tt(null),jt.current=!0,void Qt();var u;Tt(Kr(c.datum||{},c.x,c.y,{...c.stats&&{stats:c.stats},...c.category&&{category:c.category},__oAccessor:"string"==typeof Ht?Ht:void 0,__rAccessor:"string"==typeof Ot?Ot:void 0,__chartType:l}),{type:"activate",inputType:(u=e.nativeEvent.pointerType,"touch"===u?"touch":"pointer")}),jt.current=!0,Qt()},[Tt,$n,Nt.left,Nt.top,zt,Gt,M,Ht,Ot,l,Qt]),{kbFocusIndexRef:Dn,focusedNavPointRef:Wn,onKeyDown:En}=function({chartType:e,oAccessor:t,rAccessor:n,...o}){return function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:a,extractPoints:s,toHover:l}){const c=ns(-1),u=ns(null),d=ns(null),h=ts(h=>{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']")}(h))return;const f=e.current;if(!f)return;const m=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),a()};if(0===f.scene.length)return void(0>c.current||m());let g;if(d.current?.version===f.version)g=d.current.graph;else{const e=s(f.scene);if(0===e.length)return void(0>c.current||m());g=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),d.current={version:f.version,graph:g}}let p=c.current;if(g.flat.length>p||(m(),p=-1),("Enter"===h.key||" "===h.key)&&p>=0)return h.preventDefault(),void i(l(g.flat[p],f),{type:"activate",inputType:"keyboard"});if(0>p){if("Escape"===h.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(h.key))return;h.preventDefault(),c.current=0;const e=g.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void a()}const y=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?os(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?os(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}}(h.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}}(g,p),g);if(null===y)return;if(h.preventDefault(),0>y)return void m();c.current=y;const b=g.flat[y];u.current=b;const v=l(b,f);t.current=v,o(v),r(v,{type:"focus",inputType:"keyboard"}),a()},[i,r,s,t,n,a,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}({...o,extractPoints:rs,toHover:o=>({...is(o),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof n?n:void 0,__chartType:e})})}({storeRef:Cn,hoverRef:sn,setHoverPoint:cn,customHoverBehavior:_t,customClickBehavior:Tt,scheduleRender:Qt,chartType:l,oAccessor:Ht,rAccessor:Ot}),Nn=r(e=>{Dn.current=-1,Wn.current=null,On(e)},[Wn,Dn,On]);Kt.current=()=>{if(Ut.current=null,!Zt.isActive)return;const e=$n.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=Cn.current;if(!n)return;const o=Zt.now(),r=n.advanceTransition(Dt.current?o+1e6:o),i=!Dt.current&&r,a=xn.current.w!==zt||xn.current.h!==Gt,s=jt.current;let c=!1;const u=kn.current.beforeCompute(n.getLastUpdateResult(),i);!s&&!a||i&&!a||(n.computeScene({width:zt,height:Gt}),xn.current={w:zt,h:Gt},c=!0,_n()),kn.current.afterCompute(u,c,a),jt.current=s&&i&&!c;const d=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!i&&e.hasActivePulsesAt(t),s=!(n||i||!a&&!r)&&e.refreshPulse(t);return o.current=a,{changed:s,pending:a}}(n,o,c,wn);(c||i)&&e.setAttribute("aria-label",Pr(n.scene,l+" chart"));const h=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))}(),f=Et[0]*h,m=Et[1]*h;e.width===f&&e.height===m||(e.width=f,e.height=m,e.style.width=Et[0]+"px",e.style.height=Et[1]+"px"),t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,Et[0],Et[1]);const g=rt&&n.lastIngestTime>0&&o-n.lastIngestTime>(rt?.threshold??5e3);g&&(t.globalAlpha=rt?.dimOpacity??.5);const p="radial"===M;t.save(),t.beginPath(),t.rect(Nt.left,Nt.top,zt,Gt),t.clip(),p?(t.save(),t.translate(Nt.left+zt/2,Nt.top+Gt/2)):t.translate(Nt.left,Nt.top);const y=St?Ga.custom:Ga[l]||[],b={width:zt,height:Gt},v=n.scales;v&&function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let a=[];const s=()=>{a.length&&(i(a),a=[])};for(const e of n){const n=Va(o,e);if(!n){a.push(e);continue}let l;s(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(Xa(n.id,e.type??"unknown"),i([e]))}s()}({context:t,nodes:n.scene,renderMode:re,pixelRatio:h,paintBuiltIn:e=>{for(const n of y)n(t,e,v,b)}}),p&&t.restore(),t.restore(),g&&(t.globalAlpha=1),c&&n.scales?(dn(n.scales),pn(e=>e+1),yn.current=o):i&&n.scales&&o-yn.current>=33&&(pn(e=>e+1),yn.current=o),rt?.showBadge&&vn(!!g),(i||null!=n.activeTransition||d.pending)&&Qt()},function(e,t,n,o,r,i){const a=Pt("fresh");Rt(()=>{if(!e)return;const s=setInterval(()=>{const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return Lt;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:{...It,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Lt}(e,l-s.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,r,o,t,i,n])}(rt,Cn,jt,Qt,bn,vn);const zn=Sn&&ln?Se?Se(ln):as(Qa,{hover:ln}):null,Gn="radial"===M,qn=zn?as(ui,{x:ln?Gn?ln.x+zt/2:ln.x:0,y:ln?Gn?ln.y+Gt/2:ln.y:0,containerWidth:zt,containerHeight:Gt,margin:Nt,className:"stream-ordinal-tooltip",children:zn}):null,Vn="horizontal"===M?Ht:Ot,Xn=Ho("horizontal"===M?Ot:Ht,void 0,"__semiotic_resolvedO",""),Yn=Ho(Vn,void 0,"__semiotic_resolvedR",""),Un=Xn.key,Kn=Yn.key,Qn=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 a={...n};return o&&(a[e.key]=e.fn(n)),i&&(a[t.key]=t.fn(n)),a});return r?i:o}}(Xn,Yn,Pe&&Pe.length>0||!1);if(or||!Jt&&en){const e=Cn.current;e&&h&&(e.ingest({inserts:tn,bounded:!0}),e.computeScene({width:zt,height:Gt}));const t=e?.scene??[],n=e?.scales??null,o=Qi(Ve,Et,Nt,n),r=Qi(qe,Et,Nt,n),i="radial"===M,a=i?Nt.left+zt/2:Nt.left,s=i?Nt.top+Gt/2:Nt.top;return ss("div",{ref:Wt,className:"stream-ordinal-frame"+(Ye?" "+Ye:""),role:"img","aria-label":wt||("string"==typeof Xe?Xe:"Ordinal chart"),style:{position:"relative",width:_?"100%":Et[0],height:R?"100%":Et[1]},children:[as(zr,{summary:kt}),ss("svg",{xmlns:"http://www.w3.org/2000/svg",width:Et[0],height:Et[1],style:{position:"absolute",left:0,top:0},children:[r&&as("g",{transform:`translate(${Nt.left},${Nt.top})`,children:r}),ss("g",{transform:`translate(${a},${s})`,children:[Qe&&as("rect",{x:0,y:0,width:zt,height:Gt,fill:Qe}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=Va(o,t);if(!i)return r();const a=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=a?a:(Xa(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:re,fallback:()=>function(e,t,n){const o=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=n=>`ord-${e.type}-${o}-${t}-${n}`,i=`ord-${e.type}-${o}-${t}`;switch(e.type){case"rect":{const t=e,n=nr(i)+"-grad",o=function(e,t){const n=e.fillGradient;if(!n)return null;let o=e.x,r=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(o=e.x+e.w,r=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(o=e.x,r=e.y,i=e.x+e.w,a=e.y);const s=[];if("colorStops"in n){const e=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)s.push(Zo("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=tr(e.style.fill);s.push(Zo("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),s.push(Zo("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return Zo("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:o,y1:r,x2:i,y2:a,children:s})}(t,n);let r,a;if(o)a=`url(#${n})`;else if(Jn(t.style.fill)){const e=nr(i)+"-hatch";r=oo(t.style.fill,e),a=`url(#${e})`}else a=tr(t.style.fill);const s=o||r?Jo("defs",{children:[o,r]}):null;if(t.cornerRadii&&Xo(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:o,h:r}=e,{tl:i,tr:a,br:s,bl:l}=Yo(e);let c=`M${t+i},${n}`;return c+=` L${t+o-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o},${n+a}`),c+=` L${t+o},${n+r-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o-s},${n+r}`),c+=` L${t+l},${n+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+r-l}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return Jo(qo.Fragment,{children:[s,Zo("path",{d:e,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:o,w:r,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${n},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n},${o+l} Z`;break;case"left":c=`M${n+r},${o} L${n+e},${o} A${e},${e} 0 0 0 ${n},${o+e} L${n},${o+l-e} A${e},${e} 0 0 0 ${n+e},${o+l} L${n+r},${o+l} Z`;break;case"bottom":c=`M${n},${o} L${n+r},${o} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n+e},${o+l} A${e},${e} 0 0 1 ${n},${o+l-e} Z`;break;default:c=`M${n},${o+l} L${n},${o+e} A${e},${e} 0 0 1 ${n+e},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l} Z`}return Jo(qo.Fragment,{children:[s,Zo("path",{d:c,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return Jo(qo.Fragment,{children:[s,Zo("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return Zo("circle",{cx:t.x,cy:t.y,r:t.r,fill:tr(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return function(e,t,n){const o=se(e.symbolType,e.size,e.path);return Zo("path",{d:o,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?tr(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}(e,t,n);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=ht(r,e.size);if(0>=i.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=yt(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?nr(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:mt(n.fill,s,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:mt(n.stroke??"none",s,e.accent);return r||i?Zo("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 Jo("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&Zo("clipPath",{id:c,children:Zo("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?Zo("g",{children:d(e.ghostColor)}):null,l&&c?Zo("g",{clipPath:`url(#${c})`,children:d()}):d()]},o)}(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const o=e;if(o._gradientBand&&o._gradientBand.colors.length>0){const e=nr(`${n?n+"-":""}gauge-grad-${o.category||i}-${t}`),{clipPath:r,slices:a}=Qo({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds?.start??!0,roundEnd:o.roundedEnds?.end??!0,colors:o._gradientBand.colors});return Jo("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[Zo("defs",{children:Zo("clipPath",{id:e,children:Zo("path",{d:r})})}),Zo("g",{clipPath:`url(#${e})`,children:a.map((e,t)=>Zo("path",{d:e.d,fill:tr(e.color)},t))}),o.style.stroke&&"none"!==o.style.stroke&&Zo("path",{d:r,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},i)}let r;if(o.roundedEnds)r=Ko({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds.start,roundEnd:o.roundedEnds.end});else{const e=Vo().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),r=e(er)||""}return Zo("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:tr(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},i)}case"boxplot":{const t=e,n=t.columnWidth/2;return Jo("g","vertical"===t.projection?{children:[Zo("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),Zo("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:tr(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),Zo("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),Zo("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),Zo("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[Zo("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),Zo("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:tr(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),Zo("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),Zo("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),Zo("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,n=[Zo("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:tr(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,o=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?n.push(Zo("line",{x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),Zo("circle",{cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):n.push(Zo("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),Zo("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return Zo("g",{children:n},i)}case"connector":return Zo("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return Zo("polygon",{points:n,fill:tr(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Yt)})).filter(Boolean)]})]}),as(Bo,{width:zt,height:Gt,totalWidth:Et[0],totalHeight:Et[1],margin:Nt,scales:n,showAxes:le,showCategoryTicks:ce,oLabel:nn,rLabel:on,oFormat:rn,rFormat:an,rTickValues:be,tickLabelEdgeAlign:ve,axisExtent:xe,showGrid:$e,title:Xe,legend:Be,legendHoverBehavior:He,legendClickBehavior:Oe,legendHighlightedCategory:je,legendIsolatedCategories:Fe,legendPosition:De,legendLayout:Ee,foregroundGraphics:Ze(o,it(Cn.current?.customLayoutOverlays,Ct??null)),annotations:Pe,onAnnotationActivate:Ie,onObservation:_e??Ce,chartId:Re,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Le,svgAnnotationRules:Te,annotationFrame:0,xAccessor:Un,yAccessor:Kn,annotationData:Qn(e?.getData())}),Je&&"radial"===M&&as("div",{style:{position:"absolute",left:Nt.left+zt/2,top:Nt.top+Gt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Je})]})}return ss("div",{ref:Wt,className:"stream-ordinal-frame"+(Ye?" "+Ye:""),role:"group","aria-label":wt||("string"==typeof Xe?Xe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:_?"100%":Et[0],height:R?"100%":Et[1],overflow:"visible"},onKeyDown:En,children:["production"!==process.env.NODE_ENV&&Cn.current&&as(Ke,{store:Cn.current,diagnostics:kn.current}),vt&&as(Gr,{tableId:Yt}),vt&&as(Nr,{scene:Cn.current?.scene??[],chartType:l+" chart",tableId:Yt,chartTitle:"string"==typeof Xe?Xe:void 0}),as(zr,{summary:kt}),as(Sr,{hoverPoint:ln}),ss("div",{role:"img","aria-label":wt||("string"==typeof Xe?Xe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Sn?Nn:void 0,onMouseLeave:Sn?jn:void 0,onClick:Bt?Fn:void 0,children:[ss(Yi,{size:Et,margin:Nt,children:[mn,fn]}),as(To,{width:zt,height:Gt,totalWidth:Et[0],totalHeight:Et[1],margin:Nt,scales:un,showAxes:le,showGrid:$e,rFormat:an,rTickValues:be,axisExtent:xe}),as("canvas",{ref:$n,"aria-label":Pr(Cn.current?.scene??[],l+" chart"),style:{position:"absolute",top:0,left:0,width:Et[0],height:Et[1]}}),as(Bo,{width:zt,height:Gt,totalWidth:Et[0],totalHeight:Et[1],margin:Nt,scales:un,showAxes:le,showCategoryTicks:ce,oLabel:nn,rLabel:on,oFormat:rn,rFormat:an,rTickValues:be,axisExtent:xe,showGrid:$e,title:Xe,legend:Be,legendHoverBehavior:He,legendClickBehavior:Oe,legendHighlightedCategory:je,legendIsolatedCategories:Fe,legendPosition:De,legendLayout:Ee,foregroundGraphics:Ze(hn,it(Cn.current?.customLayoutOverlays,Ct??null)),annotations:Pe,onAnnotationActivate:Ie,onObservation:_e??Ce,chartId:Re,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Le,svgAnnotationRules:Te,annotationFrame:gn,xAccessor:Un,yAccessor:Kn,annotationData:Qn(Cn.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(pt||bt)&&"radial"!==M&&as(Go,{width:zt,height:Gt,totalWidth:Et[0],totalHeight:Et[1],margin:Nt,scales:un,onBrush:bt||(()=>{})}),Je&&"radial"===M&&as("div",{style:{position:"absolute",left:Nt.left+zt/2,top:Nt.top+Gt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Je}),rt?.showBadge&&as($t,{isStale:bn,position:rt.badgePosition}),as(Xr,{active:Dn.current>=0,hoverPoint:ln,margin:Nt,size:Et,shape:Wn.current?.shape,width:Wn.current?.w,height:Wn.current?.h}),qn]})]})}));cs.displayName="StreamOrdinalFrame";var us=cs;function ds(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:a,axisExtent:s,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!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function hs(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};o&&(f.annotationObservationCallback=o);const m=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(s||t||o||r||a)&&(f.customHoverBehavior=u),d&&(l||(h?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||n))&&(f.customClickBehavior=d),null!=m&&(f.hoverRadius=m),f}function fs(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:li(t)||n}}import{useMemo as ms,forwardRef as gs,useRef as ps}from"react";import{useMemo as ys,useCallback as bs,useState as vs,useId as xs,useEffect as ws,useRef as ks}from"react";import{createContext as Ss,useContext as As,useMemo as Ms}from"react";import{jsx as Cs}from"react/jsx-runtime";var _s=Ss(null);function Rs(){return As(_s)}import{createContext as Ps,useContext as Is,useEffect as Ls,useId as Ts,useLayoutEffect as $s,useMemo as Bs,useRef as Hs,useState as Os,useCallback as js}from"react";function Fs(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 Ds(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Ws(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[Es,Ns]=Dn(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||!Ws(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),a=Ds(i,t),s=new Map(a.clauses);return s.set(n.clientId,n),i.set(t,{...a,clauses:s}),{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=Ds(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}})}}));import{useId as zs,useMemo as Gs,useCallback as qs}from"react";import{useSyncExternalStore as Vs}from"react";var Xs={positions:new Map},Ys=new Set;function Us(){for(const e of Ys)e()}function Ks(e,t){const n=Xs.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Xs.positions);o.delete(e),Xs={positions:o},Us()}function Qs(e,t){const n=Xs.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(Xs.positions);o.delete(e),Xs={positions:o},Us()}function Zs(e){const t=zs(),n=e.clientId||t,{name:o}=e,r=Ns(e=>e.selections.get(o)),i=Ns(e=>e.setClause),a=Ns(e=>e.clearClause),s=Gs(()=>!!r&&r.clauses.size>0,[r]);return{predicate:Gs(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Fs(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:s,selectPoints:qs(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:qs(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:qs(()=>{a(o,n)},[a,o,n]),clientId:n}}function Js(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function el(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}import{jsx as tl,jsxs as nl}from"react/jsx-runtime";var ol=Ps(!1);Ps(!1);var rl=Ps(null),il="undefined"==typeof window?Ls:$s;function al(e){const t=Is(rl),n=Ts(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=Hs([]);(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})(r.current,o)||(r.current=o);const i=r.current;il(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),il(()=>{t&&t.registerCategories(n,i)},[t,n,i])}function sl({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){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:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):z[i%z.length];return{label:r+"",color:s}}),label:""}]}}import*as ll from"react";import{jsx as cl,jsxs as ul}from"react/jsx-runtime";function dl(){return Mi(e=>e.theme)}function hl(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function fl(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),a=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&&a!==n.orientation)}function ml(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=>fl(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"])hl(e[o])&&hl(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}}function gl(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 pl(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 yl(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}ll.createContext(void 0);var bl=[],vl={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function xl(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,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!r&&!i)return vl;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??o??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function wl(){const e=dl(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function kl(e,t,n){return ys(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],r="function"==typeof(i=n)?i:e=>e[i];var i;return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}var Sl={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 Al(e,t,n){const o=Sl[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,a=ml({...t,mode:e},{width:t.width??r,height:t.height??i}).props,s=a.mode||e,l=Sl[s||"primary"],c="context"===s||"sparkline"===s,u=s&&"primary"!==s||!n?.width?l.width:n.width;return{width:a.width??u,height:a.height??(s&&"primary"!==s||!n?.height?l.height:n.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:Ml(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:xl(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function Ml(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}import{jsx as Cl,jsxs as _l}from"react/jsx-runtime";function Rl(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Pl(e,t){if(!t)return Rl(e);try{const n=t(e);return null==n?Rl(e):n}catch{return Rl(e)}}function Il(e,t){return"function"==typeof t?t(e):e[t]}function Ll({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:r=!1,valueFormat:i}){return a=>{const s=r?a.data?.[0]||a.data||a:a.data||a,l=Il(s,e),c=Il(s,t),u=n?Il(s,n):void 0;return _l("div",{className:"semiotic-tooltip",style:ri,children:[Cl("div",{style:{fontWeight:"bold"},children:Rl(l)}),Cl("div",{style:{marginTop:4},children:Pl(c,i)}),null!=u&&_l("div",{style:{marginTop:2,opacity:.8},children:[o||(d=n,"string"==typeof d?d:"value"),": ",Rl(u)]})]});var d}}import{jsx as Tl,jsxs as $l}from"react/jsx-runtime";function Bl({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return Tl("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:$l("div",{style:{textAlign:"center",maxWidth:400},children:[Tl("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),Tl("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&Tl("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})]})})}import*as Hl from"react";import{jsx as Ol}from"react/jsx-runtime";var jl=class extends Hl.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:Ol(Bl,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as Fl}from"react/jsx-runtime";var Dl="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Wl({componentName:e,width:t,height:n,children:o}){return Fl(jl,{fallback:o=>Fl(Bl,{componentName:e,message:o.message,width:t,height:n}),children:o})}var El={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"},Nl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function zl(e,t,n,o){if(!Dl)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 Gl(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 a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function ql(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=Gl(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function Vl({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=ql(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}import{useCallback as Xl,useMemo as Yl,useState as Ul}from"react";import{useMemo as Kl}from"react";function Ql(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:a,selection:s,linkedHover:l,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:m,showLegend:g,userMargin:p,marginDefaults:y,onClick:b,hoverHighlight:v,mobileInteraction:x,mobileSemantics:w,loading:k,loadingContent:S,emptyContent:A,width:M,height:C}=e,_=void 0===n,R=Yl(()=>c(t),[t]),[P,I]=Ul([]),L=Xl(e=>{I(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,$=Yl(()=>xl(x,{width:M,mobileSemantics:w}),[x,M,w]),{activeSelectionHook:B,hoverSelectionHook:H,customHoverBehavior:O,customClickBehavior:j,crosshairSourceId:F}=function({selection:e,linkedHover:t,fallbackFields:n=bl,unwrapData:o=!1,onObservation:r,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=xs(),h=ys(()=>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=ys(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),m=Zs({name:e?.name||"__unused__",fields:f}),g=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=Zs({name:t,fields:n});return{onHover:qs(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}el(t)&&i(t)},[n,i,a]),predicate:o,isActive:r}}({name:h?.name||"hover",fields:f}),p=Nn(e=>e.pushObservation),y=bs(e=>{r?.(e),p?.(e)},[r,p]),b=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,x]=vs(null),w=ks(!1),k=c||n[0],S=ys(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),A=bs((e,n)=>{const o=!e&&w.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"===h?.mode&&h.xField){const n=gl(e,t,h.xField);null!=n&&function(e,t,n){const o=Xs.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(Xs={positions:new Map(Xs.positions).set(e,{xValue:t,sourceId:n})},Us())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&g.onHover(t)}else"x-position"!==h?.mode||o||Ks(h.name||"hover",d),"x-position"===h?.mode||o||g.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else o||x(null);(r||p)&&Za({onObservation:y,datum:e?pl(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:a,context:n})},[t,g,h,d,r,i,a,p,y,l,k,u]),M=bs((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&g.onHover(null),e&&u?.tapToSelect&&m.clear(),n&&l&&x(null),"x-position"===h?.mode&&(Qs(h.name||"hover",d),Ks(h.name||"hover",d))},[t,h,g,e,u,m,l,d]),C=bs((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=gl(n,e,h.xField);null!=t&&function(e,t,n){const o=Xs.positions.get(e);if(o?.locked){const t=new Map(Xs.positions);return t.delete(e),Xs={positions:t},Us(),!1}Xs={positions:new Map(Xs.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Us()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const o=pl(n);if(t&&"x-position"!==h?.mode&&g.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])}yl(e)&&m.selectPoints(e)}if(l&&k){const e=o?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&s){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),s(e,{x:n.x??0,y:n.y??0})}(r||p)&&Ja({onObservation:y,datum:n?pl(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:a,context:o})}},[s,r,p,y,i,a,h,d,u,t,g,e,m,f,l,k,M]);return ws(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),ws(()=>()=>{w.current&&M(!1)},[M]),ws(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Qs(e,d),Ks(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:C,crosshairSourceId:d}}({selection:s,linkedHover:l,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:m,onClick:b,hoverHighlight:v,colorByField:T,mobileInteraction:$}),D=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,F),W=function(e,t,n){const o=Rs(),r=wl();return ys(()=>{if(!t)return;const i=o??void 0,a=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&&yl(i)){const e=X(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return X(n.map(e=>({_cat:e})),"_cat",a)}if(i&&yl(i)){const n=X(e,t,a);return e=>i[e]||n(e)}return X(e,t,a)}if(i&&yl(i)){const e=X([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,o,r])}(R,o,r),E=Yl(()=>{if(!o)return[];const e=new Set;for(const t of R){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[R,o]),N=Yl(()=>_&&P.length>0?P:E,[_,P,E]),G=function(e,t,n){const[o,r]=vs(null),[i,a]=vs(new Set),s=ys(()=>new Set,[]),l=bs(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=bs(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=ys(()=>{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:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,o,N),V=Yl(()=>H||(G.legendSelectionHook?G.legendSelectionHook:B),[H,G.legendSelectionHook,B]),Y=function(e){const t=Mi(e=>e.theme.colors.selectionOpacity);return Kl(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(s),U=wl(),K=Rs(),Q=Yl(()=>{if(W)return W;if(!o||0===N.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:U&&U.length>0?U:z,t="__streamCat",n=X(N.map(e=>({[t]:e})),t,e);return e=>K?.[e]||n(e)||"#999"},[W,o,N,r,U,K]),{legend:Z,margin:J,legendPosition:ee}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s}){const l=Is(ol),c=null!==Is(rl),u=void 0!==o?o:!l&&!!t,d=!!t&&(u||c),h=ys(()=>{if(!d)return[];if(void 0!==s)return s;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)},[s,t,e,d]);al(c&&t?h:[]);const f=ys(()=>{if(!u||!t)return;const o=sl({data:e,colorBy:t,colorScale:n,getColor:q,categories:h});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[u,t,e,n,h]),m=ys(()=>{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:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("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},[a,i,f,r]);return{legend:f,margin:m,legendPosition:r}}({data:R,colorBy:o,colorScale:Q,showLegend:g,legendPosition:a,userMargin:p,defaults:y,categories:N}),te=Yl(()=>{const e={};return Z&&(e.legend=Z,e.legendPosition=ee),i&&"none"!==i&&(e.legendHoverBehavior=G.onLegendHover,e.legendClickBehavior=G.onLegendClick,e.legendHighlightedCategory=G.highlightedCategory,e.legendIsolatedCategories=G.isolatedCategories),_&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[Z,ee,i,G.onLegendHover,G.onLegendClick,G.highlightedCategory,G.isolatedCategories,_,o,L]),ne=Array.isArray(n)?c(n):n,oe=function(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return Fl("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))),a=Math.max(6,Math.floor(n/(2.5*r))),s=Math.floor((n-(r*(i+a)-a))/2);return Fl("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)=>Fl("div",{className:"semiotic-loading-bar",style:{...Nl,position:"absolute",top:s+n*(i+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}(k,M,C,S),re=oe?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?Fl("div",{style:{...El,width:t,height:n},children:o||"No data available"}):null}(ne,M,C,A);return{data:R,colorScale:W,allCategories:N,legendState:G,effectiveSelectionHook:V,activeSelectionHook:B,customHoverBehavior:O,customClickBehavior:j,mobileInteraction:$,legend:Z,margin:J,legendPosition:ee,earlyReturn:oe||re||null,legendBehaviorProps:te,crosshairProps:D,resolvedSelection:Y}}import{useImperativeHandle as Zl}from"react";function Jl({ref:e,frameRef:t,setup:n}){return Zl(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,n)=>t.current?.update(e,n)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}import{useMemo as ec}from"react";function tc(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 nc(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>ic(t(e))}function oc(e,t){const n=nc(e),o=nc(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function rc(e,t){const n=nc(t??"value"),o=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=o?o(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function ic(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 ac(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=ic(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 sc(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):ac(o,t,n))}function lc(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!sc(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function cc(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const a=o(e),s={...r(e,i)};return Object.assign(s,lc(a,t,n(a,i))),s}:r}function uc(e,t,n){return e&&0!==e.length?(o,r)=>{const i=lc(o,e,t(o,r)),a=n?n(o,r):void 0;return a?{...i,...a}:i}:n}function dc(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:r,colorScheme:i,categoryIndexMap:a,userPieceStyle:s,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:g=!1,styleRules:p,resolveRuleValue:y}=e,b=ec(()=>(e,s)=>{const l="function"==typeof m?m(e,s):m,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=q(e,t,n)}else c.fill=function(e,t,n,o,r){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=V(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=E[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:"#007bff"}(o,r,i,f?s:void 0,a);if(p&&p.length>0){const t=lc(e,p,{value:y?y(e):void 0,category:s});Object.assign(c,t)}return g&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,r,i,a,f,m,g,p,y]),v=ec(()=>tc(s?"function"==typeof s?(e,t)=>({...b(e,t),...s(e,t)||{}}):(e,t)=>({...b(e,t),...s}):b,{stroke:l,strokeWidth:c,opacity:u}),[b,s,l,c,u]);return ec(()=>{return e=v,n=h,(t=d??null)?(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??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e;var e,t,n},[v,d,h])}function hc(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}}}import{jsx as fc}from"react/jsx-runtime";var mc=gs(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=ps(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sort:m=!1,barPadding:g=40,roundedTop:p,gradientFill:y=!1,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:w,regression:k,valueExtent:S,frameProps:A={},selection:M,linkedHover:C,onObservation:_,onClick:R,hoverHighlight:P,chartId:I,loading:L,loadingContent:T,emptyContent:$,legendInteraction:B,legendPosition:H,color:O,stroke:j,strokeWidth:F,opacity:D,showCategoryTicks:W,categoryFormat:E,dataIdAccessor:N}=e,{width:z,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=n,ee=ms(()=>c(r),[r]),te=Ql({data:ee,rawData:r,colorBy:h,colorScheme:f,legendInteraction:B,legendPosition:H,selection:M,linkedHover:C,fallbackFields:h?["string"==typeof h?h:""]:[],unwrapData:!0,onObservation:_,onClick:R,hoverHighlight:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BarChart",chartId:I,showLegend:X,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:z,height:G}),{effectiveLegendProps:ne,effectiveMargin:oe}=Jl({ref:t,frameRef:o,setup:te});zl("BarChart",ee,"categoryAccessor",s),zl("BarChart",ee,"valueAccessor",l);const re=kl(ee,m,l),ie=wl(),ae=ms(()=>new Map,[]),se=ms(()=>nc(l),[l]),le=dc({colorBy:h,colorScale:te.colorScale,color:O,themeCategorical:ie,colorScheme:f,categoryIndexMap:ae,userPieceStyle:A?.pieceStyle,stroke:j,strokeWidth:F,opacity:D,styleRules:b,resolveRuleValue:se,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=ms(()=>Ll({categoryAccessor:s,valueAccessor:l,groupAccessor:h&&h!==s?h:void 0,groupLabel:"string"==typeof h?h:"group",valueFormat:d}),[s,l,h,d]);if(te.earlyReturn)return te.earlyReturn;const ue=Vl({componentName:"BarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ue)return fc(Bl,{componentName:"BarChart",message:ue,width:z,height:G});const de=hc(k),he=de?[de,...w||[]]:w,fe={chartType:"bar",...null!=r&&{data:re},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:le,size:[z,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:g,...null!=p&&{roundedTop:p},...y&&{gradientFill:!0===y?{topOpacity:.8,bottomOpacity:.05}:y},...N&&{dataIdAccessor:N},baselinePadding:v,enableHover:q,showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:d,...E&&{oFormat:E},showGrid:V,showCategoryTicks:W,oSort:m,...ne,...ds({title:Y,description:U,summary:K,accessibleTable:Q,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:x,defaultTooltipContent:ce}),...hs({linkedHover:C,selection:M,onObservation:_,onClick:R,hoverHighlight:P,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...he&&he.length>0&&{annotations:he},...S&&{rExtent:S},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return fc(Wl,{componentName:"BarChart",width:z,height:G,children:fc(us,{ref:o,...fe})})});mc.displayName="BarChart";import{useMemo as gc,forwardRef as pc,useRef as yc}from"react";import{jsx as bc}from"react/jsx-runtime";var vc=pc(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=yc(null),{data:r,margin:i,className:a,categoryAccessor:s="category",stackBy:l,valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:m,normalize:g=!1,sort:p=!1,barPadding:y=40,roundedTop:b,styleRules:v,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:S,frameProps:A={},selection:M,linkedHover:C,onObservation:_,onClick:R,hoverHighlight:P,chartId:I,loading:L,loadingContent:T,emptyContent:$,legendInteraction:B,legendPosition:H,color:O,stroke:j,strokeWidth:F,opacity:D,categoryFormat:W}=e,{width:E,height:N,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=gc(()=>c(r),[r]),J=f||l,ee=Ql({data:Z,rawData:r,colorBy:J,colorScheme:m,legendInteraction:B,legendPosition:H,selection:M,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:_,onClick:R,hoverHighlight:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"StackedBarChart",chartId:I,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:E,height:N}),te=wl(),ne=gc(()=>new Map,[]),oe=gc(()=>nc(u),[u]),re=dc({colorBy:J,colorScale:ee.colorScale,color:O,themeCategorical:te,colorScheme:m,categoryIndexMap:ne,userPieceStyle:A?.pieceStyle,stroke:j,strokeWidth:F,opacity:D,styleRules:v,resolveRuleValue:oe,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=gc(()=>Ll({categoryAccessor:l,valueAccessor:u,groupAccessor:s,valueFormat:h}),[l,s,u,h]),ae=Vl({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:u},requiredProps:{stackBy:l}}),{effectiveLegendProps:se,effectiveMargin:le}=Jl({ref:t,frameRef:o,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const ce={chartType:"bar",...null!=r&&{data:Z},oAccessor:s,rAccessor:u,stackBy:l,normalize:g,oSort:p,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:re,size:[E,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:y,...null!=b&&{roundedTop:b},baselinePadding:x,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:h,...W&&{oFormat:W},showGrid:G,...se,...ds({title:V,description:X,summary:Y,accessibleTable:U,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:w,defaultTooltipContent:ie}),...hs({linkedHover:C,selection:M,onObservation:_,onClick:R,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return ae?bc(Bl,{componentName:"StackedBarChart",message:ae,width:E,height:N}):bc(Wl,{componentName:"StackedBarChart",width:E,height:N,children:bc(us,{ref:o,...ce})})});vc.displayName="StackedBarChart";import{useMemo as xc,forwardRef as wc,useRef as kc}from"react";import{jsx as Sc}from"react/jsx-runtime";var Ac=wc(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=kc(null),{data:r,margin:i,className:a,categoryAccessor:s="category",groupBy:l,valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:m,sort:g=!1,barPadding:p=60,roundedTop:y,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:w,valueExtent:k,frameProps:S={},selection:A,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:R,chartId:P,loading:I,loadingContent:L,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:j,opacity:F,categoryFormat:D}=e,{width:W,height:E,enableHover:N,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:U,valueLabel:K}=n,Q=xc(()=>c(r),[r]),Z=f||l,J=Ql({data:Q,rawData:r,colorBy:Z,colorScheme:m,legendInteraction:$,legendPosition:B,selection:A,linkedHover:M,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GroupedBarChart",chartId:P,showLegend:G,userMargin:i,marginDefaults:n.marginDefaults,loading:I,loadingContent:L,emptyContent:T,width:W,height:E}),ee=wl(),te=xc(()=>new Map,[]),ne=xc(()=>nc(u),[u]),oe=dc({colorBy:Z,colorScale:J.colorScale,color:H,themeCategorical:ee,colorScheme:m,categoryIndexMap:te,userPieceStyle:S.pieceStyle,stroke:O,strokeWidth:j,opacity:F,styleRules:b,resolveRuleValue:ne,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=xc(()=>Ll({categoryAccessor:l,valueAccessor:u,groupAccessor:s,valueFormat:h}),[l,s,u,h]),ie=Vl({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:u},requiredProps:{groupBy:l}}),{effectiveLegendProps:ae,effectiveMargin:se}=Jl({ref:t,frameRef:o,setup:J});if(J.earlyReturn)return J.earlyReturn;const le={chartType:"clusterbar",...null!=r&&{data:Q},oAccessor:s,rAccessor:u,groupBy:l,oSort:g,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:oe,size:[W,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,barPadding:p,...null!=y&&{roundedTop:y},baselinePadding:v,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:h,...D&&{oFormat:D},showGrid:z,...ae,...ds({title:q,description:V,summary:X,accessibleTable:Y,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:x,defaultTooltipContent:re}),...hs({linkedHover:M,selection:A,onObservation:C,onClick:_,hoverHighlight:R,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return ie?Sc(Bl,{componentName:"GroupedBarChart",message:ie,width:W,height:E}):Sc(Wl,{componentName:"GroupedBarChart",width:W,height:E,children:Sc(us,{ref:o,...le})})});Ac.displayName="GroupedBarChart";import{useMemo as Mc,forwardRef as Cc,useRef as _c}from"react";import{useCallback as Rc,useRef as Pc}from"react";function Ic({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=(i="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const a="string"==typeof o?o:"value",s=function(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:a,clear:s}=Zs({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=qs(e=>{if(!e)return void s();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&&Js(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Js(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),el(t)&&a(t)},[l,n,o,a,s]);return{brushInteraction:Gs(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:s}}({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||a}),l=Pc(s.brushInteraction);l.current=s.brushInteraction;const c=Rc(e=>{if(r){l.current.end(e?e.r:null)}t?.(e)},[t,r]),u=!!(e||n||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}import{jsx as Lc}from"react/jsx-runtime";var Tc=Cc(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=_c(null),{data:r,margin:i,className:a,categoryAccessor:s="category",subcategoryAccessor:l,valueAccessor:u="value",orientation:d="horizontal",valueFormat:h,colorBy:f,colorScheme:m,barPadding:g,tooltip:p,annotations:y,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:C,chartId:_,loading:R,loadingContent:P,emptyContent:I,legendInteraction:L,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,categoryFormat:j,rTickValues:F,tickLabelEdgeAlign:D,showCategoryTicks:W,gradientFill:E,trackFill:N,roundedTop:z,valueExtent:G}=e,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,ne=Mc(()=>c(r),[r]),oe=f||l,re=Mc(()=>{if(null!=g)return g;if("sparkline"!==e.mode)return 40;const t=new Set(ne.map(e=>"function"==typeof s?s(e):e[s])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===d?V:q)-2*n)/(n-1))):1},[g,e.mode,ne,s,d,q,V]),ie=Ql({data:ne,rawData:r,colorBy:oe,colorScheme:m,legendInteraction:L,legendPosition:T,selection:k,linkedHover:S,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwimlaneChart",chartId:_,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:R,loadingContent:P,emptyContent:I,width:q,height:V}),ae=Ic({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:u}),se=wl(),le=Mc(()=>new Map,[]),ce=dc({colorBy:oe,colorScale:ie.colorScale,color:$,themeCategorical:se,colorScheme:m,categoryIndexMap:le,userPieceStyle:w?.pieceStyle,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=Mc(()=>Ll({categoryAccessor:l,valueAccessor:u,groupAccessor:s,valueFormat:h}),[l,s,u,h]),de=Vl({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:s,valueAccessor:u,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=Jl({ref:t,frameRef:o,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const me={chartType:"swimlane",...null!=r&&{data:ne},oAccessor:s,rAccessor:u,stackBy:l,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:!1===W?void 0:ee,rLabel:te,rFormat:h,...F&&{rTickValues:F},...null!=D&&{tickLabelEdgeAlign:D},...j&&{oFormat:j},...void 0!==W&&{showCategoryTicks:W},showGrid:Y,...he,...ds({title:K,description:Q,summary:Z,accessibleTable:J,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:p,defaultTooltipContent:ue}),...hs({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...y&&y.length>0&&{annotations:y},...E&&{gradientFill:!0===E?{topOpacity:.8,bottomOpacity:.05}:E},...null!=N&&{trackFill:N},...null!=z&&{roundedTop:z},...G&&{rExtent:G},...ae.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return de?Lc(Bl,{componentName:"SwimlaneChart",message:de,width:q,height:V}):Lc(Wl,{componentName:"SwimlaneChart",width:q,height:V,children:Lc(us,{ref:o,...me})})});Tc.displayName="SwimlaneChart";import{useMemo as $c,forwardRef as Bc,useRef as Hc}from"react";import{useImperativeHandle as Oc}from"react";function jc(e,t){const{variant:n,frameRef:o,overrides:r}=t;Oc(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)??[],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{...e,...r}},[o,r,n])}import{jsx as Fc}from"react/jsx-runtime";var Dc=Bc(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=Hc(null);jc(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sizeBy:m,sizeRange:g=[3,8],symbolBy:p,symbolMap:y,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:S,brush:A,onBrush:M,linkedBrush:C,frameProps:_={},selection:R,linkedHover:P,onObservation:I,onClick:L,hoverHighlight:T,chartId:$,loading:B,loadingContent:H,emptyContent:O,legendInteraction:j,legendPosition:F,color:D,stroke:W,strokeWidth:E,opacity:N,showCategoryTicks:z,categoryFormat:G}=e,{width:q,height:V,enableHover:X,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ne}=n,oe=$c(()=>c(r),[r]),re=Ql({data:oe,rawData:r,colorBy:h,colorScheme:f,legendInteraction:j,legendPosition:F,selection:R,linkedHover:P,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:I,onClick:L,hoverHighlight:T,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwarmPlot",chartId:$,showLegend:K,userMargin:i,marginDefaults:n.marginDefaults,loading:B,loadingContent:H,emptyContent:O,width:q,height:V}),ie=Ic({brushProp:A,onBrushProp:M,linkedBrush:C,valueAccessor:l}),ae=$c(()=>{if(m)return fe(oe.map(e=>"function"==typeof m?m(e):e[m]))},[oe,m]),se=wl(),le=$c(()=>new Map,[]),ce=dc({colorBy:h,colorScale:re.colorScale,color:D,themeCategorical:se,colorScheme:f,categoryIndexMap:le,userPieceStyle:_?.pieceStyle,stroke:W,strokeWidth:E,opacity:N,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:m?Y(e,m,g,ae):b})}),ue=$c(()=>Ll({categoryAccessor:s,valueAccessor:l,groupAccessor:h||void 0,valueFormat:d}),[s,l,h,d]);if(re.earlyReturn)return re.earlyReturn;const de=Vl({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(de)return Fc(Bl,{componentName:"SwarmPlot",message:de,width:q,height:V});const he={chartType:"swarm",...null!=r&&{data:oe},oAccessor:s,rAccessor:l,...p&&{symbolAccessor:p},...y&&{symbolMap:y},projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,barPadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:te,rLabel:ne,rFormat:d,...G&&{oFormat:G},showGrid:U,showCategoryTicks:z,...re.legendBehaviorProps,...ds({title:Q,description:Z,summary:J,accessibleTable:ee,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:w,defaultTooltipContent:ue}),...hs({linkedHover:P,selection:R,onObservation:I,onClick:L,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e))};return Fc(Wl,{componentName:"SwarmPlot",width:q,height:V,children:Fc(us,{ref:o,...he})})});Dc.displayName="SwarmPlot";import{useMemo as Wc,forwardRef as Ec,useRef as Nc}from"react";import{jsx as zc,jsxs as Gc}from"react/jsx-runtime";function qc(e){return t=>{const n=t.category||t.data&&t.data[0]?.category||"",o=t.stats||(t.data||t).stats;if(o&&null!=o.median)return Gc("div",{className:"semiotic-tooltip",style:ri,children:[n&&zc("div",{style:{fontWeight:"bold"},children:n+""}),null!=o.n&&Gc("div",{children:["n = ",o.n]}),null!=o.min&&Gc("div",{children:["Min: ",o.min.toLocaleString()]}),null!=o.q1&&Gc("div",{children:["Q1: ",o.q1.toLocaleString()]}),Gc("div",{children:["Median: ",o.median.toLocaleString()]}),null!=o.q3&&Gc("div",{children:["Q3: ",o.q3.toLocaleString()]}),null!=o.max&&Gc("div",{children:["Max: ",o.max.toLocaleString()]}),null!=o.mean&&Gc("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const o=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,a=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return Gc("div",{className:"semiotic-tooltip",style:ri,children:[n&&zc("div",{style:{fontWeight:"bold"},children:n+""}),i>0&&Gc("div",{children:["n = ",i]}),null!=a&&Gc("div",{children:["Median: ",a.toLocaleString()]})]})}return zc("div",{className:"semiotic-tooltip",style:ri,children:zc("div",{style:{fontWeight:"bold"},children:n+""})})}}import{jsx as Vc}from"react/jsx-runtime";var Xc=Ec(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=Nc(null);jc(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,showOutliers:m=!0,outlierRadius:g=3,categoryPadding:p=20,tooltip:y,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:C,loading:_,loadingContent:R,emptyContent:P,legendInteraction:I,legendPosition:L,color:T,stroke:$,strokeWidth:B,opacity:H,showCategoryTicks:O,categoryFormat:j}=e,{width:F,height:D,enableHover:W,showGrid:E,showLegend:N,title:z,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=Wc(()=>c(r),[r]),K=Ql({data:U,rawData:r,colorBy:h,colorScheme:f,legendInteraction:I,legendPosition:L,selection:w,linkedHover:k,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:F,height:D}),Q=wl(),Z=Wc(()=>new Map,[]),J=dc({colorBy:h,colorScale:K.colorScale,color:T,themeCategorical:Q,colorScheme:f,categoryIndexMap:Z,userPieceStyle:void 0,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=Wc(()=>qc(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Vl({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(te)return Vc(Bl,{componentName:"BoxPlot",message:te,width:F,height:D});const ne={chartType:"boxplot",...null!=r&&{data:U},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:J,showOutliers:m,size:[F,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:p,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:d,...j&&{oFormat:j},showGrid:E,showCategoryTicks:O,...K.legendBehaviorProps,...ds({title:z,description:G,summary:q,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:y,defaultTooltipContent:ee}),...hs({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return Vc(Wl,{componentName:"BoxPlot",width:F,height:D,children:Vc(us,{ref:o,...ne})})});Xc.displayName="BoxPlot";import{useMemo as Yc,forwardRef as Uc,useRef as Kc}from"react";import{jsx as Qc,jsxs as Zc}from"react/jsx-runtime";var Jc=e=>{const t=e?.category;return null==t?"All":t+""},eu=Uc(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=Kc(null);jc(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:a,categoryAccessor:s=Jc,valueAccessor:l="value",bins:u=25,relative:d=!1,valueFormat:h,colorBy:f,colorScheme:m,categoryPadding:g=20,tooltip:p,annotations:y,valueExtent:b,brush:v,onBrush:x,linkedBrush:w,frameProps:k={},selection:S,linkedHover:A,onObservation:M,onClick:C,hoverHighlight:_,chartId:R,loading:P,loadingContent:I,emptyContent:L,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:j,showCategoryTicks:F,categoryFormat:D}=e,{width:W,height:E,enableHover:N,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:U,valueLabel:K}=n,Q=Yc(()=>c(r),[r]),Z=Ql({data:Q,rawData:r,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:$,selection:S,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Histogram",chartId:R,showLegend:G,userMargin:i,marginDefaults:n.marginDefaults,loading:P,loadingContent:I,emptyContent:L,width:W,height:E}),J=Ic({brushProp:v,onBrushProp:x,linkedBrush:w,valueAccessor:l}),ee=Yc(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,n=-1/0;for(const o of Q){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[Q,l]),te=wl(),ne=Yc(()=>new Map,[]),oe=dc({colorBy:f,colorScale:Z.colorScale,color:B,themeCategorical:te,colorScheme:m,categoryIndexMap:ne,userPieceStyle:void 0,stroke:H,strokeWidth:O,opacity:j,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=Yc(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return Zc("div",{className:"semiotic-tooltip",style:ri,children:[n&&Qc("div",{style:{fontWeight:"bold"},children:n+""}),null!=o&&Zc("div",{children:["Count: ",o]}),r&&2===r.length&&Zc("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=Vl({componentName:"Histogram",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ie)return Qc(Bl,{componentName:"Histogram",message:ie,width:W,height:E});const ae={chartType:"histogram",...null!=r&&{data:Q},oAccessor:s,rAccessor:l,projection:"horizontal",summaryStyle:oe,bins:u,normalize:d,...b?{rExtent:b}:ee&&{rExtent:ee},size:[W,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:g,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:h,...D&&{oFormat:D},showGrid:z,showCategoryTicks:F,...Z.legendBehaviorProps,...ds({title:q,description:V,summary:X,accessibleTable:Y,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:p,defaultTooltipContent:re}),...hs({linkedHover:A,selection:S,onObservation:M,onClick:C,hoverHighlight:_,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...y&&y.length>0&&{annotations:y},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return Qc(Wl,{componentName:"Histogram",width:W,height:E,children:Qc(us,{ref:o,...ae})})});eu.displayName="Histogram";import{useMemo as tu,forwardRef as nu,useRef as ou}from"react";import{jsx as ru}from"react/jsx-runtime";var iu=nu(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=ou(null);jc(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="vertical",bins:d=25,curve:h="catmullRom",showIQR:f=!0,valueFormat:m,colorBy:g,colorScheme:p,categoryPadding:y=20,tooltip:b,annotations:v,valueExtent:x,brush:w,onBrush:k,linkedBrush:S,frameProps:A={},selection:M,linkedHover:C,onObservation:_,onClick:R,hoverHighlight:P,chartId:I,loading:L,loadingContent:T,emptyContent:$,legendInteraction:B,legendPosition:H,color:O,stroke:j,strokeWidth:F,opacity:D,showCategoryTicks:W,categoryFormat:E}=e,{width:N,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=tu(()=>c(r),[r]),ee=Ql({data:J,rawData:r,colorBy:g,colorScheme:p,legendInteraction:B,legendPosition:H,selection:M,linkedHover:C,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:_,onClick:R,hoverHighlight:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ViolinPlot",chartId:I,showLegend:V,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:N,height:z}),te=Ic({brushProp:w,onBrushProp:k,linkedBrush:S,valueAccessor:l}),ne=wl(),oe=tu(()=>new Map,[]),re=dc({colorBy:g,colorScale:ee.colorScale,color:O,themeCategorical:ne,colorScheme:p,categoryIndexMap:oe,userPieceStyle:void 0,stroke:j,strokeWidth:F,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=tu(()=>qc({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const ae=Vl({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ae)return ru(Bl,{componentName:"ViolinPlot",message:ae,width:N,height:z});const se={chartType:"violin",...null!=r&&{data:J},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:re,bins:d,showIQR:f,size:[N,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:G,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:m,...E&&{oFormat:E},showGrid:q,showCategoryTicks:W,...ee.legendBehaviorProps,...ds({title:X,description:Y,summary:U,accessibleTable:K,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:b,defaultTooltipContent:ie}),...hs({linkedHover:C,selection:M,onObservation:_,onClick:R,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...v&&v.length>0&&{annotations:v},...x&&{rExtent:x},...te.brushStreamProps,...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return ru(Wl,{componentName:"ViolinPlot",width:N,height:z,children:ru(us,{ref:o,...se})})});iu.displayName="ViolinPlot";import{useMemo as au,forwardRef as su,useRef as lu}from"react";import{jsx as cu}from"react/jsx-runtime";var uu=su(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=lu(null);jc(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:f,sort:m="auto",dotRadius:g=5,categoryPadding:p=10,tooltip:y,annotations:b,regression:v,valueExtent:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:C,chartId:_,loading:R,loadingContent:P,emptyContent:I,legendInteraction:L,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,categoryFormat:j}=e,{width:F,height:D,enableHover:W,showGrid:E,showLegend:N,title:z,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=au(()=>c(r),[r]),K=Ql({data:U,rawData:r,colorBy:h,colorScheme:f,legendInteraction:L,legendPosition:T,selection:k,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DotPlot",chartId:_,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:R,loadingContent:P,emptyContent:I,width:F,height:D}),Q=kl(U,m,l),Z=wl(),J=au(()=>new Map,[]),ee=dc({colorBy:h,colorScale:K.colorScale,color:$,themeCategorical:Z,colorScheme:f,categoryIndexMap:J,userPieceStyle:w?.pieceStyle,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:g,fillOpacity:.8}}),te=au(()=>Ll({categoryAccessor:s,valueAccessor:l,valueFormat:d}),[s,l,d]);if(K.earlyReturn)return K.earlyReturn;const ne=Vl({componentName:"DotPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ne)return cu(Bl,{componentName:"DotPlot",message:ne,width:F,height:D});const oe=hc(v),re=oe?[oe,...b||[]]:b,ie={chartType:"point",...null!=r&&{data:Q},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ee,size:[F,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:p,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:d,...j&&{oFormat:j},showGrid:E,oSort:m,...K.legendBehaviorProps,...ds({title:z,description:G,summary:q,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:y,defaultTooltipContent:te}),...hs({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...re&&re.length>0&&{annotations:re},...x&&{rExtent:x},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return cu(Wl,{componentName:"DotPlot",width:F,height:D,children:cu(us,{ref:o,...ie})})});uu.displayName="DotPlot";import{useMemo as du,forwardRef as hu,useRef as fu}from"react";import{jsx as mu}from"react/jsx-runtime";var gu=hu(function(e,t){const n=Al(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=fu(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",colorBy:u,colorScheme:d,startAngle:h=0,cornerRadius:f,tooltip:m,annotations:g,frameProps:p={},selection:y,linkedHover:b,onObservation:v,onClick:x,hoverHighlight:w,chartId:k,loading:S,loadingContent:A,emptyContent:M,legendInteraction:C,legendPosition:_,color:R,stroke:P,strokeWidth:I,opacity:L}=e,{width:T,height:$,enableHover:B,showLegend:H,title:O,description:j,summary:F,accessibleTable:D}=n,W=du(()=>c(r),[r]),E=u||s,N=Ql({data:W,rawData:r,colorBy:E,colorScheme:d,legendInteraction:C,legendPosition:_,selection:y,linkedHover:b,fallbackFields:E?["string"==typeof E?E:""]:[],unwrapData:!0,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:H,userMargin:i,marginDefaults:n.marginDefaults,loading:S,loadingContent:A,emptyContent:M,width:T,height:$}),z=wl(),G=du(()=>new Map,[]),q=dc({colorBy:E,colorScale:N.colorScale,color:R,themeCategorical:z,colorScheme:d,categoryIndexMap:G,userPieceStyle:p?.pieceStyle,stroke:P,strokeWidth:I,opacity:L,effectiveSelectionHook:N.effectiveSelectionHook,resolvedSelection:N.resolvedSelection,cycleByCategory:!0}),V=du(()=>Ll({categoryAccessor:s,valueAccessor:l,groupAccessor:u&&u!==s?u:void 0,groupLabel:"string"==typeof u?u:"group",pieData:!0}),[s,l,u]),X=Vl({componentName:"PieChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}}),{effectiveLegendProps:Y,effectiveMargin:U}=Jl({ref:t,frameRef:o,setup:N});if(N.earlyReturn)return N.earlyReturn;const K={chartType:"pie",...null!=r&&{data:W},oAccessor:s,rAccessor:l,projection:"radial",pieceStyle:q,startAngle:h,...null!=f&&{cornerRadius:f},size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Y,...ds({title:O,description:j,summary:F,accessibleTable:D,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:m,defaultTooltipContent:V}),...hs({linkedHover:b,selection:y,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:N.mobileInteraction,customHoverBehavior:N.customHoverBehavior,customClickBehavior:N.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return X?mu(Bl,{componentName:"PieChart",message:X,width:T,height:$}):mu(Wl,{componentName:"PieChart",width:T,height:$,children:mu(us,{ref:o,...K})})});gu.displayName="PieChart";import{useMemo as pu,forwardRef as yu,useRef as bu}from"react";import{jsx as vu}from"react/jsx-runtime";var xu=yu(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),o=bu(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",innerRadius:u,centerContent:d,colorBy:h,colorScheme:f,startAngle:m=0,cornerRadius:g,tooltip:p,annotations:y,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:C,emptyContent:_,legendInteraction:R,legendPosition:P,color:I,stroke:L,strokeWidth:T,opacity:$}=e,{width:B,height:H,enableHover:O,showLegend:j,title:F,description:D,summary:W,accessibleTable:E}=n,N=pu(()=>c(r),[r]),z=h||s,G=Ql({data:N,rawData:r,colorBy:z,colorScheme:f,legendInteraction:R,legendPosition:P,selection:v,linkedHover:x,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DonutChart",chartId:A,showLegend:j,userMargin:i,marginDefaults:n.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:B,height:H}),q=u??Math.max(2,.15*Math.min(B,H)),V=wl(),X=pu(()=>new Map,[]),Y=dc({colorBy:z,colorScale:G.colorScale,color:I,themeCategorical:V,colorScheme:f,categoryIndexMap:X,userPieceStyle:b?.pieceStyle,stroke:L,strokeWidth:T,opacity:$,effectiveSelectionHook:G.effectiveSelectionHook,resolvedSelection:G.resolvedSelection,cycleByCategory:!0}),U=pu(()=>Ll({categoryAccessor:s,valueAccessor:l,groupAccessor:h&&h!==s?h:void 0,groupLabel:"string"==typeof h?h:"group",pieData:!0}),[s,l,h]),K=Vl({componentName:"DonutChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:Z}=Jl({ref:t,frameRef:o,setup:G});if(G.earlyReturn)return G.earlyReturn;const J={chartType:"donut",...null!=r&&{data:N},oAccessor:s,rAccessor:l,projection:"radial",pieceStyle:Y,innerRadius:q,startAngle:m,...null!=g&&{cornerRadius:g},centerContent:d,size:[B,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...ds({title:F,description:D,summary:W,accessibleTable:E,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:p,defaultTooltipContent:U}),...hs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:G.mobileInteraction,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return K?vu(Bl,{componentName:"DonutChart",message:K,width:B,height:H}):vu(Wl,{componentName:"DonutChart",width:B,height:H,children:vu(us,{ref:o,...J})})});xu.displayName="DonutChart";import{useMemo as wu,forwardRef as ku,useRef as Su}from"react";function Au(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function Mu(e){return Math.max(0,Math.min(1,e))}function Cu(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function _u(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Ru(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Mu(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=Mu(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],r=n[e+1];if(t.offset>o||o>r.offset)continue;const i=r.offset-t.offset,a=i>0?(o-t.offset)/i:0,s=Cu(t.color),l=Cu(r.color);if(!s||!l)return.5>a?t.color:r.color;const[c,u,d]=s,[h,f,m]=l;return _u(c+(h-c)*a,u+(f-u)*a,d+(m-d)*a)}return n[n.length-1].color}function Pu(e,t,n){return null==n?`${e}-${t}`:`${e}-${t}-${n}`}import{jsx as Iu,jsxs as Lu}from"react/jsx-runtime";var Tu=ku(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),o=Su(null),r="context"===e.mode,{compactMode:i}=n,{value:a,min:s=0,max:l=100,thresholds:c,gradientFill:u,color:d,backgroundColor:h="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:m,showNeedle:g=!0,needleColor:p="var(--semiotic-text, #333)",centerContent:y,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:S,frameProps:A={},className:M,stroke:C,strokeWidth:_,opacity:R}=e,{width:P,height:I,title:L,description:T,summary:$,accessibleTable:B}=n,H=u&&"object"==typeof u?u:void 0,O=Math.max(s,Math.min(l,a)),j=l-s||1,F=(O-s)/j,{gaugeData:D,pieceStyle:W,gaugeAnnotations:E}=wu(()=>function(e){const{min:t,max:n,value:o,thresholds:r,fillColor:i,backgroundColor:a,fillZones:s,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:n,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(n,e.value))})),n>f[f.length-1].value&&f.push({value:n,color:f[f.length-1].color});const m=!!c&&c.colorStops.length>=2,g=[],p=new Map,y=[];if(m){const e=s?h:1,t=Pu("bg",0);if(g.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),p.set(t,{fill:a,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(Ru(c.colorStops,e*(t+.5)/n));const r=Pu("fill",0);g.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),p.set(r,{fill:o[0]||a})}}else{let e=t;for(let n=0;f.length>n;n++){const o=f[n],r=(o.value-e)/d,i=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(s?Math.min(h,l):l)-i),u=s?Math.max(0,r-c):0;if(c>0){const e=Pu("fill",n);g.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),p.set(e,{fill:o.color})}if(u>0){const e=Pu("bg",n);g.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),p.set(e,{fill:a,opacity:.4})}e=o.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&n>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:g,pieceStyle:(e,t)=>p.get(t||e.category)||{fill:a},gaugeAnnotations:y}}({min:s,max:l,value:a,thresholds:c,fillColor:d,backgroundColor:h,fillZones:w,showScaleLabels:v,gradientFill:H}),[a,s,l,c,d,h,v,w,H]),N=wu(()=>tc(W,{stroke:C,strokeWidth:_,opacity:R}),[W,C,_,R]),{sweepRad:z,startAngleDeg:G}=Au(x),q=function(e=240){const{sweepRad:t,offsetRad:n}=Au(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const r=o.map(e=>e[0]),i=o.map(e=>e[1]),[a,s]=fe(r),[l,c]=fe(i);return{minX:a,maxX:s,minY:l,maxY:c,width:s-a,height:c-l,cx:(a+s)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(P,I)/12)),X=q.cx,Y=q.cy,U=Math.max(4,Math.min((P-2*V)/q.width,(I-2*V)/q.height)-2),K=Math.max(0,Math.min(U-1.5,U*(1-f))),Q=P/2-X*U,Z=I/2-Y*U,J=2*(U+4),ee=wu(()=>{if(i&&null==y)return null;if(null!=y)return"function"==typeof y?y(O,s,l):y;const e=b?b(O):Math.round(O)+"";return Lu("div",{style:{textAlign:"center",lineHeight:1.2},children:[Iu("div",{style:{fontSize:Math.max(16,.3*U),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&Lu("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[s," – ",l]})]})},[y,O,s,l,b,v,U,i]),te=wu(()=>r&&null==y?{type:"gauge-value",text:b?b(O):Math.round(O)+""}:null,[r,y,O,b]),ne=wu(()=>{if(!g)return null;const e=-Math.PI/2+G*Math.PI/180+F*z,t=K>20?K-8:U-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:p}},[g,G,F,z,K,U,p]),oe=wu(()=>(e,t,n)=>{if("gauge-needle"===e.type){const o=(n.width||P)/2,r=(n.height||I)/2,i=Math.max(1,U-K),a=Math.max(1,Math.min(2.5,.4*i)),s=Math.max(1,Math.min(5,.6*i));return Lu("g",{transform:`translate(${o},${r})`,children:[Iu("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:a,strokeLinecap:"round"}),Iu("circle",{cx:0,cy:0,r:s,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const o=-Math.PI/2+G*Math.PI/180+(e.value-s)/j*z,r=(n.width||P)/2,i=(n.height||I)/2,a=K-1,l=U+1,c=Math.cos(o)*a,u=Math.sin(o)*a,d=Math.cos(o)*l,h=Math.sin(o)*l,f=U+10,m=Math.cos(o)*f,g=Math.sin(o)*f,p=((o+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,b;return p>=11||1>p?(y="middle",b="auto"):p>=1&&5>p?(y="start",b="middle"):p>=5&&7>p?(y="middle",b="hanging"):(y="end",b="middle"),Lu("g",{transform:`translate(${r},${i})`,children:[Iu("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),Iu("text",{x:m,y:g,textAnchor:y,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?Iu("text",{x:(n.width||P)/2,y:(n.height||I)/2-.2*K,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*U)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[P,I,s,j,G,z,K,U]),re=wu(()=>{const e=[...E,...S||[]];return ne&&e.push(ne),te&&e.push(te),e},[E,S,ne,te]),ie=wu(()=>e=>{const t=e?.data?.[0]||e?.data||e,n=t?._zone||"",o=t?._isFill;return Lu("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[Iu("div",{style:{fontWeight:600},children:n}),Iu("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:o?"Current: "+Math.round(O):"Remaining"})]})},[O]);if(0===D.length)return Iu(Bl,{componentName:"GaugeChart",message:"No data to display",width:P,height:I});const ae={chartType:"donut",data:D,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:N,innerRadius:K,startAngle:G,sweepAngle:x,...null!=m&&{cornerRadius:m},centerContent:ee,size:[P,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:Z-J/2,bottom:I-Z-J/2,left:Q-J/2,right:P-Q-J/2},enableHover:n.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:li(k)||ie,svgAnnotationRules:oe,...re.length>0&&{annotations:re},...L&&{title:L},...T&&{description:T},...$&&{summary:$},...void 0!==B&&{accessibleTable:B},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...A};return Iu(Wl,{componentName:"GaugeChart",width:P,height:I,children:Iu(us,{ref:o,...ae})})});Tu.displayName="GaugeChart";import{useMemo as $u,forwardRef as Bu,useRef as Hu}from"react";import{jsx as Ou}from"react/jsx-runtime";var ju=Bu(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=Hu(null);jc(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="horizontal",bins:d=20,amplitude:h=1.5,valueFormat:f,colorBy:m,colorScheme:g,categoryPadding:p=5,tooltip:y,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:C,loading:_,loadingContent:R,emptyContent:P,legendInteraction:I,legendPosition:L,color:T,stroke:$,strokeWidth:B,opacity:H,showCategoryTicks:O,categoryFormat:j}=e,{width:F,height:D,enableHover:W,showGrid:E,showLegend:N,title:z,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=$u(()=>c(r),[r]),K=Ql({data:U,rawData:r,colorBy:m,colorScheme:g,legendInteraction:I,legendPosition:L,selection:w,linkedHover:k,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:F,height:D}),Q=wl(),Z=$u(()=>new Map,[]),J=dc({colorBy:m,colorScale:K.colorScale,color:T,themeCategorical:Q,colorScheme:g,categoryIndexMap:Z,userPieceStyle:void 0,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=$u(()=>qc(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Vl({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(te)return Ou(Bl,{componentName:"RidgelinePlot",message:te,width:F,height:D});const ne={chartType:"ridgeline",...null!=r&&{data:U},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:J,bins:d,size:[F,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:p,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:f,...j&&{oFormat:j},showGrid:E,showCategoryTicks:O,oSort:!1,amplitude:h,...K.legendBehaviorProps,...ds({title:z,description:G,summary:q,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...fs({tooltip:y,defaultTooltipContent:ee}),...hs({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return Ou(Wl,{componentName:"RidgelinePlot",width:F,height:D,children:Ou(us,{ref:o,...ne})})});ju.displayName="RidgelinePlot";import{useMemo as Fu,forwardRef as Du,useRef as Wu}from"react";import{jsx as Eu,jsxs as Nu}from"react/jsx-runtime";var zu=Du(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=Wu(null);jc(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:a,stepAccessor:s="step",valueAccessor:l="value",categoryAccessor:u,colorBy:d,colorScheme:h,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:g=!0,tooltip:p,annotations:y,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:C,emptyContent:_,legendInteraction:R,legendPosition:P,color:I,stroke:L,strokeWidth:T,opacity:$,categoryFormat:B}=e,H="vertical"===f,{width:O,height:j,enableHover:F,showLegend:D,title:W,description:E,summary:N,accessibleTable:z}=n,G=H?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},q=Fu(()=>c(r),[r]),V=d||u,X=!V,Y=Ql({data:q,rawData:r,colorBy:V,colorScheme:h,legendInteraction:R,legendPosition:P,selection:v,linkedHover:x,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FunnelChart",chartId:A,showLegend:D,userMargin:i,marginDefaults:G,loading:M,loadingContent:C,emptyContent:_,width:O,height:j});zl("FunnelChart",q,"stepAccessor",s),zl("FunnelChart",q,"valueAccessor",l);const U=wl(),K=Fu(()=>new Map,[]),Q=Fu(()=>{if(X)return I||(U?.[0]?U[0]:Array.isArray(h)&&h[0]?h[0]:"#4e79a7")},[X,I,U,h]),Z=dc({colorBy:Q?void 0:V,colorScale:Y.colorScale,color:Q??I,themeCategorical:U,colorScheme:h,categoryIndexMap:K,userPieceStyle:b?.pieceStyle,stroke:L,strokeWidth:T,opacity:$,effectiveSelectionHook:Y.effectiveSelectionHook,resolvedSelection:Y.resolvedSelection}),J=Fu(()=>e=>{const t=e?.data||e,n=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",o=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,a=t?.__barFunnelIsDropoff,s=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return Nu("div",{className:"semiotic-tooltip",style:ri,children:[n&&Eu("div",{style:{fontWeight:"bold"},children:n+""}),s&&s!==n&&Eu("div",{style:{marginTop:2,opacity:.8},children:s+""}),a&&Eu("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),Nu("div",{style:{marginTop:4},children:[o+"",l]})]})},[]);if(Y.earlyReturn)return Y.earlyReturn;const ee=Vl({componentName:"FunnelChart",data:r,accessors:{stepAccessor:s,valueAccessor:l}});if(ee)return Eu(Bl,{componentName:"FunnelChart",message:ee,width:O,height:j});const te={chartType:H?"bar-funnel":"funnel",...null!=r&&{data:q},oAccessor:s,rAccessor:l,...u&&{stackBy:u},projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:Z,size:[O,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Y.margin,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:H,showCategoryTicks:H,...B&&{oFormat:B},showGrid:H,...!H&&{connectorOpacity:m},showLabels:g,...Y.legendBehaviorProps,...W&&{title:W},...E&&{description:E},...N&&{summary:N},...void 0!==z&&{accessibleTable:z},...a&&{className:a},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===p?()=>null:!0===p||null==p?J:li(p)||J,...hs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return Eu(Wl,{componentName:"FunnelChart",width:O,height:j,children:Eu(us,{ref:o,...te})})});zu.displayName="FunnelChart";import*as Gu from"react";import{useMemo as qu,useCallback as Vu,forwardRef as Xu,useRef as Yu,useImperativeHandle as Uu}from"react";import{useRef as Ku,useState as Qu,useCallback as Zu,useMemo as Ju}from"react";import{useMemo as ed,useCallback as td,useRef as nd}from"react";var od={RdBu:B,PiYG:H,PRGn:O,BrBG:j,RdYlBu:F,RdYlGn:D,Spectral:W},rd="__likert_neutral_neg",id="__likert_neutral_pos";function ad(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function sd(e,t,n,o,r,i){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],a=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:r})}}return l}function ld(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:rd,__likertPct:-e}),i.push({...t,__likertLevel:id,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function cd(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const a=[];for(const[,e]of i){const t=new Map;let i,s;for(const n of e)n.__likertLevel===rd?i=n:n.__likertLevel===id?s=n:t.set(n.__likertLevelIndex,n);o&&i&&a.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}var ud=["Very Low","Low","Neutral","High","Very High"];import{jsx as dd}from"react/jsx-runtime";var hd=new Map,fd=Xu(function(e,t){const n=Al(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=Yu(null),{data:r,margin:i,className:a,categoryAccessor:s="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=ud,orientation:h="horizontal",colorScheme:f,barPadding:m=20,tooltip:g,annotations:p,valueExtent:y,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:M,loading:C,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:I,categoryFormat:L,stroke:T,strokeWidth:$,opacity:B}=e,{width:H,height:O,enableHover:j,showGrid:F,showLegend:D,title:W,description:E,summary:N,accessibleTable:G,categoryLabel:V,valueLabel:Y}=n,U="horizontal"===h,K=void 0===r,Q=!c,Z=function(){const e=dl();return e?.colors?.diverging||void 0}(),J=qu(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const n=od[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,a=Math.floor(e/2),s=[];for(let e=0;a>e;e++)s.push(n[Math.min(Math.floor(e*n.length/a),n.length-1)]);i&&s.push(r);for(let e=0;a>e;e++)s.push(o[Math.min(Math.floor(e*o.length/a),o.length-1)]);return s}(d.length,Z),[f,d.length,Z]),ee=qu(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],J[t]||"#888");return e},[d,J]),{processedData:te,reAggregate:ne,accumulatorRef:oe}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:r,countAccessor:i,isDiverging:a,frameRef:s}){const l=!r,c=ed(()=>ad(n,"question"),[n]),u=ed(()=>l?ad(o,"score"):null,[l,o]),d=ed(()=>l?null:ad(r,"level"),[l,r]),h=ed(()=>l?null:ad(i,"count"),[l,i]),f=nd([]);return{processedData:ed(()=>{const n=e||[];if(0===n.length)return[];let o=sd(n,t,c,u,d,h);return a&&(o=ld(o,t),o=cd(o,t)),o},[e,t,c,u,d,h,a]),reAggregate:td(e=>{let n=sd(e,t,c,u,d,h);a&&(n=ld(n,t),n=cd(n,t)),s.current?.replace(n)},[t,c,u,d,h,a,s]),accumulatorRef:f}}({data:r,levels:d,categoryAccessor:s,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:U,frameRef:o}),re="__likertLevelLabel",ie=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:r="right"}){const i=Ku(new Set),a=Ku([]),[s,l]=Qu(0),c=Rs(),u=wl(),d=Zu(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),h=Zu(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),a.current.push(t),o=!0)}o&&l(e=>e+1)},[e,t,d]),f=Zu(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),r=a.current;r.length===o.length&&r.every((e,t)=>e===o[t])||(i.current=new Set(o),a.current=o,l(e=>e+1))},[e,t]),m=Zu(e=>t=>{h([t]),e(t)},[h]),g=Zu(e=>t=>{h(t),e(t)},[h]),p=Zu(()=>{i.current=new Set,a.current=[],l(e=>e+1)},[]);al(e&&t?a.current:[]);const y=Ju(()=>{if(!e||!t||!1===o)return;const r=a.current;if(0===r.length)return;const i=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:u&&u.length>0?u:z,s="string"==typeof t?t:"__streamCat",l=r.map(e=>({[s]:e})),d=X(l,s,i);return sl({data:l,colorBy:s,colorScale:e=>c?.[e]||d(e)||"#999",getColor:q})},[e,t,o,n,c,u,s]),b=Ju(()=>{if(y)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[y,r]);return{wrapPush:m,wrapPushMany:g,resetCategories:p,categories:a.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:y,streamingMarginAdjust:b}}({isPushMode:K,colorBy:re,colorScheme:J,showLegend:D,legendPosition:I}),{wrapPush:ae,wrapPushMany:se}=ie,le=Vu(e=>ae(e=>{oe.current.push(e),ne(oe.current)})(e),[ae,ne,oe]),ce=Vu(e=>se(e=>{oe.current.push(...e),ne(oe.current)})(e),[se,ne,oe]);Uu(t,()=>({push:le,pushMany:ce,remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>{oe.current=[],ie.resetCategories(),o.current?.clear()},getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}),[le,ce,oe,ie]);const ue=Ql({data:te,rawData:r,colorBy:re,colorScheme:J,legendInteraction:P,legendPosition:I,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:D,userMargin:i,marginDefaults:n.marginDefaults,loading:C,loadingContent:_,emptyContent:R,width:H,height:O}),de=qu(()=>{const e=d.length;return e%2!=0&&ee.get(d[Math.floor(e/2)])||"#888"},[d,ee]),he=dc({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:hd,userPieceStyle:b?.pieceStyle,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,n=e.__likertLevel||e.data?.__likertLevel;if(n===rd||n===id)return{fill:de};const o=t||n;return o&&ee.has(o)?{fill:ee.get(o)}:{fill:"#888"}}}),fe=qu(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),me=qu(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===rd||n===id?fe:n,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),a=n===rd||n===id?2*i:i,s=t.__likertCount||0;return Gu.createElement("div",{className:"semiotic-tooltip",style:ri},Gu.createElement("div",{style:{fontWeight:"bold"}},r),Gu.createElement("div",{style:{marginTop:4}},`${o}: ${a.toFixed(1)}% (n=${s})`))},[fe]),ge=qu(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:s};return Q?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),Vl({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,s,l,c,u,d,Q]),pe=qu(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,ee]),ye=qu(()=>!1!==D?{...ue.legendBehaviorProps,legend:{legendGroups:pe},legendPosition:I||ue.legendPosition||"bottom"}:ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,I,D,pe]),be=qu(()=>{const e={...ue.margin};if(K&&!1!==D){const t=I||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ie.streamingMarginAdjust)for(const[t,n]of Object.entries(ie.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[ue.margin,ie.streamingMarginAdjust,U,K,D,I]),ve=qu(()=>M||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,M]);if(ue.earlyReturn)return ue.earlyReturn;const xe={chartType:"bar",...null!=r&&{data:te},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:he,size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be,barPadding:m,enableHover:j,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:V,rLabel:Y||(U?void 0:"Percentage"),rFormat:ve,...L&&{oFormat:L},showGrid:F,...ye,...W&&{title:W},...E&&{description:E},...N&&{summary:N},...void 0!==G&&{accessibleTable:G},...a&&{className:a},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===g?()=>null:!0===g?me:li(g)||me,...hs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...p&&p.length>0&&{annotations:p},...y&&{rExtent:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return ge?dd(Bl,{componentName:"LikertChart",message:ge,width:H,height:O}):dd(Wl,{componentName:"LikertChart",width:H,height:O,children:dd(us,{ref:o,...xe})})});fd.displayName="LikertChart";import{forwardRef as md,useMemo as gd}from"react";import{useMemo as pd,useRef as yd}from"react";import{jsx as bd}from"react/jsx-runtime";var vd=md(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,categoryAccessor:a="category",valueAccessor:s="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:m,showAxes:g=!1,annotations:p,onObservation:y,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:M={}}=e,{frameRef:C,resolved:_,safeData:R,setup:P,earlyReturn:I}=function(e){const t=function(e){const t=yd(null);return jc(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Al(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:pd(()=>function(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}(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=Ql({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,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:"OrdinalCustomChart",unwrapData:!0,data:n,colorBy:f,colorScheme:m,selection:v,linkedHover:x,onObservation:y,onClick:b,chartId:w,loading:k,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),L=P.effectiveSelectionHook,T=gd(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(I)return I;const{width:$,height:B,enableHover:H,showGrid:O,title:j,description:F,summary:D,accessibleTable:W}=_,E={chartType:"custom",...null!=n&&{data:R},customLayout:o,layoutConfig:r,onLayoutError:i,...T&&{layoutSelection:T},oAccessor:a,rAccessor:s,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:m,size:[$,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P.margin,enableHover:H,showAxes:g,showGrid:O,annotations:p,...ds({title:j,description:F,summary:D,accessibleTable:W,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...hs({linkedHover:x,selection:v,onObservation:y,onClick:b,hoverHighlight:!1,mobileInteraction:P.mobileInteraction,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior}),...M};return bd(Wl,{componentName:"OrdinalCustomChart",width:$,height:B,children:bd(us,{ref:C,...E})})});vd.displayName="OrdinalCustomChart";var xd={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},wd=8;function kd(e){return null==e?void 0:e+""}function Sd(e){const t=kd(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??8,style:{...xd},datum:e.datum,pointId:t,_transitionKey:t}}function Ad(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...xd},datum:e.datum,group:e.group,_transitionKey:kd(e.id)}}export{Yn as AnnotationLabel,mc as BarChart,Xc as BoxPlot,wd as DEFAULT_HIT_RADIUS,xu as DonutChart,uu as DotPlot,zu as FunnelChart,Tu as GaugeChart,Ac as GroupedBarChart,eu as Histogram,fd as LikertChart,vd as OrdinalCustomChart,gu as PieChart,ju as RidgelinePlot,vc as StackedBarChart,us as StreamOrdinalFrame,Dc as SwarmPlot,Tc as SwimlaneChart,iu as ViolinPlot,cc as composeStyleRules,Kn as createHatchPattern,Xn as estimateLabelWidth,ft as glyphExtent,ht as glyphPlacement,to as hatchFillId,oo as hatchPatternDef,Sd as hitTargetPoint,Ad as hitTargetRect,Jn as isHatchFill,rc as makeNodeRuleContext,nc as makeRuleValueResolver,uc as makeStyleRuleStyleFn,oc as makeXYRuleContext,ac as matchesThreshold,ml as resolveResponsiveRules,lc as resolveStyleRules,ro as resolveSvgFill,fl as responsiveRuleMatches,sc as ruleMatches,rt as useCustomLayoutSelection};
2
+ import{DEFAULT_HIT_RADIUS as m,hitTargetPoint as n,hitTargetRect as u}from"./chunk-chunk-J3XWETBJ.module.min.js";import{BarChart as o,BoxPlot as i,DonutChart as c,DotPlot as h,FunnelChart as k,GaugeChart as r,GroupedBarChart as e,Histogram as t,LikertChart as d,OrdinalCustomChart as l,PieChart as p,RidgelinePlot as s,StackedBarChart as j,StreamOrdinalFrame_default as C,SwarmPlot as E,SwimlaneChart as J,ViolinPlot as M}from"./chunk-chunk-B6V35LMY.module.min.js";import"./chunk-chunk-YCQYG6J5.module.min.js";import"./chunk-chunk-JCG72SGW.module.min.js";import"./chunk-chunk-I6C3KR5H.module.min.js";import"./chunk-chunk-AZJUDQRM.module.min.js";import"./chunk-chunk-M7VYYHCE.module.min.js";import"./chunk-chunk-A63CTACR.module.min.js";import{useCustomLayoutSelection as f}from"./chunk-chunk-5UKL5W76.module.min.js";import{composeStyleRules as Y,makeNodeRuleContext as Z,makeRuleValueResolver as A,makeStyleRuleStyleFn as G,makeXYRuleContext as H,matchesThreshold as O,resolveStyleRules as T,ruleMatches as U}from"./chunk-chunk-EMO5NUGE.module.min.js";import"./chunk-chunk-SANERMIZ.module.min.js";import{AnnotationLabel as W,createHatchPattern as a,estimateLabelWidth as B,hatchFillId as N,hatchPatternDef as R,isHatchFill as S,resolveResponsiveRules as I,resolveSvgFill as K,responsiveRuleMatches as L}from"./chunk-chunk-6HSGDMTA.module.min.js";import"./chunk-chunk-JJ2OOIET.module.min.js";import"./chunk-chunk-WCX6U47H.module.min.js";import{glyphExtent as X,glyphPlacement as D}from"./chunk-chunk-KTWEBFMX.module.min.js";import"./chunk-chunk-ZCNBUZPL.module.min.js";import"./chunk-chunk-YHNZCPOZ.module.min.js";export{W as AnnotationLabel,o as BarChart,i as BoxPlot,m as DEFAULT_HIT_RADIUS,c as DonutChart,h as DotPlot,k as FunnelChart,r as GaugeChart,e as GroupedBarChart,t as Histogram,d as LikertChart,l as OrdinalCustomChart,p as PieChart,s as RidgelinePlot,j as StackedBarChart,C as StreamOrdinalFrame,E as SwarmPlot,J as SwimlaneChart,M as ViolinPlot,Y as composeStyleRules,a as createHatchPattern,B as estimateLabelWidth,X as glyphExtent,D as glyphPlacement,N as hatchFillId,R as hatchPatternDef,n as hitTargetPoint,u as hitTargetRect,S as isHatchFill,Z as makeNodeRuleContext,A as makeRuleValueResolver,G as makeStyleRuleStyleFn,H as makeXYRuleContext,O as matchesThreshold,I as resolveResponsiveRules,T as resolveStyleRules,K as resolveSvgFill,L as responsiveRuleMatches,U as ruleMatches,f as useCustomLayoutSelection};