semiotic 3.5.3 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CLAUDE.md +62 -4
  2. package/README.md +19 -12
  3. package/ai/componentMetadata.cjs +9 -2
  4. package/ai/dist/mcp-server.js +253 -3
  5. package/ai/examples.md +27 -0
  6. package/ai/schema.json +319 -49
  7. package/ai/system-prompt.md +1 -1
  8. package/dist/components/ai/audienceProfile.d.ts +90 -0
  9. package/dist/components/ai/audiences.d.ts +31 -0
  10. package/dist/components/ai/chartCapabilities.d.ts +55 -0
  11. package/dist/components/ai/chartCapabilityTypes.d.ts +196 -0
  12. package/dist/components/ai/diffProfile.d.ts +51 -0
  13. package/dist/components/ai/inferIntent.d.ts +24 -0
  14. package/dist/components/ai/intents.d.ts +34 -0
  15. package/dist/components/ai/profileData.d.ts +16 -0
  16. package/dist/components/ai/qualityFixtures.d.ts +2 -0
  17. package/dist/components/ai/qualityScorecard.d.ts +82 -0
  18. package/dist/components/ai/repairChartConfig.d.ts +73 -0
  19. package/dist/components/ai/streamingTypes.d.ts +64 -0
  20. package/dist/components/ai/suggestCharts.d.ts +76 -0
  21. package/dist/components/ai/suggestDashboard.d.ts +92 -0
  22. package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
  23. package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
  24. package/dist/components/ai/useChartSuggestions.d.ts +22 -0
  25. package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
  26. package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
  27. package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
  28. package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
  29. package/dist/components/charts/index.d.ts +4 -4
  30. package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
  31. package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
  32. package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
  33. package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
  34. package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
  35. package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
  36. package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
  37. package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
  38. package/dist/components/charts/network/Treemap.d.ts +8 -0
  39. package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
  40. package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
  41. package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
  42. package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
  43. package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
  44. package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
  45. package/dist/components/charts/ordinal/GaugeChart.d.ts +10 -0
  46. package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
  47. package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
  48. package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
  49. package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
  50. package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
  51. package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
  52. package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
  53. package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
  54. package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
  55. package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
  56. package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
  57. package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
  58. package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
  59. package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
  60. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +22 -0
  61. package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
  62. package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
  63. package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
  64. package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
  65. package/dist/components/charts/shared/chartSpecs.d.ts +0 -34
  66. package/dist/components/charts/shared/gaugeGradient.d.ts +62 -0
  67. package/dist/components/charts/shared/hooks.d.ts +2 -2
  68. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -2
  69. package/dist/components/charts/shared/types.d.ts +11 -2
  70. package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
  71. package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
  72. package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
  73. package/dist/components/charts/xy/AreaChart.d.ts +15 -0
  74. package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
  75. package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
  76. package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
  77. package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
  78. package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
  79. package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
  80. package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
  81. package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
  82. package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
  83. package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
  84. package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
  85. package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
  86. package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
  87. package/dist/components/data/DataSummarizer.d.ts +45 -0
  88. package/dist/components/semiotic-ai.d.ts +36 -1
  89. package/dist/components/semiotic-realtime.d.ts +3 -3
  90. package/dist/components/semiotic-server.d.ts +1 -0
  91. package/dist/components/semiotic-xy.d.ts +2 -2
  92. package/dist/components/semiotic.d.ts +5 -4
  93. package/dist/components/server/renderToStaticSVG.d.ts +2 -0
  94. package/dist/components/server/staticLegend.d.ts +35 -0
  95. package/dist/components/store/ThemeStore.d.ts +2 -0
  96. package/dist/components/store/useChartFocus.d.ts +43 -0
  97. package/dist/components/store/useChartInterrogation.d.ts +141 -0
  98. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -1
  99. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
  100. package/dist/components/stream/SVGOverlay.d.ts +2 -1
  101. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  102. package/dist/components/stream/geoTypes.d.ts +2 -1
  103. package/dist/components/stream/hoverUtils.d.ts +1 -0
  104. package/dist/components/stream/legendRenderer.d.ts +2 -1
  105. package/dist/components/stream/networkTypes.d.ts +2 -1
  106. package/dist/components/stream/ordinalTypes.d.ts +16 -2
  107. package/dist/components/stream/renderers/wedgePathBuilder.d.ts +31 -0
  108. package/dist/components/stream/types.d.ts +2 -1
  109. package/dist/components/types/legendTypes.d.ts +15 -0
  110. package/dist/components/types/marginType.d.ts +17 -3
  111. package/dist/geo.min.js +1 -1
  112. package/dist/geo.module.min.js +1 -1
  113. package/dist/network.min.js +1 -1
  114. package/dist/network.module.min.js +1 -1
  115. package/dist/ordinal.min.js +1 -1
  116. package/dist/ordinal.module.min.js +1 -1
  117. package/dist/realtime.min.js +1 -1
  118. package/dist/realtime.module.min.js +1 -1
  119. package/dist/semiotic-ai.d.ts +36 -1
  120. package/dist/semiotic-ai.min.js +1 -1
  121. package/dist/semiotic-ai.module.min.js +1 -1
  122. package/dist/semiotic-realtime.d.ts +3 -3
  123. package/dist/semiotic-server.d.ts +1 -0
  124. package/dist/semiotic-utils.min.js +1 -1
  125. package/dist/semiotic-utils.module.min.js +1 -1
  126. package/dist/semiotic-xy.d.ts +2 -2
  127. package/dist/semiotic.d.ts +5 -4
  128. package/dist/semiotic.min.js +1 -1
  129. package/dist/semiotic.module.min.js +1 -1
  130. package/dist/server.min.js +1 -1
  131. package/dist/server.module.min.js +1 -1
  132. package/dist/xy.min.js +1 -1
  133. package/dist/xy.module.min.js +1 -1
  134. package/package.json +25 -24
package/dist/geo.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-geo"),o=require("d3-scale"),i=require("d3-quadtree"),r=require("d3-array"),l=require("d3-hierarchy"),s=require("d3-shape"),a=require("regression"),c=require("d3-zoom"),u=require("d3-selection");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const f=h(t),p=d(a);class g{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,l=this.buffer[r];if(e(l)){let e;e="object"!=typeof l||null===l?l:Array.isArray(l)?[...l]:Object.assign({},l),n.push(e),this.buffer[r]=t(l)}}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}}function y(e,t,n){return e+(t-e)*n}function m(e,t,n){var o,i,r;if(1>=n)return 1;const l=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return l+(1-s/(n-1))*(1-l);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return l+Math.pow(.5,s/t)*(1-l)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>s?1:l;default:return 1}}const v={mercator:n.geoMercator,equalEarth:n.geoEqualEarth,albersUsa:n.geoAlbersUsa,orthographic:n.geoOrthographic,naturalEarth:n.geoNaturalEarth1,equirectangular:n.geoEquirectangular};function b(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function x(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function j(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function k(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let i=[e[0]];for(let t=1;e.length>t;t++){const r=e[t];Math.abs(r[0]-e[t-1][0])>n?(2>i.length||o.push(i),i=[r]):i.push(r)}return 2>i.length||o.push(i),o}function w(e,t,n=24){const o=t[0]-e[0],i=t[1]-e[1],r=Math.sqrt(o*o+i*i);if(0===r)return[e,t];const l=-i/r,s=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+l*a,u=(e[1]+t[1])/2+s*a,d=[];for(let o=0;n>=o;o++){const i=o/n,r=1-i;d.push([r*r*e[0]+2*r*i*c+i*i*t[0],r*r*e[1]+2*r*i*u+i*i*t[1]])}return d}function O(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const i=e[t];let r,l;0===t?(r=e[1][0]-i[0],l=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],l=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],l=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(r*r+l*l)||1;o.push([i[0]+l/s*n,i[1]+-r/s*n])}return o}function M(e,t,n,o,i){const r=t[0]-e[0],l=t[1]-e[1],s=Math.sqrt(r*r+l*l);if(0===s)return[e,t];const a=l/s,c=-r/s,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class S{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e.slice()}initStreaming(e=500){this.pointBuffer=new g(e),this.timestampBuffer=new g(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}pushLine(e){null!=e&&"object"==typeof e&&(this.lineData.push(e),this.version++)}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return;const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){for(const e of t)this.lineData.push(e);this.version++}}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!o.has(n(e)+"")||(i.push(e),!1)),i.length>0&&this.version++,i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return n.geoEqualEarth();if("string"==typeof e){const t=v[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),n.geoEqualEarth())}if("object"==typeof e&&"type"in e){const t=v[e.type],o=t?t():n.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(t.projection),this.geoPath=n.geoPath(this.projection),this.fitProjection(e),this.geoPath=n.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const i=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&i.length>0&&this.startTransition(i),this.version++}fitProjection(e){var t,n,o,i,r;const l=this.projection,s=this.config,a=[...this.areas],c=b(s.xAccessor,"lon"),u=b(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=x(s.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(s.projectionExtent){const[[t,n],[o,i]]=s.projectionExtent;l.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,i],[t,i],[t,n]]]}})}else if(l.clipAngle&&(null!==(t=l.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);l.scale(o/2-o*t),l.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;l.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=l.scale(),this.baseTranslate=l.translate(),this.baseRotation=null!==(r=null===(i=l.rotate)||void 0===i?void 0:i.call(l))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,S.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=i.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,o,i;const r=[],{config:l}=this,s=this.projection,a=this.geoPath,c=b(l.xAccessor,"lon"),u=b(l.yAccessor,"lat"),d=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(l),h=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(l),f=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(l);if(l.graticule){const t=!0===l.graticule?{}:l.graticule,o=n.geoGraticule();t.step&&o.step(t.step);const i=a(o())||"";i&&r.push({type:"geoarea",pathData:i,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=a(e);if(!t)continue;const n=a.centroid(e),o=a.bounds(e),i=a.area(e),s=j(l.areaStyle,e,d);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:i,style:s,datum:e,interactive:!0})}const p=x(l.lineDataAccessor);for(const t of this.lineData){const o=p(t);if(!o||2>o.length)continue;let i=[];if("geo"===l.lineType){const e=Array(o.length);for(let t=0;o.length>t;t++)e[t]=[c(o[t]),u(o[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],l=n.geoDistance(o,r)||0,a=Math.max(2,Math.ceil(l/(Math.PI/180))),c=n.geoInterpolate(o,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=s(c(e/a));null!=n&&i.push(n)}}}else for(let e=0;o.length>e;e++){const t=o[e],n=s([c(t),u(t)]);null!=n&&i.push(n)}if(2>i.length)continue;const a=j(l.lineStyle,t,h),d="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==o.length||2>i.length||"arc"!==l.flowStyle?2!==o.length||2>i.length||"offset"!==l.flowStyle||(i="geo"===l.lineType?O(i,d):M(i[0],i[i.length-1],0,0,d)):i=w(i[0],i[i.length-1]);const f=k(i,e.width);if(f.length>1)for(const e of f){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>i.length&&f[0]||i,style:a,datum:t})}const g=this.getPoints(),y=l.pointIdAccessor?"function"==typeof l.pointIdAccessor?l.pointIdAccessor:e=>e[l.pointIdAccessor]:null,m=s.clipAngle&&null!==(t=s.clipAngle())&&void 0!==t?t:0,v=m>0?m*Math.PI/180:null,S=s.rotate?s.rotate():[0,0,0],A="function"==typeof s.center?s.center():[0,0],C=[(null!==(o=A[0])&&void 0!==o?o:0)-S[0],(null!==(i=A[1])&&void 0!==i?i:0)-S[1]];for(let e=0;g.length>e;e++){const t=g[e],o=c(t),i=u(t);if(null!=v&&n.geoDistance([o,i],C)>v)continue;const a=s([o,i]);if(!a)continue;const d=l.pointStyle?l.pointStyle(t):Object.assign({},f),h={type:"point",x:a[0],y:a[1],r:d.r||4,style:d,datum:t,pointId:y?y(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,i,r;const l=this.scene.filter(e=>"point"===e.type);if(2>l.length)return;const s=null!==(n=e.strength)&&void 0!==n?n:1;if(0===s)return;const a=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=l.find(t=>t.datum&&a(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,h=u.y,f=l.map(e=>e.datum?c(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),p=Math.max(...f,1),g=Math.min(t.width,t.height)/2,y=o.scaleLinear().domain([0,p]).range([0,g]);this.cartogramLayout={cx:d,cy:h,maxCost:p,availableRadius:g},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of l){if(e===u)continue;if(!e.datum)continue;const t=Math.atan2(e.y-h,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-h,2)),o=c(e.datum),i=n+((isFinite(o)?y(o):n)-n)*s;e.x=d+Math.cos(t)*i,e.y=h+Math.sin(t)*i}const m=t.width/2,v=t.height/2,b=m-u.x,x=v-u.y;if(Math.abs(b)>.5||Math.abs(x)>.5)for(const e of l)e.x+=b,e.y+=x;this.cartogramLayout={cx:m,cy:v,maxCost:p,availableRadius:g};const j=this.scene.filter(e=>"line"===e.type);if(j.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of l)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of j){const n=null===(i=t.datum)||void 0===i?void 0:i.source,o=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&o){const i=e.get(n+""),r=e.get(o+"");i&&r&&(t.path=[i,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const i=m(e,o,t);n[o]._decayOpacity=i,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:i})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,i=performance.now(),r=this.scene.filter(e=>"point"===e.type),l=this.timestampBuffer.toArray();for(let e=0;r.length>e&&l.length>e;e++){const s=i-l[e];o>s&&(r[e]._pulseIntensity=1-s/o,r[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",r[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const i=new Map;for(const t of e)"point"===t.type&&t.pointId&&i.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let l=!1;for(const e of r)if(e.pointId){const t=i.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(l=!0))}l&&(this.activeTransition={startTime:performance.now(),duration:o})}cancelIntroAnimation(){this.activeTransition=null}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),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=y(e.x,e._targetX,n),e.y=y(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function A(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function C(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function R(e,t){const n=C(e);if(!n)return!1;const o=C(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function L(e,t,n,o,i,r,l=0){if(r){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),l=t-r,s=t+r,a=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,f)=>{if(i>s||l>h||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,l=e.y-n,s=Math.sqrt(r*r+l*l);A(e.r,o)>=s&&d>s&&(u=e,d=s),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,l);if(e)return e}else{let i=null,r=o;for(const l of e){if("point"!==l.type)continue;const e=l.x-t,s=l.y-n,a=Math.sqrt(e*e+s*s);A(l.r,o)>=a&&r>a&&(i=l,r=a)}if(i)return{node:i,distance:r}}for(let o=e.length-1;o>=0;o--){const r=e[o];if("geoarea"!==r.type)continue;const l=r;if(!1===l.interactive)continue;const[[s,a],[c,u]]=l.bounds;if(!(s>t||t>c||a>n||n>u)&&(l._cachedPath2D||(l._cachedPath2D=new Path2D(l.pathData)),i.isPointInPath(l._cachedPath2D,t,n)))return{node:l,distance:0}}let s=null,a=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:i}=e,r=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;i.length-1>o;o++){const[l,c]=i[o],[u,d]=i[o+1],h=z(t,n,l,c,u,d);r>=h&&a>h&&(s=e,a=h)}}return s?{node:s,distance:a}:null}function z(e,t,n,o,i,r){const l=i-n,s=r-o,a=l*l+s*s;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*l+(t-o)*s)/a;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*l),2)+Math.pow(t-u,2))}function P(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=I(n);return[function({children:o,initialState:r}){const l=t.useRef(r),s=t.useMemo(()=>I(n,l.current),[]),a=i();return e.jsx(a.Provider,{value:s,children:o})},e=>{var n;const o=i(),l=null!==(n=t.useContext(o))&&void 0!==n?n:r,s=t.useRef(e);s.current=e;const a=t.useCallback(()=>s.current(l.getState()),[l]),c=t.useCallback(()=>s.current(l.getState()),[l]);return t.useSyncExternalStore(l.subscribe,a,c)}]}function I(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function D(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function E(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:$})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}S.QUADTREE_THRESHOLD=500;const $=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],B={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},W={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},N={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:$,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 T(e,t){if("light"===t)return B;if("dark"===t)return W;if("high-contrast"===t)return N;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?W:B;return E(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return E(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[_,H]=P(e=>({theme:B,setTheme(t){e(e=>({theme:T(e.theme,t)}))}}));const F=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,q=new WeakMap;let G=0,V=!1,U=null,Z=null,Y=null;function X(e,t){var n,o;if(!t)return t;const i=F.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(V)return;if("undefined"==typeof window||"undefined"==typeof document)return;V=!0;const e=()=>{G++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(U=new MutationObserver(e),U.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Z=window.matchMedia("(prefers-color-scheme: dark)"),Y=e,"function"==typeof Z.addEventListener?Z.addEventListener("change",Y):"function"==typeof Z.addListener&&Z.addListener(Y)}catch(e){}}();let l=q.get(r);l&&l.version===G||(l={version:G,map:new Map},q.set(r,l));const s=l.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return l.map.set(t,a),a}const Q="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function K(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function J(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(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=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=function(e,n,o){const i=t.useRef(null),[r,l]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),l=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),s=r[0]-l.left-l.right,a=r[1]-l.top-l.bottom,c=K(e.foregroundGraphics,r,l),u=K(e.backgroundGraphics,r,l),d=H(e=>e.theme),{transition:h,introEnabled:p}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+f.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),k=t.useRef(0),w=t.useCallback(()=>{k.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),O=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(w))},[w]),M=t.useCallback(()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return Q(()=>{S&&(G++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:l,adjustedWidth:s,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:g,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:O,onPointerLeave:M}}const ee={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function te(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,ee[n])(o(e,t)),i}function ne(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function oe(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ie=(t,n,o,i,r,l,s,a,c,u)=>{const{type:d="fill",styleFn:h,items:f}=t,p=[];let g=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=r;return f.forEach((t,u)=>{const v=te(t,u,d,h),b=oe(t,i,r),x=r&&r.size>0&&r.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${g})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===l&&u===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?x||!1:void 0,"aria-current":y&&!m&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(ne,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),g+=22}),p};function re({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:l,format:s}=t,a=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+f.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":l||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),l&&e.jsx("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e.jsx("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),e.jsx("text",{x:s+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":l||"Gradient legend",children:[l&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function le(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,legendInteraction:s,title:a="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,p]=f.useState(0),[g,y]=f.useState(0),m=f.useCallback((e,t)=>{p(e),y(t)},[]),v="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,f)=>{d+=5,h.push(e.jsx("line",{stroke:"gray",x1:0,y1:d,x2:n,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,t.label&&(d+=16,h.push(e.jsx("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),d+=8),h.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${d})`,children:ie(t,o,i,r,l,s,a,f,c,u)},"legend-group-"+f)),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:h,focusedItemIndex:g,onFocusedIndexChange:m,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:l,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const f=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const g=((t,n,o,i,r,l,s,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=t,g=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=r;p.forEach((t,u)=>{const x=te(t,u,h,f),j=oe(t,i,r),k=r&&r.size>0&&r.has(t.label),w=26+7*t.label.length;d&&d>0&&y>0&&y+w>d&&(m++,y=0),g.push(e.jsxs("g",{transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?a===l&&u===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?k||!1:void 0,"aria-current":v&&!b&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&e.jsx(ne,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=w});let x=0,j=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&j>0&&j+t>d?(x=Math.max(x,j),j=t):j+=t}x=Math.max(x,j);const k=m+1;return{items:g,offset:x,totalRows:k,totalHeight:22*k}})(t,i,r,l,s,a,c,n,u,d,o);p+=g.offset+5,f.push(Object.assign(Object.assign({label:t.label},g),{offset:p,totalRows:g.totalRows,totalHeight:g.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const g=[];return f.forEach((o,i)=>{const r=t[i];r.label&&(g.push(e.jsx("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),p+=16),g.push(e.jsx("g",{className:"legend-item",transform:`translate(${p},0)`,children:o.items},"legend-group-"+i)),p+=o.offset+5,t[i+1]&&g.push(e.jsx("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),p+=12}),e.jsx("g",{children:g})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:h,focusedItemIndex:g,onFocusedIndexChange:m,legendInteraction:s}),b=!(!o&&!i);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),v]})}function se(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ae(t){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:l="right",title:s,legendHoverBehavior:a,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const f="top"===l||"bottom"===l;let p,g;return"left"===l?(p=4,g=r.top):"top"===l?(p=0,g=s?32:8):"bottom"===l?(p=0,g=i-r.bottom+50):(p=o-r.right+10,g=r.top),e.jsx("g",{transform:`translate(${p}, ${g})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?e.jsx(re,{config:n.gradient,orientation:f?"horizontal":"vertical",width:f?o:100}):se(n)?e.jsx(le,{legendGroups:n.legendGroups,title:"",width:f?o:100,orientation:f?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)});var y}function ce(e){return"string"==typeof e?{type:e}:e}function ue({orient:n,config:o,values:i,scale:l,size:s,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=t.useMemo(()=>{if(0===i.length)return null;const t=l.domain(),o=s-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],l=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*l),whiskerHigh:Math.min(t[n-1],r+1.5*l)}}(i);if(!t)return null;const{q1:r,median:s,q3:a,whiskerLow:d,whiskerHigh:h}=t,f=Math.min(.5*o,20),p=(o-f)/2+4;if(u){const t=l(r),o=l(a),i=l(s),u=l(d),g=l(h),y="top"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:m+y*(p+f/2),x2:g,y2:m+y*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*p,x2:u,y2:m+y*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:g,y1:m+y*p,x2:g,y2:m+y*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?m-p-f:m+p,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?m-p-f:m+p,x2:i,y2:"top"===n?m-p:m+p+f,stroke:c.fill,strokeWidth:2})]})}{const t=l(r),o=l(a),i=l(s),u=l(d),g=l(h),y="left"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:m+y*(p+f/2),y1:u,x2:m+y*(p+f/2),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*p,y1:u,x2:m+y*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*p,y1:g,x2:m+y*(p+f),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?m-p-f:m+p,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?m-p-f:m+p,y1:i,x2:"left"===n?m-p:m+p+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=r.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*o;if(u){const o=l(t.x0),s=l(t.x1)-l(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-r:4,width:Math.max(s,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=l(t.x0),s=l(t.x1)-l(t.x0);return e.jsx("rect",{x:"left"===n?-4-r:4,y:Math.min(o,o+s),width:r,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(o/2),s=l((e.x0+e.x1)/2);i.push(u?`${s},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${s}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const s=r.length/h*(o/2),a=l((r.x0+r.x1)/2);i.push(u?`${a},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=d[0].x0?l(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=l((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-i-4:i+4}`)}const r=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?l(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=l((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${r}`)}const r=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${e},${r}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,l,c,s,a,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function de(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let l="";for(const e of i)l&&l.length+1+e.length>o?(r.push(l),l=e):l=l?`${l} ${e}`:e;return l&&r.push(l),r}function he(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 fe(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:l,orientation:s,align:a,wrap:c=120,noWrap:u}=t;if(!r&&!l)return e.jsx("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const p=16,g=l?u?[l]:de(l,c):[],y=r?u?[r]:de(r,c):[],m="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";g.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:g.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=g.length*p),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let j=null;if((l||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(g.length+y.length)*p+(y.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,g.length+y.length-1)*p;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+p+(y.length>0&&g.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),j]})}function pe(t,n,o,i,r){var l;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&s.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,l=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;s.push(e.jsx("line",{x1:i,y1:(n.y1||0)-l,x2:i,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-l;s.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.jsx("line",{x1:0,y1:(n.y1||0)-l,x2:0,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(l=null==n?void 0:n.width)&&void 0!==l?l:null==n?void 0:n.height;void 0!==t&&s.push(e.jsx("path",{d:he((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:s})}function ge(t,n,o,i,r,l){const s=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==l?void 0:l.radius)){if("callout-rect"===r&&l){const e=l.width||0,o=l.height||0;if(e>0||o>0){const i=e/2,r=o/2,l=t-i,s=n-r;if(0!==l||0!==s){const t=Math.abs(l),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;a=i+l*h,c=r+s*h}}}else if("bracket"===r&&l){const e=l.width,t=l.height,n=l.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(l.radius||0)+(l.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(s.push(e.jsx("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,l=Math.atan2(n-c,t-a);s.push(e.jsx("path",{d:`M${a},${c}L${a+o*Math.cos(l+r)},${c+o*Math.sin(l+r)}L${a+o*Math.cos(l-r)},${c+o*Math.sin(l-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:s})}function ye(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:l,ny:s,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:p,events:g={},"data-testid":y}=t,m=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=l&&(v=l-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},g,{children:[!m.has("connector")&&ge(v,b,c,h,x,u),!m.has("subject")&&pe(x,u,h,n,o),!m.has("note")&&fe(a,v,b,h)]}))}function me(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,l="string"==typeof i.type?i.type:"label",s=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),s=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.jsx(ye,Object.assign({"data-testid":"semiotic-annotation"},r,{type:l}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(ye,Object.assign({"data-testid":"semiotic-annotation",events:s},i,{type:l}),c)}function ve(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function be(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function xe(e,t,n){var o,i,r,l;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=ve(e,n),c=be(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===s){const e=null===(l=n.stickyPositionCache)||void 0===l?void 0:l.get(t);if(e)return e}return null}function je(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const ke={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};let we={positions:new Map};const Oe=new Set;function Me(){for(const e of Oe)e()}function Se(e,t){const n=we.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(we.positions);o.delete(e),we={positions:o},Me()}function Ae(e,t){const n=we.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(we.positions);o.delete(e),we={positions:o},Me()}function Ce(){return we}function Re(e){return Oe.add(e),()=>Oe.delete(e)}const Le={positions:new Map};function ze(){return()=>{}}function Pe(){return Le}function Ie(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,l=o instanceof Date?o.getTime():o,s=i instanceof Date?i.getTime():i;if(2>t||l===s)return r?[new Date(l),new Date(s)]:[l,s];const a=(s-l)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:l+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function De(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function Ee(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function $e(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function Be(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function We(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let l="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);l+=`L${Math.min(8*e+4,t)},${o+4*i}`,l+=`L${Math.min(n,t)},${o}`}return l}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let l=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);l+=`L${o+4*i},${Math.min(8*e+4,n)}`,l+=`L${o},${Math.min(t,n)}`}return l}}function Ne(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Te(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function _e(n){var o,i;const{width:r,height:a,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:f,axes:g,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,axisExtent:j,showGrid:k,title:w,legend:O,legendHoverBehavior:M,legendClickBehavior:S,legendHighlightedCategory:A,legendIsolatedCategories:C,legendPosition:L="right",foregroundGraphics:z,marginalGraphics:P,xValues:I,yValues:D,annotations:E,svgAnnotationRules:$,xAccessor:B,yAccessor:W,annotationData:N,pointNodes:T,curve:_,underlayRendered:H,canvasObscuresUnderlay:F=!0,linkedCrosshairName:q,linkedCrosshairSourceId:G,children:V}=n,U=t.useMemo(()=>{var e,t;if(!f||!h)return[];const n=null==g?void 0:g.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||b||Ne,i=Math.max(2,Math.floor(r/70)),l=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Ie(h.x,"exact"===j?Math.max(2,l):Math.min(l,i),j),a=s.map(e=>e.valueOf()),c=s.map((e,t)=>({value:e,pixel:h.x(e),label:o(e,t,a)})),u=c.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(u+8,55)):Math.max(55,u+8);let p=Te(c,d);if(p.length>1&&(p=p.filter((e,t)=>0===t||e.label+""!=p[t-1].label+"")),(null==n?void 0:n.includeMax)&&p.length>0&&"exact"!==j&&!(null==n?void 0:n.tickValues)){const e=h.x.domain()[1],t=h.x(e),n=p[p.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,p.length,a);d>t-n&&p.length>1&&(p=p.slice(0,-1)),p.push({value:e,pixel:t,label:i})}}return p},[f,h,g,b,r,j]),Z=t.useMemo(()=>{var e,t;if(!f||!h)return[];const n=null==g?void 0:g.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||x||Ne,i=Math.max(2,Math.floor(a/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let l=Te((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Ie(h.y,"exact"===j?Math.max(2,r):Math.min(r,i),j)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22);if(l.length>1&&(l=l.filter((e,t)=>0===t||e.label+""!=l[t-1].label+"")),(null==n?void 0:n.includeMax)&&l.length>0&&"exact"!==j&&!(null==n?void 0:n.tickValues)){const e=h.y.domain()[1],t=h.y(e),n=l[l.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&l.length>1&&(l=l.slice(0,-1)),l.push({value:e,pixel:t,label:i})}}return l},[f,h,g,x,a,j]),Y=t.useMemo(()=>{var e,t;if(!f||!h)return[];const n=null==g?void 0:g.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||x||Ne,i=Math.max(2,Math.floor(a/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return Te((null!==(t=n.tickValues)&&void 0!==t?t:Ie(h.y,"exact"===j?Math.max(2,r):Math.min(r,i),j)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22)},[f,h,g,x,a,j]),X=t.useRef(new Map),Q=t.useRef(null!==(o=null==E?void 0:E.length)&&void 0!==o?o:0),K=null!==(i=null==E?void 0:E.length)&&void 0!==i?i:0;Q.current!==K&&(Q.current=K,X.current=new Map);const J=t.useMemo(()=>{if(!E||0===E.length)return null;const t=function(t,n,o){var i,r,a,c,u,d,h,f,g,y,m,v,b,x,j,k,w,O,M,S,A,C,R,L,z,P,I,D,E,$,B,W,N,T,_,H,F,q,G,V,U,Z,Y,X,Q,K,J,ee;switch(t.type){case"label":{const i=xe(t,n,o);if(!i)return null;const{x:r,y:l}=i;return je(r,l,o)?e.jsx(me,{noteData:{x:r,y:l,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"callout":{const i=xe(t,n,o);if(!i)return null;const{x:r,y:l}=i;return je(r,l,o)?e.jsx(me,{noteData:{x:r,y:l,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"x-threshold":{const i=ve(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",l=t.labelPosition||"top";let s;return s="bottom"===l?(o.height||0)-4:"center"===l?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:s,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=be(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",l=t.labelPosition||"right";let s,a;return"left"===l?(s=4,a="start"):"center"===l?(s=(o.width||0)/2,a="middle"):(s=(o.width||0)-4,a="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:s,y:i-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:ve(Object.assign(Object.assign({},e),{type:"point"}),o),y:be(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=l.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:ve(Object.assign(Object.assign({},e),{type:"point"}),o),y:be(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,l=i.map(e=>e.x),s=i.map(e=>e.y),a=Math.min(...l)-r,c=Math.max(...l)+r,u=Math.min(...s)-r,d=Math.max(...s)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:a,y:u,width:c-a,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(a+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],l={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=ve(n,o),s=be(n,o);if(null==r||null==s)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||l;return e.jsx("circle",Object.assign({cx:r,cy:s,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=ve(t,o),r=be(t,o);return e.jsx(me,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const l=o.data||[];if(2>l.length)return null;const s=o.xAccessor||"x",f=o.yAccessor||"y",g="ordinal"===o.frameType,y="horizontal"===o.projection,m=g?s:null,v=g?f:null;let b;const x=[],j=new Map;if(g&&m&&v){for(const e of l){const t=e[m];if(null==t)continue;const n=t+"";j.has(n)||(j.set(n,x.length),x.push(n))}b=l.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=j.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=l.map(e=>[e[s],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(r=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(a=o.scales)||void 0===a?void 0:a.time,w=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!k||!w)return null;const O=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},M=k,S=w;let A;if(g)if(y){const e=O(S);A=(t,n)=>[M(n),e(t)]}else{const e=O(M);A=(t,n)=>[e(t),S(n)]}else A=(e,t)=>[M(e),S(t)];const C=t.method||"linear";let R;R="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),l=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(l-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){s.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))s.push([t,h/u]);else{const e=(u*p-d*h)/g;s.push([t,(h-e*d)/u+e*t])}}return s}(b,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===C?p.default.polynomial(b,{order:t.order||2}):p.default.linear(b)).points;const L=R.map(([e,t])=>{const[n,o]=A(e,t);return`${n},${o}`}).join(" "),z=t.color||"#6366f1",P=R[R.length-1],[I,D]=A(P[0],P[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:L,fill:"none",stroke:z,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:I+4,y:D-4,fill:z,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(g=null===(f=o.scales)||void 0===f?void 0:f.y)&&void 0!==g?g:null===(y=o.scales)||void 0===y?void 0:y.value,r=null!==(m=null==i?void 0:i(t.y0))&&void 0!==m?m:0,l=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,l),width:o.width||0,height:Math.abs(l-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,l)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",l=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(j=o.scales)||void 0===j?void 0:j.time,a=null!==(w=null===(k=o.scales)||void 0===k?void 0:k.y)&&void 0!==w?w:null===(O=o.scales)||void 0===O?void 0:O.value;if(!l||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const f=ke[o.curve||"linear"]||s.curveLinear,p=s.area().x(e=>l(e[r])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:g,fillOpacity:null!==(M=t.fillOpacity)&&void 0!==M?M:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:l(h[h.length-1][r])+4,y:a(h[h.length-1][c])-4,fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",l=null!==(A=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==A?A:null===(C=o.scales)||void 0===C?void 0:C.time,s=null!==(L=null===(R=o.scales)||void 0===R?void 0:R.y)&&void 0!==L?L:null===(z=o.scales)||void 0===z?void 0:z.value;if(!l||!s)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,d=Math.sqrt(u),h=null!==(P=t.threshold)&&void 0!==P?P:2,f=c-h*d,p=!1!==t.showBand,g=t.fill||"#6366f1",y=null!==(I=t.fillOpacity)&&void 0!==I?I:.1,m=t.anomalyColor||"#ef4444",v=null!==(D=t.anomalyRadius)&&void 0!==D?D:6,b=s(c+h*d),x=s(f),j=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:g,fillOpacity:y}),j.map((t,n)=>{const i=ve(t,o),r=be(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",l=o.yAccessor||"y",s=null!==($=null===(E=o.scales)||void 0===E?void 0:E.x)&&void 0!==$?$:null===(B=o.scales)||void 0===B?void 0:B.time,a=null!==(N=null===(W=o.scales)||void 0===W?void 0:W.y)&&void 0!==N?N:null===(T=o.scales)||void 0===T?void 0:T.value;if(!s||!a)return null;const c=i.map(e=>[e[r],e[l]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=p.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const l=(e*i-t*n)/r,s=(n-l*t)/e;u=e=>s+l*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),g=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),m=null!==(_=t.confidence)&&void 0!==_?_:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(H=t.steps)&&void 0!==H?H:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*j);const w=[];for(const e of k){const t=u(e),n=f*Math.sqrt(1+1/d+(y>0?Math.pow(e-g,2)/y:0))*v;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,M=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),S=`${s(x)},${a(u(x))}`,A=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:O,fill:t.fill||"#6366f1",fillOpacity:null!==(F=t.fillOpacity)&&void 0!==F?F:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${M}`,fill:"none",stroke:A,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&w.length>0&&e.jsx("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:A,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=xe(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!je(i,r,o))return null;const l=null!==(V=t.dx)&&void 0!==V?V:0,s=null!==(U=t.dy)&&void 0!==U?U:0,a=null!==(Z=t.width)&&void 0!==Z?Z:32,c=null!==(Y=t.height)&&void 0!==Y?Y:32,u=null!==(X=t.content)&&void 0!==X?X:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+l-a/2,y:r+s-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=xe(t,n,o);if(!i)return null;const{x:r,y:l}=i;return e.jsx("text",{x:r+(t.dx||0),y:l+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,l=null===(Q=o.scales)||void 0===Q?void 0:Q.o,s=null===(K=o.scales)||void 0===K?void 0:K.x,a=null===(J=o.scales)||void 0===J?void 0:J.y,c=r(l)?l:r(s)?s:r(a)?a:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,p=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===s)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+n)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:B,yAccessor:W,width:r,height:a,data:N,frameType:"xy",pointNodes:T,curve:_,stickyPositionCache:X.current};return E.map((e,o)=>{if($){const i=$(e,o,n);return null!=i?i:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[E,$,r,a,B,W,N,h,T,_]),ee=function(e){var n;const o=t.useSyncExternalStore(e?Re:ze,e?Ce:Pe,e?Ce:Pe);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(q);return t.useEffect(()=>{if(!(null==ee?void 0:ee.locked)||!q)return;const e=e=>{"Escape"===e.key&&Ae(q)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ee?void 0:ee.locked,q]),f||w||O||z||P||J&&J.length>0||k||V||ee?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof w?w:"XY Chart"}),e.jsx("desc",{children:"string"==typeof w?w+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[k&&h&&(!H||F)&&(()=>{var t,n;const o=Be(null===(t=null==g?void 0:g.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=Be(null===(n=null==g?void 0:g.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[U.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:a,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),Z.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),f&&h&&(()=>{const t=null==g?void 0:g.find(e=>"left"===e.orient),n=null==g?void 0:g.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,l=(null==t?void 0:t.jaggedBase)||!1,s=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&U.length>1&&(()=>{const e=r/Math.max(U.length-1,1);return U.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 10px)"},j={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},k={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},w=null==n?void 0:n.tickAnchor,O=null==t?void 0:t.tickAnchor,M=$e(U),S=$e(Z);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||F)&&i&&!s&&e.jsx("line",{x1:0,y1:a,x2:r,y2:a,stroke:h,strokeWidth:1}),(!H||F)&&s&&e.jsx("path",{d:We("bottom",r,a),fill:"none",stroke:h,strokeWidth:1}),U.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):R(t.value,n>0?U[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${a})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":De(w,t.pixel===M.min,t.pixel===M.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:r/2,y:a+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:y})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||F)&&o&&!l&&e.jsx("line",{x1:0,y1:0,x2:0,y2:a,stroke:h,strokeWidth:1}),(!H||F)&&l&&e.jsx("path",{d:We("left",r,a),fill:"none",stroke:h,strokeWidth:1}),Z.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):R(t.value,n>0?Z[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:Ee(O,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.jsx("text",{x:15-d.left,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-d.left}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:n}):null})()]}),(()=>{const t=null==g?void 0:g.find(e=>"right"===e.orient);if(!t||0===Y.length)return null;const n=!1!==t.baseline,o=t.landmarkTicks,i=t.label||v,l=t.tickAnchor,s=$e(Y);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e.jsx("line",{x1:r,y1:0,x2:r,y2:a,stroke:h,strokeWidth:1}),Y.map((t,n)=>{const i=!!o&&("function"==typeof o?o(t.value,n):R(t.value,n>0?Y[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:Ee(l,t.pixel===s.min,t.pixel===s.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?j:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+n)}),i&&e.jsx("text",{x:r+d.right-15,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${r+d.right-15}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:i})]})})()]})})(),J,P&&h&&I&&D&&e.jsxs(e.Fragment,{children:[P.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ue,{orient:"top",config:ce(P.top),values:I,scale:h.x,size:d.top,length:r})}),P.bottom&&e.jsx("g",{transform:`translate(0, ${a})`,children:e.jsx(ue,{orient:"bottom",config:ce(P.bottom),values:I,scale:h.x,size:d.bottom,length:r})}),P.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ue,{orient:"left",config:ce(P.left),values:D,scale:h.y,size:d.left,length:a})}),P.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(ue,{orient:"right",config:ce(P.right),values:D,scale:h.y,size:d.right,length:a})})]}),z,ee&&ee.sourceId!==G&&(null==h?void 0:h.x)&&(()=>{const t=h.x(ee.xValue);if(null==t||0>t||t>r)return null;const n=ee.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:a,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),V]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof w?w:null}),ae({legend:O,totalWidth:c,totalHeight:u,margin:d,legendPosition:L,title:w,legendHoverBehavior:M,legendClickBehavior:S,legendHighlightedCategory:A,legendIsolatedCategories:C})]}):null}function He(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Fe="undefined"==typeof window||"undefined"==typeof document,qe="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Ge=()=>()=>{},Ve=()=>!1,Ue=()=>!0;function Ze(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).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 Ye(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 Xe(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}const Qe=f.createContext(null),Ke={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Je(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){const e=t.type+"";n[e]=(n[e]||0)+1}const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],l=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of l)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const et=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},tt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},nt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},ot={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},it={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},rt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},lt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},st={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function at({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[l,s]=f.useState(!1),a=f.useContext(Qe),c=null!==(r=null==a?void 0:a.visible)&&void 0!==r&&r,u=l||c,d=f.useRef(null),h=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n,p=f.useCallback(()=>{l||c||s(!0)},[l,c]),g=f.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Ke}):null;if(!u)return e.jsx("div",{id:o,tabIndex:-1,onFocus:p,style:Ke,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>s(!0),children:["View data summary (",t.length," elements)"]})});const y=function(e){var t,n,o,i,r,l,s,a,c,u,d,h,f,p,g,y,m,v,b,x,j,k,w,O,M;const S=[];if(!Array.isArray(e))return S;for(const A of e)if(A&&"object"==typeof A)try{switch(A.type){case"point":S.push({label:"Point",values:{x:A.x,y:A.y}});break;case"line":{const e=A.path,t=Array.isArray(A.datum)?A.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=A.topPath,t=Array.isArray(A.datum)?A.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=A.datum&&"object"==typeof A.datum?A.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:A.group)&&void 0!==n?n:"",l=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,value:null!=l?l:""}});break}case"heatcell":S.push({label:"Cell",values:{x:A.x,y:A.y,value:A.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(a=null!==(l=null===(r=A.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:null===(s=A.datum)||void 0===s?void 0:s.label)&&void 0!==a?a:"",value:null!==(u=null===(c=A.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=A.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=A.cx)&&void 0!==f?f:A.x,y:null!==(p=A.cy)&&void 0!==p?p:A.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(y=null===(g=A.datum)||void 0===g?void 0:g.id)&&void 0!==y?y:"",x:null!==(m=A.cx)&&void 0!==m?m:A.x,y:null!==(v=A.cy)&&void 0!==v?v:A.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:A.x,open:A.open,high:A.high,low:A.low,close:A.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(w=null!==(j=null===(x=null===(b=A.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==j?j:null===(k=A.datum)||void 0===k?void 0:k.name)&&void 0!==w?w:"",value:null!==(M=null===(O=A.datum)||void 0===O?void 0:O.value)&&void 0!==M?M:""}})}}catch(e){}return S}(t),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${et(e.min)} to ${et(e.max)}, mean ${et(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),b=y.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const j=Array.from(x);return e.jsxs("div",{ref:d,id:o,tabIndex:-1,onBlur:g,style:tt,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",onClick:()=>{c&&a&&a.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:ot,children:"×"}),e.jsx("div",{role:"note",style:nt,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+n,style:it,children:[e.jsxs("caption",{style:st,children:["First ",b.length," of ",y.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:rt,children:"type"}),j.map(t=>e.jsx("th",{style:rt,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:lt,children:t.label}),j.map(n=>{return e.jsx("td",{style:lt,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":et(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function ct({summary:t}){return t?e.jsx("div",{role:"note",style:Ke,children:t}):null}function ut({tableId:t}){return e.jsx("a",{href:"#"+t,style:Ke,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Ke)},children:"Skip to data table"})}function dt({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Ke,children:n})}const ht=Object.freeze([]);function ft(e){if(!e)return ht;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}const pt="var(--semiotic-focus, #005fcc)";function gt({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:l,height:s}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=l&&null!=s){const t=Math.max(l,4),n=Math.max(s,4);u=e.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:pt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:pt,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}const yt={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 mt(e,t){return"function"==typeof t?t(e):e[t]}function vt(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 bt(t={}){const{fields:n,title:o,format:i,style:r={},className:l=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const a=[];if(o){const e=mt(t,o);s=vt(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const l=mt(t,o);a.push({label:n,value:vt(l,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=vt(t[n],i);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=vt(t[e[0]],i))}}const c=Object.assign(Object.assign({},yt),r);return e.jsxs("div",{className:("semiotic-tooltip "+l).trim(),style:c,children:[s&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&s?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function xt(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t,r=n(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:yt,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?bt(t):bt())}}function jt({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:l,className:s="stream-frame-tooltip",zIndex:a=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=f.useRef(null),[d,h]=f.useState(null);f.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[l,s,o,i]);let p;p=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const g=function(e){if(!f.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(l),y=g?null:yt;return c?e.jsx("div",{ref:u,className:g?s:(s+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:p,pointerEvents:"none",zIndex:a,width:"max-content"}),children:l}):null}function kt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function wt(e,t,n=.6){var o,i,r,l,s;if(!kt(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(s=null!==(l=t.cy)&&void 0!==l?l:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Ot(e,t,n,o=.35){kt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Mt(e){switch(e){case"monotoneX":return s.curveMonotoneX;case"monotoneY":return s.curveMonotoneY;case"cardinal":return s.curveCardinal;case"catmullRom":return s.curveCatmullRom;case"step":return s.curveStep;case"stepBefore":return s.curveStepBefore;case"stepAfter":return s.curveStepAfter;case"basis":return s.curveBasis;case"natural":return s.curveNatural;default:return null}}function St(e,t,n){return null==t?n:"string"!=typeof t?t:X(e,t)||n}function At(e,t,n,o,i,r){const l=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>l.length)return null;const s=e.createLinearGradient(n,o,i,r);for(const e of l)s.addColorStop(e.offset,e.color);return s}function Ct(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Rt(e,t,n,o,i,r){if(2>t.length)return;const l=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];l.push(l[e-1]+Math.sqrt(n*n+o*o))}const s=l[l.length-1];if(0===s)return;const a=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(l[n]+l[n+1])/2;let r=i;a>o&&(r*=o/a),a>s-o&&(r*=(s-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Lt(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,l=t[1]*o,s=t[0]+"px",a=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===l||(e.width=r,e.height=l),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function zt(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Pt([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function It(e,t,n,o,i){return"function"==typeof e?e(t,n,o,i):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",i>1?"@2x":"")}class Dt{constructor(e=256){this.cache=new Map,this.limit=e}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,o]of this.cache)t>o.lastUsed&&(t=o.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}}class Et{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let i=0;this.capacity>i;i++){const r=this.particles[i];if(!r.active)continue;const l=n[r.lineIndex];if(!l||2>l.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const s=$t(l),a=Bt(l,r.t*s),c=(o[r.lineIndex]||2)/2;r.x=a.x+a.nx*r.offset*c*2,r.y=a.y+a.ny*r.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function $t(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+i*i)}return t}function Bt(e,t){let n=0;for(let o=1;e.length>o;o++){const i=e[o][0]-e[o-1][0],r=e[o][1]-e[o-1][1],l=Math.sqrt(i*i+r*r);if(n+l>=t||o===e.length-1){const s=l>0?(t-n)/l:0,a=l>.001?l:1;return{x:e[o-1][0]+i*s,y:e[o-1][1]+r*s,nx:-r/a,ny:i/a}}n+=l}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const Wt={top:10,right:10,bottom:10,left:10},Nt={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"},Tt={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function _t(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Ht(e){return e?e.getContext("2d"):null}function Ft({data:t}){if(!t)return null;if(t.properties)return e.jsx("div",{className:"semiotic-tooltip",style:Nt,children:e.jsx("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const n=null!=t.data?t.data:t;if(!n||"object"!=typeof n)return null;const o=Object.entries(n).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===o.length?null:e.jsx("div",{className:"semiotic-tooltip",style:Nt,children:o.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),e.jsx("span",{style:{fontWeight:600},children:n+""})]},t))})}Ft.ownsChrome=!0;const qt=t.forwardRef(function(n,o){var i,r,l,a,d,h,f,p,g,y;const{projection:m,projectionExtent:v,fitPadding:b,projectionTransform:x,areas:j,points:k,lines:w,xAccessor:O,yAccessor:M,lineDataAccessor:A,pointIdAccessor:C,lineIdAccessor:R,lineType:z="geo",flowStyle:P="basic",graticule:I,zoomable:E,zoomExtent:$,onZoom:B,dragRotate:W,showParticles:N,particleStyle:T,tileURL:_,tileAttribution:H,tileCacheSize:F,size:q,width:G,height:V,responsiveWidth:U,responsiveHeight:Z,margin:Y,className:Q,background:K,areaStyle:ee,pointStyle:te,lineStyle:ne,colorScheme:oe,enableHover:ie=!0,hoverAnnotation:re,tooltipContent:le,customClickBehavior:se,customHoverBehavior:ae,annotations:ce,decay:ue,pulse:de,transition:he,animate:fe,staleness:pe,backgroundGraphics:ge,foregroundGraphics:ye,title:me,legend:ve,legendPosition:be,legendHoverBehavior:xe,legendClickBehavior:je,legendHighlightedCategory:ke,legendIsolatedCategories:we,legendCategoryAccessor:Oe,onCategoriesChange:Me,showAxes:Se,accessibleTable:Ae=!0,description:Ce,summary:Re}=n,Le=q||[G||600,V||400],ze=t.useRef(!0),Pe=J({sizeProp:Le,responsiveWidth:U,responsiveHeight:Z,userMargin:Y,marginDefault:Wt,foregroundGraphics:ye,backgroundGraphics:ge,animate:fe,transitionProp:he,themeDirtyRef:ze}),{reducedMotionRef:Ie,responsiveRef:De,size:Ee,margin:$e,adjustedWidth:Be,adjustedHeight:We,resolvedForeground:Ne,resolvedBackground:Te,transition:Qe,introEnabled:Ke,tableId:et,rafRef:tt,renderFnRef:nt,scheduleRender:ot,currentTheme:it}=Pe,rt=function(){const[e,n]=t.useState(!1);return qe(()=>{n(!0)},[]),e}(),lt=function(){const e=t.useSyncExternalStore(Ge,Ve,Ue);return t.useRef(e).current}(),st=t.useMemo(()=>Array.isArray(j)?ft(j):j,[j]),ht=t.useMemo(()=>ft(k),[k]),pt=t.useMemo(()=>ft(w),[w]),yt=t.useMemo(()=>null!=W?W:"orthographic"===_t(m),[W,m]),mt=t.useMemo(()=>{var e,t;return{projection:m,projectionExtent:v,fitPadding:b,xAccessor:O,yAccessor:M,lineDataAccessor:A,lineType:z,flowStyle:P,areaStyle:ee,pointStyle:te,lineStyle:ne,colorScheme:oe,themeSemantic:D(it),themeSequential:null===(e=null==it?void 0:it.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==it?void 0:it.colors)||void 0===t?void 0:t.diverging,graticule:I,projectionTransform:x,decay:ue,pulse:de,transition:Qe,introAnimation:Ke,annotations:ce,pointIdAccessor:C,lineIdAccessor:R}},[m,v,b,O,M,A,z,P,ee,te,ne,oe,I,x,ue,de,null==Qe?void 0:Qe.duration,null==Qe?void 0:Qe.easing,Ke,ce,C,R,it]),vt=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ye(e,t);if(!Xe(e)||!Xe(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Ye(n,i))return!1}else{if(!Xe(n)||!Xe(i))return!1;if(!Ze(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(mt),bt=t.useRef(null);bt.current||(bt.current=new S(vt));const xt=t.useRef(null),kt=t.useRef(null),$t=t.useRef(null),Bt=t.useRef(null),Nt=t.useRef(null);_&&!Nt.current&&(Nt.current=new Dt(F||256));const qt=t.useRef(ce),Gt=t.useRef(null),Vt=t.useRef(c.zoomIdentity),Ut=t.useRef(!1),Zt=t.useRef(null),Yt=t.useCallback(e=>{Zt.current=e,De&&"object"==typeof De&&(De.current=e)},[De]),Xt=t.useRef(null),Qt=t.useRef(null),Kt=t.useRef(null),Jt=t.useRef(0);if(N&&!Kt.current){const e=null!==(i=null==T?void 0:T.maxPerLine)&&void 0!==i?i:30;Kt.current=new Et(50*e)}const en=t.useRef(null),tn=t.useRef(null),[nn,on]=t.useState(null),[rn,ln]=t.useState(0),[sn,an]=t.useState(!1),cn=t.useRef([]),un=t.useRef(Oe),dn=t.useRef(Me);un.current=Oe,dn.current=Me;const hn=t.useCallback(()=>{var e,t;const n=un.current,o=dn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=bt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[],n);(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})(i,cn.current)||(cn.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=bt.current)||void 0===e||e.updateConfig(vt),ze.current=!0,ot()},[vt,ot]),t.useEffect(()=>{const e=bt.current;e&&(st&&e.setAreas(st),k&&e.setPoints(ht),w&&e.setLines(pt),ze.current=!0,ot())},[st,k,ht,w,pt,ot]);const fn=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=bt.current)||void 0===t||t.pushPoint(e),ze.current=!0,ot())},[ot]),pn=t.useCallback(e=>{var t;const n=ft(e);0!==n.length&&(null===(t=bt.current)||void 0===t||t.pushMany(n),ze.current=!0,ot())},[ot]),gn=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=bt.current)||void 0===t||t.pushLine(e),ze.current=!0,ot())},[ot]),yn=t.useCallback(e=>{var t;const n=ft(e);0!==n.length&&(null===(t=bt.current)||void 0===t||t.pushManyLines(n),ze.current=!0,ot())},[ot]),mn=t.useCallback(()=>{var e;null===(e=bt.current)||void 0===e||e.clear(),ze.current=!0,ot()},[ot]);t.useImperativeHandle(o,()=>({push:fn,pushMany:pn,removePoint:e=>{var t,n;const o=null!==(n=null===(t=bt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(ze.current=!0,ot()),o},pushLine:gn,pushManyLines:yn,removeLine:e=>{var t,n;const o=null!==(n=null===(t=bt.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&(ze.current=!0,ot()),o},getLines:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:mn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=bt.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.projection)&&void 0!==n?n:null},getGeoPath:()=>{var e,t,n;return null!==(n=null===(t=null===(e=bt.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.geoPath)&&void 0!==n?n:null},getCartogramLayout:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>Vt.current.k,resetZoom:()=>{const e=Zt.current;e&&Gt.current&&u.select(e).call(Gt.current.transform,c.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[fn,pn,gn,yn,mn,ot]);const{hoverHandlerRef:vn,onPointerMove:bn,onPointerLeave:xn}=Pe;t.useEffect(()=>{vn.current=e=>{if(!ie)return;const t=bt.current;if(!t||!t.scene.length)return;const n=kt.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-$e.left,r=e.clientY-o.top-$e.top;if(0>i||i>Be||0>r||r>We)return en.current=null,tn.current=null,on(null),null==ae||ae(null),void ot();Bt.current||(Bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const l=Ht(Bt.current);if(!l)return;const s=L(t.scene,i,r,30,l,t.quadtree,t.maxPointRadius);if(s){const e=s.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,l;"point"===e.type?(o=e.x,l=e.y):"geoarea"===e.type?(o=e.centroid[0],l=e.centroid[1]):(o=i,l=r);const a=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,__semioticHoverData:!0,x:o,y:l});en.current=a,tn.current=e,on(a),null==ae||ae(a),ot()}else en.current&&(en.current=null,tn.current=null,on(null),null==ae||ae(null),ot())}},[ie,Be,We,$e,ae,ot]),Pe.hoverLeaveRef.current=()=>{en.current=null,tn.current=null,on(null),null==ae||ae(null),ot()};const jn=t.useCallback(e=>{if(!se)return;const t=bt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-$e.left,i=e.clientY-n.top-$e.top;Bt.current||(Bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=Ht(Bt.current);if(!r)return;const l=L(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(l){const e=l.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;se(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[se,$e]),kn=t.useRef(-1),wn=t.useRef(null),On=t.useCallback(e=>{const t=bt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=kn.current,i=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===i)return;if(e.preventDefault(),0>i)return kn.current=-1,wn.current=null,en.current=null,tn.current=null,on(null),null==ae||ae(null),void ot();const r=0>o?0:i;kn.current=r;const l=n[r];wn.current={shape:l.shape,w:l.w,h:l.h};const s=l.datum,a=Object.assign(Object.assign(Object.assign({},s||{}),(null==s?void 0:s.properties)||{}),{data:s,properties:null==s?void 0:s.properties,x:l.x,y:l.y,__semioticHoverData:!0});en.current=a,on(a),null==ae||ae(a),ot()},[ae,ot]),Mn=t.useCallback(e=>{kn.current=-1,wn.current=null,bn(e)},[bn]);nt.current=()=>{var e,t,n,o,i,r,l,a;tt.current=0;const c=kt.current,u=bt.current;if(!c||!u)return;const d=performance.now();let h=!1;const f=Qt.current;f&&(Qt.current=null,u.applyRotation(f,{width:Be,height:We}));const p=u.advanceTransition(Ie.current?d+1e6:d),g=!Ie.current&&p;if(ze.current&&!p){const e={width:Be,height:We},t=yt?u.getRotation():null;u.computeScene(e);const n=Vt.current,o=1!==n.k||0!==n.x||0!==n.y;yt&&t?o?(u.setRotation(t),u.applyZoomScale(n.k,e)):u.applyRotation(t,e):o&&u.applyZoomTransform(n,e),ze.current=!1,c.setAttribute("aria-label",Je(u.scene,"Geographic chart")),hn()}const y=zt();if(_&&Nt.current){const t=xt.current;if(t&&(null===(e=u.scales)||void 0===e?void 0:e.projection)){const e=Lt(t,Ee,$e,y);if(e){e.clearRect(-$e.left,-$e.top,Ee[0],Ee[1]),e.save(),e.beginPath(),e.rect(0,0,Be,We),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:l,onTileLoad:s}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,l=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(l),a=1<<s,c=Math.pow(2,l-s+8),u=o[0]-n/2,d=o[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?a:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(r?0:-1/0,Math.floor((0-d)/c)),g=Math.min(r?a:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)y.push([t,e,s]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=zt();let h=!0;for(const t of u.tiles){const[o,i,r]=Pt(t),a=`${r}/${o}/${i}`;let c=l.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};l.set(a,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=It(n,r,o,i,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(e,{tileURL:_,projection:u.scales.projection,width:Be,height:We,tileCache:Nt.current,onTileLoad:()=>ot()});e.restore(),t||(h=!0)}}}const m=Lt(c,Ee,$e,y);if(!m)return;if(m.clearRect(-$e.left,-$e.top,Ee[0],Ee[1]),K&&!_){const e=X(m,K);e&&(m.fillStyle=e,m.fillRect(0,0,Be,We))}m.save(),m.beginPath(),m.rect(0,0,Be,We),m.clip();const v=u.scene,b={width:Be,height:We};if(function(e,t){var n,o,i;const r=t.filter(e=>"geoarea"===e.type);for(const t of r){if(!t.pathData)continue;const r=new Path2D(t.pathData),l=t.style.fill||"#e0e0e0";if("none"!==l&&(e.fillStyle=l,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=X(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(i=t._decayOpacity)&&void 0!==i?i:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(r)}Ot(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(m,v),((e,t,n,o)=>{var i,r;const l=t.filter(e=>"line"===e.type);for(const a of l){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",d=X(e,u)||u,h=a.style.strokeWidth||2,f=a.colorThresholds,p=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=h,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;Rt(e,a.path,d,h,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=Mt(a.curve),y=f&&f.length>0&&p&&p.length===a.path.length,m=a._decayOpacities;if(m&&m.length===a.path.length&&!y){e.strokeStyle=d;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(y){let j=null,k=null,w=null,O=null,M=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),M=!0}function A(){M&&(e.stroke(),M=!1)}for(let C=0;a.path.length>C;C++){const[R,L]=a.path[C],z=p[C],P=Ct(z,f,d);if(null!==j&&null!==O&&null!==w){if(P===O)e.lineTo(R,L);else{const I=[];for(const D of f){const E=D.value;(w>E||E>z)&&(E>w||z>E)||w===E||z===E||I.push({t:(E-w)/(z-w)})}I.sort((e,t)=>e.t-t.t);for(const $ of I){const B=j+(R-j)*$.t,W=k+(L-k)*$.t,N=Ct(w+(z-w)*Math.min($.t+1e-4,1),f,d);e.lineTo(B,W),A(),S(N,B,W)}e.lineTo(R,L)}j=R,k=L,w=z,O=P}else S(P,R,L),j=R,k=L,w=z,O=P}A()}else{e.beginPath();const T=a.strokeGradient&&a.path.length>=2?At(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=T||d,g)s.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[_,H]=a.path[0];e.moveTo(_,H);for(let F=1;a.path.length>F;F++)e.lineTo(a.path[F][0],a.path[F][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=St(e,a.style.fill,a.style.fill),g&&!y)s.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[G,V]=a.path[0];e.moveTo(G,V);for(let U=1;a.path.length>U;U++)e.lineTo(a.path[U][0],a.path[U][1])}const q=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(q,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(m,v,0,b),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=St(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=St(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),wt(e,t),e.globalAlpha=1}}finally{e.restore()}}})(m,v),N&&Kt.current){const e=Kt.current,s=v.filter(e=>"line"===e.type);if(s.length>0){const a=T||{},c=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),u=null!==(n=a.maxPerLine)&&void 0!==n?n:30,f=null!==(o=a.spawnRate)&&void 0!==o?o:.15,p=null!==(i=a.radius)&&void 0!==i?i:2,g=null!==(r=a.opacity)&&void 0!==r?r:.7,y=d/1e3,v=Jt.current>0?Math.min(y-Jt.current,.1):.016;Jt.current=y;const b=s.map(e=>e.path),x=s.map(e=>e.style.strokeWidth||2);for(let t=0;s.length>t;t++)Math.random()<f&&e.countForLine(t)<u&&e.spawn(t);e.step(v,c,b,x),m.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=s[n.lineIndex],i="function"==typeof a.color?a.color(null!==(l=null==o?void 0:o.datum)&&void 0!==l?l:{}):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";m.beginPath(),m.arc(n.x,n.y,p,0,2*Math.PI),m.fillStyle=i,m.fill()}m.globalAlpha=1,h=!0}}m.restore();const x=$t.current;if(x){const e=Lt(x,Ee,$e,y);if(e){e.clearRect(-$e.left,-$e.top,Ee[0],Ee[1]);const t=tn.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof re?re:void 0,i=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(pe){const e=performance.now()-u.lastIngestTime>(null!==(a=pe.threshold)&&void 0!==a?a:5e3);e!==sn&&an(e)}const j=ce!==qt.current;j&&(qt.current=ce),(ze.current||j)&&ln(e=>e+1),(g||null!=u.activeTransition||u.hasActivePulses||h)&&(tt.current=requestAnimationFrame(()=>nt.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:l,cleanup:s}=e;qe(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,l.current()},[n,o]);const a=t.useRef(s);a.current=s,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:rt,wasHydratingFromSSR:lt,storeRef:bt,dirtyRef:ze,renderFnRef:nt,cleanup:()=>{var e;return null===(e=Nt.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{ze.current=!0,ot()},[Be,We,K,ot]),function(e,n,o,i,r,l){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const s=n.current;if(!s||0===s.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=a-s.lastIngestTime>c;u!==r&&(l(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(pe,bt,ze,ot,sn,an),t.useEffect(()=>{if("production"!==process.env.NODE_ENV&&_){const e=_t(m);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[_,m]),t.useEffect(()=>{const e=Zt.current;if(!E||!e)return Gt.current&&e&&(u.select(e).on(".zoom",null),Gt.current=null),void(e&&u.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=$||[1,8],o={width:Be,height:We};if(yt){let i=Vt.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),Vt.current=c.zoomIdentity.scale(i);const l=bt.current;l&&(l.applyZoomScale(i,o),ze.current=!1,ot(),(null===(r=l.scales)||void 0===r?void 0:r.projection)&&(null==B||B({projection:l.scales.projection,zoom:l.currentZoom})))};Gt.current={scaleBy:(e,t)=>r(i*t),transform:(e,t)=>{var n;return r(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const l=e=>{e.preventDefault(),r(i*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),r(1.5*i))};e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("dblclick",s);const a=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=bt.current;if(!o)return;const i=o.getRotation();Xt.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Xt.current;t&&(Qt.current=[t.rotation[0]+(e.clientX-t.x)*a,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*a)),t.rotation[2]],ot())},h=t=>{var n;if(!Xt.current)return;Xt.current=null,e.releasePointerCapture(t.pointerId);const i=Qt.current;if(i){Qt.current=null;const e=bt.current;e&&(e.applyRotation(i,o),ot())}const r=bt.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==B||B({projection:r.scales.projection,zoom:r.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",l),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),Gt.current=null}}const i=c.zoom().scaleExtent([t,n]).extent([[0,0],[Ee[0],Ee[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;Vt.current=t,Ut.current=!0;const n=bt.current;n&&(n.applyZoomTransform(t,o),ze.current=!1,ot())}).on("end",e=>{var t;Vt.current=e.transform,Ut.current=!1;const n=bt.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==B||B({projection:n.scales.projection,zoom:n.currentZoom}))});return Gt.current=i,u.select(e).call(i),()=>{u.select(e).on(".zoom",null)}},[E,$,yt,Ee,Be,We,$e,B,ot]);const Sn=ie&&!1!==re,An=Sn&&nn?le?le(nn):e.jsx(Ft,{data:nn}):null,Cn=An?e.jsx(jt,{x:nn.x,y:nn.y,containerWidth:Be,containerHeight:We,margin:$e,className:"stream-frame-tooltip",zIndex:10,children:An}):null;if(Fe||!rt&&lt){const t=bt.current;t&&(st||k||w)&&(st&&t.setAreas(st),k&&t.setPoints(ht),w&&t.setLines(pt),t.computeScene({width:Be,height:We}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[];return e.jsxs("div",{ref:Yt,className:"stream-geo-frame"+(Q?" "+Q:""),role:"img","aria-label":Ce||("string"==typeof me?me:"Geographic chart"),style:{position:"relative",width:U?"100%":Ee[0],height:Z?"100%":Ee[1]},children:[e.jsx(ct,{summary:Re}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ee[0],height:Ee[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${$e.left},${$e.top})`,children:Te}),e.jsxs("g",{transform:`translate(${$e.left},${$e.top})`,children:[K&&e.jsx("rect",{x:0,y:0,width:Be,height:We,fill:K}),n.map((t,n)=>function(t,n){var o,i,r,l,s,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e.jsx("path",{d:r.pathData,fill:He(r.style.fill,"#e0e0e0"),fillOpacity:null!==(o=r.style.fillOpacity)&&void 0!==o?o:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(i=r._decayOpacity)&&void 0!==i?i:1},"geoarea-"+n):null}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:He(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(l=o._decayOpacity)&&void 0!==l?l:null!==(s=o.style.opacity)&&void 0!==s?s:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const i="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(a=o.style.opacity)&&void 0!==a?a:1},"line-"+n)}default:return null}}(t,n))]})]}),e.jsx(_e,{width:Be,height:We,totalWidth:Ee[0],totalHeight:Ee[1],margin:$e,scales:null,showAxes:!1,title:me,legend:ve,legendPosition:be,legendHoverBehavior:xe,legendClickBehavior:je,legendHighlightedCategory:ke,legendIsolatedCategories:we,foregroundGraphics:Ne,annotations:ce,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)})]})}return e.jsxs("div",{ref:Yt,className:"stream-geo-frame"+(Q?" "+Q:""),role:"group","aria-label":Ce||("string"==typeof me?me:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:U?"100%":Ee[0],height:Z?"100%":Ee[1],overflow:"hidden"},E?{touchAction:"none"}:{}),onKeyDown:On,children:[Ae&&e.jsx(ut,{tableId:et}),Ae&&e.jsx(at,{scene:null!==(a=null===(l=bt.current)||void 0===l?void 0:l.scene)&&void 0!==a?a:[],chartType:"Geographic chart",tableId:et,chartTitle:"string"==typeof me?me:void 0}),e.jsx(ct,{summary:Re}),e.jsxs("div",{role:"img","aria-label":Ce||("string"==typeof me?me:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Sn?Mn:void 0,onMouseLeave:Sn?xn:void 0,onClick:se?jn:void 0,children:[Te&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Ee[0],height:Ee[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${$e.left},${$e.top})`,children:Te})}),_&&e.jsx("canvas",{ref:xt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx("canvas",{ref:kt,"aria-label":Je(null!==(h=null===(d=bt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:$t,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(dt,{hoverPoint:nn}),e.jsx(_e,{width:Be,height:We,totalWidth:Ee[0],totalHeight:Ee[1],margin:$e,scales:null,showAxes:null!=Se&&Se,title:me,legend:ve,legendPosition:be,legendHoverBehavior:xe,legendClickBehavior:je,legendHighlightedCategory:ke,legendIsolatedCategories:we,foregroundGraphics:Ne,annotations:ce,annotationFrame:rn,xValues:[],yValues:[],pointNodes:null===(f=bt.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type)}),(null==pe?void 0:pe.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===pe.badgePosition?{top:4,left:4}:"bottom-left"===pe.badgePosition?{bottom:4,left:4}:"bottom-right"===pe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:sn?"#dc3545":"#28a745",color:"white"}),children:sn?"STALE":"LIVE"}),E&&e.jsxs("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:$e.bottom+8,left:$e.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e.jsx("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Zt.current,n=Gt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1.5)},style:Tt,children:"+"}),e.jsx("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Zt.current,n=Gt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1/1.5)},style:Tt,children:"−"})]}),H&&e.jsx("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:$e.bottom+2,right:$e.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:H}),e.jsx(gt,{active:kn.current>=0,hoverPoint:nn,margin:$e,size:Ee,shape:null===(p=wn.current)||void 0===p?void 0:p.shape,width:null===(g=wn.current)||void 0===g?void 0:g.w,height:null===(y=wn.current)||void 0===y?void 0:y.h}),Cn]})]})});function Gt(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Vt(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Ut(e){const t=e.map(Gt),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Vt(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Vt(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[l,s,a]=t[i],[c,u,d]=t[i+1];return Vt(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}qt.displayName="StreamGeoFrame";const Zt=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Yt=Ut(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Xt=Ut(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Qt=Ut(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Kt=Ut(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Jt=Ut(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),en=Ut(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),tn=Ut(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),nn=Ut(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),on=Ut(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),rn=Ut(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ln=Ut(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),sn=Ut(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Ut(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Ut(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Ut(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Ut(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Ut(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Ut(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Ut(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const an={category10:Zt,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Yt,reds:Xt,greens:Qt,oranges:Kt,purples:Jt,viridis:tn,plasma:nn},cn=Zt,un=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],dn=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 hn(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")||dn.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):cn[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))%cn.length]}function fn(e,t,n="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return o.scaleOrdinal().domain(i).range(n).unknown("#999");const l=an[n]||an.category10;if(r&&"function"==typeof l){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>l(Number(t)/e)}{const e=Array.isArray(l)?l:cn;return o.scaleOrdinal().domain(i).range(e).unknown("#999")}}function pn(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,l]=o,[s,a]=n;if(l===r)return(s+a)/2;let c=(i-r)/(l-r);return 0>c?c=0:c>1&&(c=1),s+c*(a-s)}const gn=t.createContext(null);function yn(){return t.useContext(gn)}function mn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function vn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[bn,xn]=P(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=vn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=vn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[jn,kn]=P(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 wn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=xn(e=>e.selections.get(i)),l=xn(e=>e.setClause),s=xn(e=>e.clearClause),a=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(mn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};l(i,{clientId:o,type:"point",fields:t})},[o,i,l]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};l(i,{clientId:o,type:"interval",fields:t})},[o,i,l]),clear:t.useCallback(()=>{s(i,o)},[s,i,o]),clientId:o}}function On(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:l,clear:s}=wn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&l(t)},[o,l,s,n]),predicate:i,isActive:r}}const Mn=t.createContext(!1),Sn=t.createContext(null),An="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Cn(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}function Rn(e,t,n){return t?(o,...i)=>{var r;const l=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(l,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;l.opacity=e,l.fillOpacity=e,l.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(l,n.unselectedStyle)}return l}:e}function Ln(){return H(e=>e.theme)}f.createContext(void 0);const zn="#007bff";function Pn(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function In(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?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function Dn(){var e;const t=Ln(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function En({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:l,chartId:s,onClick:a,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=Cn(n,o),f=wn({name:(null==e?void 0:e.name)||"__unused__"}),p=On({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),g=kn(e=>e.pushObservation),y=e?{isActive:f.isActive,predicate:f.predicate}:null,[m,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),j=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=Pn(e,t,h.xField);null!=n&&function(e,t,n){const o=we.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(we={positions:new Map(we.positions).set(e,{xValue:t,sourceId:n})},Me())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Se(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(r||g){const n={timestamp:Date.now(),chartType:l||"unknown",chartId:s};if(e){const i=In(e),l=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(l),g&&g(l)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),g&&g(e)}}},[n,p,h,d,r,l,s,g,c,b]),k=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=Pn(e,t,h.xField);null!=n&&function(e,t,n){const o=we.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(we.positions);return t.delete(e),we={positions:t},Me(),!1}we={positions:new Map(we.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Me()}(h.name||"hover",n,d)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||g){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:s};if(e){const n=In(e),l=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(l),g&&g(l)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),g&&g(e)}}},[a,r,g,l,s,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{Ae(e,d),Se(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:x,customHoverBehavior:j,customClickBehavior:k,crosshairSourceId:d}}function $n({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:l,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(Mn),u=null!==t.useContext(Sn),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,h]);!function(e){const n=t.useContext(Sn),o=t.useId(),i=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=t.useRef([]);(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,i)||(r.current=i);const l=r.current;An(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),An(()=>{n&&n.registerCategories(o,l)},[n,o,l])}(u&&n?f:[]);const p=t.useMemo(()=>{if(!d||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:l}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(l&&l.length>0?l:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const l=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=l?o(l,t,n):n?n(i):un[r%un.length];return{label:i+"",color:s}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:hn,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),g=t.useMemo(()=>{const e="number"==typeof l?{top:l,bottom:l,left:l,right:l}:null!=l?l:{},t=Object.assign(Object.assign({},s),e),n=t=>null!=e[t];return p&&("right"===r&&!n("right")&&110>t.right?t.right=110:"left"===r&&!n("left")&&110>t.left?t.left=110:"top"===r&&!n("top")&&50>t.top?t.top=50:"bottom"===r&&!n("bottom")&&80>t.bottom&&(t.bottom=80)),t},[s,l,p,r]);return{legend:p,margin:g,legendPosition:r}}const Bn={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Wn(e,t,n){var o,i,r,l,s,a,c;const u=Bn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(i=t.height)&&void 0!==i?i:u.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(l=t.showGrid)&&void 0!==l?l:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Nn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Nn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Tn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function _n({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,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:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class Hn extends f.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(_n,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Fn;const qn="undefined"!=typeof process&&"production"!==(null===(Fn=process.env)||void 0===Fn?void 0:Fn.NODE_ENV);function Gn({componentName:t,width:n,height:o,children:i}){return e.jsx(Hn,{fallback:i=>e.jsx(_n,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Vn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Un={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Zn(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Vn),{width:n,height:o}),children:i||"No data available"}):null}function Yn(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),l=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(l+s)-s))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Un),{position:"absolute",top:a+o*(l+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:l,opacity:.5+o%2*.2})},o))})}function Xn(e,t,n,o){if(!qn)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Qn(e){const n=H(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function Kn(e,t,n,o){return new(n||(n=Promise))(function(i,r){function l(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,s)}a((o=o.apply(e,t||[])).next())})}function Jn(e){return e}function eo(e,t){var n=t.id,o=t.bbox,i=null==t.properties?{}:t.properties,r=function(e,t){var n=function(e){if(null==e)return Jn;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],l=e.translate[1];return function(e,s){s||(t=n=0);var a=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+r,u[1]=(n+=e[1])*i+l;c>a;)u[a]=e[a],++a;return u}}(e.transform),o=e.arcs;function i(e,t){t.length&&t.pop();for(var i=o[0>e?~e:e],r=0,l=i.length;l>r;++r)t.push(n(i[r],r));0>e&&function(e,t){for(var n,o=e.length,i=o-t;i<--o;)n=e[i],e[i++]=e[o],e[o]=n}(t,l)}function r(e){return n(e)}function l(e){for(var t=[],n=0,o=e.length;o>n;++n)i(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=l(e);4>t.length;)t.push(t[0]);return t}function a(e){return e.map(s)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=r(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(r);break;case"LineString":n=l(t.arcs);break;case"MultiLineString":n=t.arcs.map(l);break;case"Polygon":n=a(t.arcs);break;case"MultiPolygon":n=t.arcs.map(a);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:i,geometry:r}:null==o?{type:"Feature",id:n,properties:i,geometry:r}:{type:"Feature",id:n,bbox:o,properties:i,geometry:r}}"function"==typeof SuppressedError&&SuppressedError;const to=new Map;function no(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function oo(e){return Kn(this,void 0,void 0,function*(){const t=to.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Kn(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:no(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:no(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:no(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:no(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return eo(e,t)})}:eo(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return to.set(e,r),r})}function io(e){const n=t.useMemo(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=t.useState(null);return t.useEffect(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),oo(e).then(e=>{t||i(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),i(null)}else i(null)},[e]),void 0!==n?n:o}const ro={blues:Yt,reds:Xt,greens:Qt,viridis:tn,oranges:Kt,purples:Jt,greys:en,plasma:nn,inferno:on,magma:rn,cividis:ln,turbo:sn};function lo(n){var i;const l=Wn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),s=function(){var e;const t=Ln();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:a,valueAccessor:c,colorScheme:u,projection:d="equalEarth",graticule:h,fitPadding:f,zoomable:p,zoomExtent:g,onZoom:y,dragRotate:m,tileURL:v,tileAttribution:b,tileCacheSize:x,tooltip:j,areaOpacity:k=1,annotations:w,margin:O,className:M,selection:S,linkedHover:A,onObservation:C,onClick:R,chartId:L,loading:z,loadingContent:P,emptyContent:I,frameProps:D={},stroke:E,strokeWidth:$,opacity:B}=n,W=null!=p?p:!!v,N=io(a),T=t.useMemo(()=>N?ft(N):N,[N]),_=t.useMemo(()=>"function"==typeof c?c:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[c])&&void 0!==n?n:null==e?void 0:e[c]},[c]),H=null!==(i=null!=u?u:s)&&void 0!==i?i:"blues",F=t.useMemo(()=>{if(!T)return o.scaleSequential(Yt).domain([0,1]);const e=T.map(e=>_(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=r.extent(e);return o.scaleSequential(ro[H]||Yt).domain([null!=t?t:0,null!=n?n:1])},[T,_,H]),{activeSelectionHook:q,customHoverBehavior:G,customClickBehavior:V}=En({selection:S,linkedHover:A,onObservation:C,onClick:R,chartType:"ChoroplethMap",chartId:L}),U=Qn(S),Z=t.useMemo(()=>{const e=Tn(e=>{const t=_(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:E,strokeWidth:$,opacity:B});return q?Rn(e,q,U):e},[_,F,q,U,k,E,$,B]),Y=t.useMemo(()=>t=>{var n,o;const i=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",r=_(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:i}),null!=r&&e.jsx("div",{style:{opacity:.7},children:(l=r,"number"==typeof l&&isFinite(l)?Number.isInteger(l)?l.toLocaleString():l.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=l?l:"")+"")})]});var l},[_]),X=t.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},"number"==typeof O?{top:O,bottom:O,left:O,right:O}:O),[O]),Q=Yn(z,l.width,l.height,P)||(T?null:Yn(!0,l.width,l.height,P)),K=Q?null:Zn(T,l.width,l.height,I);if(Array.isArray(T)&&T.length>0){const t=T[0];if(!t||"object"!=typeof t||!t.geometry)return e.jsx(_n,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:l.width,height:l.height})}const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:d,areas:T,areaStyle:Z,size:[l.width,l.height],margin:X,enableHover:!0,tooltipContent:!1===j?()=>null:!0===j?Y:xt(j)||Y},null!=h&&{graticule:h}),null!=f&&{fitPadding:f}),W&&{zoomable:!0}),g&&{zoomExtent:g}),y&&{onZoom:y}),null!=m&&{dragRotate:m}),v&&{tileURL:v}),b&&{tileAttribution:b}),x&&{tileCacheSize:x}),(A||C||R)&&{customHoverBehavior:G}),(C||R)&&{customClickBehavior:V}),w&&w.length>0&&{annotations:w}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),M&&{className:M}),null!=n.animate&&{animate:n.animate}),D);return Q||K||e.jsx(Gn,{componentName:"ChoroplethMap",width:l.width,height:l.height,children:e.jsx(qt,Object.assign({},J))})}function so(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:l,legendPosition:s,selection:a,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:p,showLegend:g,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,loadingContent:j,emptyContent:k,width:w,height:O}=e,M=void 0===o,S=t.useMemo(()=>ft(n),[n]),[A,C]=t.useState([]),R=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:z,hoverSelectionHook:P,customHoverBehavior:I,customClickBehavior:D,crosshairSourceId:E}=En({selection:a,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:p,onClick:v,hoverHighlight:b,colorByField:L}),$=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(c,E),B=function(e,n,o){const i=yn(),r=Dn();return t.useMemo(()=>{var t;if(!n)return;const l=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(i&&Object.keys(i).length>0){const e=fn(t.map(e=>({_cat:e})),"_cat",l);return t=>i[t]||e(t)}return fn(t.map(e=>({_cat:e})),"_cat",l)}if(i&&Object.keys(i).length>0){const t=fn(e,n,l);return e=>i[e]||t(e)}return fn(e,n,l)}if(i&&Object.keys(i).length>0){const e=fn([{_:"a"}],"_",l);return t=>i[t]||e(t)}},[e,n,o,i,r])}(S,i,r),W=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of S){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[S,i]),N=t.useMemo(()=>M&&A.length>0?A:W,[M,A,W]),T=function(e,n,o){const[i,r]=t.useState(null),[l,s]=t.useState(new Set),a=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&s(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return l.has(o)}}:null},[e,n,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:a,onLegendClick:c,legendSelectionHook:u}}(l,i,N),_=t.useMemo(()=>P||(T.legendSelectionHook?T.legendSelectionHook:z),[P,T.legendSelectionHook,z]),H=Qn(a),F=Dn(),q=yn(),G=t.useMemo(()=>{if(B)return B;if(!i||0===N.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:F&&F.length>0?F:un,t="__streamCat",n=fn(N.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[B,i,N,r,F,q]),{legend:V,margin:U,legendPosition:Z}=$n({data:S,colorBy:i,colorScale:G,showLegend:g,legendPosition:s,userMargin:y,defaults:m,categories:N}),Y=t.useMemo(()=>{const e={};return V&&(e.legend=V,e.legendPosition=Z),l&&"none"!==l&&(e.legendHoverBehavior=T.onLegendHover,e.legendClickBehavior=T.onLegendClick,e.legendHighlightedCategory=T.highlightedCategory,e.legendIsolatedCategories=T.isolatedCategories),M&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=R),e},[V,Z,l,T.onLegendHover,T.onLegendClick,T.highlightedCategory,T.isolatedCategories,M,i,R]),X=Array.isArray(o)?ft(o):o,Q=Yn(x,w,O,j),K=Q?null:Zn(X,w,O,k);return{data:S,colorScale:B,allCategories:N,legendState:T,effectiveSelectionHook:_,activeSelectionHook:z,customHoverBehavior:I,customClickBehavior:D,legend:V,margin:U,legendPosition:Z,earlyReturn:Q||K||null,legendBehaviorProps:Y,crosshairProps:$,resolvedSelection:H}}function ao(e,n){const{variant:o,frameRef:i,overrides:r,deps:l}=n;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,l;const s=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of s){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(l=e.current)||void 0===l||l.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const l=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of l)null===(r=e.current)||void 0===r||r.push(n(t));return l},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const l=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of l)null===(r=n.current)||void 0===r||r.pushLine(t(e));return l},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=l?l:[])}lo.displayName="ChoroplethMap";const co=t.forwardRef(function(n,o){const i=t.useRef(null);ao(o,{variant:"geo-points",frameRef:i});const r=Wn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:l,xAccessor:s="lon",yAccessor:a="lat",sizeBy:c,sizeRange:u=[3,30],colorBy:d,colorScheme:h,projection:f="equalEarth",graticule:p,fitPadding:g,zoomable:y,zoomExtent:m,onZoom:v,dragRotate:b,tileURL:x,tileAttribution:j,tileCacheSize:k,areas:w,areaStyle:O={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:M,annotations:S,margin:A,className:C,selection:R,linkedHover:L,onObservation:z,onClick:P,chartId:I,loading:D,loadingContent:E,emptyContent:$,legendInteraction:B,legendPosition:W,frameProps:N={},stroke:T,strokeWidth:_,opacity:H}=n,F=null!=y?y:!!x,q=io(w),G=so({data:null!=l?l:ht,rawData:l,colorBy:d,colorScheme:h,legendInteraction:B,legendPosition:W,selection:R,linkedHover:L,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!1,onObservation:z,onClick:P,chartType:"ProportionalSymbolMap",chartId:I,showLegend:r.showLegend,userMargin:A,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:D,loadingContent:E,emptyContent:$,width:r.width,height:r.height}),V=G.data,U=t.useMemo(()=>{if(!c)return;const e="function"==typeof c?c:e=>null==e?void 0:e[c],t=V.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[V,c]),Z=t.useMemo(()=>{const e=Tn(e=>({fill:d?hn(e,d,G.colorScale):zn,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:c?pn(e,c,u,U):6}),{stroke:T,strokeWidth:_,opacity:H});return G.effectiveSelectionHook?Rn(e,G.effectiveSelectionHook,G.resolvedSelection):e},[d,G.colorScale,G.effectiveSelectionHook,G.resolvedSelection,c,u,U,T,_,H]),Y=t.useMemo(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof c?c:null,i=("function"==typeof c?c:e=>e[c])(t),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",l="string"==typeof d?d:null,s=l?null==t?void 0:t[l]:null;return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[n&&e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:n}),o&&null!=i&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[o,": "]}),r(i)]}),l&&null!=s&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[l,": "]}),s+""]}),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),r(n)]},t))]})},[c,d]);Xn("ProportionalSymbolMap",V,"xAccessor",s),Xn("ProportionalSymbolMap",V,"yAccessor",a);const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:f},null!=l&&{points:V}),{xAccessor:s,yAccessor:a,pointStyle:Z}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),q&&{areas:q,areaStyle:O}),null!=p&&{graticule:p}),null!=g&&{fitPadding:g}),F&&{zoomable:!0}),m&&{zoomExtent:m}),v&&{onZoom:v}),null!=b&&{dragRotate:b}),x&&{tileURL:x}),j&&{tileAttribution:j}),k&&{tileCacheSize:k}),{size:[r.width,r.height],margin:G.margin,enableHover:!0,tooltipContent:!1===M?()=>null:xt(M)||Y}),G.legendBehaviorProps),(L||z||P)&&{customHoverBehavior:G.customHoverBehavior}),(z||P)&&{customClickBehavior:G.customClickBehavior}),S&&S.length>0&&{annotations:S}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),N);return G.earlyReturn?G.earlyReturn:e.jsx(Gn,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:e.jsx(qt,Object.assign({ref:i},X))})});co.displayName="ProportionalSymbolMap";const uo="__semiotic_x",ho="__semiotic_y",fo=t.forwardRef(function(n,i){const r=Wn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:l,nodes:s,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:g,zoomExtent:y,onZoom:m,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:j,lineType:k="geo",flowStyle:w="basic",areas:O,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:S,edgeOpacity:A=.6,edgeWidthRange:C=[1,8],edgeLinecap:R="round",colorScheme:L,showParticles:z,particleStyle:P,tooltip:I,annotations:D,margin:E,className:$,selection:B,linkedHover:W,onObservation:N,onClick:T,chartId:_,loading:H,loadingContent:F,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Z,strokeWidth:Y,opacity:X,lineIdAccessor:Q}=n,K=null!=g?g:!!b,J=io(O),ee=t.useMemo(()=>ft(s),[s]),te=so({data:null!=l?l:ht,rawData:l,colorBy:S,colorScheme:L,legendInteraction:V,legendPosition:U,selection:B,linkedHover:W,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:N,onClick:T,chartType:"FlowMap",chartId:_,showLegend:r.showLegend,userMargin:E,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:H,loadingContent:F,emptyContent:q,width:r.width,height:r.height}),ne=te.data,oe=Cn(W),ie=On({name:(null==oe?void 0:oe.name)||"hover",fields:(null==oe?void 0:oe.fields)||[]}),re=kn(e=>e.pushObservation),le=t.useMemo(()=>{const e=new Map;for(const t of ee)e.set(t[a]+"",t);return e},[ee,a]),se=t.useRef(null),ae=t.useRef(le);ae.current=le;const ce=t.useRef(c);ce.current=c;const ue=t.useRef(u);ue.current=u;const de=t.useCallback(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof ce.current?ce.current:e=>e[ce.current],r="function"==typeof ue.current?ue.current:e=>e[ue.current];return Object.assign(Object.assign({},e),{coordinates:[{[uo]:i(n),[ho]:r(n)},{[uo]:i(o),[ho]:r(o)}]})},[]);ao(i,{variant:"geo-lines",frameRef:se,overrides:{push:e=>{var t;const n=de(e);n&&(null===(t=se.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=de(t);e&&n.push(e)}n.length>0&&(null===(t=se.current)||void 0===t||t.pushManyLines(n))}}});const he=t.useMemo(()=>{const e=new Map;for(const t of ne)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ne]),fe=t.useCallback(e=>{var t,n;if(W)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=he.get(t[a]+"");e&&ie.onHover(e)}else ie.onHover(t)}else ie.onHover(null);if(N||re){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:_};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});N&&N(r),re&&re(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});N&&N(e),re&&re(e)}}},[W,ie,a,he,N,_,re]),pe=te.customClickBehavior,ge=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=le.get(n.source+""),i=le.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[uo]:e(o),[ho]:t(o)},{[uo]:e(i),[ho]:t(i)}]}):null}).filter(Boolean)},[ne,le,c,u]),ye=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c];return t=>null!=t&&"object"==typeof t&&uo in t?t[uo]:e(t)},[c]),me=t.useMemo(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&ho in t?t[ho]:e(t)},[u]),ve=t.useMemo(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>C[0]:o.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(C)},[ne,d,C]),be=t.useMemo(()=>e=>{var t;return{stroke:S?hn(e,S,te.colorScale):zn,strokeWidth:ve(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:R,opacity:A}},[S,te.colorScale,ve,d,A,R]),xe=t.useMemo(()=>{var e;const t=Tn(be,{stroke:Z,strokeWidth:Y,opacity:X});if(!te.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=te.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return Rn(t,te.effectiveSelectionHook,Object.assign(Object.assign({},te.resolvedSelection||{}),{unselectedStyle:n}))},[be,te.effectiveSelectionHook,te.resolvedSelection,Z,Y,X]),je=t.useMemo(()=>Tn(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Z,strokeWidth:Y,opacity:X}),[Z,Y,X]),ke=t.useMemo(()=>t=>{var n,o,i,r,l,s,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(i=null==t?void 0:t.properties)||void 0===i?void 0:i.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(l=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.properties)||void 0===l?void 0:l.name)||(null===(c=null===(s=null==t?void 0:t.data)||void 0===s?void 0:s.properties)||void 0===c?void 0:c.NAME);if(n)return e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:n})})}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[d];return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsxs("div",{style:{fontWeight:600},children:[t.source," → ",t.target]}),null!=n&&e.jsx("div",{style:{opacity:.7},children:"number"==typeof n?n.toLocaleString():n})]})}const u=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=u?e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:u})}):null},[d,a]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=l&&{lines:ge}),{points:ee,xAccessor:ye,yAccessor:me,lineDataAccessor:"coordinates"}),null!=Q&&{lineIdAccessor:Q}),{lineType:k,flowStyle:w,lineStyle:xe,pointStyle:je}),J&&{areas:J,areaStyle:M}),null!=f&&{graticule:f}),null!=p&&{fitPadding:p}),K&&{zoomable:!0}),y&&{zoomExtent:y}),m&&{onZoom:m}),null!=v&&{dragRotate:v}),z&&{showParticles:z}),P&&{particleStyle:P}),b&&{tileURL:b}),x&&{tileAttribution:x}),j&&{tileCacheSize:j}),{size:[r.width,r.height],margin:te.margin,enableHover:!0,tooltipContent:!1===I?()=>null:xt(I)||ke}),te.legendBehaviorProps),(W||N||T)&&{customHoverBehavior:fe}),(N||T)&&{customClickBehavior:pe}),D&&D.length>0&&{annotations:D}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),$&&{className:$}),null!=n.animate&&{animate:n.animate}),G);return te.earlyReturn?te.earlyReturn:e.jsx(Gn,{componentName:"FlowMap",width:r.width,height:r.height,children:e.jsx(qt,Object.assign({ref:se},we))})});fo.displayName="FlowMap";const po=t.forwardRef(function(n,o){const i=Wn(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:r,lines:l,xAccessor:s="lon",yAccessor:a="lat",nodeIdAccessor:c="id",center:u,costAccessor:d,strength:h=1,lineMode:f="straight",projection:p="mercator",graticule:g,fitPadding:y,zoomable:m,zoomExtent:v,onZoom:b,dragRotate:x,tileURL:j,tileAttribution:k,tileCacheSize:w,transition:O,colorBy:M,colorScheme:S,pointRadius:A=5,tooltip:C,showRings:R=!0,ringStyle:L,showNorth:z=!0,costLabel:P,annotations:I,margin:D,className:E,selection:$,linkedHover:B,onObservation:W,onClick:N,chartId:T,loading:_,loadingContent:H,emptyContent:F,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=n,Y=null!=m?m:!!j,X=t.useMemo(()=>ft(r),[r]),Q=so({data:X,rawData:r,colorBy:M,colorScheme:S,legendInteraction:void 0,legendPosition:q,selection:$,linkedHover:B,fallbackFields:M?["string"==typeof M?M:""]:[],unwrapData:!1,onObservation:W,onClick:N,chartType:"DistanceCartogram",chartId:T,showLegend:i.showLegend,userMargin:D,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:H,emptyContent:F,width:i.width,height:i.height}),K=t.useMemo(()=>{const e=Tn(e=>({fill:M?hn(e,M,Q.colorScale):zn,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:A}),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?Rn(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[M,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,A,V,U,Z]),J=t.useMemo(()=>({center:u,centerAccessor:c,costAccessor:d,strength:h,lineMode:f}),[u,c,d,h,f]),ee=t.useMemo(()=>{if(!l)return;const e="function"==typeof s?s:e=>e[s],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of X)n.set(e[c]+"",e);return l.map(o=>{if(o.coordinates)return o;const i=n.get(o.source+""),r=n.get(o.target+"");return i&&r?Object.assign(Object.assign({},o),{coordinates:[{[s]:e(i),[a]:t(i)},{[s]:e(r),[a]:t(r)}]}):null}).filter(Boolean)},[l,X,s,a,c]),te=t.useMemo(()=>t=>{const n=("function"==typeof d?d:e=>e[d])(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:t[c]||t.name||t.id||"Point"}),null!=n&&e.jsxs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof n?n.toFixed(1):n]})]})},[d,c]),ne=t.useRef(null);ao(o,{variant:"geo-points",frameRef:ne});const[oe,ie]=t.useState(null),re=t.useCallback(()=>{var e,t;const n=null===(t=null===(e=ne.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ie(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);t.useEffect(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,h,u,i.width,i.height,X]);const le=t.useMemo(()=>{if(!R||!oe)return[];const{maxCost:e}=oe;if(0>=e)return[];if(Array.isArray(R))return R.filter(t=>t>0&&e>=t);const t="number"==typeof R?R:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[R,oe]),se=t.useMemo(()=>{var t,n;if(!oe)return G.foregroundGraphics||null;const{cx:o,cy:i,maxCost:r,availableRadius:l}=oe,s=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},L),a=null!==(t=Q.margin.left)&&void 0!==t?t:10,c=null!==(n=Q.margin.top)&&void 0!==n?n:10;return e.jsxs("g",{children:[le.map(t=>{const n=t/r*l;return e.jsxs("g",{children:[e.jsx("circle",{cx:o+a,cy:i+c,r:n,fill:"none",stroke:s.stroke,strokeWidth:s.strokeWidth,strokeDasharray:s.strokeDasharray,opacity:.5}),e.jsxs("text",{x:o+a+n+3,y:i+c-2,fontSize:s.labelSize,fill:s.labelColor,fontFamily:"system-ui, sans-serif",children:[t,P?" "+P:""]})]},t)}),z&&e.jsxs("g",{transform:`translate(${a+24}, ${c+24})`,children:[e.jsx("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.jsx("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e.jsx("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e.jsx("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[oe,le,z,P,L,Q.margin,G.foregroundGraphics]);Xn("DistanceCartogram",X,"xAccessor",s),Xn("DistanceCartogram",X,"yAccessor",a);const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:p},null!=r&&{points:X}),ee&&{lines:ee,lineDataAccessor:"coordinates"}),{xAccessor:s,yAccessor:a,pointIdAccessor:c,pointStyle:K,projectionTransform:J}),O&&{transition:{duration:O}}),null!=g&&{graticule:g}),null!=y&&{fitPadding:y}),Y&&{zoomable:!0}),v&&{zoomExtent:v}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),j&&{tileURL:j}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[i.width,i.height],margin:Q.margin,enableHover:!0,tooltipContent:!1===C?()=>null:xt(C)||te}),Q.legendBehaviorProps),(B||W||N)&&{customHoverBehavior:Q.customHoverBehavior}),(W||N)&&{customClickBehavior:Q.customClickBehavior}),I&&I.length>0&&{annotations:I}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),G),se&&{foregroundGraphics:se});return Q.earlyReturn?Q.earlyReturn:e.jsx(Gn,{componentName:"DistanceCartogram",width:i.width,height:i.height,children:e.jsx(qt,Object.assign({ref:ne},ae))})});po.displayName="DistanceCartogram",exports.ChoroplethMap=lo,exports.DistanceCartogram=po,exports.FlowMap=fo,exports.ProportionalSymbolMap=co,exports.StreamGeoFrame=qt,exports.mergeData=function(e,t,n){const{featureKey:o,dataKey:i}=n,r=new Map;for(const e of t)r.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=r.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})},exports.resolveReferenceGeography=oo;
2
+ "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-geo"),o=require("d3-scale"),i=require("d3-quadtree"),r=require("d3-array"),l=require("d3-hierarchy"),s=require("d3-shape"),a=require("regression"),c=require("d3-zoom"),u=require("d3-selection");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const f=h(t),p=d(a);class g{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,l=this.buffer[r];if(e(l)){let e;e="object"!=typeof l||null===l?l:Array.isArray(l)?[...l]:Object.assign({},l),n.push(e),this.buffer[r]=t(l)}}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}}function m(e,t,n){return e+(t-e)*n}function y(e,t,n){var o,i,r;if(1>=n)return 1;const l=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return l+(1-s/(n-1))*(1-l);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return l+Math.pow(.5,s/t)*(1-l)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>s?1:l;default:return 1}}const v={mercator:n.geoMercator,equalEarth:n.geoEqualEarth,albersUsa:n.geoAlbersUsa,orthographic:n.geoOrthographic,naturalEarth:n.geoNaturalEarth1,equirectangular:n.geoEquirectangular};function b(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function x(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function j(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function k(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let i=[e[0]];for(let t=1;e.length>t;t++){const r=e[t];Math.abs(r[0]-e[t-1][0])>n?(2>i.length||o.push(i),i=[r]):i.push(r)}return 2>i.length||o.push(i),o}function w(e,t,n=24){const o=t[0]-e[0],i=t[1]-e[1],r=Math.sqrt(o*o+i*i);if(0===r)return[e,t];const l=-i/r,s=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+l*a,u=(e[1]+t[1])/2+s*a,d=[];for(let o=0;n>=o;o++){const i=o/n,r=1-i;d.push([r*r*e[0]+2*r*i*c+i*i*t[0],r*r*e[1]+2*r*i*u+i*i*t[1]])}return d}function M(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const i=e[t];let r,l;0===t?(r=e[1][0]-i[0],l=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],l=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],l=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(r*r+l*l)||1;o.push([i[0]+l/s*n,i[1]+-r/s*n])}return o}function O(e,t,n,o,i){const r=t[0]-e[0],l=t[1]-e[1],s=Math.sqrt(r*r+l*l);if(0===s)return[e,t];const a=l/s,c=-r/s,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class S{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e.slice()}initStreaming(e=500){this.pointBuffer=new g(e),this.timestampBuffer=new g(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}pushLine(e){null!=e&&"object"==typeof e&&(this.lineData.push(e),this.version++)}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return;const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){for(const e of t)this.lineData.push(e);this.version++}}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!o.has(n(e)+"")||(i.push(e),!1)),i.length>0&&this.version++,i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return n.geoEqualEarth();if("string"==typeof e){const t=v[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),n.geoEqualEarth())}if("object"==typeof e&&"type"in e){const t=v[e.type],o=t?t():n.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(t.projection),this.geoPath=n.geoPath(this.projection),this.fitProjection(e),this.geoPath=n.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const i=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&i.length>0&&this.startTransition(i),this.version++}fitProjection(e){var t,n,o,i,r;const l=this.projection,s=this.config,a=[...this.areas],c=b(s.xAccessor,"lon"),u=b(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=x(s.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(s.projectionExtent){const[[t,n],[o,i]]=s.projectionExtent;l.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,i],[t,i],[t,n]]]}})}else if(l.clipAngle&&(null!==(t=l.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=s.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);l.scale(o/2-o*t),l.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;l.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=l.scale(),this.baseTranslate=l.translate(),this.baseRotation=null!==(r=null===(i=l.rotate)||void 0===i?void 0:i.call(l))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,S.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=i.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,o,i;const r=[],{config:l}=this,s=this.projection,a=this.geoPath,c=b(l.xAccessor,"lon"),u=b(l.yAccessor,"lat"),d=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(l),h=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(l),f=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(l);if(l.graticule){const t=!0===l.graticule?{}:l.graticule,o=n.geoGraticule();t.step&&o.step(t.step);const i=a(o())||"";i&&r.push({type:"geoarea",pathData:i,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=a(e);if(!t)continue;const n=a.centroid(e),o=a.bounds(e),i=a.area(e),s=j(l.areaStyle,e,d);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:i,style:s,datum:e,interactive:!0})}const p=x(l.lineDataAccessor);for(const t of this.lineData){const o=p(t);if(!o||2>o.length)continue;let i=[];if("geo"===l.lineType){const e=Array(o.length);for(let t=0;o.length>t;t++)e[t]=[c(o[t]),u(o[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],l=n.geoDistance(o,r)||0,a=Math.max(2,Math.ceil(l/(Math.PI/180))),c=n.geoInterpolate(o,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=s(c(e/a));null!=n&&i.push(n)}}}else for(let e=0;o.length>e;e++){const t=o[e],n=s([c(t),u(t)]);null!=n&&i.push(n)}if(2>i.length)continue;const a=j(l.lineStyle,t,h),d="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==o.length||2>i.length||"arc"!==l.flowStyle?2!==o.length||2>i.length||"offset"!==l.flowStyle||(i="geo"===l.lineType?M(i,d):O(i[0],i[i.length-1],0,0,d)):i=w(i[0],i[i.length-1]);const f=k(i,e.width);if(f.length>1)for(const e of f){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>i.length&&f[0]||i,style:a,datum:t})}const g=this.getPoints(),m=l.pointIdAccessor?"function"==typeof l.pointIdAccessor?l.pointIdAccessor:e=>e[l.pointIdAccessor]:null,y=s.clipAngle&&null!==(t=s.clipAngle())&&void 0!==t?t:0,v=y>0?y*Math.PI/180:null,S=s.rotate?s.rotate():[0,0,0],A="function"==typeof s.center?s.center():[0,0],C=[(null!==(o=A[0])&&void 0!==o?o:0)-S[0],(null!==(i=A[1])&&void 0!==i?i:0)-S[1]];for(let e=0;g.length>e;e++){const t=g[e],o=c(t),i=u(t);if(null!=v&&n.geoDistance([o,i],C)>v)continue;const a=s([o,i]);if(!a)continue;const d=l.pointStyle?l.pointStyle(t):Object.assign({},f),h={type:"point",x:a[0],y:a[1],r:d.r||4,style:d,datum:t,pointId:m?m(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,i,r;const l=this.scene.filter(e=>"point"===e.type);if(2>l.length)return;const s=null!==(n=e.strength)&&void 0!==n?n:1;if(0===s)return;const a=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=l.find(t=>t.datum&&a(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,h=u.y,f=l.map(e=>e.datum?c(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),p=Math.max(...f,1),g=Math.min(t.width,t.height)/2,m=o.scaleLinear().domain([0,p]).range([0,g]);this.cartogramLayout={cx:d,cy:h,maxCost:p,availableRadius:g},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of l){if(e===u)continue;if(!e.datum)continue;const t=Math.atan2(e.y-h,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-h,2)),o=c(e.datum),i=n+((isFinite(o)?m(o):n)-n)*s;e.x=d+Math.cos(t)*i,e.y=h+Math.sin(t)*i}const y=t.width/2,v=t.height/2,b=y-u.x,x=v-u.y;if(Math.abs(b)>.5||Math.abs(x)>.5)for(const e of l)e.x+=b,e.y+=x;this.cartogramLayout={cx:y,cy:v,maxCost:p,availableRadius:g};const j=this.scene.filter(e=>"line"===e.type);if(j.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of l)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of j){const n=null===(i=t.datum)||void 0===i?void 0:i.source,o=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&o){const i=e.get(n+""),r=e.get(o+"");i&&r&&(t.path=[i,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const i=y(e,o,t);n[o]._decayOpacity=i,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:i})}}applyPulse(){var e,t;const n=this.config.pulse;if(!n||!this.timestampBuffer)return;const o=null!==(e=n.duration)&&void 0!==e?e:500,i=performance.now(),r=this.scene.filter(e=>"point"===e.type),l=this.timestampBuffer.toArray();for(let e=0;r.length>e&&l.length>e;e++){const s=i-l[e];o>s&&(r[e]._pulseIntensity=1-s/o,r[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",r[e]._pulseGlowRadius=null!==(t=n.glowRadius)&&void 0!==t?t:4)}}get hasActivePulses(){var e,t;if(!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const n=null!==(t=null===(e=this.config.pulse)||void 0===e?void 0:e.duration)&&void 0!==t?t:500,o=this.timestampBuffer.toArray()[this.timestampBuffer.size-1];return performance.now()-o<n}startTransition(e){var t,n;const o=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=o)return;const i=new Map;for(const t of e)"point"===t.type&&t.pointId&&i.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let l=!1;for(const e of r)if(e.pointId){const t=i.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(l=!0))}l&&(this.activeTransition={startTime:performance.now(),duration:o})}cancelIntroAnimation(){this.activeTransition=null}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),o=this.scene.filter(e=>"point"===e.type);for(const e of o)if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=m(e.x,e._targetX,n),e.y=m(t,e._targetY,n)}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0);return this.activeTransition=null,!1}return!0}}function A(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function C(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function L(e,t){const n=C(e);if(!n)return!1;const o=C(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function R(e,t,n,o,i,r,l=0){if(r){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),l=t-r,s=t+r,a=n-r,c=n+r;let u=null,d=1/0;return e.visit((e,i,r,h,f)=>{if(i>s||l>h||r>c||a>f)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,l=e.y-n,s=Math.sqrt(r*r+l*l);A(e.r,o)>=s&&d>s&&(u=e,d=s),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,l);if(e)return e}else{let i=null,r=o;for(const l of e){if("point"!==l.type)continue;const e=l.x-t,s=l.y-n,a=Math.sqrt(e*e+s*s);A(l.r,o)>=a&&r>a&&(i=l,r=a)}if(i)return{node:i,distance:r}}for(let o=e.length-1;o>=0;o--){const r=e[o];if("geoarea"!==r.type)continue;const l=r;if(!1===l.interactive)continue;const[[s,a],[c,u]]=l.bounds;if(!(s>t||t>c||a>n||n>u)&&(l._cachedPath2D||(l._cachedPath2D=new Path2D(l.pathData)),i.isPointInPath(l._cachedPath2D,t,n)))return{node:l,distance:0}}let s=null,a=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:i}=e,r=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;i.length-1>o;o++){const[l,c]=i[o],[u,d]=i[o+1],h=z(t,n,l,c,u,d);r>=h&&a>h&&(s=e,a=h)}}return s?{node:s,distance:a}:null}function z(e,t,n,o,i,r){const l=i-n,s=r-o,a=l*l+s*s;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*l+(t-o)*s)/a;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*l),2)+Math.pow(t-u,2))}function P(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=I(n);return[function({children:o,initialState:r}){const l=t.useRef(r),s=t.useMemo(()=>I(n,l.current),[]),a=i();return e.jsx(a.Provider,{value:s,children:o})},e=>{var n;const o=i(),l=null!==(n=t.useContext(o))&&void 0!==n?n:r,s=t.useRef(e);s.current=e;const a=t.useCallback(()=>s.current(l.getState()),[l]),c=t.useCallback(()=>s.current(l.getState()),[l]);return t.useSyncExternalStore(l.subscribe,a,c)}]}function I(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function D(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function E(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:$})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}S.QUADTREE_THRESHOLD=500;const $=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],W={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},B={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},N={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:$,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 T(e,t){if("light"===t)return W;if("dark"===t)return B;if("high-contrast"===t)return N;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?B:W;return E(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return E(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[_,H]=P(e=>({theme:W,setTheme(t){e(e=>({theme:T(e.theme,t)}))}}));const F=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,q=new WeakMap;let G=0,V=!1,U=null,Z=null,Y=null;function X(e,t){var n,o;if(!t)return t;const i=F.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(V)return;if("undefined"==typeof window||"undefined"==typeof document)return;V=!0;const e=()=>{G++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(U=new MutationObserver(e),U.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Z=window.matchMedia("(prefers-color-scheme: dark)"),Y=e,"function"==typeof Z.addEventListener?Z.addEventListener("change",Y):"function"==typeof Z.addListener&&Z.addListener(Y)}catch(e){}}();let l=q.get(r);l&&l.version===G||(l={version:G,map:new Map},q.set(r,l));const s=l.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return l.map.set(t,a),a}const Q="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function K(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function J(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(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=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=function(e,n,o){const i=t.useRef(null),[r,l]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),l=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),s=r[0]-l.left-l.right,a=r[1]-l.top-l.bottom,c=K(e.foregroundGraphics,r,l),u=K(e.backgroundGraphics,r,l),d=H(e=>e.theme),{transition:h,introEnabled:p}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+f.useId(),m=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{m.current||(m.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),k=t.useRef(0),w=t.useCallback(()=>{k.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),M=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(w))},[w]),O=t.useCallback(()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return Q(()=>{S&&(G++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:l,adjustedWidth:s,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:g,rafRef:m,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:M,onPointerLeave:O}}const ee={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function te(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,ee[n])(o(e,t),i),r}function ne({swatchSize:t}){return e.jsx("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function oe(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ie=(t,n,o,i,r,l,s,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=t,g=[];let m=0;const y=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:j}=d;return p.forEach((t,u)=>{const d=te(t,u,h,f,b),k=oe(t,i,r),w=r&&r.size>0&&r.has(t.label);g.push(e.jsxs("g",{transform:`translate(0,${m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===l&&u===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?w||!1:void 0,"aria-current":y&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+p.length)%p.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,w&&e.jsx(ne,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),m+=j}),g};function re({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:l,format:s}=t,a=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+f.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":l||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),l&&e.jsx("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e.jsx("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),e.jsx("text",{x:s+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":l||"Gradient legend",children:[l&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function le(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,legendInteraction:s,title:a="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,p=function(e){var t,n,o,i,r;const l=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),s=Math.max(l,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:l,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:s,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(h),[g,m]=f.useState(0),[y,v]=f.useState(0),b=f.useCallback((e,t)=>{m(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,p)=>{h+=5,f.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+p)),h+=8,t.label&&(h+=16,f.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+p)),h+=8),f.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:ie(t,o,i,r,l,s,a,p,c,u,d)},"legend-group-"+p)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:s,metrics:p}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:l,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var f;let p=0;const g=[];t.forEach((t,n)=>{var f;let m=0;t.label&&(m+=16);const y=((t,n,o,i,r,l,s,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=t,m=[],{swatchSize:y,labelGap:v,itemGap:b,rowHeight:x,align:j}=d,k=!(!n&&!o),w="isolate"===u||void 0===u&&null!=r,M=g.map(e=>y+v+7*e.label.length),O=[];let S=0,A=0;M.forEach((e,t)=>{const n=0===A?e:A+b+e;h&&h>0&&A>0&&n>h?(O.push({start:S,end:t,width:A}),S=t,A=e):A=n}),g.length>0&&O.push({start:S,end:g.length,width:A}),O.forEach((t,u)=>{let d="center"===j?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===j?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=g[h],j=te(t,h,f,p,y),O=oe(t,i,r),S=r&&r.size>0&&r.has(t.label);m.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?a===l&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:k?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(a,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:O,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+v+2+7*t.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),j,S&&e.jsx(ne,{swatchSize:y}),e.jsx("text",{y:y/2,x:y+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=M[h]+b}});const C=Math.max(0,...O.map(e=>e.width)),L=O.length;return{items:m,offset:C,totalRows:L,totalHeight:L*x}})(t,i,r,l,s,a,c,n,u,d,h,null!==(f=h.maxWidth)&&void 0!==f?f:o);m+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:m,totalRows:y.totalRows,totalHeight:y.totalHeight})),p+=m+12});const m=null!==(f=h.maxWidth)&&void 0!==f?f:o;let y=p>m?0:"center"===h.align?Math.max(0,(m-p)/2):"end"===h.align?Math.max(0,m-p):0;const v=[];return g.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),y+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${y},0)`,children:o.items},"legend-group-"+i)),y+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:s,metrics:p}),j=!(!o&&!i);return e.jsxs("g",{role:j?"listbox":void 0,"aria-multiselectable":!(!j||"isolate"!==s&&(void 0!==s||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function se(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ae(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:l,legendPosition:s="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:p}=t;if(!o)return null;const g="top"===s||"bottom"===s,m=!!c,y=Math.max(1,g?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-l.left-l.right):100);let v,b;return"left"===s?(v=Math.max(4,l.left-y-10),b=l.top):"top"===s?(v=l.left,b=m?32:8):"bottom"===s?(v=l.left,b=r-l.bottom+38):(v=i-l.right+10,b=l.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(re,{config:o.gradient,orientation:g?"horizontal":"vertical",width:y}):se(o)?e.jsx(le,{legendGroups:o.legendGroups,title:"",width:y,orientation:g?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:p}):o)});var x}function ce(e){return"string"==typeof e?{type:e}:e}function ue({orient:n,config:o,values:i,scale:l,size:s,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=t.useMemo(()=>{if(0===i.length)return null;const t=l.domain(),o=s-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],l=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*l),whiskerHigh:Math.min(t[n-1],r+1.5*l)}}(i);if(!t)return null;const{q1:r,median:s,q3:a,whiskerLow:d,whiskerHigh:h}=t,f=Math.min(.5*o,20),p=(o-f)/2+4;if(u){const t=l(r),o=l(a),i=l(s),u=l(d),g=l(h),m="top"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:y+m*(p+f/2),x2:g,y2:y+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:y+m*p,x2:u,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:g,y1:y+m*p,x2:g,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?y-p-f:y+p,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?y-p-f:y+p,x2:i,y2:"top"===n?y-p:y+p+f,stroke:c.fill,strokeWidth:2})]})}{const t=l(r),o=l(a),i=l(s),u=l(d),g=l(h),m="left"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:y+m*(p+f/2),y1:u,x2:y+m*(p+f/2),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:u,x2:y+m*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:g,x2:y+m*(p+f),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?y-p-f:y+p,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?y-p-f:y+p,y1:i,x2:"left"===n?y-p:y+p+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=r.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*o;if(u){const o=l(t.x0),s=l(t.x1)-l(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-r:4,width:Math.max(s,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=l(t.x0),s=l(t.x1)-l(t.x0);return e.jsx("rect",{x:"left"===n?-4-r:4,y:Math.min(o,o+s),width:r,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(o/2),s=l((e.x0+e.x1)/2);i.push(u?`${s},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${s}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const s=r.length/h*(o/2),a=l((r.x0+r.x1)/2);i.push(u?`${a},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=d[0].x0?l(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=l((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-i-4:i+4}`)}const r=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?l(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=l((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${r}`)}const r=null!=d[d.length-1].x1?l(d[d.length-1].x1):a;t.push(`L${e},${r}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,l,c,s,a,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function de(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let l="";for(const e of i)l&&l.length+1+e.length>o?(r.push(l),l=e):l=l?`${l} ${e}`:e;return l&&r.push(l),r}function he(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 fe(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:l,orientation:s,align:a,wrap:c=120,noWrap:u}=t;if(!r&&!l)return e.jsx("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const p=16,g=l?u?[l]:de(l,c):[],m=r?u?[r]:de(r,c):[],y="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";g.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:g.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=g.length*p),m.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:m.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let j=null;if((l||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(g.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,g.length+m.length-1)*p;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+p+(m.length>0&&g.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),j]})}function pe(t,n,o,i,r){var l;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&s.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,l=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;s.push(e.jsx("line",{x1:i,y1:(n.y1||0)-l,x2:i,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-l;s.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.jsx("line",{x1:0,y1:(n.y1||0)-l,x2:0,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(l=null==n?void 0:n.width)&&void 0!==l?l:null==n?void 0:n.height;void 0!==t&&s.push(e.jsx("path",{d:he((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:s})}function ge(t,n,o,i,r,l){const s=[];let a=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==l?void 0:l.radius)){if("callout-rect"===r&&l){const e=l.width||0,o=l.height||0;if(e>0||o>0){const i=e/2,r=o/2,l=t-i,s=n-r;if(0!==l||0!==s){const t=Math.abs(l),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;a=i+l*h,c=r+s*h}}}else if("bracket"===r&&l){const e=l.width,t=l.height,n=l.depth||30;void 0!==e?(a=e/2,c=n):void 0!==t&&(a=n,c=t/2)}}else{const e=(l.radius||0)+(l.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);a=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-a,2)+Math.pow(n-c,2))>.5&&(s.push(e.jsx("line",{x1:a,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,l=Math.atan2(n-c,t-a);s.push(e.jsx("path",{d:`M${a},${c}L${a+o*Math.cos(l+r)},${c+o*Math.sin(l+r)}L${a+o*Math.cos(l-r)},${c+o*Math.sin(l-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:s})}function me(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:l,ny:s,note:a,connector:c,subject:u,type:d,color:h,className:f,disable:p,events:g={},"data-testid":m}=t,y=new Set(Array.isArray(p)?p:[]);let v=i||0,b=r||0;null!=l&&(v=l-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(f||"")).trim(),transform:`translate(${n},${o})`,"data-testid":m},g,{children:[!y.has("connector")&&ge(v,b,c,h,x,u),!y.has("subject")&&pe(x,u,h,n,o),!y.has("note")&&fe(a,v,b,h)]}))}function ye(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,l="string"==typeof i.type?i.type:"label",s=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),s=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.jsx(me,Object.assign({"data-testid":"semiotic-annotation"},r,{type:l}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(me,Object.assign({"data-testid":"semiotic-annotation",events:s},i,{type:l}),c)}function ve(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function be(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function xe(e,t,n){var o,i,r,l;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let a=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,c=t.y)}if(null!=a&&null!=c||(a=ve(e,n),c=be(e,n)),null!=a&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:a,y:c}),{x:a,y:c};if("sticky"===s){const e=null===(l=n.stickyPositionCache)||void 0===l?void 0:l.get(t);if(e)return e}return null}function je(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const ke={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};let we={positions:new Map};const Me=new Set;function Oe(){for(const e of Me)e()}function Se(e,t){const n=we.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(we.positions);o.delete(e),we={positions:o},Oe()}function Ae(e,t){const n=we.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(we.positions);o.delete(e),we={positions:o},Oe()}function Ce(){return we}function Le(e){return Me.add(e),()=>Me.delete(e)}const Re={positions:new Map};function ze(){return()=>{}}function Pe(){return Re}function Ie(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,l=o instanceof Date?o.getTime():o,s=i instanceof Date?i.getTime():i;if(2>t||l===s)return r?[new Date(l),new Date(s)]:[l,s];const a=(s-l)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:l+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function De(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function Ee(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function $e(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function We(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Be(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let l="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);l+=`L${Math.min(8*e+4,t)},${o+4*i}`,l+=`L${Math.min(n,t)},${o}`}return l}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let l=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);l+=`L${o+4*i},${Math.min(8*e+4,n)}`,l+=`L${o},${Math.min(t,n)}`}return l}}function Ne(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Te(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function _e(n){var o,i;const{width:r,height:a,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:f,axes:g,xLabel:m,yLabel:y,yLabelRight:v,xFormat:b,yFormat:x,axisExtent:j,showGrid:k,title:w,legend:M,legendHoverBehavior:O,legendClickBehavior:S,legendHighlightedCategory:A,legendIsolatedCategories:C,legendPosition:R="right",legendLayout:z,foregroundGraphics:P,marginalGraphics:I,xValues:D,yValues:E,annotations:$,svgAnnotationRules:W,xAccessor:B,yAccessor:N,annotationData:T,pointNodes:_,curve:H,underlayRendered:F,canvasObscuresUnderlay:q=!0,linkedCrosshairName:G,linkedCrosshairSourceId:V,children:U}=n,Z=t.useMemo(()=>{var e,t;if(!f||!h)return[];const n=null==g?void 0:g.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||b||Ne,i=Math.max(2,Math.floor(r/70)),l=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Ie(h.x,"exact"===j?Math.max(2,l):Math.min(l,i),j),a=s.map(e=>e.valueOf()),c=s.map((e,t)=>({value:e,pixel:h.x(e),label:o(e,t,a)})),u=c.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(u+8,55)):Math.max(55,u+8);let p=Te(c,d);if(p.length>1&&(p=p.filter((e,t)=>0===t||e.label+""!=p[t-1].label+"")),(null==n?void 0:n.includeMax)&&p.length>0&&"exact"!==j&&!(null==n?void 0:n.tickValues)){const e=h.x.domain()[1],t=h.x(e),n=p[p.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,p.length,a);d>t-n&&p.length>1&&(p=p.slice(0,-1)),p.push({value:e,pixel:t,label:i})}}return p},[f,h,g,b,r,j]),Y=t.useMemo(()=>{var e,t;if(!f||!h)return[];const n=null==g?void 0:g.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||x||Ne,i=Math.max(2,Math.floor(a/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let l=Te((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Ie(h.y,"exact"===j?Math.max(2,r):Math.min(r,i),j)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22);if(l.length>1&&(l=l.filter((e,t)=>0===t||e.label+""!=l[t-1].label+"")),(null==n?void 0:n.includeMax)&&l.length>0&&"exact"!==j&&!(null==n?void 0:n.tickValues)){const e=h.y.domain()[1],t=h.y(e),n=l[l.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&l.length>1&&(l=l.slice(0,-1)),l.push({value:e,pixel:t,label:i})}}return l},[f,h,g,x,a,j]),X=t.useMemo(()=>{var e,t;if(!f||!h)return[];const n=null==g?void 0:g.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||x||Ne,i=Math.max(2,Math.floor(a/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return Te((null!==(t=n.tickValues)&&void 0!==t?t:Ie(h.y,"exact"===j?Math.max(2,r):Math.min(r,i),j)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22)},[f,h,g,x,a,j]),Q=t.useRef(new Map),K=t.useRef(null!==(o=null==$?void 0:$.length)&&void 0!==o?o:0),J=null!==(i=null==$?void 0:$.length)&&void 0!==i?i:0;K.current!==J&&(K.current=J,Q.current=new Map);const ee=t.useMemo(()=>{if(!$||0===$.length)return null;const t=function(t,n,o){var i,r,a,c,u,d,h,f,g,m,y,v,b,x,j,k,w,M,O,S,A,C,L,R,z,P,I,D,E,$,W,B,N,T,_,H,F,q,G,V,U,Z,Y,X,Q,K,J,ee;switch(t.type){case"label":{const i=xe(t,n,o);if(!i)return null;const{x:r,y:l}=i;return je(r,l,o)?e.jsx(ye,{noteData:{x:r,y:l,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"callout":{const i=xe(t,n,o);if(!i)return null;const{x:r,y:l}=i;return je(r,l,o)?e.jsx(ye,{noteData:{x:r,y:l,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+n):null}case"x-threshold":{const i=ve(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",l=t.labelPosition||"top";let s;return s="bottom"===l?(o.height||0)-4:"center"===l?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:s,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=be(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",l=t.labelPosition||"right";let s,a;return"left"===l?(s=4,a="start"):"center"===l?(s=(o.width||0)/2,a="middle"):(s=(o.width||0)-4,a="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:s,y:i-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:ve(Object.assign(Object.assign({},e),{type:"point"}),o),y:be(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=l.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:ve(Object.assign(Object.assign({},e),{type:"point"}),o),y:be(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,l=i.map(e=>e.x),s=i.map(e=>e.y),a=Math.min(...l)-r,c=Math.max(...l)+r,u=Math.min(...s)-r,d=Math.max(...s)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:a,y:u,width:c-a,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(a+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],l={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=ve(n,o),s=be(n,o);if(null==r||null==s)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||l;return e.jsx("circle",Object.assign({cx:r,cy:s,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=ve(t,o),r=be(t,o);return e.jsx(ye,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const l=o.data||[];if(2>l.length)return null;const s=o.xAccessor||"x",f=o.yAccessor||"y",g="ordinal"===o.frameType,m="horizontal"===o.projection,y=g?s:null,v=g?f:null;let b;const x=[],j=new Map;if(g&&y&&v){for(const e of l){const t=e[y];if(null==t)continue;const n=t+"";j.has(n)||(j.set(n,x.length),x.push(n))}b=l.map(e=>{const t=e[y],n=e[v];if(null==t||null==n)return null;const o=j.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=l.map(e=>[e[s],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(r=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==r?r:null===(a=o.scales)||void 0===a?void 0:a.time,w=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!k||!w)return null;const M=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},O=k,S=w;let A;if(g)if(m){const e=M(S);A=(t,n)=>[O(n),e(t)]}else{const e=M(O);A=(t,n)=>[e(t),S(n)]}else A=(e,t)=>[O(e),S(t)];const C=t.method||"linear";let L;L="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),l=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(l-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){s.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))s.push([t,h/u]);else{const e=(u*p-d*h)/g;s.push([t,(h-e*d)/u+e*t])}}return s}(b,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===C?p.default.polynomial(b,{order:t.order||2}):p.default.linear(b)).points;const R=L.map(([e,t])=>{const[n,o]=A(e,t);return`${n},${o}`}).join(" "),z=t.color||"#6366f1",P=L[L.length-1],[I,D]=A(P[0],P[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:R,fill:"none",stroke:z,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:I+4,y:D-4,fill:z,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(g=null===(f=o.scales)||void 0===f?void 0:f.y)&&void 0!==g?g:null===(m=o.scales)||void 0===m?void 0:m.value,r=null!==(y=null==i?void 0:i(t.y0))&&void 0!==y?y:0,l=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,l),width:o.width||0,height:Math.abs(l-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,l)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",l=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(j=o.scales)||void 0===j?void 0:j.time,a=null!==(w=null===(k=o.scales)||void 0===k?void 0:k.y)&&void 0!==w?w:null===(M=o.scales)||void 0===M?void 0:M.value;if(!l||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const f=ke[o.curve||"linear"]||s.curveLinear,p=s.area().x(e=>l(e[r])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:g,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:l(h[h.length-1][r])+4,y:a(h[h.length-1][c])-4,fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",l=null!==(A=null===(S=o.scales)||void 0===S?void 0:S.x)&&void 0!==A?A:null===(C=o.scales)||void 0===C?void 0:C.time,s=null!==(R=null===(L=o.scales)||void 0===L?void 0:L.y)&&void 0!==R?R:null===(z=o.scales)||void 0===z?void 0:z.value;if(!l||!s)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,d=Math.sqrt(u),h=null!==(P=t.threshold)&&void 0!==P?P:2,f=c-h*d,p=!1!==t.showBand,g=t.fill||"#6366f1",m=null!==(I=t.fillOpacity)&&void 0!==I?I:.1,y=t.anomalyColor||"#ef4444",v=null!==(D=t.anomalyRadius)&&void 0!==D?D:6,b=s(c+h*d),x=s(f),j=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:g,fillOpacity:m}),j.map((t,n)=>{const i=ve(t,o),r=be(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",l=o.yAccessor||"y",s=null!==($=null===(E=o.scales)||void 0===E?void 0:E.x)&&void 0!==$?$:null===(W=o.scales)||void 0===W?void 0:W.time,a=null!==(N=null===(B=o.scales)||void 0===B?void 0:B.y)&&void 0!==N?N:null===(T=o.scales)||void 0===T?void 0:T.value;if(!s||!a)return null;const c=i.map(e=>[e[r],e[l]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=p.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const l=(e*i-t*n)/r,s=(n-l*t)/e;u=e=>s+l*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),g=c.reduce((e,t)=>e+t[0],0)/d,m=c.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),y=null!==(_=t.confidence)&&void 0!==_?_:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(H=t.steps)&&void 0!==H?H:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*j);const w=[];for(const e of k){const t=u(e),n=f*Math.sqrt(1+1/d+(m>0?Math.pow(e-g,2)/m:0))*v;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const M=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),S=`${s(x)},${a(u(x))}`,A=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:M,fill:t.fill||"#6366f1",fillOpacity:null!==(F=t.fillOpacity)&&void 0!==F?F:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:A,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&w.length>0&&e.jsx("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:A,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=xe(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!je(i,r,o))return null;const l=null!==(V=t.dx)&&void 0!==V?V:0,s=null!==(U=t.dy)&&void 0!==U?U:0,a=null!==(Z=t.width)&&void 0!==Z?Z:32,c=null!==(Y=t.height)&&void 0!==Y?Y:32,u=null!==(X=t.content)&&void 0!==X?X:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+l-a/2,y:r+s-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=xe(t,n,o);if(!i)return null;const{x:r,y:l}=i;return e.jsx("text",{x:r+(t.dx||0),y:l+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,l=null===(Q=o.scales)||void 0===Q?void 0:Q.o,s=null===(K=o.scales)||void 0===K?void 0:K.x,a=null===(J=o.scales)||void 0===J?void 0:J.y,c=r(l)?l:r(s)?s:r(a)?a:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,p=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===s)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+n)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:B,yAccessor:N,width:r,height:a,data:T,frameType:"xy",pointNodes:_,curve:H,stickyPositionCache:Q.current};return $.map((e,o)=>{if(W){const i=W(e,o,n);return null!=i?i:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[$,W,r,a,B,N,T,h,_,H]),te=function(e){var n;const o=t.useSyncExternalStore(e?Le:ze,e?Ce:Pe,e?Ce:Pe);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(G);return t.useEffect(()=>{if(!(null==te?void 0:te.locked)||!G)return;const e=e=>{"Escape"===e.key&&Ae(G)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==te?void 0:te.locked,G]),f||w||M||P||I||ee&&ee.length>0||k||U||te?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof w?w:"XY Chart"}),e.jsx("desc",{children:"string"==typeof w?w+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[k&&h&&(!F||q)&&(()=>{var t,n;const o=We(null===(t=null==g?void 0:g.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=We(null===(n=null==g?void 0:g.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[Z.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:a,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),Y.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),f&&h&&(()=>{const t=null==g?void 0:g.find(e=>"left"===e.orient),n=null==g?void 0:g.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,l=(null==t?void 0:t.jaggedBase)||!1,s=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&Z.length>1&&(()=>{const e=r/Math.max(Z.length-1,1);return Z.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 10px)"},j={fontSize:"calc(var(--semiotic-tick-font-size, 10px) + 1px)"},k={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},w=null==n?void 0:n.tickAnchor,M=null==t?void 0:t.tickAnchor,O=$e(Z),S=$e(Y);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!F||q)&&i&&!s&&e.jsx("line",{x1:0,y1:a,x2:r,y2:a,stroke:h,strokeWidth:1}),(!F||q)&&s&&e.jsx("path",{d:Be("bottom",r,a),fill:"none",stroke:h,strokeWidth:1}),Z.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):L(t.value,n>0?Z[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${a})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":De(w,t.pixel===O.min,t.pixel===O.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+n)}),m&&e.jsx("text",{x:r/2,y:a+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:m})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!F||q)&&o&&!l&&e.jsx("line",{x1:0,y1:0,x2:0,y2:a,stroke:h,strokeWidth:1}),(!F||q)&&l&&e.jsx("path",{d:Be("left",r,a),fill:"none",stroke:h,strokeWidth:1}),Y.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):L(t.value,n>0?Y[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:Ee(M,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||y;return n?e.jsx("text",{x:15-d.left,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-d.left}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:n}):null})()]}),(()=>{const t=null==g?void 0:g.find(e=>"right"===e.orient);if(!t||0===X.length)return null;const n=!1!==t.baseline,o=t.landmarkTicks,i=t.label||v,l=t.tickAnchor,s=$e(X);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e.jsx("line",{x1:r,y1:0,x2:r,y2:a,stroke:h,strokeWidth:1}),X.map((t,n)=>{const i=!!o&&("function"==typeof o?o(t.value,n):L(t.value,n>0?X[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:Ee(l,t.pixel===s.min,t.pixel===s.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?j:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+n)}),i&&e.jsx("text",{x:r+d.right-15,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${r+d.right-15}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:i})]})})()]})})(),ee,I&&h&&D&&E&&e.jsxs(e.Fragment,{children:[I.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ue,{orient:"top",config:ce(I.top),values:D,scale:h.x,size:d.top,length:r})}),I.bottom&&e.jsx("g",{transform:`translate(0, ${a})`,children:e.jsx(ue,{orient:"bottom",config:ce(I.bottom),values:D,scale:h.x,size:d.bottom,length:r})}),I.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ue,{orient:"left",config:ce(I.left),values:E,scale:h.y,size:d.left,length:a})}),I.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(ue,{orient:"right",config:ce(I.right),values:E,scale:h.y,size:d.right,length:a})})]}),P,te&&te.sourceId!==V&&(null==h?void 0:h.x)&&(()=>{const t=h.x(te.xValue);if(null==t||0>t||t>r)return null;const n=te.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:a,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),U]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof w?w:null}),ae({legend:M,totalWidth:c,totalHeight:u,margin:d,legendPosition:R,title:w,legendLayout:z,legendHoverBehavior:O,legendClickBehavior:S,legendHighlightedCategory:A,legendIsolatedCategories:C})]}):null}function He(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Fe="undefined"==typeof window||"undefined"==typeof document,qe="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Ge=()=>()=>{},Ve=()=>!1,Ue=()=>!0;function Ze(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).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 Ye(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 Xe(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}const Qe=f.createContext(null),Ke={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Je(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],l=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of l)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const et=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},tt="semiotic-accessible-data-table",nt=tt+" semiotic-accessible-data-table-hidden",ot=tt+" semiotic-accessible-data-table-visible",it={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"},rt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},lt={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)"},st={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},at={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))"},ct={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},ut={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function dt({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[l,s]=f.useState(!1),a=f.useContext(Qe),c=null!==(r=null==a?void 0:a.visible)&&void 0!==r&&r,u=l||c,d=f.useRef(null),h=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n,p=f.useCallback(()=>{l||c||s(!0)},[l,c]),g=f.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[c]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Ke}):null;if(!u)return e.jsx("div",{id:o,className:nt,tabIndex:-1,onFocus:p,style:Ke,role:"region","aria-label":h,children:e.jsxs("button",{type:"button",onClick:()=>s(!0),children:["View data summary (",t.length," elements)"]})});const m=function(e){var t,n,o,i,r,l,s,a,c,u,d,h,f,p,g,m,y,v,b,x,j,k,w,M,O;const S=[];if(!Array.isArray(e))return S;for(const A of e)if(A&&"object"==typeof A&&null!==A.datum)try{switch(A.type){case"point":S.push({label:"Point",values:{x:A.x,y:A.y}});break;case"line":{const e=A.path,t=Array.isArray(A.datum)?A.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=A.topPath,t=Array.isArray(A.datum)?A.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=A.datum&&"object"==typeof A.datum?A.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:A.group)&&void 0!==n?n:"",l=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,value:null!=l?l:""}});break}case"heatcell":S.push({label:"Cell",values:{x:A.x,y:A.y,value:A.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(a=null!==(l=null===(r=A.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:null===(s=A.datum)||void 0===s?void 0:s.label)&&void 0!==a?a:"",value:null!==(u=null===(c=A.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=A.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(f=A.cx)&&void 0!==f?f:A.x,y:null!==(p=A.cy)&&void 0!==p?p:A.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(m=null===(g=A.datum)||void 0===g?void 0:g.id)&&void 0!==m?m:"",x:null!==(y=A.cx)&&void 0!==y?y:A.x,y:null!==(v=A.cy)&&void 0!==v?v:A.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:A.x,open:A.open,high:A.high,low:A.low,close:A.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(w=null!==(j=null===(x=null===(b=A.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==j?j:null===(k=A.datum)||void 0===k?void 0:k.name)&&void 0!==w?w:"",value:null!==(O=null===(M=A.datum)||void 0===M?void 0:M.value)&&void 0!==O?O:""}})}}catch(e){}return S}(t),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${et(e.min)} to ${et(e.max)}, mean ${et(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,y),b=m.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const j=Array.from(x);return e.jsxs("div",{ref:d,id:o,className:ot,tabIndex:-1,onBlur:g,style:it,role:"region","aria-label":h,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&a&&a.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:lt,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:rt,children:v}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:st,children:[e.jsxs("caption",{className:"semiotic-accessible-data-table-caption",style:ut,children:["First ",b.length," of ",m.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:at,children:"type"}),j.map(t=>e.jsx("th",{style:at,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:ct,children:t.label}),j.map(n=>{return e.jsx("td",{style:ct,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":et(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function ht({summary:t}){return t?e.jsx("div",{role:"note",style:Ke,children:t}):null}function ft({tableId:t}){return e.jsx("a",{href:"#"+t,style:Ke,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Ke)},children:"Skip to data table"})}function pt({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Ke,children:n})}const gt=Object.freeze([]);function mt(e){if(!e)return gt;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}const yt="var(--semiotic-focus, #005fcc)";function vt({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:l,height:s}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=l&&null!=s){const t=Math.max(l,4),n=Math.max(s,4);u=e.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:yt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:yt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:yt,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}const bt={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 xt(e,t){return"function"==typeof t?t(e):e[t]}function jt(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 kt(t={}){const{fields:n,title:o,format:i,style:r={},className:l=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const a=[];if(o){const e=xt(t,o);s=jt(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const l=xt(t,o);a.push({label:n,value:jt(l,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=jt(t[n],i);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=jt(t[e[0]],i))}}const c=Object.assign(Object.assign({},bt),r);return e.jsxs("div",{className:("semiotic-tooltip "+l).trim(),style:c,children:[s&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&s?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function wt(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=(r=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t,Array.isArray(r)?r[0]:r);var r;const l=n(i);return null==l?null:e.jsx("div",{className:"semiotic-tooltip",style:bt,children:l})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?kt(t):kt())}}function Mt({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:l,className:s="stream-frame-tooltip",zIndex:a=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=f.useRef(null),[d,h]=f.useState(null);f.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[l,s,o,i]);let p;p=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const g=function(e){if(!f.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(l),m=g?null:bt;return c?e.jsx("div",{ref:u,className:g?s:(s+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},m||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:p,pointerEvents:"none",zIndex:a,width:"max-content"}),children:l}):null}function Ot(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function St(e,t,n=.6){var o,i,r,l,s;if(!Ot(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(s=null!==(l=t.cy)&&void 0!==l?l:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function At(e,t,n,o=.35){Ot(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Ct(e){switch(e){case"monotoneX":return s.curveMonotoneX;case"monotoneY":return s.curveMonotoneY;case"cardinal":return s.curveCardinal;case"catmullRom":return s.curveCatmullRom;case"step":return s.curveStep;case"stepBefore":return s.curveStepBefore;case"stepAfter":return s.curveStepAfter;case"basis":return s.curveBasis;case"natural":return s.curveNatural;default:return null}}function Lt(e,t,n){return null==t?n:"string"!=typeof t?t:X(e,t)||n}function Rt(e,t,n,o,i,r){const l=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>l.length)return null;const s=e.createLinearGradient(n,o,i,r);for(const e of l)s.addColorStop(e.offset,e.color);return s}function zt(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Pt(e,t,n,o,i,r){if(2>t.length)return;const l=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];l.push(l[e-1]+Math.sqrt(n*n+o*o))}const s=l[l.length-1];if(0===s)return;const a=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(l[n]+l[n+1])/2;let r=i;a>o&&(r*=o/a),a>s-o&&(r*=(s-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function It(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,l=t[1]*o,s=t[0]+"px",a=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===l||(e.width=r,e.height=l),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function Dt(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Et([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function $t(e,t,n,o,i){return"function"==typeof e?e(t,n,o,i):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",i>1?"@2x":"")}class Wt{constructor(e=256){this.cache=new Map,this.limit=e}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,o]of this.cache)t>o.lastUsed&&(t=o.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}}class Bt{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let i=0;this.capacity>i;i++){const r=this.particles[i];if(!r.active)continue;const l=n[r.lineIndex];if(!l||2>l.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const s=Nt(l),a=Tt(l,r.t*s),c=(o[r.lineIndex]||2)/2;r.x=a.x+a.nx*r.offset*c*2,r.y=a.y+a.ny*r.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function Nt(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+i*i)}return t}function Tt(e,t){let n=0;for(let o=1;e.length>o;o++){const i=e[o][0]-e[o-1][0],r=e[o][1]-e[o-1][1],l=Math.sqrt(i*i+r*r);if(n+l>=t||o===e.length-1){const s=l>0?(t-n)/l:0,a=l>.001?l:1;return{x:e[o-1][0]+i*s,y:e[o-1][1]+r*s,nx:-r/a,ny:i/a}}n+=l}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const _t={top:10,right:10,bottom:10,left:10},Ht={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"},Ft={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function qt(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Gt(e){return e?e.getContext("2d"):null}function Vt({data:t}){if(!t)return null;if(t.properties)return e.jsx("div",{className:"semiotic-tooltip",style:Ht,children:e.jsx("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const n=null!=t.data?t.data:t;if(!n||"object"!=typeof n)return null;const o=Object.entries(n).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===o.length?null:e.jsx("div",{className:"semiotic-tooltip",style:Ht,children:o.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),e.jsx("span",{style:{fontWeight:600},children:n+""})]},t))})}Vt.ownsChrome=!0;const Ut=t.forwardRef(function(n,o){var i,r,l,a,d,h,f,p,g,m;const{projection:y,projectionExtent:v,fitPadding:b,projectionTransform:x,areas:j,points:k,lines:w,xAccessor:M,yAccessor:O,lineDataAccessor:A,pointIdAccessor:C,lineIdAccessor:L,lineType:z="geo",flowStyle:P="basic",graticule:I,zoomable:E,zoomExtent:$,onZoom:W,dragRotate:B,showParticles:N,particleStyle:T,tileURL:_,tileAttribution:H,tileCacheSize:F,size:q,width:G,height:V,responsiveWidth:U,responsiveHeight:Z,margin:Y,className:Q,background:K,areaStyle:ee,pointStyle:te,lineStyle:ne,colorScheme:oe,enableHover:ie=!0,hoverAnnotation:re,tooltipContent:le,customClickBehavior:se,customHoverBehavior:ae,annotations:ce,decay:ue,pulse:de,transition:he,animate:fe,staleness:pe,backgroundGraphics:ge,foregroundGraphics:me,title:ye,legend:ve,legendPosition:be,legendLayout:xe,legendHoverBehavior:je,legendClickBehavior:ke,legendHighlightedCategory:we,legendIsolatedCategories:Me,legendCategoryAccessor:Oe,onCategoriesChange:Se,showAxes:Ae,accessibleTable:Ce=!0,description:Le,summary:Re}=n,ze=q||[G||600,V||400],Pe=t.useRef(!0),Ie=J({sizeProp:ze,responsiveWidth:U,responsiveHeight:Z,userMargin:Y,marginDefault:_t,foregroundGraphics:me,backgroundGraphics:ge,animate:fe,transitionProp:he,themeDirtyRef:Pe}),{reducedMotionRef:De,responsiveRef:Ee,size:$e,margin:We,adjustedWidth:Be,adjustedHeight:Ne,resolvedForeground:Te,resolvedBackground:Qe,transition:Ke,introEnabled:et,tableId:tt,rafRef:nt,renderFnRef:ot,scheduleRender:it,currentTheme:rt}=Ie,lt=function(){const[e,n]=t.useState(!1);return qe(()=>{n(!0)},[]),e}(),st=function(){const e=t.useSyncExternalStore(Ge,Ve,Ue);return t.useRef(e).current}(),at=t.useMemo(()=>Array.isArray(j)?mt(j):j,[j]),ct=t.useMemo(()=>mt(k),[k]),ut=t.useMemo(()=>mt(w),[w]),gt=t.useMemo(()=>null!=B?B:"orthographic"===qt(y),[B,y]),yt=t.useMemo(()=>{var e,t;return{projection:y,projectionExtent:v,fitPadding:b,xAccessor:M,yAccessor:O,lineDataAccessor:A,lineType:z,flowStyle:P,areaStyle:ee,pointStyle:te,lineStyle:ne,colorScheme:oe,themeSemantic:D(rt),themeSequential:null===(e=null==rt?void 0:rt.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==rt?void 0:rt.colors)||void 0===t?void 0:t.diverging,graticule:I,projectionTransform:x,decay:ue,pulse:de,transition:Ke,introAnimation:et,annotations:ce,pointIdAccessor:C,lineIdAccessor:L}},[y,v,b,M,O,A,z,P,ee,te,ne,oe,I,x,ue,de,null==Ke?void 0:Ke.duration,null==Ke?void 0:Ke.easing,et,ce,C,L,rt]),bt=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ye(e,t);if(!Xe(e)||!Xe(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Ye(n,i))return!1}else{if(!Xe(n)||!Xe(i))return!1;if(!Ze(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(yt),xt=t.useRef(null);xt.current||(xt.current=new S(bt));const jt=t.useRef(null),kt=t.useRef(null),wt=t.useRef(null),Ot=t.useRef(null),Nt=t.useRef(null);_&&!Nt.current&&(Nt.current=new Wt(F||256));const Tt=t.useRef(ce),Ht=t.useRef(null),Ut=t.useRef(c.zoomIdentity),Zt=t.useRef(!1),Yt=t.useRef(null),Xt=t.useCallback(e=>{Yt.current=e,Ee&&"object"==typeof Ee&&(Ee.current=e)},[Ee]),Qt=t.useRef(null),Kt=t.useRef(null),Jt=t.useRef(null),en=t.useRef(0);if(N&&!Jt.current){const e=null!==(i=null==T?void 0:T.maxPerLine)&&void 0!==i?i:30;Jt.current=new Bt(50*e)}const tn=t.useRef(null),nn=t.useRef(null),[on,rn]=t.useState(null),[ln,sn]=t.useState(0),[an,cn]=t.useState(!1),un=t.useRef([]),dn=t.useRef(Oe),hn=t.useRef(Se);dn.current=Oe,hn.current=Se;const fn=t.useCallback(()=>{var e,t;const n=dn.current,o=hn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=xt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[],n);(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})(i,un.current)||(un.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=xt.current)||void 0===e||e.updateConfig(bt),Pe.current=!0,it()},[bt,it]),t.useEffect(()=>{const e=xt.current;e&&(at&&e.setAreas(at),k&&e.setPoints(ct),w&&e.setLines(ut),Pe.current=!0,it())},[at,k,ct,w,ut,it]);const pn=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=xt.current)||void 0===t||t.pushPoint(e),Pe.current=!0,it())},[it]),gn=t.useCallback(e=>{var t;const n=mt(e);0!==n.length&&(null===(t=xt.current)||void 0===t||t.pushMany(n),Pe.current=!0,it())},[it]),mn=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=xt.current)||void 0===t||t.pushLine(e),Pe.current=!0,it())},[it]),yn=t.useCallback(e=>{var t;const n=mt(e);0!==n.length&&(null===(t=xt.current)||void 0===t||t.pushManyLines(n),Pe.current=!0,it())},[it]),vn=t.useCallback(()=>{var e;null===(e=xt.current)||void 0===e||e.clear(),Pe.current=!0,it()},[it]);t.useImperativeHandle(o,()=>({push:pn,pushMany:gn,removePoint:e=>{var t,n;const o=null!==(n=null===(t=xt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Pe.current=!0,it()),o},pushLine:mn,pushManyLines:yn,removeLine:e=>{var t,n;const o=null!==(n=null===(t=xt.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&(Pe.current=!0,it()),o},getLines:()=>{var e,t;return null!==(t=null===(e=xt.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:vn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=xt.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.projection)&&void 0!==n?n:null},getGeoPath:()=>{var e,t,n;return null!==(n=null===(t=null===(e=xt.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.geoPath)&&void 0!==n?n:null},getCartogramLayout:()=>{var e,t;return null!==(t=null===(e=xt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>Ut.current.k,resetZoom:()=>{const e=Yt.current;e&&Ht.current&&u.select(e).call(Ht.current.transform,c.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=xt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[pn,gn,mn,yn,vn,it]);const{hoverHandlerRef:bn,onPointerMove:xn,onPointerLeave:jn}=Ie;t.useEffect(()=>{bn.current=e=>{if(!ie)return;const t=xt.current;if(!t||!t.scene.length)return;const n=kt.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-We.left,r=e.clientY-o.top-We.top;if(0>i||i>Be||0>r||r>Ne)return tn.current=null,nn.current=null,rn(null),null==ae||ae(null),void it();Ot.current||(Ot.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const l=Gt(Ot.current);if(!l)return;const s=R(t.scene,i,r,30,l,t.quadtree,t.maxPointRadius);if(s){const e=s.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,l;"point"===e.type?(o=e.x,l=e.y):"geoarea"===e.type?(o=e.centroid[0],l=e.centroid[1]):(o=i,l=r);const a=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,__semioticHoverData:!0,x:o,y:l});tn.current=a,nn.current=e,rn(a),null==ae||ae(a),it()}else tn.current&&(tn.current=null,nn.current=null,rn(null),null==ae||ae(null),it())}},[ie,Be,Ne,We,ae,it]),Ie.hoverLeaveRef.current=()=>{tn.current=null,nn.current=null,rn(null),null==ae||ae(null),it()};const kn=t.useCallback(e=>{if(!se)return;const t=xt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-We.left,i=e.clientY-n.top-We.top;Ot.current||(Ot.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=Gt(Ot.current);if(!r)return;const l=R(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(l){const e=l.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;se(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[se,We]),wn=t.useRef(-1),Mn=t.useRef(null),On=t.useCallback(e=>{const t=xt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=wn.current,i=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===i)return;if(e.preventDefault(),0>i)return wn.current=-1,Mn.current=null,tn.current=null,nn.current=null,rn(null),null==ae||ae(null),void it();const r=0>o?0:i;wn.current=r;const l=n[r];Mn.current={shape:l.shape,w:l.w,h:l.h};const s=l.datum,a=Object.assign(Object.assign(Object.assign({},s||{}),(null==s?void 0:s.properties)||{}),{data:s,properties:null==s?void 0:s.properties,x:l.x,y:l.y,__semioticHoverData:!0});tn.current=a,rn(a),null==ae||ae(a),it()},[ae,it]),Sn=t.useCallback(e=>{wn.current=-1,Mn.current=null,xn(e)},[xn]);ot.current=()=>{var e,t,n,o,i,r,l,a;nt.current=0;const c=kt.current,u=xt.current;if(!c||!u)return;const d=performance.now();let h=!1;const f=Kt.current;f&&(Kt.current=null,u.applyRotation(f,{width:Be,height:Ne}));const p=u.advanceTransition(De.current?d+1e6:d),g=!De.current&&p;if(Pe.current&&!p){const e={width:Be,height:Ne},t=gt?u.getRotation():null;u.computeScene(e);const n=Ut.current,o=1!==n.k||0!==n.x||0!==n.y;gt&&t?o?(u.setRotation(t),u.applyZoomScale(n.k,e)):u.applyRotation(t,e):o&&u.applyZoomTransform(n,e),Pe.current=!1,c.setAttribute("aria-label",Je(u.scene,"Geographic chart")),fn()}const m=Dt();if(_&&Nt.current){const t=jt.current;if(t&&(null===(e=u.scales)||void 0===e?void 0:e.projection)){const e=It(t,$e,We,m);if(e){e.clearRect(-We.left,-We.top,$e[0],$e[1]),e.save(),e.beginPath(),e.rect(0,0,Be,Ne),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:l,onTileLoad:s}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,l=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(l),a=1<<s,c=Math.pow(2,l-s+8),u=o[0]-n/2,d=o[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?a:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(r?0:-1/0,Math.floor((0-d)/c)),g=Math.min(r?a:1/0,Math.ceil((t[1]-d)/c)),m=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)m.push([t,e,s]);return{tiles:m,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=Dt();let h=!0;for(const t of u.tiles){const[o,i,r]=Et(t),a=`${r}/${o}/${i}`;let c=l.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};l.set(a,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=$t(n,r,o,i,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(e,{tileURL:_,projection:u.scales.projection,width:Be,height:Ne,tileCache:Nt.current,onTileLoad:()=>it()});e.restore(),t||(h=!0)}}}const y=It(c,$e,We,m);if(!y)return;if(y.clearRect(-We.left,-We.top,$e[0],$e[1]),K&&!_){const e=X(y,K);e&&(y.fillStyle=e,y.fillRect(0,0,Be,Ne))}y.save(),y.beginPath(),y.rect(0,0,Be,Ne),y.clip();const v=u.scene,b={width:Be,height:Ne};if(function(e,t){var n,o,i;const r=t.filter(e=>"geoarea"===e.type);for(const t of r){if(!t.pathData)continue;const r=new Path2D(t.pathData),l=t.style.fill||"#e0e0e0";if("none"!==l&&(e.fillStyle=l,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=X(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(i=t._decayOpacity)&&void 0!==i?i:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(r)}At(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(y,v),((e,t,n,o)=>{var i,r;const l=t.filter(e=>"line"===e.type);for(const a of l){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",d=X(e,u)||u,h=a.style.strokeWidth||2,f=a.colorThresholds,p=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=h,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;Pt(e,a.path,d,h,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=Ct(a.curve),m=f&&f.length>0&&p&&p.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!m){e.strokeStyle=d;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(y[x]+y[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(m){let j=null,k=null,w=null,M=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function A(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[L,R]=a.path[C],z=p[C],P=zt(z,f,d);if(null!==j&&null!==M&&null!==w){if(P===M)e.lineTo(L,R);else{const I=[];for(const D of f){const E=D.value;(w>E||E>z)&&(E>w||z>E)||w===E||z===E||I.push({t:(E-w)/(z-w)})}I.sort((e,t)=>e.t-t.t);for(const $ of I){const W=j+(L-j)*$.t,B=k+(R-k)*$.t,N=zt(w+(z-w)*Math.min($.t+1e-4,1),f,d);e.lineTo(W,B),A(),S(N,W,B)}e.lineTo(L,R)}j=L,k=R,w=z,M=P}else S(P,L,R),j=L,k=R,w=z,M=P}A()}else{e.beginPath();const T=a.strokeGradient&&a.path.length>=2?Rt(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=T||d,g)s.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[_,H]=a.path[0];e.moveTo(_,H);for(let F=1;a.path.length>F;F++)e.lineTo(a.path[F][0],a.path[F][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=Lt(e,a.style.fill,a.style.fill),g&&!m)s.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[G,V]=a.path[0];e.moveTo(G,V);for(let U=1;a.path.length>U;U++)e.lineTo(a.path[U][0],a.path[U][1])}const q=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(q,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(y,v,0,b),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=Lt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Lt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),St(e,t),e.globalAlpha=1}}finally{e.restore()}}})(y,v),N&&Jt.current){const e=Jt.current,s=v.filter(e=>"line"===e.type);if(s.length>0){const a=T||{},c=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),u=null!==(n=a.maxPerLine)&&void 0!==n?n:30,f=null!==(o=a.spawnRate)&&void 0!==o?o:.15,p=null!==(i=a.radius)&&void 0!==i?i:2,g=null!==(r=a.opacity)&&void 0!==r?r:.7,m=d/1e3,v=en.current>0?Math.min(m-en.current,.1):.016;en.current=m;const b=s.map(e=>e.path),x=s.map(e=>e.style.strokeWidth||2);for(let t=0;s.length>t;t++)Math.random()<f&&e.countForLine(t)<u&&e.spawn(t);e.step(v,c,b,x),y.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=s[n.lineIndex],i="function"==typeof a.color?a.color(null!==(l=null==o?void 0:o.datum)&&void 0!==l?l:{}):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";y.beginPath(),y.arc(n.x,n.y,p,0,2*Math.PI),y.fillStyle=i,y.fill()}y.globalAlpha=1,h=!0}}y.restore();const x=wt.current;if(x){const e=It(x,$e,We,m);if(e){e.clearRect(-We.left,-We.top,$e[0],$e[1]);const t=nn.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof re?re:void 0,i=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(pe){const e=performance.now()-u.lastIngestTime>(null!==(a=pe.threshold)&&void 0!==a?a:5e3);e!==an&&cn(e)}const j=ce!==Tt.current;j&&(Tt.current=ce),(Pe.current||j)&&sn(e=>e+1),(g||null!=u.activeTransition||u.hasActivePulses||h)&&(nt.current=requestAnimationFrame(()=>ot.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:l,cleanup:s}=e;qe(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,l.current()},[n,o]);const a=t.useRef(s);a.current=s,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:lt,wasHydratingFromSSR:st,storeRef:xt,dirtyRef:Pe,renderFnRef:ot,cleanup:()=>{var e;return null===(e=Nt.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Pe.current=!0,it()},[Be,Ne,K,it]),function(e,n,o,i,r,l){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const s=n.current;if(!s||0===s.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=a-s.lastIngestTime>c;u!==r&&(l(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(pe,xt,Pe,it,an,cn),t.useEffect(()=>{if("production"!==process.env.NODE_ENV&&_){const e=qt(y);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[_,y]),t.useEffect(()=>{const e=Yt.current;if(!E||!e)return Ht.current&&e&&(u.select(e).on(".zoom",null),Ht.current=null),void(e&&u.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=$||[1,8],o={width:Be,height:Ne};if(gt){let i=Ut.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),Ut.current=c.zoomIdentity.scale(i);const l=xt.current;l&&(l.applyZoomScale(i,o),Pe.current=!1,it(),(null===(r=l.scales)||void 0===r?void 0:r.projection)&&(null==W||W({projection:l.scales.projection,zoom:l.currentZoom})))};Ht.current={scaleBy:(e,t)=>r(i*t),transform:(e,t)=>{var n;return r(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const l=e=>{e.preventDefault(),r(i*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),r(1.5*i))};e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("dblclick",s);const a=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=xt.current;if(!o)return;const i=o.getRotation();Qt.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Qt.current;t&&(Kt.current=[t.rotation[0]+(e.clientX-t.x)*a,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*a)),t.rotation[2]],it())},h=t=>{var n;if(!Qt.current)return;Qt.current=null,e.releasePointerCapture(t.pointerId);const i=Kt.current;if(i){Kt.current=null;const e=xt.current;e&&(e.applyRotation(i,o),it())}const r=xt.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==W||W({projection:r.scales.projection,zoom:r.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",l),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),Ht.current=null}}const i=c.zoom().scaleExtent([t,n]).extent([[0,0],[$e[0],$e[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;Ut.current=t,Zt.current=!0;const n=xt.current;n&&(n.applyZoomTransform(t,o),Pe.current=!1,it())}).on("end",e=>{var t;Ut.current=e.transform,Zt.current=!1;const n=xt.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==W||W({projection:n.scales.projection,zoom:n.currentZoom}))});return Ht.current=i,u.select(e).call(i),()=>{u.select(e).on(".zoom",null)}},[E,$,gt,$e,Be,Ne,We,W,it]);const An=ie&&!1!==re,Cn=An&&on?le?le(on):e.jsx(Vt,{data:on}):null,Ln=Cn?e.jsx(Mt,{x:on.x,y:on.y,containerWidth:Be,containerHeight:Ne,margin:We,className:"stream-frame-tooltip",zIndex:10,children:Cn}):null;if(Fe||!lt&&st){const t=xt.current;t&&(at||k||w)&&(at&&t.setAreas(at),k&&t.setPoints(ct),w&&t.setLines(ut),t.computeScene({width:Be,height:Ne}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[];return e.jsxs("div",{ref:Xt,className:"stream-geo-frame"+(Q?" "+Q:""),role:"img","aria-label":Le||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:U?"100%":$e[0],height:Z?"100%":$e[1]},children:[e.jsx(ht,{summary:Re}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:$e[0],height:$e[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${We.left},${We.top})`,children:Qe}),e.jsxs("g",{transform:`translate(${We.left},${We.top})`,children:[K&&e.jsx("rect",{x:0,y:0,width:Be,height:Ne,fill:K}),n.map((t,n)=>function(t,n){var o,i,r,l,s,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e.jsx("path",{d:r.pathData,fill:He(r.style.fill,"#e0e0e0"),fillOpacity:null!==(o=r.style.fillOpacity)&&void 0!==o?o:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(i=r._decayOpacity)&&void 0!==i?i:1},"geoarea-"+n):null}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:He(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(l=o._decayOpacity)&&void 0!==l?l:null!==(s=o.style.opacity)&&void 0!==s?s:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const i="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(a=o.style.opacity)&&void 0!==a?a:1},"line-"+n)}default:return null}}(t,n))]})]}),e.jsx(_e,{width:Be,height:Ne,totalWidth:$e[0],totalHeight:$e[1],margin:We,scales:null,showAxes:!1,title:ye,legend:ve,legendPosition:be,legendLayout:xe,legendHoverBehavior:je,legendClickBehavior:ke,legendHighlightedCategory:we,legendIsolatedCategories:Me,foregroundGraphics:Te,annotations:ce,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)})]})}return e.jsxs("div",{ref:Xt,className:"stream-geo-frame"+(Q?" "+Q:""),role:"group","aria-label":Le||("string"==typeof ye?ye:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:U?"100%":$e[0],height:Z?"100%":$e[1],overflow:"hidden"},E?{touchAction:"none"}:{}),onKeyDown:On,children:[Ce&&e.jsx(ft,{tableId:tt}),Ce&&e.jsx(dt,{scene:null!==(a=null===(l=xt.current)||void 0===l?void 0:l.scene)&&void 0!==a?a:[],chartType:"Geographic chart",tableId:tt,chartTitle:"string"==typeof ye?ye:void 0}),e.jsx(ht,{summary:Re}),e.jsxs("div",{role:"img","aria-label":Le||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:An?Sn:void 0,onMouseLeave:An?jn:void 0,onClick:se?kn:void 0,children:[Qe&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:$e[0],height:$e[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${We.left},${We.top})`,children:Qe})}),_&&e.jsx("canvas",{ref:jt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx("canvas",{ref:kt,"aria-label":Je(null!==(h=null===(d=xt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:wt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(pt,{hoverPoint:on}),e.jsx(_e,{width:Be,height:Ne,totalWidth:$e[0],totalHeight:$e[1],margin:We,scales:null,showAxes:null!=Ae&&Ae,title:ye,legend:ve,legendPosition:be,legendLayout:xe,legendHoverBehavior:je,legendClickBehavior:ke,legendHighlightedCategory:we,legendIsolatedCategories:Me,foregroundGraphics:Te,annotations:ce,annotationFrame:ln,xValues:[],yValues:[],pointNodes:null===(f=xt.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type)}),(null==pe?void 0:pe.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===pe.badgePosition?{top:4,left:4}:"bottom-left"===pe.badgePosition?{bottom:4,left:4}:"bottom-right"===pe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:an?"#dc3545":"#28a745",color:"white"}),children:an?"STALE":"LIVE"}),E&&e.jsxs("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:We.bottom+8,left:We.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e.jsx("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Yt.current,n=Ht.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1.5)},style:Ft,children:"+"}),e.jsx("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Yt.current,n=Ht.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1/1.5)},style:Ft,children:"−"})]}),H&&e.jsx("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:We.bottom+2,right:We.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:H}),e.jsx(vt,{active:wn.current>=0,hoverPoint:on,margin:We,size:$e,shape:null===(p=Mn.current)||void 0===p?void 0:p.shape,width:null===(g=Mn.current)||void 0===g?void 0:g.w,height:null===(m=Mn.current)||void 0===m?void 0:m.h}),Ln]})]})});function Zt(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Yt(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Xt(e){const t=e.map(Zt),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Yt(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Yt(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[l,s,a]=t[i],[c,u,d]=t[i+1];return Yt(Math.round(l+(c-l)*r),Math.round(s+(u-s)*r),Math.round(a+(d-a)*r))}}Ut.displayName="StreamGeoFrame";const Qt=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Kt=Xt(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Jt=Xt(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),en=Xt(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),tn=Xt(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),nn=Xt(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),on=Xt(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),rn=Xt(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ln=Xt(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),sn=Xt(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),an=Xt(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cn=Xt(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),un=Xt(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Xt(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Xt(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Xt(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Xt(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Xt(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Xt(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Xt(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const dn={category10:Qt,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Kt,reds:Jt,greens:en,oranges:tn,purples:nn,viridis:rn,plasma:ln},hn=Qt,fn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],pn=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 gn(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")||pn.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):hn[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))%hn.length]}function mn(e,t,n="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return o.scaleOrdinal().domain(i).range(n).unknown("#999");const l=dn[n]||dn.category10;if(r&&"function"==typeof l){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>l(Number(t)/e)}{const e=Array.isArray(l)?l:hn;return o.scaleOrdinal().domain(i).range(e).unknown("#999")}}function yn(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,l]=o,[s,a]=n;if(l===r)return(s+a)/2;let c=(i-r)/(l-r);return 0>c?c=0:c>1&&(c=1),s+c*(a-s)}const vn=t.createContext(null);function bn(){return t.useContext(vn)}function xn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function jn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[kn,wn]=P(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=jn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=jn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Mn,On]=P(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 Sn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=wn(e=>e.selections.get(i)),l=wn(e=>e.setClause),s=wn(e=>e.clearClause),a=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(xn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};l(i,{clientId:o,type:"point",fields:t})},[o,i,l]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};l(i,{clientId:o,type:"interval",fields:t})},[o,i,l]),clear:t.useCallback(()=>{s(i,o)},[s,i,o]),clientId:o}}function An(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:l,clear:s}=Sn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&l(t)},[o,l,s,n]),predicate:i,isActive:r}}const Cn=t.createContext(!1),Ln=t.createContext(null),Rn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function zn(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}function Pn(e,t,n){return t?(o,...i)=>{var r;const l=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(l,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;l.opacity=e,l.fillOpacity=e,l.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(l,n.unselectedStyle)}return l}:e}function In(){return H(e=>e.theme)}f.createContext(void 0);const Dn="#007bff";function En(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function $n(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?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function Wn(){var e;const t=In(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Bn({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:l,chartId:s,onClick:a,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=zn(n,o),f=Sn({name:(null==e?void 0:e.name)||"__unused__"}),p=An({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),g=On(e=>e.pushObservation),m=e?{isActive:f.isActive,predicate:f.predicate}:null,[y,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==y||!b)return null;const e=y,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,y,b]),j=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=En(e,t,h.xField);null!=n&&function(e,t,n){const o=we.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(we={positions:new Map(we.positions).set(e,{xValue:t,sourceId:n})},Oe())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Se(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(r||g){const n={timestamp:Date.now(),chartType:l||"unknown",chartId:s};if(e){const i=$n(e),l=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(l),g&&g(l)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),g&&g(e)}}},[n,p,h,d,r,l,s,g,c,b]),k=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=En(e,t,h.xField);null!=n&&function(e,t,n){const o=we.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(we.positions);return t.delete(e),we={positions:t},Oe(),!1}we={positions:new Map(we.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Oe()}(h.name||"hover",n,d)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||g){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:s};if(e){const n=$n(e),l=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(l),g&&g(l)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),g&&g(e)}}},[a,r,g,l,s,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{Ae(e,d),Se(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:m,hoverSelectionHook:x,customHoverBehavior:j,customClickBehavior:k,crosshairSourceId:d}}function Nn({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:l,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(Cn),u=null!==t.useContext(Ln),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,h]);!function(e){const n=t.useContext(Ln),o=t.useId(),i=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=t.useRef([]);(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,i)||(r.current=i);const l=r.current;Rn(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),Rn(()=>{n&&n.registerCategories(o,l)},[n,o,l])}(u&&n?f:[]);const p=t.useMemo(()=>{if(!d||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:l}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(l&&l.length>0?l:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const l=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=l?o(l,t,n):n?n(i):fn[r%fn.length];return{label:i+"",color:s}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:gn,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),g=t.useMemo(()=>{const e="number"==typeof l?{top:l,bottom:l,left:l,right:l}:null!=l?l:{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,l,p,r]);return{legend:p,margin:g,legendPosition:r}}const Tn={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function _n(e,t,n){var o,i,r,l,s,a,c;const u=Tn[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(i=t.height)&&void 0!==i?i:u.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(l=t.showGrid)&&void 0!==l?l:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Hn(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Hn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Fn(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function qn({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,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:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class Gn extends f.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(qn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Vn;const Un="undefined"!=typeof process&&"production"!==(null===(Vn=process.env)||void 0===Vn?void 0:Vn.NODE_ENV);function Zn({componentName:t,width:n,height:o,children:i}){return e.jsx(Gn,{fallback:i=>e.jsx(qn,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Yn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Xn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Qn(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Yn),{width:n,height:o}),children:i||"No data available"}):null}function Kn(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),l=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(l+s)-s))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Xn),{position:"absolute",top:a+o*(l+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:l,opacity:.5+o%2*.2})},o))})}function Jn(e,t,n,o){if(!Un)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function eo(e){const n=H(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function to(e,t,n,o){return new(n||(n=Promise))(function(i,r){function l(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,s)}a((o=o.apply(e,t||[])).next())})}function no(e){return e}function oo(e,t){var n=t.id,o=t.bbox,i=null==t.properties?{}:t.properties,r=function(e,t){var n=function(e){if(null==e)return no;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],l=e.translate[1];return function(e,s){s||(t=n=0);var a=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+r,u[1]=(n+=e[1])*i+l;c>a;)u[a]=e[a],++a;return u}}(e.transform),o=e.arcs;function i(e,t){t.length&&t.pop();for(var i=o[0>e?~e:e],r=0,l=i.length;l>r;++r)t.push(n(i[r],r));0>e&&function(e,t){for(var n,o=e.length,i=o-t;i<--o;)n=e[i],e[i++]=e[o],e[o]=n}(t,l)}function r(e){return n(e)}function l(e){for(var t=[],n=0,o=e.length;o>n;++n)i(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=l(e);4>t.length;)t.push(t[0]);return t}function a(e){return e.map(s)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=r(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(r);break;case"LineString":n=l(t.arcs);break;case"MultiLineString":n=t.arcs.map(l);break;case"Polygon":n=a(t.arcs);break;case"MultiPolygon":n=t.arcs.map(a);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:i,geometry:r}:null==o?{type:"Feature",id:n,properties:i,geometry:r}:{type:"Feature",id:n,bbox:o,properties:i,geometry:r}}"function"==typeof SuppressedError&&SuppressedError;const io=new Map;function ro(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function lo(e){return to(this,void 0,void 0,function*(){const t=io.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return to(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:ro(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:ro(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:ro(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:ro(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return oo(e,t)})}:oo(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return io.set(e,r),r})}function so(e){const n=t.useMemo(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=t.useState(null);return t.useEffect(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),lo(e).then(e=>{t||i(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),i(null)}else i(null)},[e]),void 0!==n?n:o}const ao={blues:Kt,reds:Jt,greens:en,viridis:rn,oranges:tn,purples:nn,greys:on,plasma:ln,inferno:sn,magma:an,cividis:cn,turbo:un};function co(n){var i;const l=_n(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),s=function(){var e;const t=In();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:a,valueAccessor:c,colorScheme:u,projection:d="equalEarth",graticule:h,fitPadding:f,zoomable:p,zoomExtent:g,onZoom:m,dragRotate:y,tileURL:v,tileAttribution:b,tileCacheSize:x,tooltip:j,areaOpacity:k=1,annotations:w,margin:M,className:O,selection:S,linkedHover:A,onObservation:C,onClick:L,chartId:R,loading:z,loadingContent:P,emptyContent:I,frameProps:D={},stroke:E,strokeWidth:$,opacity:W}=n,B=null!=p?p:!!v,N=so(a),T=t.useMemo(()=>N?mt(N):N,[N]),_=t.useMemo(()=>"function"==typeof c?c:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[c])&&void 0!==n?n:null==e?void 0:e[c]},[c]),H=null!==(i=null!=u?u:s)&&void 0!==i?i:"blues",F=t.useMemo(()=>{if(!T)return o.scaleSequential(Kt).domain([0,1]);const e=T.map(e=>_(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=r.extent(e);return o.scaleSequential(ao[H]||Kt).domain([null!=t?t:0,null!=n?n:1])},[T,_,H]),{activeSelectionHook:q,customHoverBehavior:G,customClickBehavior:V}=Bn({selection:S,linkedHover:A,onObservation:C,onClick:L,chartType:"ChoroplethMap",chartId:R}),U=eo(S),Z=t.useMemo(()=>{const e=Fn(e=>{const t=_(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:E,strokeWidth:$,opacity:W});return q?Pn(e,q,U):e},[_,F,q,U,k,E,$,W]),Y=t.useMemo(()=>t=>{var n,o;const i=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",r=_(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:i}),null!=r&&e.jsx("div",{style:{opacity:.7},children:(l=r,"number"==typeof l&&isFinite(l)?Number.isInteger(l)?l.toLocaleString():l.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=l?l:"")+"")})]});var l},[_]),X=t.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},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}(M)),[M]),Q=Kn(z,l.width,l.height,P)||(T?null:Kn(!0,l.width,l.height,P)),K=Q?null:Qn(T,l.width,l.height,I);if(Array.isArray(T)&&T.length>0){const t=T[0];if(!t||"object"!=typeof t||!t.geometry)return e.jsx(qn,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:l.width,height:l.height})}const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:d,areas:T,areaStyle:Z,size:[l.width,l.height],margin:X,enableHover:!0,tooltipContent:!1===j?()=>null:!0===j?Y:wt(j)||Y},null!=h&&{graticule:h}),null!=f&&{fitPadding:f}),B&&{zoomable:!0}),g&&{zoomExtent:g}),m&&{onZoom:m}),null!=y&&{dragRotate:y}),v&&{tileURL:v}),b&&{tileAttribution:b}),x&&{tileCacheSize:x}),(A||C||L)&&{customHoverBehavior:G}),(C||L)&&{customClickBehavior:V}),w&&w.length>0&&{annotations:w}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),D);return Q||K||e.jsx(Zn,{componentName:"ChoroplethMap",width:l.width,height:l.height,children:e.jsx(Ut,Object.assign({},J))})}function uo(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:l,legendPosition:s,selection:a,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:p,showLegend:g,userMargin:m,marginDefaults:y,onClick:v,hoverHighlight:b,loading:x,loadingContent:j,emptyContent:k,width:w,height:M}=e,O=void 0===o,S=t.useMemo(()=>mt(n),[n]),[A,C]=t.useState([]),L=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),R="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:z,hoverSelectionHook:P,customHoverBehavior:I,customClickBehavior:D,crosshairSourceId:E}=Bn({selection:a,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:p,onClick:v,hoverHighlight:b,colorByField:R}),$=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(c,E),W=function(e,n,o){const i=bn(),r=Wn();return t.useMemo(()=>{var t;if(!n)return;const l=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(i&&Object.keys(i).length>0){const e=mn(t.map(e=>({_cat:e})),"_cat",l);return t=>i[t]||e(t)}return mn(t.map(e=>({_cat:e})),"_cat",l)}if(i&&Object.keys(i).length>0){const t=mn(e,n,l);return e=>i[e]||t(e)}return mn(e,n,l)}if(i&&Object.keys(i).length>0){const e=mn([{_:"a"}],"_",l);return t=>i[t]||e(t)}},[e,n,o,i,r])}(S,i,r),B=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of S){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[S,i]),N=t.useMemo(()=>O&&A.length>0?A:B,[O,A,B]),T=function(e,n,o){const[i,r]=t.useState(null),[l,s]=t.useState(new Set),a=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&s(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return l.has(o)}}:null},[e,n,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:a,onLegendClick:c,legendSelectionHook:u}}(l,i,N),_=t.useMemo(()=>P||(T.legendSelectionHook?T.legendSelectionHook:z),[P,T.legendSelectionHook,z]),H=eo(a),F=Wn(),q=bn(),G=t.useMemo(()=>{if(W)return W;if(!i||0===N.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:F&&F.length>0?F:fn,t="__streamCat",n=mn(N.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[W,i,N,r,F,q]),{legend:V,margin:U,legendPosition:Z}=Nn({data:S,colorBy:i,colorScale:G,showLegend:g,legendPosition:s,userMargin:m,defaults:y,categories:N}),Y=t.useMemo(()=>{const e={};return V&&(e.legend=V,e.legendPosition=Z),l&&"none"!==l&&(e.legendHoverBehavior=T.onLegendHover,e.legendClickBehavior=T.onLegendClick,e.legendHighlightedCategory=T.highlightedCategory,e.legendIsolatedCategories=T.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=L),e},[V,Z,l,T.onLegendHover,T.onLegendClick,T.highlightedCategory,T.isolatedCategories,O,i,L]),X=Array.isArray(o)?mt(o):o,Q=Kn(x,w,M,j),K=Q?null:Qn(X,w,M,k);return{data:S,colorScale:W,allCategories:N,legendState:T,effectiveSelectionHook:_,activeSelectionHook:z,customHoverBehavior:I,customClickBehavior:D,legend:V,margin:U,legendPosition:Z,earlyReturn:Q||K||null,legendBehaviorProps:Y,crosshairProps:$,resolvedSelection:H}}function ho(e,n){const{variant:o,frameRef:i,overrides:r,deps:l}=n;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,l;const s=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of s){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(l=e.current)||void 0===l||l.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const l=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of l)null===(r=e.current)||void 0===r||r.push(n(t));return l},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const l=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of l)null===(r=n.current)||void 0===r||r.pushLine(t(e));return l},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=l?l:[])}co.displayName="ChoroplethMap";const fo=t.forwardRef(function(n,o){const i=t.useRef(null);ho(o,{variant:"geo-points",frameRef:i});const r=_n(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:l,xAccessor:s="lon",yAccessor:a="lat",sizeBy:c,sizeRange:u=[3,30],colorBy:d,colorScheme:h,projection:f="equalEarth",graticule:p,fitPadding:g,zoomable:m,zoomExtent:y,onZoom:v,dragRotate:b,tileURL:x,tileAttribution:j,tileCacheSize:k,areas:w,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:O,annotations:S,margin:A,className:C,selection:L,linkedHover:R,onObservation:z,onClick:P,chartId:I,loading:D,loadingContent:E,emptyContent:$,legendInteraction:W,legendPosition:B,frameProps:N={},stroke:T,strokeWidth:_,opacity:H}=n,F=null!=m?m:!!x,q=so(w),G=uo({data:null!=l?l:gt,rawData:l,colorBy:d,colorScheme:h,legendInteraction:W,legendPosition:B,selection:L,linkedHover:R,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!1,onObservation:z,onClick:P,chartType:"ProportionalSymbolMap",chartId:I,showLegend:r.showLegend,userMargin:A,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:D,loadingContent:E,emptyContent:$,width:r.width,height:r.height}),V=G.data,U=t.useMemo(()=>{if(!c)return;const e="function"==typeof c?c:e=>null==e?void 0:e[c],t=V.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[V,c]),Z=t.useMemo(()=>{const e=Fn(e=>({fill:d?gn(e,d,G.colorScale):Dn,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:c?yn(e,c,u,U):6}),{stroke:T,strokeWidth:_,opacity:H});return G.effectiveSelectionHook?Pn(e,G.effectiveSelectionHook,G.resolvedSelection):e},[d,G.colorScale,G.effectiveSelectionHook,G.resolvedSelection,c,u,U,T,_,H]),Y=t.useMemo(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof c?c:null,i=("function"==typeof c?c:e=>e[c])(t),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",l="string"==typeof d?d:null,s=l?null==t?void 0:t[l]:null;return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[n&&e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:n}),o&&null!=i&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[o,": "]}),r(i)]}),l&&null!=s&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[l,": "]}),s+""]}),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),r(n)]},t))]})},[c,d]);Jn("ProportionalSymbolMap",V,"xAccessor",s),Jn("ProportionalSymbolMap",V,"yAccessor",a);const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:f},null!=l&&{points:V}),{xAccessor:s,yAccessor:a,pointStyle:Z}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),q&&{areas:q,areaStyle:M}),null!=p&&{graticule:p}),null!=g&&{fitPadding:g}),F&&{zoomable:!0}),y&&{zoomExtent:y}),v&&{onZoom:v}),null!=b&&{dragRotate:b}),x&&{tileURL:x}),j&&{tileAttribution:j}),k&&{tileCacheSize:k}),{size:[r.width,r.height],margin:G.margin,enableHover:!0,tooltipContent:!1===O?()=>null:wt(O)||Y}),G.legendBehaviorProps),(R||z||P)&&{customHoverBehavior:G.customHoverBehavior}),(z||P)&&{customClickBehavior:G.customClickBehavior}),S&&S.length>0&&{annotations:S}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),N);return G.earlyReturn?G.earlyReturn:e.jsx(Zn,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:e.jsx(Ut,Object.assign({ref:i},X))})});fo.displayName="ProportionalSymbolMap";const po="__semiotic_x",go="__semiotic_y",mo=t.forwardRef(function(n,i){const r=_n(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:l,nodes:s,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:g,zoomExtent:m,onZoom:y,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:j,lineType:k="geo",flowStyle:w="basic",areas:M,areaStyle:O={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:S,edgeOpacity:A=.6,edgeWidthRange:C=[1,8],edgeLinecap:L="round",colorScheme:R,showParticles:z,particleStyle:P,tooltip:I,annotations:D,margin:E,className:$,selection:W,linkedHover:B,onObservation:N,onClick:T,chartId:_,loading:H,loadingContent:F,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Z,strokeWidth:Y,opacity:X,lineIdAccessor:Q}=n,K=null!=g?g:!!b,J=so(M),ee=t.useMemo(()=>mt(s),[s]),te=uo({data:null!=l?l:gt,rawData:l,colorBy:S,colorScheme:R,legendInteraction:V,legendPosition:U,selection:W,linkedHover:B,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:N,onClick:T,chartType:"FlowMap",chartId:_,showLegend:r.showLegend,userMargin:E,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:H,loadingContent:F,emptyContent:q,width:r.width,height:r.height}),ne=te.data,oe=zn(B),ie=An({name:(null==oe?void 0:oe.name)||"hover",fields:(null==oe?void 0:oe.fields)||[]}),re=On(e=>e.pushObservation),le=t.useMemo(()=>{const e=new Map;for(const t of ee)e.set(t[a]+"",t);return e},[ee,a]),se=t.useRef(null),ae=t.useRef(le);ae.current=le;const ce=t.useRef(c);ce.current=c;const ue=t.useRef(u);ue.current=u;const de=t.useCallback(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof ce.current?ce.current:e=>e[ce.current],r="function"==typeof ue.current?ue.current:e=>e[ue.current];return Object.assign(Object.assign({},e),{coordinates:[{[po]:i(n),[go]:r(n)},{[po]:i(o),[go]:r(o)}]})},[]);ho(i,{variant:"geo-lines",frameRef:se,overrides:{push:e=>{var t;const n=de(e);n&&(null===(t=se.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=de(t);e&&n.push(e)}n.length>0&&(null===(t=se.current)||void 0===t||t.pushManyLines(n))}}});const he=t.useMemo(()=>{const e=new Map;for(const t of ne)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ne]),fe=t.useCallback(e=>{var t,n;if(B)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=he.get(t[a]+"");e&&ie.onHover(e)}else ie.onHover(t)}else ie.onHover(null);if(N||re){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:_};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});N&&N(r),re&&re(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});N&&N(e),re&&re(e)}}},[B,ie,a,he,N,_,re]),pe=te.customClickBehavior,ge=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=le.get(n.source+""),i=le.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[po]:e(o),[go]:t(o)},{[po]:e(i),[go]:t(i)}]}):null}).filter(Boolean)},[ne,le,c,u]),me=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c];return t=>null!=t&&"object"==typeof t&&po in t?t[po]:e(t)},[c]),ye=t.useMemo(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&go in t?t[go]:e(t)},[u]),ve=t.useMemo(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>C[0]:o.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(C)},[ne,d,C]),be=t.useMemo(()=>e=>{var t;return{stroke:S?gn(e,S,te.colorScale):Dn,strokeWidth:ve(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:L,opacity:A}},[S,te.colorScale,ve,d,A,L]),xe=t.useMemo(()=>{var e;const t=Fn(be,{stroke:Z,strokeWidth:Y,opacity:X});if(!te.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=te.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return Pn(t,te.effectiveSelectionHook,Object.assign(Object.assign({},te.resolvedSelection||{}),{unselectedStyle:n}))},[be,te.effectiveSelectionHook,te.resolvedSelection,Z,Y,X]),je=t.useMemo(()=>Fn(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Z,strokeWidth:Y,opacity:X}),[Z,Y,X]),ke=t.useMemo(()=>t=>{var n,o,i,r,l,s,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(i=null==t?void 0:t.properties)||void 0===i?void 0:i.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(l=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.properties)||void 0===l?void 0:l.name)||(null===(c=null===(s=null==t?void 0:t.data)||void 0===s?void 0:s.properties)||void 0===c?void 0:c.NAME);if(n)return e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:n})})}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[d];return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsxs("div",{style:{fontWeight:600},children:[t.source," → ",t.target]}),null!=n&&e.jsx("div",{style:{opacity:.7},children:"number"==typeof n?n.toLocaleString():n})]})}const u=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=u?e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:u})}):null},[d,a]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=l&&{lines:ge}),{points:ee,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates"}),null!=Q&&{lineIdAccessor:Q}),{lineType:k,flowStyle:w,lineStyle:xe,pointStyle:je}),J&&{areas:J,areaStyle:O}),null!=f&&{graticule:f}),null!=p&&{fitPadding:p}),K&&{zoomable:!0}),m&&{zoomExtent:m}),y&&{onZoom:y}),null!=v&&{dragRotate:v}),z&&{showParticles:z}),P&&{particleStyle:P}),b&&{tileURL:b}),x&&{tileAttribution:x}),j&&{tileCacheSize:j}),{size:[r.width,r.height],margin:te.margin,enableHover:!0,tooltipContent:!1===I?()=>null:wt(I)||ke}),te.legendBehaviorProps),(B||N||T)&&{customHoverBehavior:fe}),(N||T)&&{customClickBehavior:pe}),D&&D.length>0&&{annotations:D}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),$&&{className:$}),null!=n.animate&&{animate:n.animate}),G);return te.earlyReturn?te.earlyReturn:e.jsx(Zn,{componentName:"FlowMap",width:r.width,height:r.height,children:e.jsx(Ut,Object.assign({ref:se},we))})});mo.displayName="FlowMap";const yo=t.forwardRef(function(n,o){const i=_n(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:r,lines:l,xAccessor:s="lon",yAccessor:a="lat",nodeIdAccessor:c="id",center:u,costAccessor:d,strength:h=1,lineMode:f="straight",projection:p="mercator",graticule:g,fitPadding:m,zoomable:y,zoomExtent:v,onZoom:b,dragRotate:x,tileURL:j,tileAttribution:k,tileCacheSize:w,transition:M,colorBy:O,colorScheme:S,pointRadius:A=5,tooltip:C,showRings:L=!0,ringStyle:R,showNorth:z=!0,costLabel:P,annotations:I,margin:D,className:E,selection:$,linkedHover:W,onObservation:B,onClick:N,chartId:T,loading:_,loadingContent:H,emptyContent:F,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=n,Y=null!=y?y:!!j,X=t.useMemo(()=>mt(r),[r]),Q=uo({data:X,rawData:r,colorBy:O,colorScheme:S,legendInteraction:void 0,legendPosition:q,selection:$,linkedHover:W,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!1,onObservation:B,onClick:N,chartType:"DistanceCartogram",chartId:T,showLegend:i.showLegend,userMargin:D,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:H,emptyContent:F,width:i.width,height:i.height}),K=t.useMemo(()=>{const e=Fn(e=>({fill:O?gn(e,O,Q.colorScale):Dn,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:A}),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?Pn(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[O,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,A,V,U,Z]),J=t.useMemo(()=>({center:u,centerAccessor:c,costAccessor:d,strength:h,lineMode:f}),[u,c,d,h,f]),ee=t.useMemo(()=>{if(!l)return;const e="function"==typeof s?s:e=>e[s],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of X)n.set(e[c]+"",e);return l.map(o=>{if(o.coordinates)return o;const i=n.get(o.source+""),r=n.get(o.target+"");return i&&r?Object.assign(Object.assign({},o),{coordinates:[{[s]:e(i),[a]:t(i)},{[s]:e(r),[a]:t(r)}]}):null}).filter(Boolean)},[l,X,s,a,c]),te=t.useMemo(()=>t=>{const n=("function"==typeof d?d:e=>e[d])(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:t[c]||t.name||t.id||"Point"}),null!=n&&e.jsxs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof n?n.toFixed(1):n]})]})},[d,c]),ne=t.useRef(null);ho(o,{variant:"geo-points",frameRef:ne});const[oe,ie]=t.useState(null),re=t.useCallback(()=>{var e,t;const n=null===(t=null===(e=ne.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ie(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);t.useEffect(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,h,u,i.width,i.height,X]);const le=t.useMemo(()=>{if(!L||!oe)return[];const{maxCost:e}=oe;if(0>=e)return[];if(Array.isArray(L))return L.filter(t=>t>0&&e>=t);const t="number"==typeof L?L:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[L,oe]),se=t.useMemo(()=>{var t,n;if(!oe)return G.foregroundGraphics||null;const{cx:o,cy:i,maxCost:r,availableRadius:l}=oe,s=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},R),a=null!==(t=Q.margin.left)&&void 0!==t?t:10,c=null!==(n=Q.margin.top)&&void 0!==n?n:10;return e.jsxs("g",{children:[le.map(t=>{const n=t/r*l;return e.jsxs("g",{children:[e.jsx("circle",{cx:o+a,cy:i+c,r:n,fill:"none",stroke:s.stroke,strokeWidth:s.strokeWidth,strokeDasharray:s.strokeDasharray,opacity:.5}),e.jsxs("text",{x:o+a+n+3,y:i+c-2,fontSize:s.labelSize,fill:s.labelColor,fontFamily:"system-ui, sans-serif",children:[t,P?" "+P:""]})]},t)}),z&&e.jsxs("g",{transform:`translate(${a+24}, ${c+24})`,children:[e.jsx("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.jsx("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e.jsx("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e.jsx("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[oe,le,z,P,R,Q.margin,G.foregroundGraphics]);Jn("DistanceCartogram",X,"xAccessor",s),Jn("DistanceCartogram",X,"yAccessor",a);const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:p},null!=r&&{points:X}),ee&&{lines:ee,lineDataAccessor:"coordinates"}),{xAccessor:s,yAccessor:a,pointIdAccessor:c,pointStyle:K,projectionTransform:J}),M&&{transition:{duration:M}}),null!=g&&{graticule:g}),null!=m&&{fitPadding:m}),Y&&{zoomable:!0}),v&&{zoomExtent:v}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),j&&{tileURL:j}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[i.width,i.height],margin:Q.margin,enableHover:!0,tooltipContent:!1===C?()=>null:wt(C)||te}),Q.legendBehaviorProps),(W||B||N)&&{customHoverBehavior:Q.customHoverBehavior}),(B||N)&&{customClickBehavior:Q.customClickBehavior}),I&&I.length>0&&{annotations:I}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),G),se&&{foregroundGraphics:se});return Q.earlyReturn?Q.earlyReturn:e.jsx(Zn,{componentName:"DistanceCartogram",width:i.width,height:i.height,children:e.jsx(Ut,Object.assign({ref:ne},ae))})});yo.displayName="DistanceCartogram",exports.ChoroplethMap=co,exports.DistanceCartogram=yo,exports.FlowMap=mo,exports.ProportionalSymbolMap=fo,exports.StreamGeoFrame=Ut,exports.mergeData=function(e,t,n){const{featureKey:o,dataKey:i}=n,r=new Map;for(const e of t)r.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=r.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})},exports.resolveReferenceGeography=lo;