semiotic 3.2.3 → 3.3.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 (53) hide show
  1. package/CLAUDE.md +118 -264
  2. package/README.md +37 -17
  3. package/ai/schema.json +1 -1
  4. package/ai/system-prompt.md +3 -3
  5. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -0
  6. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
  7. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +2 -0
  8. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
  9. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
  10. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
  11. package/dist/components/charts/shared/hooks.d.ts +2 -1
  12. package/dist/components/charts/shared/types.d.ts +6 -2
  13. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  14. package/dist/components/realtime/RingBuffer.d.ts +11 -0
  15. package/dist/components/realtime/types.d.ts +4 -0
  16. package/dist/components/semiotic-server.d.ts +6 -1
  17. package/dist/components/server/animatedGif.d.ts +78 -0
  18. package/dist/components/server/renderToStaticSVG.d.ts +85 -5
  19. package/dist/components/server/staticAnnotations.d.ts +40 -0
  20. package/dist/components/server/staticLegend.d.ts +39 -0
  21. package/dist/components/server/svgHatchPattern.d.ts +26 -0
  22. package/dist/components/server/themeResolver.d.ts +35 -0
  23. package/dist/components/stream/GeoPipelineStore.d.ts +6 -1
  24. package/dist/components/stream/NetworkPipelineStore.d.ts +20 -0
  25. package/dist/components/stream/OrdinalPipelineStore.d.ts +11 -0
  26. package/dist/components/stream/OrdinalSVGOverlay.d.ts +5 -0
  27. package/dist/components/stream/PipelineStore.d.ts +11 -0
  28. package/dist/components/stream/accessorUtils.d.ts +3 -3
  29. package/dist/components/stream/geoTypes.d.ts +2 -0
  30. package/dist/components/stream/networkTypes.d.ts +33 -0
  31. package/dist/components/stream/ordinalTypes.d.ts +30 -3
  32. package/dist/components/stream/renderers/resolveCSSColor.d.ts +17 -0
  33. package/dist/components/stream/types.d.ts +4 -0
  34. package/dist/geo.min.js +1 -1
  35. package/dist/geo.module.min.js +1 -1
  36. package/dist/network.min.js +1 -1
  37. package/dist/network.module.min.js +1 -1
  38. package/dist/ordinal.min.js +1 -1
  39. package/dist/ordinal.module.min.js +1 -1
  40. package/dist/realtime.min.js +1 -1
  41. package/dist/realtime.module.min.js +1 -1
  42. package/dist/semiotic-ai.min.js +1 -1
  43. package/dist/semiotic-ai.module.min.js +1 -1
  44. package/dist/semiotic-server.d.ts +6 -1
  45. package/dist/semiotic-utils.min.js +1 -1
  46. package/dist/semiotic-utils.module.min.js +1 -1
  47. package/dist/semiotic.min.js +1 -1
  48. package/dist/semiotic.module.min.js +1 -1
  49. package/dist/server.min.js +1 -1
  50. package/dist/server.module.min.js +1 -1
  51. package/dist/xy.min.js +1 -1
  52. package/dist/xy.module.min.js +1 -1
  53. package/package.json +14 -3
package/dist/geo.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("react"),t=require("d3-geo"),n=require("d3-scale"),o=require("d3-array"),r=require("d3-hierarchy"),i=require("d3-shape"),a=require("regression"),s=require("d3-zoom"),l=require("d3-selection"),c=require("d3-scale-chromatic");function u(e){return e&&e.__esModule?e:{default:e}}function d(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 p=d(e),h=u(a);class y{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}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 f(e,t,n){return e+(t-e)*n}const g={mercator:t.geoMercator,equalEarth:t.geoEqualEarth,albersUsa:t.geoAlbersUsa,orthographic:t.geoOrthographic,naturalEarth:t.geoNaturalEarth1,equirectangular:t.geoEquirectangular};function m(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function b(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function v(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const x={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},k={fill:"#4e79a7",r:4,fillOpacity:.8},w={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function A(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function j(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function E(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function O(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class S{constructor(e){this.scene=[],this.scales=null,this.version=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.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}initStreaming(e=500){this.pointBuffer=new y(e),this.timestampBuffer=new y(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}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this.version++}computeScene(e){const{config:n}=this;this.projection=function(e){if(!e)return t.geoEqualEarth();if("string"==typeof e){const n=g[e];return n?n():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),t.geoEqualEarth())}if("object"==typeof e&&"type"in e){const n=g[e.type],o=n?n():t.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(n.projection),this.geoPath=t.geoPath(this.projection),this.fitProjection(e),this.geoPath=t.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 r=this.scene;this.scene=this.buildSceneNodes(e),n.projectionTransform&&this.applyCartogramTransform(n.projectionTransform,e),n.decay&&this.streaming&&this.applyDecay(),n.pulse&&this.streaming&&this.applyPulse(),n.transition&&r.length>0&&this.startTransition(r),this.version++}fitProjection(e){var t,n,o,r,i;const a=this.projection,s=this.config,l=[...this.areas],c=m(s.xAccessor,"lon"),u=m(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const p=b(s.lineDataAccessor);for(const e of this.lineData){const t=p(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(s.projectionExtent){const[[t,n],[o,r]]=s.projectionExtent;a.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(a.clipAngle&&(null!==(t=a.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);a.scale(o/2-o*t),a.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;a.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=a.scale(),this.baseTranslate=a.translate(),this.baseRotation=null!==(i=null===(r=a.rotate)||void 0===r?void 0:r.call(a))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,n){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=t.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(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyZoomScale(e,n){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=t.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(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyRotation(e,n){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=t.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(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),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}buildSceneNodes(e){var n,o,r;const i=[],{config:a}=this,s=this.projection,l=this.geoPath,c=m(a.xAccessor,"lon"),u=m(a.yAccessor,"lat");if(a.graticule){const n=!0===a.graticule?{}:a.graticule,o=t.geoGraticule();n.step&&o.step(n.step);const r=l(o())||"";r&&i.push({type:"geoarea",pathData:r,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:n.stroke||"#e0e0e0",strokeWidth:n.strokeWidth||.5,strokeDasharray:n.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=l(e);if(!t)continue;const n=l.centroid(e),o=l.bounds(e),r=l.area(e),s=v(a.areaStyle,e,x);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:r,style:s,datum:e,interactive:!0})}const d=b(a.lineDataAccessor);for(const n of this.lineData){const o=d(n);if(!o||2>o.length)continue;const r=o.map(e=>[c(e),u(e)]);let l;if("geo"===a.lineType){const e=[];for(let n=0;r.length-1>n;n++){const o=r[n],i=r[n+1],a=t.geoDistance(o,i)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=t.geoInterpolate(o,i);for(let t=0;s>=t;t++)n>0&&0===t||e.push(l(t/s))}l=e.map(([e,t])=>s([e,t])).filter(e=>null!=e)}else l=r.map(([e,t])=>s([e,t])).filter(e=>null!=e);if(2>l.length)continue;const p=v(a.lineStyle,n,w),h="number"==typeof p.strokeWidth?p.strokeWidth:1;2!==r.length||2>l.length||"arc"!==a.flowStyle?2!==r.length||2>l.length||"offset"!==a.flowStyle||(l="geo"===a.lineType?E(l,h):O(l[0],l[l.length-1],0,0,h)):l=j(l[0],l[l.length-1]);const y=A(l,e.width);if(y.length>1)for(const e of y){if(2>e.length)continue;const t={type:"line",path:e,style:Object.assign(Object.assign({},p),{_edgeFade:!0}),datum:n};i.push(t)}else i.push({type:"line",path:2>l.length&&y[0]||l,style:p,datum:n})}const p=this.getPoints(),h=a.pointIdAccessor?"function"==typeof a.pointIdAccessor?a.pointIdAccessor:e=>e[a.pointIdAccessor]:null,y=s.clipAngle&&null!==(n=s.clipAngle())&&void 0!==n?n:0,f=y>0?y*Math.PI/180:null,g=s.rotate?s.rotate():[0,0,0],S="function"==typeof s.center?s.center():[0,0],M=[(null!==(o=S[0])&&void 0!==o?o:0)-g[0],(null!==(r=S[1])&&void 0!==r?r:0)-g[1]];for(let e=0;p.length>e;e++){const n=p[e],o=c(n),r=u(n);if(null!=f&&t.geoDistance([o,r],M)>f)continue;const l=s([o,r]);if(!l)continue;const d=a.pointStyle?a.pointStyle(n):Object.assign({},k),y={type:"point",x:l[0],y:l[1],r:d.r||4,style:d,datum:n,pointId:h?h(n)+"":void 0};i.push(y)}return i}applyCartogramTransform(e,t){var o,r,i;const a=this.scene.filter(e=>"point"===e.type);if(2>a.length)return;const s=null!==(o=e.strength)&&void 0!==o?o:1;if(0===s)return;const l=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=a.find(t=>l(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,p=u.y,h=a.map(e=>c(e.datum)).filter(e=>isFinite(e)&&e>=0),y=Math.max(...h,1),f=Math.min(t.width,t.height)/2,g=n.scaleLinear().domain([0,y]).range([0,f]);this.cartogramLayout={cx:d,cy:p,maxCost:y,availableRadius:f},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 a){if(e===u)continue;const t=Math.atan2(e.y-p,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-p,2)),o=c(e.datum),r=n+((isFinite(o)?g(o):n)-n)*s;e.x=d+Math.cos(t)*r,e.y=p+Math.sin(t)*r}const m=t.width/2,b=t.height/2,v=m-u.x,x=b-u.y;if(Math.abs(v)>.5||Math.abs(x)>.5)for(const e of a)e.x+=v,e.y+=x;this.cartogramLayout={cx:m,cy:b,maxCost:y,availableRadius:f};const k=this.scene.filter(e=>"line"===e.type);if(k.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of a)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of k){const n=null===(r=t.datum)||void 0===r?void 0:r.source,o=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&o){const r=e.get(n+""),i=e.get(o+"");r&&i&&(t.path=[r,i])}}}}applyDecay(){var e,t,n;const o=this.config.decay;if(!o||!this.pointBuffer)return;const r=this.pointBuffer.size;if(0===r)return;const i=null!==(e=o.minOpacity)&&void 0!==e?e:.1,a=null!==(t=o.halfLife)&&void 0!==t?t:r/2,s=null!==(n=o.stepThreshold)&&void 0!==n?n:.5*r,l=this.scene.filter(e=>"point"===e.type);for(let e=0;l.length>e;e++){const t=r-1-e;let n;switch(o.type){case"exponential":n=i+Math.pow(.5,t/a)*(1-i);break;case"step":n=s>t?1:i;break;default:n=i+(r>1?1-t/(r-1):1)*(1-i)}l[e]._decayOpacity=n,l[e].style=Object.assign(Object.assign({},l[e].style),{opacity:n})}}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,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),a=this.timestampBuffer.toArray();for(let e=0;i.length>e&&a.length>e;e++){const s=r-a[e];o>s&&(i[e]._pulseIntensity=1-s/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[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 r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of i)if(e.pointId){const t=r.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)&&(a=!0))}a&&(this.activeTransition={startTime:performance.now(),duration:o})}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=f(e.x,e._targetX,n),e.y=f(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 M(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 $(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 z(e,t,n,o,r,i){const a=e.filter(e=>"point"===e.type);let s=null,l=o;for(const e of a){const r=e.x-t,i=e.y-n,a=Math.sqrt(r*r+i*i);M(e.r,o)>=a&&l>a&&(s=e,l=a)}if(s)return{node:s,distance:l};const c=e.filter(e=>"geoarea"===e.type&&!1!==e.interactive);for(let e=c.length-1;e>=0;e--){const o=c[e],[[i,a],[s,l]]=o.bounds;if(!(i>t||t>s||a>n||n>l)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),r.isPointInPath(o._cachedPath2D,t,n)))return{node:o,distance:0}}const u=e.filter(e=>"line"===e.type);let d=null,p=o;for(const e of u){const{path:o}=e;for(let r=0;o.length-1>r;r++){const[i,a]=o[r],[s,l]=o[r+1],c=L(t,n,i,a,s,l);Math.max((e.style.strokeWidth||2)+4,5)>=c&&p>c&&(d=e,p=c)}}return d?{node:d,distance:p}:null}function L(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}const P={fill:e=>p.createElement("rect",{style:e,width:16,height:16}),line:e=>p.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function R(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,P[n])(o(e,t)),r}function I(){return p.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function B(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function N({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+p.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&p.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])),p.createElement("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])))}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},i&&p.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),p.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])),p.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function D(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical"}=e,[d,h]=p.useState(0),[y,f]=p.useState(0),g=p.useCallback((e,t)=>{h(e),f(t)},[]),m="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c})=>{let u=24;const d=[];return e.forEach((e,h)=>{u+=5,d.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,d.push(p.createElement("text",{key:"legend-text-"+h,y:u,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),u+=8),d.push(p.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,a,s,l,c)=>{const{type:u="fill",styleFn:d,items:h}=e,y=[];let f=0;const g=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return h.forEach((e,c)=>{const b=R(e,c,u,d),v=B(e,o,r),x=r&&r.size>0&&r.has(e.label);y.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${f})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:g?s===i&&c===a?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?x||!1:void 0,"aria-current":g&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:g?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+h.length)%h.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},g&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&p.createElement(I,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=22}),y})(e,n,o,r,i,a,s,h,l,c))),u+=22*e.items.length+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:a}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=0;const h=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const f=((e,t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:y}=e,f=[];let g=0,m=0;const b=!(!t&&!n),v="isolate"===c||void 0===c&&null!=r;y.forEach((e,c)=>{const x=R(e,c,d,h),k=B(e,o,r),w=r&&r.size>0&&r.has(e.label),A=26+7*e.label.length;u&&u>0&&g>0&&g+A>u&&(m++,g=0),f.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(${g},${22*m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:b?s===i&&c===a?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&v?w||!1:void 0,"aria-current":b&&!v&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:b?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(c+("ArrowRight"===n.key?1:-1)+y.length)%y.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:b?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},b&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&p.createElement(I,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),g+=A});let x=0,k=0;for(const e of y){const t=26+7*e.label.length;u&&u>0&&k>0&&k+t>u?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:f,offset:x,totalRows:w,totalHeight:22*w}})(e,o,r,i,a,s,l,t,c,u,n);y+=f.offset+5,h.push(Object.assign(Object.assign({label:e.label},f),{offset:y,totalRows:f.totalRows,totalHeight:f.totalHeight})),d+=y+12});let y=d>n?0:Math.max(0,(n-d)/2);const f=[];return h.forEach((n,o)=>{const r=e[o];r.label&&(f.push(p.createElement("text",{key:"legend-text-"+o,transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),y+=16),f.push(p.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${y},0)`},n.items)),y+=n.offset+5,e[o+1]&&f.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8})),y+=12}),p.createElement("g",null,f)})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:a}),b=!(!n&&!o);return p.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==s&&""!==s&&"vertical"===u&&p.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},s),m)}function T(e){return"string"==typeof e?{type:e}:e}function W({orient:t,config:n,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;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!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(n),c="top"===t||"bottom"===t,u=e.useMemo(()=>{if(0===r.length)return null;const e=i.domain(),n=a-8;if("boxplot"===l.type){const e=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!e)return null;const{q1:o,median:a,q3:s,whiskerLow:u,whiskerHigh:d}=e,h=Math.min(.5*n,20),y=(n-h)/2+4;if(c){const e=i(o),n=i(s),r=i(a),c=i(u),f=i(d),g="top"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:c,y1:m+g*(y+h/2),x2:f,y2:m+g*(y+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:c,y1:m+g*y,x2:c,y2:m+g*(y+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:f,y1:m+g*y,x2:f,y2:m+g*(y+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:Math.min(e,n),y:"top"===t?m-y-h:m+y,width:Math.abs(n-e),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:r,y1:"top"===t?m-y-h:m+y,x2:r,y2:"top"===t?m-y:m+y+h,stroke:l.fill,strokeWidth:2}))}{const e=i(o),n=i(s),r=i(a),c=i(u),f=i(d),g="left"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:m+g*(y+h/2),y1:c,x2:m+g*(y+h/2),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+g*y,y1:c,x2:m+g*(y+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+g*y,y1:f,x2:m+g*(y+h),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:"left"===t?m-y-h:m+y,y:Math.min(e,n),width:h,height:Math.abs(n-e),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:"left"===t?m-y-h:m+y,y1:r,x2:"left"===t?m-y:m+y+h,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=o.bin().domain(e).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return p.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((e,o)=>{if(null==e.x0||null==e.x1)return null;const r=e.length/d*n;if(c){const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:n,y:"top"===t?-4-r:4,width:Math.max(a,.5),height:r,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:"left"===t?-4-r:4,y:Math.min(n,n+a),width:r,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const e=n/2+4,o=[];for(const r of u){if(null==r.x0||null==r.x1)continue;const a=r.length/d*(n/2),s=i((r.x0+r.x1)/2);o.push(c?`${s},${"top"===t?-(e-a):e-a}`:`${"left"===t?-(e-a):e-a},${s}`)}for(let r=u.length-1;r>=0;r--){const a=u[r];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(n/2),l=i((a.x0+a.x1)/2);o.push(c?`${l},${"top"===t?-(e+s):e+s}`:`${"left"===t?-(e+s):e+s},${l}`)}return p.createElement("g",{"data-testid":"marginal-violin-"+t},p.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const e=[];if(c){const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${r},${o}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${a},${o}`),e.push("Z")}else{const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${o},${r}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${o},${a}`),e.push("Z")}return p.createElement("g",{"data-testid":"marginal-ridgeline-"+t},p.createElement("path",{d:e.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,t,c,4]);return u?p.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function _(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function F(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 H(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:y,events:f={},"data-testid":g}=e,m=new Set(Array.isArray(y)?y:[]);let b=o||0,v=r||0;null!=i&&(b=i-t),null!=a&&(v=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===b&&0===v)if(void 0!==c.width){b=c.width/2;const e=c.depth||30;v=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;b=e+(0>e?-5:5),v=c.height/2}return p.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${t},${n})`,"data-testid":g},f),!m.has("connector")&&function(e,t,n,o,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=o/2,p=e*d>t*u?u/e:d/t;s=r+a*p,l=i+c*p}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);s=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-s,2)+Math.pow(t-l,2))>.5&&(a.push(p.createElement("line",{key:"connector-line",x1:s,y1:l,x2:e,y2:t,stroke:o||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-s);a.push(p.createElement("path",{key:"connector-arrow",d:`M${s},${l}L${s+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${s+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return p.createElement("g",{className:"annotation-connector"},a)}(b,v,l,d,x,c),!m.has("subject")&&function(e,t,n,o,r){var i;const a=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&a.push(p.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&a.push(p.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==t?void 0:t.custom)&&a.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;a.push(p.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(p.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&a.push(p.createElement("path",{key:"bracket-path",d:F((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}}return p.createElement("g",{className:"annotation-subject"},a)}(x,c,d,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return p.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return p.createElement("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const y=16,f=i?c?[i]:_(i,l):[],g=r?c?[r]:_(r,l):[],m="leftRight"===u?"end"===h?-4:4:0;let b=0;const v=[],x=o||"var(--semiotic-text, #333)";f.length>0&&(v.push(p.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:h,fontWeight:"bold"},f.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:y},e)))),b=f.length*y),g.length>0&&v.push(p.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:h,y:b},g.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:y},e))));let k=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),k=p.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(f.length+g.length)*y+(g.length>0?y:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),k=p.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,f.length+g.length-1)*y;let A=0;return"topBottom"===u?A=0>n?-(w+2):18:"leftRight"===u&&(A="middle"===d?-(w+y+(g.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),p.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},p.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},v),k)}(s,b,v,d))}function q(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),s=r.map((t,n)=>{const r=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:a});return p.createElement(H,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return p.createElement("g",null,s)}const s=o.note||{title:"none",label:o.label};return p.createElement(H,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${o.i}`,events:a},o,{type:i}))}function G(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function V(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function U(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=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!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],p=l[e.yAccessor||"y"];return null==d||null==p?null:{x:c(d),y:u(p)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=G(e,n),c=V(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Z(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Y={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};let X={positions:new Map};const K=new Set;function J(){for(const e of K)e()}function Q(e,t){const n=X.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(X.positions);o.delete(e),X={positions:o},J()}function ee(e,t){const n=X.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(X.positions);o.delete(e),X={positions:o},J()}function te(){return X}function ne(e){return K.add(e),()=>K.delete(e)}const oe={positions:new Map};function re(){return()=>{}}function ie(){return oe}function ae(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function se(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function le(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function ce(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 ue(t){var n,o;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:y,axes:f,xLabel:g,yLabel:m,yLabelRight:b,xFormat:v,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:j,legendClickBehavior:E,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:C,marginalGraphics:z,xValues:L,yValues:P,annotations:R,svgAnnotationRules:I,xAccessor:B,yAccessor:_,annotationData:F,pointNodes:H,curve:X,underlayRendered:K,linkedCrosshairName:J,linkedCrosshairSourceId:Q,children:oe}=t,ue=e.useMemo(()=>{var e;if(!y||!d)return[];const t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||v||le,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=d.x.ticks(Math.min(o,Math.max(2,Math.floor(a/70)))),i=r.map(e=>e.valueOf()),s=r.map((e,t)=>({value:e,pixel:d.x(e),label:n(e,t,i)})),l=s.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),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(l+8,55)):Math.max(55,l+8);let u=ce(s,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=d.x.domain()[1],t=d.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[y,d,f,v,a]),de=e.useMemo(()=>{var e;if(!y||!d)return[];const t=null==f?void 0:f.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||le,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=ce(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=d.y.domain()[1],t=d.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[y,d,f,x,s]),pe=e.useMemo(()=>{var e;if(!y||!d)return[];const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||le,o=null!==(e=t.ticks)&&void 0!==e?e:5;return ce(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[y,d,f,x,s]),he=e.useRef(new Map),ye=e.useRef(null!==(n=null==R?void 0:R.length)&&void 0!==n?n:0),fe=null!==(o=null==R?void 0:R.length)&&void 0!==o?o:0;ye.current!==fe&&(ye.current=fe,he.current=new Map);const ge=e.useMemo(()=>{if(!R||0===R.length)return null;const e=function(e,t,n){var o,a,s,l,c,u,d,y,f,g,m,b,v,x,k,w,A,j,E,O,S,M,C,$,z,L,P,R,I,B,N,D,T,W,_,F,H,X,K,J,Q,ee,te,ne,oe,re,ie,ae;switch(e.type){case"label":{const o=U(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Z(r,i,n)?p.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=U(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Z(r,i,n)?p.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=G(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let a;return a="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12,p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:o+4,y:a,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=V(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,s;return"left"===i?(a=4,s="start"):"center"===i?(a=(n.width||0)/2,s="middle"):(a=(n.width||0)-4,s="end"),p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:a,y:o-4,textAnchor:s,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:G(Object.assign(Object.assign({},e),{type:"point"}),n),y:V(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=r.packEnclose(o),a=e.padding||10;return p.createElement("g",{key:"ann-"+t},p.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:G(Object.assign(Object.assign({},e),{type:"point"}),n),y:V(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),s=Math.min(...i)-r,l=Math.max(...i)+r,c=Math.min(...a)-r,u=Math.max(...a)+r;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:s,y:c,width:l-s,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:(s+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return p.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=G(t,n),a=V(t,n);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return p.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:a,r:s},l))}))}case"bracket":{const o=G(e,n),r=V(e,n);return p.createElement(q,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const r=n.data||[];if(2>r.length)return null;const i=n.xAccessor||"x",y=n.yAccessor||"y",f=r.map(e=>[e[i],e[y]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const g=null!==(a=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==a?a:null===(s=n.scales)||void 0===s?void 0:s.time,m=null!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!g||!m)return null;const b=e.method||"linear";let v;v="loess"===b?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,p=0,h=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],p+=t*i[e],h+=t*r[e]*r[e],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const f=u*h-d*d;if(1e-12>Math.abs(f))s.push([t,p/u]);else{const e=(u*y-d*p)/f;s.push([t,(p-e*d)/u+e*t])}}return s}(f,null!==(d=e.bandwidth)&&void 0!==d?d:.3):("polynomial"===b?h.default.polynomial(f,{order:e.order||2}):h.default.linear(f)).points;const x=v.map(([e,t])=>`${g(e)},${m(t)}`).join(" "),k=e.color||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("polyline",{points:x,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:g(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:k,fontSize:11},e.label))}case"band":{const o=null!==(f=null===(y=n.scales)||void 0===y?void 0:y.y)&&void 0!==f?f:null===(g=n.scales)||void 0===g?void 0:g.value,r=null!==(m=null==o?void 0:o(e.y0))&&void 0!==m?m:0,i=null!==(b=null==o?void 0:o(e.y1))&&void 0!==b?b:n.height||0;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(v=n.scales)||void 0===v?void 0:v.x)&&void 0!==x?x:null===(k=n.scales)||void 0===k?void 0:k.time,s=null!==(A=null===(w=n.scales)||void 0===w?void 0:w.y)&&void 0!==A?A:null===(j=n.scales)||void 0===j?void 0:j.value;if(!a||!s)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,d=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const h=Y[n.curve||"linear"]||i.curveLinear,y=i.area().x(e=>a(e[r])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!y)return null;const f=e.fill||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:y,fill:f,fillOpacity:null!==(E=e.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.label&&d.length>0&&p.createElement("text",{x:a(d[d.length-1][r])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(S=null===(O=n.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(M=n.scales)||void 0===M?void 0:M.time,a=null!==($=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==$?$:null===(z=n.scales)||void 0===z?void 0:z.value;if(!i||!a)return null;const s=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+Math.pow(t-l,2),0)/s.length,u=Math.sqrt(c),d=null!==(L=e.threshold)&&void 0!==L?L:2,h=l-d*u,y=!1!==e.showBand,f=e.fill||"#6366f1",g=null!==(P=e.fillOpacity)&&void 0!==P?P:.1,m=e.anomalyColor||"#ef4444",b=null!==(R=e.anomalyRadius)&&void 0!==R?R:6,v=a(l+d*u),x=a(h),k=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return p.createElement("g",{key:"ann-"+t},y&&p.createElement("rect",{x:0,y:Math.min(v,x),width:n.width||0,height:Math.abs(x-v),fill:f,fillOpacity:g}),k.map((e,t)=>{const o=G(e,n),r=V(e,n);return null==o||null==r?null:p.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a=null!==(B=null===(I=n.scales)||void 0===I?void 0:I.x)&&void 0!==B?B:null===(N=n.scales)||void 0===N?void 0:N.time,s=null!==(T=null===(D=n.scales)||void 0===D?void 0:D.y)&&void 0!==T?T:null===(W=n.scales)||void 0===W?void 0:W.value;if(!a||!s)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=h.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),y=Math.sqrt(d/Math.max(u-2,1)),f=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(_=e.confidence)&&void 0!==_?_:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(F=e.steps)&&void 0!==F?F:5,x=l[u-1][0],k=(x-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;v>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=c(e),n=y*Math.sqrt(1+1/u+(g>0?Math.pow(e-f,2)/g:0))*b;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${A.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,E=A.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),O=`${a(x)},${s(c(x))}`,S=e.strokeColor||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:null!==(H=e.fillOpacity)&&void 0!==H?H:.15,stroke:"none"}),p.createElement("polyline",{points:`${O} ${E}`,fill:"none",stroke:S,strokeWidth:null!==(X=e.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(K=e.strokeDasharray)&&void 0!==K?K:"6,3"}),e.label&&A.length>0&&p.createElement("text",{x:a(A[A.length-1].x)+4,y:s(A[A.length-1].yCenter)-4,fill:S,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=U(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!Z(o,r,n))return null;const i=null!==(J=e.dx)&&void 0!==J?J:0,a=null!==(Q=e.dy)&&void 0!==Q?Q:0,s=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,c=null!==(ne=e.content)&&void 0!==ne?ne:p.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return p.createElement("foreignObject",{key:"ann-"+t,x:o+i-s/2,y:r+a-l/2,width:s,height:l,style:{overflow:"visible",pointerEvents:"auto"}},p.createElement("div",{style:{width:s,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=U(e,t,n);if(!o)return null;const{x:r,y:i}=o;return p.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=null===(oe=n.scales)||void 0===oe?void 0:oe.o,i=null===(re=n.scales)||void 0===re?void 0:re.x,a=null===(ie=n.scales)||void 0===ie?void 0:ie.y,s=(null==r?void 0:r.bandwidth)?r:(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:null;if(!s)return null;const l=s(o);if(null==l)return null;const c=s.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",d=null!==(ae=e.opacity)&&void 0!==ae?ae:.15,h=e.label;return(n.projection?"vertical"===n.projection:s===i)?p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:l,y:0,width:c,height:n.height||0,fill:u,fillOpacity:d}),h&&p.createElement("text",{x:l+c/2,y:12,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold"},h)):p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:0,y:l,width:n.width||0,height:c,fill:u,fillOpacity:d}),h&&p.createElement("text",{x:12,y:l+c/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold"},h))}default:return null}},t={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:B,yAccessor:_,width:a,height:s,data:F,frameType:"xy",pointNodes:H,curve:X,stickyPositionCache:he.current};return R.map((n,o)=>{if(I){const r=I(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[R,I,a,s,B,_,F,d,H,X]),me=function(t){var n;const o=e.useSyncExternalStore(t?ne:re,t?te:ie,t?te:ie);return t&&null!==(n=o.positions.get(t))&&void 0!==n?n:null}(J);return e.useEffect(()=>{if(!(null==me?void 0:me.locked)||!J)return;const e=e=>{"Escape"===e.key&&ee(J)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==me?void 0:me.locked,J]),y||w||A||C||z||ge&&ge.length>0||k||oe||me?p.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},p.createElement("title",null,"string"==typeof w?w:"XY Chart"),p.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),p.createElement("g",{transform:`translate(${u.left},${u.top})`},k&&d&&!K&&(()=>{var e,t;const n=ae(null===(e=null==f?void 0:f.find(e=>"bottom"===e.orient))||void 0===e?void 0:e.gridStyle),o=ae(null===(t=null==f?void 0:f.find(e=>"left"===e.orient))||void 0===t?void 0:t.gridStyle);return p.createElement("g",{className:"stream-grid"},ue.map((e,t)=>p.createElement("line",{key:"xgrid-"+t,x1:e.pixel,y1:0,x2:e.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n})),de.map((e,t)=>p.createElement("line",{key:"ygrid-"+t,x1:0,y1:e.pixel,x2:a,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})))})(),y&&d&&(()=>{const e=null==f?void 0:f.find(e=>"left"===e.orient),t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,o=!t||!1!==t.baseline,r=(null==e?void 0:e.jaggedBase)||!1,i=(null==t?void 0:t.jaggedBase)||!1,l=null==t?void 0:t.landmarkTicks,c=null==e?void 0:e.landmarkTicks,d="var(--semiotic-border, #ccc)",h="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",v=!!(null==t?void 0:t.autoRotate)&&ue.length>1&&(()=>{const e=a/Math.max(ue.length-1,1);return ue.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return p.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!K&&o&&!i&&p.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:d,strokeWidth:1}),!K&&i&&p.createElement("path",{d:se("bottom",a,s),fill:"none",stroke:d,strokeWidth:1}),ue.map((e,t)=>{const n=!!l&&("function"==typeof l?l(e.value,t):$(e.value,t>0?ue[t-1].value:void 0));return p.createElement("g",{key:"xtick-"+t,transform:`translate(${e.pixel},${s})`},p.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?p.createElement("text",{y:v?10:18,textAnchor:v?"end":"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:h,style:{userSelect:"none"},transform:v?"rotate(-45)":void 0},e.label):p.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},p.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},e.label)))}),g&&p.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"}},g),!K&&n&&!r&&p.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:d,strokeWidth:1}),!K&&r&&p.createElement("path",{d:se("left",a,s),fill:"none",stroke:d,strokeWidth:1}),de.map((e,t)=>{const n=!!c&&("function"==typeof c?c(e.value,t):$(e.value,t>0?de[t-1].value:void 0));return p.createElement("g",{key:"ytick-"+t,transform:`translate(0,${e.pixel})`},p.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?p.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:h,style:{userSelect:"none"}},e.label):p.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},p.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},e.label)))}),(()=>{const t=(null==e?void 0:e.label)||m;return t?p.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},t):null})(),(()=>{const e=null==f?void 0:f.find(e=>"right"===e.orient);if(!e||0===pe.length)return null;const t=e.landmarkTicks,n=e.label||b;return p.createElement(p.Fragment,null,!1!==e.baseline&&p.createElement("line",{x1:a,y1:0,x2:a,y2:s,stroke:d,strokeWidth:1}),pe.map((e,n)=>{const o=!!t&&("function"==typeof t?t(e.value,n):$(e.value,n>0?pe[n-1].value:void 0));return p.createElement("g",{key:"ytick-r-"+n,transform:`translate(${a},${e.pixel})`},p.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?p.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},e.label):p.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},p.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},e.label)))}),n&&p.createElement("text",{x:a+u.right-15,y:s/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(90, ${a+u.right-15}, ${s/2})`,style:{userSelect:"none"}},n))})())})(),ge,z&&d&&L&&P&&p.createElement(p.Fragment,null,z.top&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(W,{orient:"top",config:T(z.top),values:L,scale:d.x,size:u.top,length:a})),z.bottom&&p.createElement("g",{transform:`translate(0, ${s})`},p.createElement(W,{orient:"bottom",config:T(z.bottom),values:L,scale:d.x,size:u.bottom,length:a})),z.left&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(W,{orient:"left",config:T(z.left),values:P,scale:d.y,size:u.left,length:s})),z.right&&p.createElement("g",{transform:`translate(${a}, 0)`},p.createElement(W,{orient:"right",config:T(z.right),values:P,scale:d.y,size:u.right,length:s}))),C,me&&me.sourceId!==Q&&(null==d?void 0:d.x)&&(()=>{const e=d.x(me.xValue);if(null==e||0>e||e>a)return null;const t=me.locked;return p.createElement("line",{x1:e,y1:0,x2:e,y2:s,stroke:t?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:t?1.5:1,strokeDasharray:t?"6,3":"4,4",pointerEvents:"none"})})(),oe),w&&p.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",title:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const h="top"===i||"bottom"===i;let y,f;return"left"===i?(y=4,f=r.top):"top"===i?(y=0,f=a?32:8):"bottom"===i?(y=0,f=o-r.bottom+50):(y=n-r.right+10,f=r.top),p.createElement("g",{transform:`translate(${y}, ${f})`},"object"==typeof(g=t)&&null!==g&&"gradient"in g?p.createElement(N,{config:t.gradient,orientation:h?"horizontal":"vertical",width:h?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?p.createElement(D,{legendGroups:t.legendGroups,title:"",width:h?n:100,orientation:h?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t);var g}({legend:A,totalWidth:l,totalHeight:c,margin:u,legendPosition:M,title:w,legendHoverBehavior:j,legendClickBehavior:E,legendHighlightedCategory:O,legendIsolatedCategories:S})):null}function de(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const pe="undefined"==typeof window||"undefined"==typeof document,he=p.createContext(null),ye={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function fe(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const ge=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},me={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"},be={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},ve={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)"},xe={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ke={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)"},we={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ae={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function je({scene:e,chartType:t,tableId:n,chartTitle:o}){var r;const[i,a]=p.useState(!1),s=p.useContext(he),l=null!==(r=null==s?void 0:s.visible)&&void 0!==r&&r,c=i||l,u=p.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t,h=p.useCallback(()=>{i||l||a(!0)},[i,l]),y=p.useCallback(e=>{var t;l||(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[l]);if(!e||0===e.length)return n?p.createElement("span",{id:n,tabIndex:-1,style:ye}):null;if(!c)return p.createElement("div",{id:n,tabIndex:-1,onFocus:h,style:ye,role:"region","aria-label":d},p.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",e.length," elements)"));const f=function(e){var t,n,o,r,i,a,s,l,c,u,d,p,h,y,f,g,m,b,v,x,k,w,A,j,E;const O=[];if(!Array.isArray(e))return O;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":O.push({label:"Point",values:{x:S.x,y:S.y}});break;case"line":{const e=S.path,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=S.topPath,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=S.datum&&"object"==typeof S.datum?S.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;O.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":O.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":O.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=S.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=S.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":O.push({label:"Node",values:{id:null!==(p=null===(d=S.datum)||void 0===d?void 0:d.id)&&void 0!==p?p:"",x:null!==(h=S.cx)&&void 0!==h?h:S.x,y:null!==(y=S.cy)&&void 0!==y?y:S.y}});break;case"arc":O.push({label:"Arc",values:{id:null!==(g=null===(f=S.datum)||void 0===f?void 0:f.id)&&void 0!==g?g:"",x:null!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(b=S.cy)&&void 0!==b?b:S.y}});break;case"candlestick":O.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":O.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(v=S.datum)||void 0===v?void 0:v.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=S.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(E=null===(j=S.datum)||void 0===j?void 0:j.value)&&void 0!==E?E:""}})}}catch(e){}return O}(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(f),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ge(e.min)} to ${ge(e.max)}, mean ${ge(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(" ")}(f.length,g),b=f.slice(0,5),v=new Set;for(const e of b)for(const t of Object.keys(e.values))v.add(t);const x=Array.from(v);return p.createElement("div",{ref:u,id:n,tabIndex:-1,onBlur:y,style:me,role:"region","aria-label":d},p.createElement("button",{type:"button",onClick:()=>{l&&s&&s.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:ve},"×"),p.createElement("div",{role:"note",style:be},m),p.createElement("table",{role:"table","aria-label":"Sample data for "+t,style:xe},p.createElement("caption",{style:Ae},"First ",b.length," of ",f.length," data points"),p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",{style:ke},"type"),x.map(e=>p.createElement("th",{key:e,style:ke},e)))),p.createElement("tbody",null,b.map((e,t)=>p.createElement("tr",{key:t},p.createElement("td",{style:we},e.label),x.map(t=>{return p.createElement("td",{key:t,style:we},null==(n=e.values[t])||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":ge(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"");var n}))))))}function Ee({summary:e}){return e?p.createElement("div",{role:"note",style:ye},e):null}function Oe({tableId:e}){return p.createElement("a",{href:"#"+e,style:ye,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ye)}},"Skip to data table")}function Se({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return p.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:ye},t)}const Me="var(--semiotic-focus, #005fcc)";function Ce({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:a}){if(!e||!t)return null;const s=t.x+n.left,l=t.y+n.top;let c;if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);c=p.createElement("rect",{x:s-e/2-3,y:l-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Me,strokeWidth:2,strokeDasharray:"4,2"})}else c=p.createElement("circle","wedge"===r?{cx:s,cy:l,r:12,fill:"none",stroke:Me,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:l,r:8,fill:"none",stroke:Me,strokeWidth:2,strokeDasharray:"4,2"});return p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},c)}function $e({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=p.useRef(null),[c,u]=p.useState(null);p.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect();u(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,a,n,o]);let d;return d=c?`translate(${c.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${c.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`,p.createElement("div",{ref:l,className:a,style:{position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:s,width:"max-content"}},i)}function ze(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Le(e,t,n=.6){var o,r,i,a,s;if(!ze(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a: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 Pe(e,t,n,o=.35){ze(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Re(e){switch(e){case"monotoneX":return i.curveMonotoneX;case"monotoneY":return i.curveMonotoneY;case"cardinal":return i.curveCardinal;case"catmullRom":return i.curveCatmullRom;case"step":return i.curveStep;case"stepBefore":return i.curveStepBefore;case"stepAfter":return i.curveStepAfter;case"basis":return i.curveBasis;case"natural":return i.curveNatural;default:return null}}function Ie(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 Be(e,t,n,o,r,i){if(2>t.length)return;const a=[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];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Ne(e){return e.k}function De(e){return[e.x,e.y]}function Te(e){return function(){return e}}function We([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function _e(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Fe(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function He(e,t,n,o,r){return"function"==typeof e?e(t,n,o,r):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",r>1?"@2x":"")}class qe{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 Ge{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 r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const a=n[i.lineIndex];if(!a||2>a.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const s=Ve(a),l=Ue(a,i.t*s),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.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 Ve(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],r=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+r*r)}return t}function Ue(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],a=Math.sqrt(r*r+i*i);if(n+a>=t||o===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[o-1][0]+r*s,y:e[o-1][1]+i*s,nx:-i/l,ny:r/l}}n+=a}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}function Ze(t){const n=e.createContext(null),o=Ye(t);return[function({children:o}){const r=e.useMemo(()=>Ye(t),[]);return p.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,a=e.useRef(t);a.current=t;const s=e.useCallback(()=>a.current(i.getState()),[i]),l=e.useCallback(()=>a.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,s,l)}]}function Ye(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const Xe={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Ke={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Je={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[Qe,et]=Ze(e=>({theme:Xe,setTheme(t){e(e=>{if("light"===t)return{theme:Xe};if("dark"===t)return{theme:Ke};if("high-contrast"===t)return{theme:Je};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ke:Xe;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}})),tt={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"},ot={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 rt({data:e}){if(!e)return null;if(e.properties)return p.createElement("div",{className:"semiotic-tooltip",style:nt},p.createElement("div",{style:{fontWeight:600}},e.properties.name||e.properties.NAME||e.properties.id||"Feature"));const t=Object.entries(e).slice(0,3);return p.createElement("div",{className:"semiotic-tooltip",style:nt},t.map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),p.createElement("span",{style:{fontWeight:600}},t+""))))}const it=e.forwardRef(function(t,n){var o,r,a,c,u,d,h,y,f,g;const{projection:m,projectionExtent:b,fitPadding:v,projectionTransform:x,areas:k,points:w,lines:A,xAccessor:j,yAccessor:E,lineDataAccessor:O,pointIdAccessor:M,lineType:C="geo",flowStyle:$="basic",graticule:L,zoomable:P,zoomExtent:R,onZoom:I,dragRotate:B,showParticles:N,particleStyle:D,tileURL:T,tileAttribution:W,tileCacheSize:_,size:F,width:H,height:q,responsiveWidth:G,responsiveHeight:V,margin:U,className:Z,background:Y,areaStyle:X,pointStyle:K,lineStyle:J,colorScheme:Q,enableHover:ee=!0,hoverAnnotation:te,tooltipContent:ne,customClickBehavior:oe,customHoverBehavior:re,annotations:ie,decay:ae,pulse:se,transition:le,staleness:ce,backgroundGraphics:he,foregroundGraphics:ye,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:ke,legendIsolatedCategories:we,showAxes:Ae,accessibleTable:Me=!0,description:ze,summary:Ve}=t,Ue=function(){const[t,n]=e.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return e.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),t}(),Ze=e.useRef(Ue);Ze.current=Ue;const Ye="semiotic-table-"+p.useId(),Xe=F||[H||600,q||400],[Ke,Je]=function(t,n,o){const r=e.useRef(null),[i,a]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(Xe,G,V),Qe=e.useMemo(()=>Object.assign(Object.assign({},tt),U),[U]),nt=Je[0]-Qe.left-Qe.right,it=Je[1]-Qe.top-Qe.bottom,at="function"==typeof ye?ye({size:Je,margin:Qe}):ye,st="function"==typeof he?he({size:Je,margin:Qe}):he,lt=e.useMemo(()=>null!=B?B:"orthographic"===("string"==typeof m?m:"object"==typeof m&&"type"in m?m.type:null),[B,m]),ct=e.useMemo(()=>({projection:m,projectionExtent:b,fitPadding:v,xAccessor:j,yAccessor:E,lineDataAccessor:O,lineType:C,flowStyle:$,areaStyle:X,pointStyle:K,lineStyle:J,colorScheme:Q,graticule:L,projectionTransform:x,decay:ae,pulse:se,transition:le,annotations:ie,pointIdAccessor:M}),[m,b,v,j,E,O,C,$,X,K,J,Q,L,x,ae,se,le,ie,M]),ut=e.useRef(null);ut.current||(ut.current=new S(ct));const dt=e.useRef(null),pt=e.useRef(null),ht=e.useRef(null),yt=e.useRef(null),ft=e.useRef(null);T&&!ft.current&&(ft.current=new qe(_||256));const gt=e.useRef(0),mt=e.useRef(!0),bt=et(e=>e.theme),vt=e.useRef(ie),xt=e.useRef(()=>{}),kt=e.useRef(null),wt=e.useRef(s.zoomIdentity),At=e.useRef(!1),jt=e.useRef(null),Et=e.useRef(null),Ot=e.useRef(null),St=e.useRef(null),Mt=e.useRef(0);if(N&&!St.current){const e=null!==(o=null==D?void 0:D.maxPerLine)&&void 0!==o?o:30;St.current=new Ge(50*e)}const Ct=e.useRef(null),$t=e.useRef(null),[zt,Lt]=e.useState(null),[Pt,Rt]=e.useState(0),[It,Bt]=e.useState(!1),Nt=e.useCallback(()=>{gt.current||(gt.current=requestAnimationFrame(()=>xt.current()))},[]);e.useEffect(()=>{mt.current=!0,Nt()},[bt,Nt]),e.useEffect(()=>{var e;null===(e=ut.current)||void 0===e||e.updateConfig(ct),mt.current=!0,Nt()},[ct,Nt]),e.useEffect(()=>{const e=ut.current;e&&(k&&e.setAreas(k),w&&e.setPoints(w),A&&e.setLines(A),mt.current=!0,Nt())},[k,w,A,Nt]);const Dt=e.useCallback(e=>{var t;null===(t=ut.current)||void 0===t||t.pushPoint(e),mt.current=!0,Nt()},[Nt]),Tt=e.useCallback(e=>{var t;null===(t=ut.current)||void 0===t||t.pushMany(e),mt.current=!0,Nt()},[Nt]),Wt=e.useCallback(()=>{var e;null===(e=ut.current)||void 0===e||e.clear(),mt.current=!0,Nt()},[Nt]);e.useImperativeHandle(n,()=>({push:Dt,pushMany:Tt,clear:Wt,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=ut.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=ut.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=ut.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>wt.current.k,resetZoom:()=>{const e=jt.current;e&&kt.current&&l.select(e).call(kt.current.transform,s.zoomIdentity)},getData:()=>{const e=ut.current;return e?e.scene.filter(e=>"point"===e.type).map(e=>e.datum).filter(Boolean):[]}}),[Dt,Tt,Wt]);const _t=e.useRef(()=>{});e.useEffect(()=>{_t.current=e=>{if(!ee)return;const t=ut.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Qe.left,r=e.clientY-n.top-Qe.top;if(0>o||o>nt||0>r||r>it)return Ct.current=null,$t.current=null,Lt(null),null==re||re(null),void Nt();yt.current||(yt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=yt.current.getContext("2d");if(!i)return;const a=z(t.scene,o,r,30,i);if(a){const e=a.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let i,s;"point"===e.type?(i=e.x,s=e.y):"geoarea"===e.type?(i=e.centroid[0],s=e.centroid[1]):(i=o,s=r);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,x:i,y:s,time:0});Ct.current=l,$t.current=e,Lt(l),null==re||re({type:e.type,data:n,x:i,y:s}),Nt()}else Ct.current&&(Ct.current=null,$t.current=null,Lt(null),null==re||re(null),Nt())}},[ee,nt,it,Qe,re,Nt]);const Ft=e.useCallback(()=>{Ct.current=null,$t.current=null,Lt(null),null==re||re(null),Nt()},[re,Nt]),Ht=e.useCallback(e=>{if(!oe)return;const t=ut.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Qe.left,r=e.clientY-n.top-Qe.top;yt.current||(yt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=yt.current.getContext("2d");if(!i)return;const a=z(t.scene,o,r,30,i);if(a){const e=a.node.datum;oe({type:a.node.type,data:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,x:o,y:r})}},[oe,Qe]),qt=e.useRef(-1),Gt=e.useRef(null),Vt=e.useCallback(e=>{const t=ut.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=qt.current,r=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===r)return;if(e.preventDefault(),0>r)return qt.current=-1,Gt.current=null,Ct.current=null,$t.current=null,Lt(null),null==re||re(null),void Nt();const i=0>o?0:r;qt.current=i;const a=n[i];Gt.current={shape:a.shape,w:a.w,h:a.h};const s=function(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}(a);Ct.current=s,Lt(s);const l=a.datum;let c="point",u=l;l&&"object"==typeof l&&"geometry"in l&&(c="geoarea",l.properties&&"object"==typeof l.properties&&(u=Object.assign(Object.assign({},l),l.properties))),null==re||re({type:c,data:u,x:a.x,y:a.y}),Nt()},[re,Nt]),Ut=e.useCallback(e=>{qt.current=-1,Gt.current=null,_t.current(e)},[]);xt.current=()=>{var e,t,n,o,r,a,s;gt.current=0;const l=pt.current,c=ut.current;if(!l||!c)return;const u=performance.now();let d=!1;const p=Ot.current;p&&(Ot.current=null,c.applyRotation(p,{width:nt,height:it}));const h=c.advanceTransition(Ze.current?u+1e6:u),y=!Ze.current&&h;if(mt.current&&!h){const e={width:nt,height:it},t=lt?c.getRotation():null;c.computeScene(e);const n=wt.current,o=1!==n.k||0!==n.x||0!==n.y;lt&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),mt.current=!1,l.setAttribute("aria-label",fe(c.scene,"Geographic chart"))}const f=Fe();if(T&&ft.current){const t=dt.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=_e(t,Je,Qe,f);if(e){e.clearRect(-Qe.left,-Qe.top,Je[0],Je[1]),e.save(),e.beginPath(),e.rect(0,0,nt,it),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:a,onTileLoad:s}=t,l=o.scale(),c=o.translate(),u=2*l*Math.PI,d=function(){let e=0,t=0,n=960,o=500,r=!0,i=!0,a=256,s=Ne,l=De,c=0;function u(){const u=+s.apply(this,arguments),d=l.apply(this,arguments),p=Math.log2(u/a),h=Math.round(Math.max(p+c,0)),y=Math.pow(2,p-h)*a,f=+d[0]-u/2,g=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-f)/y)),b=Math.min(r?1<<h:1/0,Math.ceil((n-f)/y)),v=Math.max(i?0:-1/0,Math.floor((t-g)/y)),x=Math.min(i?1<<h:1/0,Math.ceil((o-g)/y)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[f/y,g/y],k.scale=y,k}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(s="function"==typeof e?e:Te(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:Te([+e[0],+e[1]]),u):l},u.zoomDelta=function(e){return arguments.length?(c=+e,u):c},u.tileSize=function(e){return arguments.length?(a=+e,u):a},u.clamp=function(e){return arguments.length?(r=i=!!e,u):r&&i},u.clampX=function(e){return arguments.length?(r=!!e,u):r},u.clampY=function(e){return arguments.length?(i=!!e,u):i},u}().size([r,i]).scale(u).translate(c).clamp(!0)(),p=Fe();let h=!0;for(const t of d){const[o,r,i]=We(t),l=`${i}/${o}/${r}`;let c=a.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};a.set(l,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=He(n,i,o,r,p),c=t}if(!c.loaded){h=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return h}(e,{tileURL:T,projection:c.scales.projection,width:nt,height:it,tileCache:ft.current,onTileLoad:()=>Nt()});e.restore(),t||(d=!0)}}}const g=_e(l,Je,Qe,f);if(!g)return;g.clearRect(-Qe.left,-Qe.top,Je[0],Je[1]),Y&&!T&&(g.fillStyle=Y,g.fillRect(0,0,nt,it)),g.save(),g.beginPath(),g.rect(0,0,nt,it),g.clip();const m=c.scene,b={height:it};if(function(e,t){var n,o,r;const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;const i=new Path2D(t.pathData),a=t.style.fill||"#e0e0e0";if("none"!==a&&(e.fillStyle=a,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(i)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}Pe(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(g,m),((e,t,n,o)=>{var r,a;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const c=l.style.stroke||"#007bff",u=l.style.strokeWidth||2,d=l.colorThresholds,p=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=u,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const g=null!==(r=l.style.opacity)&&void 0!==r?r:1;Be(e,l.path,c,u,g,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Re(l.curve),y=d&&d.length>0&&p&&p.length===l.path.length,f=l._decayOpacities;if(f&&f.length===l.path.length&&!y){e.strokeStyle=c;const m=null!==(a=l.style.opacity)&&void 0!==a?a:1;for(let b=0;l.path.length-1>b;b++)e.globalAlpha=.5*(f[b]+f[b+1])*m,e.beginPath(),e.moveTo(l.path[b][0],l.path[b][1]),e.lineTo(l.path[b+1][0],l.path[b+1][1]),e.stroke()}else if(y){let v=null,x=null,k=null,w=null,A=!1;function j(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),A=!0}function E(){A&&(e.stroke(),A=!1)}for(let O=0;l.path.length>O;O++){const[S,M]=l.path[O],C=p[O],$=Ie(C,d,c);if(null!==v&&null!==w&&null!==k){if($===w)e.lineTo(S,M);else{const z=[];for(const L of d){const P=L.value;(k>P||P>C)&&(P>k||C>P)||k===P||C===P||z.push({t:(P-k)/(C-k)})}z.sort((e,t)=>e.t-t.t);for(const R of z){const I=v+(S-v)*R.t,B=x+(M-x)*R.t,N=Ie(k+(C-k)*Math.min(R.t+1e-4,1),d,c);e.lineTo(I,B),E(),j(N,I,B)}e.lineTo(S,M)}v=S,x=M,k=C,w=$}else j($,S,M),v=S,x=M,k=C,w=$}E()}else{if(e.beginPath(),!l.strokeGradient||2>l.strokeGradient.colorStops.length||2>l.path.length)e.strokeStyle=c;else{const D=e.createLinearGradient(l.path[0][0],0,l.path[l.path.length-1][0],0);for(const T of l.strokeGradient.colorStops)D.addColorStop(Math.max(0,Math.min(1,T.offset)),T.color);e.strokeStyle=D}if(h)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[W,_]=l.path[0];e.moveTo(W,_);for(let F=1;l.path.length>F;F++)e.lineTo(l.path[F][0],l.path[F][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=l.style.fill,h&&!y)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[q,G]=l.path[0];e.moveTo(q,G);for(let V=1;l.path.length>V;V++)e.lineTo(l.path[V][0],l.path[V][1])}const H=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(H,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(g,m,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=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Le(e,t),e.globalAlpha=1}}finally{e.restore()}}})(g,m),N&&St.current){const e=St.current,i=m.filter(e=>"line"===e.type);if(i.length>0){const s=D||{},l=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),c=null!==(n=s.maxPerLine)&&void 0!==n?n:30,p=null!==(o=s.spawnRate)&&void 0!==o?o:.15,h=null!==(r=s.radius)&&void 0!==r?r:2,y=null!==(a=s.opacity)&&void 0!==a?a:.7,f=u/1e3,m=Mt.current>0?Math.min(f-Mt.current,.1):.016;Mt.current=f;const b=i.map(e=>e.path),v=i.map(e=>e.style.strokeWidth||2);for(let t=0;i.length>t;t++)Math.random()<p&&e.countForLine(t)<c&&e.spawn(t);e.step(m,l,b,v),g.globalAlpha=y;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=i[n.lineIndex],r="function"==typeof s.color?s.color(null==o?void 0:o.datum):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";g.beginPath(),g.arc(n.x,n.y,h,0,2*Math.PI),g.fillStyle=r,g.fill()}g.globalAlpha=1,d=!0}}g.restore();const v=ht.current;if(v){const e=_e(v,Je,Qe,f);if(e){e.clearRect(-Qe.left,-Qe.top,Je[0],Je[1]);const t=$t.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 te?te:void 0,r=(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),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(ce){const e=performance.now()-c.lastIngestTime>(null!==(s=ce.threshold)&&void 0!==s?s:5e3);e!==It&&Bt(e)}const x=ie!==vt.current;x&&(vt.current=ie),(mt.current||x)&&Rt(e=>e+1),(y||c.hasActivePulses||d)&&(gt.current=requestAnimationFrame(()=>xt.current()))},e.useEffect(()=>(Nt(),()=>{var e;gt.current&&(cancelAnimationFrame(gt.current),gt.current=0),null===(e=ft.current)||void 0===e||e.clear()}),[Nt]),e.useEffect(()=>{mt.current=!0,Nt()},[nt,it,Y,Nt]),function(t,n,o,r,i,a){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const s=n.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(ce,ut,mt,Nt,It,Bt),e.useEffect(()=>{if("production"!==process.env.NODE_ENV&&T){const e="string"==typeof m?m:"object"==typeof m&&"type"in m?m.type:null;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.`)}},[T,m]),e.useEffect(()=>{const e=jt.current;if(!P||!e)return kt.current&&e&&(l.select(e).on(".zoom",null),kt.current=null),void(e&&l.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=R||[1,8],o={width:nt,height:it};if(lt){let r=wt.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),wt.current=s.zoomIdentity.scale(r);const a=ut.current;a&&(a.applyZoomScale(r,o),mt.current=!1,Nt(),null==I||I({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};kt.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},l=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",l);const c=.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=ut.current;if(!o)return;const r=o.getRotation();Et.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Et.current;t&&(Ot.current=[t.rotation[0]+(e.clientX-t.x)*c,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*c)),t.rotation[2]],Nt())},p=t=>{var n;if(!Et.current)return;Et.current=null,e.releasePointerCapture(t.pointerId);const r=Ot.current;if(r){Ot.current=null;const e=ut.current;e&&(e.applyRotation(r,o),Nt())}const i=ut.current;i&&(null==I||I({projection:null===(n=i.scales)||void 0===n?void 0:n.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),kt.current=null}}const r=s.zoom().scaleExtent([t,n]).extent([[0,0],[Je[0],Je[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;wt.current=t,At.current=!0;const n=ut.current;n&&(n.applyZoomTransform(t,o),mt.current=!1,Nt())}).on("end",e=>{var t;wt.current=e.transform,At.current=!1;const n=ut.current;n&&(null==I||I({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return kt.current=r,l.select(e).call(r),()=>{l.select(e).on(".zoom",null)}},[P,R,lt,Je,nt,it,Qe,I,Nt]);const Zt=ee&&!1!==te,Yt=Zt&&zt?ne?ne(zt):p.createElement(rt,{data:zt}):null,Xt=Yt?p.createElement($e,{x:zt.x,y:zt.y,containerWidth:nt,containerHeight:it,margin:Qe,className:"stream-frame-tooltip",zIndex:10},Yt):null;if(pe){const e=ut.current;e&&(k||w||A)&&(k&&e.setAreas(k),w&&e.setPoints(w),A&&e.setLines(A),e.computeScene({width:nt,height:it}));const t=null!==(r=null==e?void 0:e.scene)&&void 0!==r?r:[];return p.createElement("div",{className:"stream-geo-frame"+(Z?" "+Z:""),role:"img","aria-label":ze||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:Je[0],height:Je[1]}},p.createElement(Ee,{summary:Ve}),p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Je[0],height:Je[1],style:{position:"absolute",left:0,top:0}},p.createElement("g",{transform:`translate(${Qe.left},${Qe.top})`},st),p.createElement("g",{transform:`translate(${Qe.left},${Qe.top})`},Y&&p.createElement("rect",{x:0,y:0,width:nt,height:it,fill:Y}),t.map((e,t)=>function(e,t){var n,o,r,i,a,s;switch(e.type){case"geoarea":{const r=e;return r.pathData?p.createElement("path",{key:"geoarea-"+t,d:r.pathData,fill:de(r.style.fill,"#e0e0e0"),fillOpacity:null!==(n=r.style.fillOpacity)&&void 0!==n?n:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(o=r._decayOpacity)&&void 0!==o?o:1}):null}case"point":{const n=e;return p.createElement("circle",{key:"point-"+t,cx:n.x,cy:n.y,r:n.r,fill:de(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:null!==(i=n._decayOpacity)&&void 0!==i?i:null!==(a=n.style.opacity)&&void 0!==a?a:1})}case"line":{const n=e;if(2>n.path.length)return null;const o="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return p.createElement("path",{key:"line-"+t,d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:null!==(s=n.style.opacity)&&void 0!==s?s:1})}default:return null}}(e,t)))),p.createElement(ue,{width:nt,height:it,totalWidth:Je[0],totalHeight:Je[1],margin:Qe,scales:null,showAxes:!1,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:ke,legendIsolatedCategories:we,foregroundGraphics:at,annotations:ie,annotationFrame:0,xValues:[],yValues:[],pointNodes:t.filter(e=>"point"===e.type)}))}const Kt=e.useCallback(e=>{jt.current=e,Ke&&"object"==typeof Ke&&(Ke.current=e)},[Ke]);return p.createElement("div",{ref:Kt,className:"stream-geo-frame"+(Z?" "+Z:""),role:"group","aria-label":ze||("string"==typeof ge?ge:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:G?"100%":Je[0],height:V?"100%":Je[1],overflow:"hidden"},P?{touchAction:"none"}:{}),onKeyDown:Vt},Me&&p.createElement(Oe,{tableId:Ye}),Me&&p.createElement(je,{scene:null!==(c=null===(a=ut.current)||void 0===a?void 0:a.scene)&&void 0!==c?c:[],chartType:"Geographic chart",tableId:Ye,chartTitle:"string"==typeof ge?ge:void 0}),p.createElement(Ee,{summary:Ve}),p.createElement("div",{role:"img","aria-label":ze||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Zt?Ut:void 0,onMouseLeave:Zt?Ft:void 0,onClick:oe?Ht:void 0},st&&p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Je[0],height:Je[1],pointerEvents:"none"}},p.createElement("g",{transform:`translate(${Qe.left},${Qe.top})`},st)),T&&p.createElement("canvas",{ref:dt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement("canvas",{ref:pt,"aria-label":fe(null!==(d=null===(u=ut.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),p.createElement("canvas",{ref:ht,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement(Se,{hoverPoint:zt}),p.createElement(ue,{width:nt,height:it,totalWidth:Je[0],totalHeight:Je[1],margin:Qe,scales:null,showAxes:null!=Ae&&Ae,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:ke,legendIsolatedCategories:we,foregroundGraphics:at,annotations:ie,annotationFrame:Pt,xValues:[],yValues:[],pointNodes:null===(h=ut.current)||void 0===h?void 0:h.scene.filter(e=>"point"===e.type)}),(null==ce?void 0:ce.showBadge)&&p.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ce.badgePosition?{top:4,left:4}:"bottom-left"===ce.badgePosition?{bottom:4,left:4}:"bottom-right"===ce.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:It?"#dc3545":"#28a745",color:"white"})},It?"STALE":"LIVE"),P&&p.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Qe.bottom+8,left:Qe.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},p.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=jt.current,n=kt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1.5)},style:ot},"+"),p.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=jt.current,n=kt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1/1.5)},style:ot},"−")),W&&p.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Qe.bottom+2,right:Qe.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}},W),p.createElement(Ce,{active:qt.current>=0,hoverPoint:zt,margin:Qe,size:Je,shape:null===(y=Gt.current)||void 0===y?void 0:y.shape,width:null===(f=Gt.current)||void 0===f?void 0:f.w,height:null===(g=Gt.current)||void 0===g?void 0:g.h}),Xt))});it.displayName="StreamGeoFrame";const at={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 st(e,t){return"function"==typeof t?t(e):e[t]}function lt(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 ct(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=st(e,n);a=lt(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=st(e,r);s.push({label:n,value:lt(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=lt(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=lt(e[t[0]],o))}}const l=Object.assign(Object.assign({},at),r);return p.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},a&&p.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},a),s.map((e,t)=>p.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&p.createElement("span",null,e.label,": "),e.value)))}}function ut(e){if(!0===e)return ct();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:p.createElement("div",{className:"semiotic-tooltip",style:at},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?ct(e):ct())}const dt={category10:c.schemeCategory10,tableau10:c.schemeTableau10,set3:c.schemeSet3,blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,oranges:c.interpolateOranges,purples:c.interpolatePurples,viridis:c.interpolateViridis,plasma:c.interpolatePlasma},pt=c.schemeCategory10,ht=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],yt=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 ft(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")||yt.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):pt[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+""))%pt.length]}function gt(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const a=dt[o]||dt.category10;if(i&&"function"==typeof a){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>a(Number(t)/e)}{const e=Array.isArray(a)?a:pt;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function mt(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}const bt=e.createContext(null);function vt(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function xt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[kt,wt]=Ze(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=xt(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=xt(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[At,jt]=Ze(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 Et(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=wt(e=>e.selections.get(r)),a=wt(e=>e.setClause),s=wt(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(vt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:e.useCallback(()=>{s(r,o)},[s,r,o]),clientId:o}}function Ot(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:a,clear:s}=Et({name:n});return{onHover:e.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&&a(t)},[o,a,s,n]),predicate:r,isActive:i}}const St=e.createContext(!1);function Mt(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 Ct(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}p.createContext(void 0);const $t="#007bff";function zt(t,n,o){const r=e.useContext(bt),i=function(){var e;const t=et(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}();return e.useMemo(()=>{var e;if(!n)return;const a=null!==(e=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==e?e:"category10";if(0!==t.length){if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const t=gt(e.map(e=>({_cat:e})),"_cat",a);return e=>r[e]||t(e)}return gt(e.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const e=gt(t,n,a);return t=>r[t]||e(t)}return gt(t,n,a)}if(r&&Object.keys(r).length>0){const e=gt([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[t,n,o,r,i])}function Lt({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:a,chartId:s,onClick:l,hoverHighlight:c,colorByField:u}){const d=e.useId(),p=Mt(n,o),h=Et({name:(null==t?void 0:t.name)||"__unused__"}),y=Ot({name:(null==p?void 0:p.name)||"hover",fields:(null==p?void 0:p.fields)||o||[]}),f=jt(e=>e.pushObservation),g=t?{isActive:h.isActive,predicate:h.predicate}:null,[m,b]=e.useState(null),v=u||o[0],x=e.useMemo(()=>{if(!c||null==m||!v)return null;const e=m,t=v;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,v]),k=e.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==p?void 0:p.mode)&&p.xField){const e=null==t?void 0:t[p.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=X.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(X={positions:new Map(X.positions).set(e,{xValue:t,sourceId:n})},J())}(p.name||"hover",Number(e),d)}"x-position"!==(null==p?void 0:p.mode)&&y.onHover(t)}else"x-position"===(null==p?void 0:p.mode)&&Q(p.name||"hover",d),"x-position"!==(null==p?void 0:p.mode)&&y.onHover(null);if(c&&v)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[v];b(null!=n?n+"":null)}else b(null);if(i||f){const n={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),f&&f(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),f&&f(e)}}},[n,y,p,d,i,a,s,f,c,v]),w=e.useCallback(e=>{var t,n,o,r;if("x-position"===(null==p?void 0:p.mode)&&p.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[p.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=X.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(X.positions);return t.delete(e),X={positions:t},J(),!1}X={positions:new Map(X.positions).set(e,{xValue:t,sourceId:n,locked:!0})},J()}(p.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||f){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const a=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(a),f&&f(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),f&&f(e)}}},[l,i,f,a,s,p,d]);return e.useEffect(()=>{if("x-position"!==(null==p?void 0:p.mode))return;const e=p.name||"hover";return()=>{ee(e,d),Q(e,d)}},[null==p?void 0:p.mode,null==p?void 0:p.name,d]),{activeSelectionHook:g,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function Pt({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40},categories:l}){const c=e.useContext(St),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):ht[i%ht.length];return{label:r+"",color:s}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:ft,categories:l})},[u,n,t,o,l]),p=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),a);return d&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[s,a,d,i]);return{legend:d,margin:p,legendPosition:i}}const Rt={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 It(e,t,n){var o,r,i,a,s,l;const c=Rt[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:Bt(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function Bt(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 Nt({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return p.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},p.createElement("div",{style:{textAlign:"center",maxWidth:400}},p.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),p.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&p.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class Dt extends p.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:p.createElement(Nt,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Tt(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Wt(e,t,n=3){let o,r=n+1;for(const n of t){const t=Tt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function _t(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Ft(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Wt(e,t,3))&&void 0!==n?n:null)}const Ht={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},qt={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Gt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Vt=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Ut=["vertical","horizontal"],Zt={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Vt},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Vt},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Vt},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),qt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ut},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ut},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Ut},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ut},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ut},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ut},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ut},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ut},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Ht),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Ht),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Ht),Gt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Ht),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Ht),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Ut},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Ht),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Ht),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Ht),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Ht),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Ht),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Yt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Xt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Kt=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Jt=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Qt=new Set(["LineChart","AreaChart","StackedAreaChart"]),en=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function tn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function nn(e,t){const n=tn(e),o=tn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const on=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function rn(e,t){const n=[],o=function(e,t){const n=[],o=Zt[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Zt).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!Yt(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Wt(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=function({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=_t(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Ft(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=_t(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=Ft(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Zt[e]?(function(e,t,n){const o=Zt[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=Zt[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Xt.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){Kt.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=Zt[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Jt.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!Qt.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=Zt[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!en.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=nn(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=nn(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of on)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var an;const sn="undefined"!=typeof process&&"production"!==(null===(an=process.env)||void 0===an?void 0:an.NODE_ENV);function ln({componentName:e,width:t,height:n,chartProps:o,children:r}){return p.createElement(Dt,{fallback:r=>{let i="";if(sn&&o)try{const t=rn(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return p.createElement(Nt,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const cn={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 dn(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?p.createElement("div",{style:Object.assign(Object.assign({},cn),{width:t,height:n})},o||"No data available"):null}function pn(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(r+i)-i))/2);return p.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>p.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},un),{position:"absolute",top:a+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}function hn(e,t,n,o){if(!sn)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function yn(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((o=o.apply(e,t||[])).next())})}function fn(e){return e}function gn(e,t){var n=t.id,o=t.bbox,r=null==t.properties?{}:t.properties,i=function(e,t){var n=function(e){if(null==e)return fn;var t,n,o=e.scale[0],r=e.scale[1],i=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+i,u[1]=(n+=e[1])*r+a;c>l;)u[l]=e[l],++l;return u}}(e.transform),o=e.arcs;function r(e,t){t.length&&t.pop();for(var r=o[0>e?~e:e],i=0,a=r.length;a>i;++i)t.push(n(r[i],i));0>e&&function(e,t){for(var n,o=e.length,r=o-t;r<--o;)n=e[r],e[r++]=e[o],e[o]=n}(t,a)}function i(e){return n(e)}function a(e){for(var t=[],n=0,o=e.length;o>n;++n)r(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=a(e);4>t.length;)t.push(t[0]);return t}function l(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=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:r,geometry:i}:null==o?{type:"Feature",id:n,properties:r,geometry:i}:{type:"Feature",id:n,bbox:o,properties:r,geometry:i}}"function"==typeof SuppressedError&&SuppressedError;const mn=new Map;function bn(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function vn(e){return yn(this,void 0,void 0,function*(){const t=mn.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return yn(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:bn(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:bn(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:bn(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:bn(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 r=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return gn(e,t)})}:gn(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return mn.set(e,i),i})}function xn(t){const n=e.useMemo(()=>Array.isArray(t)?t:void 0,[t]),[o,r]=e.useState(null);return e.useEffect(()=>{if(t&&!Array.isArray(t)){if("string"==typeof(e=t)&&["world-110m","world-50m","land-110m","land-50m"].includes(e)){let e=!1;return r(null),vn(t).then(t=>{e||r(t)}),()=>{e=!0}}var e;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${t}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[t]),void 0!==n?n:o}const kn={blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,viridis:c.interpolateViridis};function wn(t){const r=It(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{areas:i,valueAccessor:a,colorScheme:s="blues",projection:l="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:y,onZoom:f,dragRotate:g,tileURL:m,tileAttribution:b,tileCacheSize:v,tooltip:x,areaOpacity:k=1,annotations:w,margin:A,className:j,selection:E,linkedHover:O,onObservation:S,onClick:M,chartId:C,loading:$,emptyContent:z,frameProps:L={}}=t,P=null!=h?h:!!m,R=xn(i),I=e.useMemo(()=>"function"==typeof a?a:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[a])&&void 0!==n?n:null==e?void 0:e[a]},[a]),B=e.useMemo(()=>{if(!R)return n.scaleSequential(c.interpolateBlues).domain([0,1]);const e=R.map(e=>I(e)).filter(e=>null!=e&&isFinite(e)),[t,r]=o.extent(e);return n.scaleSequential(kn[s]||c.interpolateBlues).domain([null!=t?t:0,null!=r?r:1])},[R,I,s]),{activeSelectionHook:N,customHoverBehavior:D,customClickBehavior:T}=Lt({selection:E,linkedHover:O,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C}),W=e.useMemo(()=>{const e=e=>{const t=I(e);return{fill:null!=t&&isFinite(t)?B(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}};return N?Ct(e,N,E):e},[I,B,N,E,k]),_=e.useMemo(()=>e=>{var t,n;const o=(null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.name)||(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||"Feature",r=I(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},o),null!=r&&p.createElement("div",{style:{opacity:.7}},"number"==typeof(i=r)&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=i?i:"")+""));var i},[I]),F=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},A),[A]),H=pn($,r.width,r.height)||(R?null:pn(!0,r.width,r.height)),q=H?null:dn(R,r.width,r.height,z);if(Array.isArray(R)&&R.length>0){const e=R[0];if(!e||"object"!=typeof e||!e.geometry)return p.createElement(Nt,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:r.width,height:r.height})}const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:l,areas:R,areaStyle:W,size:[r.width,r.height],margin:F,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?_:ut(x)||_},null!=u&&{graticule:u}),null!=d&&{fitPadding:d}),P&&{zoomable:!0}),y&&{zoomExtent:y}),f&&{onZoom:f}),null!=g&&{dragRotate:g}),m&&{tileURL:m}),b&&{tileAttribution:b}),v&&{tileCacheSize:v}),(O||S||M)&&{customHoverBehavior:D}),(S||M)&&{customClickBehavior:T}),w&&w.length>0&&{annotations:w}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),j&&{className:j}),L);return H||q||p.createElement(ln,{componentName:"ChoroplethMap",width:r.width,height:r.height},p.createElement(it,Object.assign({},G)))}wn.displayName="ChoroplethMap";const An=e.forwardRef(function(t,n){const o=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const r=It(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:i,xAccessor:a="lon",yAccessor:s="lat",sizeBy:l,sizeRange:c=[3,30],colorBy:u,colorScheme:d,projection:h="equalEarth",graticule:y,fitPadding:f,zoomable:g,zoomExtent:m,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:w,areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:E,annotations:O,margin:S,className:M,selection:C,linkedHover:$,onObservation:z,onClick:L,chartId:P,loading:R,emptyContent:I,legendInteraction:B,legendPosition:N,frameProps:D={}}=t,T=null!=g?g:!!x,W=xn(A),_=i||[],{activeSelectionHook:F,customHoverBehavior:H,customClickBehavior:q}=Lt({selection:C,linkedHover:$,fallbackFields:u?["string"==typeof u?u:""]:[],onObservation:z,onClick:L,chartType:"ProportionalSymbolMap",chartId:P}),G=zt(_,u,d),V=e.useMemo(()=>{if(!l)return;const e="function"==typeof l?l:e=>e[l],t=_.map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[_,l]),U=e.useMemo(()=>{const e=e=>({fill:u?ft(e,u,G):$t,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:l?mt(e,l,c,V):6});return F?Ct(e,F,C):e},[u,G,l,c,V,F,C]),Z=e.useMemo(()=>{if(!u)return[];const e="function"==typeof u?u:e=>e[u],t=new Set;for(const n of _){const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[_,u]),Y=function(t,n,o){const[r,i]=e.useState(null),[a,s]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&s(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"isolate"===t&&a.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return a.has(o)}}:null},[t,n,r,a]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?a:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(B,u,Z),{legend:X,margin:K,legendPosition:J}=Pt({data:_,colorBy:u,colorScale:G,showLegend:r.showLegend,legendPosition:N,userMargin:S,defaults:{top:10,bottom:10,left:10,right:10}}),Q=e.useMemo(()=>e=>{const t=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e.NAME)||(null==e?void 0:e.id),n="string"==typeof l?l:null,o=("function"==typeof l?l:e=>e[l])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",i="string"==typeof u?u:null,a=i?null==e?void 0:e[i]:null;return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},t&&p.createElement("div",{style:{fontWeight:600,marginBottom:2}},t),n&&null!=o&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},n,": "),r(o)),i&&null!=a&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},i,": "),a+""),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),r(t))))},[l,u]),ee=pn(R,r.width,r.height),te=ee?null:dn(i,r.width,r.height,I);hn("ProportionalSymbolMap",_,"xAccessor",a),hn("ProportionalSymbolMap",_,"yAccessor",s);const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=i&&{points:_}),{xAccessor:a,yAccessor:s,pointStyle:U}),W&&{areas:W,areaStyle:j}),null!=y&&{graticule:y}),null!=f&&{fitPadding:f}),T&&{zoomable:!0}),m&&{zoomExtent:m}),b&&{onZoom:b}),null!=v&&{dragRotate:v}),x&&{tileURL:x}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[r.width,r.height],margin:K,enableHover:!0,tooltipContent:!1===E?()=>null:ut(E)||Q}),X&&{legend:X,legendPosition:J}),B&&"none"!==B&&{legendHoverBehavior:Y.onLegendHover,legendClickBehavior:Y.onLegendClick,legendHighlightedCategory:Y.highlightedCategory,legendIsolatedCategories:Y.isolatedCategories}),($||z||L)&&{customHoverBehavior:H}),(z||L)&&{customClickBehavior:q}),O&&O.length>0&&{annotations:O}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),M&&{className:M}),D);return ee||te||p.createElement(ln,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height},p.createElement(it,Object.assign({ref:o},ne)))});function jn(t){const o=It(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{flows:r,nodes:i,nodeIdAccessor:a="id",xAccessor:s="lon",yAccessor:l="lat",valueAccessor:c="value",projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:y,zoomExtent:f,onZoom:g,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:w="basic",areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:E,edgeOpacity:O=.6,edgeWidthRange:S=[1,8],edgeLinecap:M="round",colorScheme:C,showParticles:$,particleStyle:z,tooltip:L,annotations:P,margin:R,className:I,selection:B,linkedHover:N,onObservation:D,onClick:T,chartId:W,loading:_,emptyContent:F,frameProps:H={}}=t,q=null!=y?y:!!b,G=xn(A),V=Mt(N),U=Et({name:(null==B?void 0:B.name)||"__unused__"}),Z=Ot({name:(null==V?void 0:V.name)||"hover",fields:(null==V?void 0:V.fields)||[]}),Y=jt(e=>e.pushObservation),X=B?{isActive:U.isActive,predicate:U.predicate}:null,K=r||[],J=i||[],Q=zt(K,E,C),ee=e.useMemo(()=>{const e=new Map;for(const t of J)e.set(t[a]+"",t);return e},[J,a]),te=e.useMemo(()=>{const e=new Map;for(const t of K)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},[K]),ne=e.useCallback(e=>{var t,n;if(N)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=te.get(t[a]+"");e&&Z.onHover(e)}else Z.onHover(t)}else Z.onHover(null);if(D||Y){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:W};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},o),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});D&&D(i),Y&&Y(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});D&&D(e),Y&&Y(e)}}},[N,Z,a,te,D,W,Y]),oe=e.useCallback(e=>{var t,n,o,r;if(e&&T){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),T(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(e&&(D||Y)){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n={timestamp:Date.now(),chartType:"FlowMap",chartId:W,type:"click",datum:t||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0};D&&D(n),Y&&Y(n)}},[T,D,Y,W]),re=e.useMemo(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof l?l:e=>e[l];return K.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ee.get(n.source+""),r=ee.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[s]:e(o),[l]:t(o)},{[s]:e(r),[l]:t(r)}]}):null}).filter(Boolean)},[K,ee,s,l]),ie=e.useMemo(()=>{const e=K.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[c])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>S[0]:n.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(S)},[K,c,S]),ae=e.useMemo(()=>e=>{var t;return{stroke:E?ft(e,E,Q):$t,strokeWidth:ie(null!==(t=e[c])&&void 0!==t?t:0),strokeLinecap:M,opacity:O}},[E,Q,ie,c,O,M]),se=e.useMemo(()=>X?Ct(ae,X,Object.assign(Object.assign({},B||{}),{unselectedStyle:{opacity:.15,strokeOpacity:.15,fillOpacity:0}})):ae,[ae,X,B]),le=e.useMemo(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),ce=e.useMemo(()=>e=>{var t,n,o,r,i,s,l;if((null==e?void 0:e.geometry)||(null==e?void 0:e.properties)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.geometry)){const t=(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.name)||(null===(o=null==e?void 0:e.properties)||void 0===o?void 0:o.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||(null===(i=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.properties)||void 0===i?void 0:i.name)||(null===(l=null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.properties)||void 0===l?void 0:l.NAME);if(t)return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},t))}if(null!=(null==e?void 0:e.source)&&null!=(null==e?void 0:e.target)){const t=e[c];return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e.source," → ",e.target),null!=t&&p.createElement("div",{style:{opacity:.7}},"number"==typeof t?t.toLocaleString():t))}const u=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e[a]);return null!=u?p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},u)):null},[c,a]),ue=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},R),[R]),de=pn(_,o.width,o.height),pe=de?null:dn(r,o.width,o.height,F),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:u,lines:re,points:J,xAccessor:s,yAccessor:l,lineDataAccessor:"coordinates",lineType:k,flowStyle:w,lineStyle:se,pointStyle:le},G&&{areas:G,areaStyle:j}),null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),q&&{zoomable:!0}),f&&{zoomExtent:f}),g&&{onZoom:g}),null!=m&&{dragRotate:m}),$&&{showParticles:$}),z&&{particleStyle:z}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[o.width,o.height],margin:ue,enableHover:!0,tooltipContent:!1===L?()=>null:ut(L)||ce}),(N||D||T)&&{customHoverBehavior:ne}),(D||T)&&{customClickBehavior:oe}),P&&P.length>0&&{annotations:P}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),I&&{className:I}),H);return de||pe||p.createElement(ln,{componentName:"FlowMap",width:o.width,height:o.height},p.createElement(it,Object.assign({},he)))}An.displayName="ProportionalSymbolMap",jn.displayName="FlowMap";const En=e.forwardRef(function(t,n){const o=It(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:r,lines:i,xAccessor:a="lon",yAccessor:s="lat",nodeIdAccessor:l="id",center:c,costAccessor:u,strength:d=1,lineMode:h="straight",projection:y="mercator",graticule:f,fitPadding:g,zoomable:m,zoomExtent:b,onZoom:v,dragRotate:x,tileURL:k,tileAttribution:w,tileCacheSize:A,transition:j,colorBy:E,colorScheme:O,pointRadius:S=5,tooltip:M,showRings:C=!0,ringStyle:$,showNorth:z=!0,costLabel:L,annotations:P,margin:R,className:I,selection:B,linkedHover:N,onObservation:D,onClick:T,chartId:W,loading:_,emptyContent:F,legendPosition:H,frameProps:q={}}=t,G=null!=m?m:!!k,V=r||[],{activeSelectionHook:U,customHoverBehavior:Z,customClickBehavior:Y}=Lt({selection:B,linkedHover:N,fallbackFields:E?["string"==typeof E?E:""]:[],onObservation:D,onClick:T,chartType:"DistanceCartogram",chartId:W}),X=zt(V,E,O),K=e.useMemo(()=>{const e=e=>({fill:E?ft(e,E,X):$t,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:S});return U?Ct(e,U,B):e},[E,X,S,U,B]),{legend:J,margin:Q,legendPosition:ee}=Pt({data:V,colorBy:E,colorScale:X,showLegend:o.showLegend,legendPosition:H,userMargin:R,defaults:{top:10,bottom:10,left:10,right:10}}),te=e.useMemo(()=>({center:c,centerAccessor:l,costAccessor:u,strength:d,lineMode:h}),[c,l,u,d,h]),ne=e.useMemo(()=>{if(!i)return;const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of V)n.set(e[l]+"",e);return i.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[a]:e(r),[s]:t(r)},{[a]:e(i),[s]:t(i)}]}):null}).filter(Boolean)},[i,V,a,s,l]),oe=e.useMemo(()=>e=>{const t=("function"==typeof u?u:e=>e[u])(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e[l]||e.name||e.id||"Point"),null!=t&&p.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof t?t.toFixed(1):t))},[u,l]),re=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[ie,ae]=e.useState(null),se=e.useCallback(()=>{var e,t;const n=null===(t=null===(e=re.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ae(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);e.useEffect(()=>{const e=requestAnimationFrame(se);return()=>cancelAnimationFrame(e)},[se,d,c,o.width,o.height,V]);const le=e.useMemo(()=>{if(!C||!ie)return[];const{maxCost:e}=ie;if(0>=e)return[];if(Array.isArray(C))return C.filter(t=>t>0&&e>=t);const t="number"==typeof C?C: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},[C,ie]),ce=e.useMemo(()=>{var e,t;if(!ie)return q.foregroundGraphics||null;const{cx:n,cy:o,maxCost:r,availableRadius:i}=ie,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},$),s=null!==(e=Q.left)&&void 0!==e?e:10,l=null!==(t=Q.top)&&void 0!==t?t:10;return p.createElement("g",null,le.map(e=>{const t=e/r*i;return p.createElement("g",{key:e},p.createElement("circle",{cx:n+s,cy:o+l,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),p.createElement("text",{x:n+s+t+3,y:o+l-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif"},e,L?" "+L:""))}),z&&p.createElement("g",{transform:`translate(${s+24}, ${l+24})`},p.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),p.createElement("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),p.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),p.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),q.foregroundGraphics)},[ie,le,z,L,$,Q,q.foregroundGraphics]),ue=pn(_,o.width,o.height),de=ue?null:dn(r,o.width,o.height,F);hn("DistanceCartogram",V,"xAccessor",a),hn("DistanceCartogram",V,"yAccessor",s);const pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:y},null!=r&&{points:V}),ne&&{lines:ne,lineDataAccessor:"coordinates"}),{xAccessor:a,yAccessor:s,pointIdAccessor:l,pointStyle:K,projectionTransform:te}),j&&{transition:{duration:j}}),null!=f&&{graticule:f}),null!=g&&{fitPadding:g}),G&&{zoomable:!0}),b&&{zoomExtent:b}),v&&{onZoom:v}),null!=x&&{dragRotate:x}),k&&{tileURL:k}),w&&{tileAttribution:w}),A&&{tileCacheSize:A}),{size:[o.width,o.height],margin:Q,enableHover:!0,tooltipContent:!1===M?()=>null:ut(M)||oe}),J&&{legend:J,legendPosition:ee}),(N||D||T)&&{customHoverBehavior:Z}),(D||T)&&{customClickBehavior:Y}),P&&P.length>0&&{annotations:P}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),I&&{className:I}),q),ce&&{foregroundGraphics:ce});return ue||de||p.createElement(ln,{componentName:"DistanceCartogram",width:o.width,height:o.height},p.createElement(it,Object.assign({ref:re},pe)))});En.displayName="DistanceCartogram",exports.ChoroplethMap=wn,exports.DistanceCartogram=En,exports.FlowMap=jn,exports.ProportionalSymbolMap=An,exports.StreamGeoFrame=it,exports.mergeData=function(e,t,n){const{featureKey:o,dataKey:r}=n,i=new Map;for(const e of t)i.set(e[r]+"",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=i.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})},exports.resolveReferenceGeography=vn;
1
+ "use strict";const e=require("react"),t=require("d3-geo"),n=require("d3-scale"),o=require("d3-array"),r=require("d3-hierarchy"),i=require("d3-shape"),a=require("regression"),s=require("d3-zoom"),l=require("d3-selection"),c=require("d3-scale-chromatic");function u(e){return e&&e.__esModule?e:{default:e}}function d(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 p=d(e),h=u(a);class f{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[i]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function y(e,t,n){return e+(t-e)*n}const g={mercator:t.geoMercator,equalEarth:t.geoEqualEarth,albersUsa:t.geoAlbersUsa,orthographic:t.geoOrthographic,naturalEarth:t.geoNaturalEarth1,equirectangular:t.geoEquirectangular};function m(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function b(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function v(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):n}const x={fill:"#e0e0e0",stroke:"#999",strokeWidth:.5,fillOpacity:1},k={fill:"#4e79a7",r:4,fillOpacity:.8},w={stroke:"#4e79a7",strokeWidth:1.5,fill:"none"};function A(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function j(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;d.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return d}function E(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function O(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}class S{constructor(e){this.scene=[],this.scales=null,this.version=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.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}initStreaming(e=500){this.pointBuffer=new f(e),this.timestampBuffer=new f(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}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.version++}computeScene(e){const{config:n}=this;this.projection=function(e){if(!e)return t.geoEqualEarth();if("string"==typeof e){const n=g[e];return n?n():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),t.geoEqualEarth())}if("object"==typeof e&&"type"in e){const n=g[e.type],o=n?n():t.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(n.projection),this.geoPath=t.geoPath(this.projection),this.fitProjection(e),this.geoPath=t.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 r=this.scene;this.scene=this.buildSceneNodes(e),n.projectionTransform&&this.applyCartogramTransform(n.projectionTransform,e),n.decay&&this.streaming&&this.applyDecay(),n.pulse&&this.streaming&&this.applyPulse(),n.transition&&r.length>0&&this.startTransition(r),this.version++}fitProjection(e){var t,n,o,r,i;const a=this.projection,s=this.config,l=[...this.areas],c=m(s.xAccessor,"lon"),u=m(s.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const p=b(s.lineDataAccessor);for(const e of this.lineData){const t=p(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);l.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==l.length){if(s.projectionExtent){const[[t,n],[o,r]]=s.projectionExtent;a.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,r],[t,r],[t,n]]]}})}else if(a.clipAngle&&(null!==(t=a.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);a.scale(o/2-o*t),a.translate([e.width/2,e.height/2])}else{const t=null!==(o=s.fitPadding)&&void 0!==o?o:0,n=e.width*t,r=e.height*t;a.fitExtent([[n,r],[e.width-n,e.height-r]],{type:"FeatureCollection",features:l})}this.baseScale=a.scale(),this.baseTranslate=a.translate(),this.baseRotation=null!==(i=null===(r=a.rotate)||void 0===r?void 0:r.call(a))&&void 0!==i?i:[0,0,0]}}applyZoomTransform(e,n){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=t.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(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyZoomScale(e,n){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=t.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(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),this.version++)}applyRotation(e,n){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=t.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(n),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,n),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}buildSceneNodes(e){var n,o,r;const i=[],{config:a}=this,s=this.projection,l=this.geoPath,c=m(a.xAccessor,"lon"),u=m(a.yAccessor,"lat");if(a.graticule){const n=!0===a.graticule?{}:a.graticule,o=t.geoGraticule();n.step&&o.step(n.step);const r=l(o())||"";r&&i.push({type:"geoarea",pathData:r,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:n.stroke||"#e0e0e0",strokeWidth:n.strokeWidth||.5,strokeDasharray:n.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=l(e);if(!t)continue;const n=l.centroid(e),o=l.bounds(e),r=l.area(e),s=v(a.areaStyle,e,x);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:r,style:s,datum:e,interactive:!0})}const d=b(a.lineDataAccessor);for(const n of this.lineData){const o=d(n);if(!o||2>o.length)continue;const r=o.map(e=>[c(e),u(e)]);let l;if("geo"===a.lineType){const e=[];for(let n=0;r.length-1>n;n++){const o=r[n],i=r[n+1],a=t.geoDistance(o,i)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=t.geoInterpolate(o,i);for(let t=0;s>=t;t++)n>0&&0===t||e.push(l(t/s))}l=e.map(([e,t])=>s([e,t])).filter(e=>null!=e)}else l=r.map(([e,t])=>s([e,t])).filter(e=>null!=e);if(2>l.length)continue;const p=v(a.lineStyle,n,w),h="number"==typeof p.strokeWidth?p.strokeWidth:1;2!==r.length||2>l.length||"arc"!==a.flowStyle?2!==r.length||2>l.length||"offset"!==a.flowStyle||(l="geo"===a.lineType?E(l,h):O(l[0],l[l.length-1],0,0,h)):l=j(l[0],l[l.length-1]);const f=A(l,e.width);if(f.length>1)for(const e of f){if(2>e.length)continue;const t={type:"line",path:e,style:Object.assign(Object.assign({},p),{_edgeFade:!0}),datum:n};i.push(t)}else i.push({type:"line",path:2>l.length&&f[0]||l,style:p,datum:n})}const p=this.getPoints(),h=a.pointIdAccessor?"function"==typeof a.pointIdAccessor?a.pointIdAccessor:e=>e[a.pointIdAccessor]:null,f=s.clipAngle&&null!==(n=s.clipAngle())&&void 0!==n?n:0,y=f>0?f*Math.PI/180:null,g=s.rotate?s.rotate():[0,0,0],S="function"==typeof s.center?s.center():[0,0],M=[(null!==(o=S[0])&&void 0!==o?o:0)-g[0],(null!==(r=S[1])&&void 0!==r?r:0)-g[1]];for(let e=0;p.length>e;e++){const n=p[e],o=c(n),r=u(n);if(null!=y&&t.geoDistance([o,r],M)>y)continue;const l=s([o,r]);if(!l)continue;const d=a.pointStyle?a.pointStyle(n):Object.assign({},k),f={type:"point",x:l[0],y:l[1],r:d.r||4,style:d,datum:n,pointId:h?h(n)+"":void 0};i.push(f)}return i}applyCartogramTransform(e,t){var o,r,i;const a=this.scene.filter(e=>"point"===e.type);if(2>a.length)return;const s=null!==(o=e.strength)&&void 0!==o?o:1;if(0===s)return;const l=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=a.find(t=>l(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,p=u.y,h=a.map(e=>c(e.datum)).filter(e=>isFinite(e)&&e>=0),f=Math.max(...h,1),y=Math.min(t.width,t.height)/2,g=n.scaleLinear().domain([0,f]).range([0,y]);this.cartogramLayout={cx:d,cy:p,maxCost:f,availableRadius:y},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 a){if(e===u)continue;const t=Math.atan2(e.y-p,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-p,2)),o=c(e.datum),r=n+((isFinite(o)?g(o):n)-n)*s;e.x=d+Math.cos(t)*r,e.y=p+Math.sin(t)*r}const m=t.width/2,b=t.height/2,v=m-u.x,x=b-u.y;if(Math.abs(v)>.5||Math.abs(x)>.5)for(const e of a)e.x+=v,e.y+=x;this.cartogramLayout={cx:m,cy:b,maxCost:f,availableRadius:y};const k=this.scene.filter(e=>"line"===e.type);if(k.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of a)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of k){const n=null===(r=t.datum)||void 0===r?void 0:r.source,o=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&o){const r=e.get(n+""),i=e.get(o+"");r&&i&&(t.path=[r,i])}}}}applyDecay(){var e,t,n;const o=this.config.decay;if(!o||!this.pointBuffer)return;const r=this.pointBuffer.size;if(0===r)return;const i=null!==(e=o.minOpacity)&&void 0!==e?e:.1,a=null!==(t=o.halfLife)&&void 0!==t?t:r/2,s=null!==(n=o.stepThreshold)&&void 0!==n?n:.5*r,l=this.scene.filter(e=>"point"===e.type);for(let e=0;l.length>e;e++){const t=r-1-e;let n;switch(o.type){case"exponential":n=i+Math.pow(.5,t/a)*(1-i);break;case"step":n=s>t?1:i;break;default:n=i+(r>1?1-t/(r-1):1)*(1-i)}l[e]._decayOpacity=n,l[e].style=Object.assign(Object.assign({},l[e].style),{opacity:n})}}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,r=performance.now(),i=this.scene.filter(e=>"point"===e.type),a=this.timestampBuffer.toArray();for(let e=0;i.length>e&&a.length>e;e++){const s=r-a[e];o>s&&(i[e]._pulseIntensity=1-s/o,i[e]._pulseColor=n.color||"rgba(255,255,255,0.6)",i[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 r=new Map;for(const t of e)"point"===t.type&&t.pointId&&r.set(t.pointId,[t.x,t.y]);const i=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of i)if(e.pointId){const t=r.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)&&(a=!0))}a&&(this.activeTransition={startTime:performance.now(),duration:o})}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 M(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 $(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 z(e,t,n,o,r,i){const a=e.filter(e=>"point"===e.type);let s=null,l=o;for(const e of a){const r=e.x-t,i=e.y-n,a=Math.sqrt(r*r+i*i);M(e.r,o)>=a&&l>a&&(s=e,l=a)}if(s)return{node:s,distance:l};const c=e.filter(e=>"geoarea"===e.type&&!1!==e.interactive);for(let e=c.length-1;e>=0;e--){const o=c[e],[[i,a],[s,l]]=o.bounds;if(!(i>t||t>s||a>n||n>l)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),r.isPointInPath(o._cachedPath2D,t,n)))return{node:o,distance:0}}const u=e.filter(e=>"line"===e.type);let d=null,p=o;for(const e of u){const{path:o}=e;for(let r=0;o.length-1>r;r++){const[i,a]=o[r],[s,l]=o[r+1],c=P(t,n,i,a,s,l);Math.max((e.style.strokeWidth||2)+4,5)>=c&&p>c&&(d=e,p=c)}}return d?{node:d,distance:p}:null}function P(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}const L={fill:e=>p.createElement("rect",{style:e,width:16,height:16}),line:e=>p.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function I(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,L[n])(o(e,t)),r}function B(){return p.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function R(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function D({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+p.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&p.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])),p.createElement("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])))}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(p.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return p.createElement("g",{"aria-label":i||"Gradient legend"},i&&p.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),p.createElement("defs",null,p.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),p.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),p.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])),p.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function N(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical"}=e,[d,h]=p.useState(0),[f,y]=p.useState(0),g=p.useCallback((e,t)=>{h(e),y(t)},[]),m="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c})=>{let u=24;const d=[];return e.forEach((e,h)=>{u+=5,d.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+h,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,d.push(p.createElement("text",{key:"legend-text-"+h,y:u,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),u+=8),d.push(p.createElement("g",{key:"legend-group-"+h,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,a,s,l,c)=>{const{type:u="fill",styleFn:d,items:h}=e,f=[];let y=0;const g=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return h.forEach((e,c)=>{const b=I(e,c,u,d),v=R(e,o,r),x=r&&r.size>0&&r.has(e.label);f.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:g?s===i&&c===a?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?x||!1:void 0,"aria-current":g&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:g?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+h.length)%h.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:v,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},g&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,x&&p.createElement(B,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),y+=22}),f})(e,n,o,r,i,a,s,h,l,c))),u+=22*e.items.length+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:f,onFocusedIndexChange:g,legendInteraction:a}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=0;const h=[];e.forEach((e,t)=>{let f=0;e.label&&(f+=16);const y=((e,t,n,o,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,y=[];let g=0,m=0;const b=!(!t&&!n),v="isolate"===c||void 0===c&&null!=r;f.forEach((e,c)=>{const x=I(e,c,d,h),k=R(e,o,r),w=r&&r.size>0&&r.has(e.label),A=26+7*e.label.length;u&&u>0&&g>0&&g+A>u&&(m++,g=0),y.push(p.createElement("g",{key:"legend-item-"+c,transform:`translate(${g},${22*m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:b?s===i&&c===a?0:-1:void 0,role:b?"option":void 0,"aria-selected":b&&v?w||!1:void 0,"aria-current":b&&!v&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:b?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(c+("ArrowRight"===n.key?1:-1)+f.length)%f.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:b?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:b?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:b?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},b&&p.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&p.createElement(B,null),p.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),g+=A});let x=0,k=0;for(const e of f){const t=26+7*e.label.length;u&&u>0&&k>0&&k+t>u?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:y,offset:x,totalRows:w,totalHeight:22*w}})(e,o,r,i,a,s,l,t,c,u,n);f+=y.offset+5,h.push(Object.assign(Object.assign({label:e.label},y),{offset:f,totalRows:y.totalRows,totalHeight:y.totalHeight})),d+=f+12});let f=d>n?0:Math.max(0,(n-d)/2);const y=[];return h.forEach((n,o)=>{const r=e[o];r.label&&(y.push(p.createElement("text",{key:"legend-text-"+o,transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),f+=16),y.push(p.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${f},0)`},n.items)),f+=n.offset+5,e[o+1]&&y.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:f,y1:-8,x2:f,y2:(n.totalHeight||t)+0+8})),f+=12}),p.createElement("g",null,y)})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:d,focusedItemIndex:f,onFocusedIndexChange:g,legendInteraction:a}),b=!(!n&&!o);return p.createElement("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==s&&""!==s&&"vertical"===u&&p.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},s),m)}function T(e){return"string"==typeof e?{type:e}:e}function W({orient:t,config:n,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;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!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(n),c="top"===t||"bottom"===t,u=e.useMemo(()=>{if(0===r.length)return null;const e=i.domain(),n=a-8;if("boxplot"===l.type){const e=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!e)return null;const{q1:o,median:a,q3:s,whiskerLow:u,whiskerHigh:d}=e,h=Math.min(.5*n,20),f=(n-h)/2+4;if(c){const e=i(o),n=i(s),r=i(a),c=i(u),y=i(d),g="top"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:c,y1:m+g*(f+h/2),x2:y,y2:m+g*(f+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:c,y1:m+g*f,x2:c,y2:m+g*(f+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:y,y1:m+g*f,x2:y,y2:m+g*(f+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:Math.min(e,n),y:"top"===t?m-f-h:m+f,width:Math.abs(n-e),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:r,y1:"top"===t?m-f-h:m+f,x2:r,y2:"top"===t?m-f:m+f+h,stroke:l.fill,strokeWidth:2}))}{const e=i(o),n=i(s),r=i(a),c=i(u),y=i(d),g="left"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:m+g*(f+h/2),y1:c,x2:m+g*(f+h/2),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+g*f,y1:c,x2:m+g*(f+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+g*f,y1:y,x2:m+g*(f+h),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:"left"===t?m-f-h:m+f,y:Math.min(e,n),width:h,height:Math.abs(n-e),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:"left"===t?m-f-h:m+f,y1:r,x2:"left"===t?m-f:m+f+h,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=o.bin().domain(e).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return p.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((e,o)=>{if(null==e.x0||null==e.x1)return null;const r=e.length/d*n;if(c){const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:n,y:"top"===t?-4-r:4,width:Math.max(a,.5),height:r,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const n=i(e.x0),a=i(e.x1)-i(e.x0);return p.createElement("rect",{key:o,x:"left"===t?-4-r:4,y:Math.min(n,n+a),width:r,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const e=n/2+4,o=[];for(const r of u){if(null==r.x0||null==r.x1)continue;const a=r.length/d*(n/2),s=i((r.x0+r.x1)/2);o.push(c?`${s},${"top"===t?-(e-a):e-a}`:`${"left"===t?-(e-a):e-a},${s}`)}for(let r=u.length-1;r>=0;r--){const a=u[r];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(n/2),l=i((a.x0+a.x1)/2);o.push(c?`${l},${"top"===t?-(e+s):e+s}`:`${"left"===t?-(e+s):e+s},${l}`)}return p.createElement("g",{"data-testid":"marginal-violin-"+t},p.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const e=[];if(c){const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${r},${o}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${a},${o}`),e.push("Z")}else{const o=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${o},${r}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,a=i((o.x0+o.x1)/2);e.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;e.push(`L${o},${a}`),e.push("Z")}return p.createElement("g",{"data-testid":"marginal-ridgeline-"+t},p.createElement("path",{d:e.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,t,c,4]);return u?p.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function _(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function F(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 H(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,events:y={},"data-testid":g}=e,m=new Set(Array.isArray(f)?f:[]);let b=o||0,v=r||0;null!=i&&(b=i-t),null!=a&&(v=a-n);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===b&&0===v)if(void 0!==c.width){b=c.width/2;const e=c.depth||30;v=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;b=e+(0>e?-5:5),v=c.height/2}return p.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${t},${n})`,"data-testid":g},y),!m.has("connector")&&function(e,t,n,o,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=o/2,p=e*d>t*u?u/e:d/t;s=r+a*p,l=i+c*p}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);s=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-s,2)+Math.pow(t-l,2))>.5&&(a.push(p.createElement("line",{key:"connector-line",x1:s,y1:l,x2:e,y2:t,stroke:o||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-s);a.push(p.createElement("path",{key:"connector-arrow",d:`M${s},${l}L${s+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${s+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return p.createElement("g",{className:"annotation-connector"},a)}(b,v,l,d,x,c),!m.has("subject")&&function(e,t,n,o,r){var i;const a=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&a.push(p.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&a.push(p.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==t?void 0:t.custom)&&a.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;a.push(p.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(p.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(p.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&a.push(p.createElement("path",{key:"bracket-path",d:F((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}}return p.createElement("g",{className:"annotation-subject"},a)}(x,c,d,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return p.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return p.createElement("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,y=i?c?[i]:_(i,l):[],g=r?c?[r]:_(r,l):[],m="leftRight"===u?"end"===h?-4:4:0;let b=0;const v=[],x=o||"var(--semiotic-text, #333)";y.length>0&&(v.push(p.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:h,fontWeight:"bold"},y.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:f},e)))),b=y.length*f),g.length>0&&v.push(p.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:h,y:b},g.map((e,t)=>p.createElement("tspan",{key:t,x:m,dy:0===t?0:f},e))));let k=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),k=p.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+g.length)*f+(g.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),k=p.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,y.length+g.length-1)*f;let A=0;return"topBottom"===u?A=0>n?-(w+2):18:"leftRight"===u&&(A="middle"===d?-(w+f+(g.length>0&&y.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),p.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},p.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},v),k)}(s,b,v,d))}function q(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),s=r.map((t,n)=>{const r=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:a});return p.createElement(H,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return p.createElement("g",null,s)}const s=o.note||{title:"none",label:o.label};return p.createElement(H,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${o.i}`,events:a},o,{type:i}))}function G(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function V(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function U(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=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!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],p=l[e.yAccessor||"y"];return null==d||null==p?null:{x:c(d),y:u(p)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=G(e,n),c=V(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Z(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Y={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};let X={positions:new Map};const K=new Set;function J(){for(const e of K)e()}function Q(e,t){const n=X.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(X.positions);o.delete(e),X={positions:o},J()}function ee(e,t){const n=X.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(X.positions);o.delete(e),X={positions:o},J()}function te(){return X}function ne(e){return K.add(e),()=>K.delete(e)}const oe={positions:new Map};function re(){return()=>{}}function ie(){return oe}function ae(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function se(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function le(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function ce(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 ue(t){var n,o;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:f,axes:y,xLabel:g,yLabel:m,yLabelRight:b,xFormat:v,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:j,legendClickBehavior:E,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:C,marginalGraphics:z,xValues:P,yValues:L,annotations:I,svgAnnotationRules:B,xAccessor:R,yAccessor:_,annotationData:F,pointNodes:H,curve:X,underlayRendered:K,linkedCrosshairName:J,linkedCrosshairSourceId:Q,children:oe}=t,ue=e.useMemo(()=>{var e;if(!f||!d)return[];const t=null==y?void 0:y.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||v||le,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=d.x.ticks(Math.min(o,Math.max(2,Math.floor(a/70)))),i=r.map(e=>e.valueOf()),s=r.map((e,t)=>({value:e,pixel:d.x(e),label:n(e,t,i)})),l=s.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),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(l+8,55)):Math.max(55,l+8);let u=ce(s,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=d.x.domain()[1],t=d.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[f,d,y,v,a]),de=e.useMemo(()=>{var e;if(!f||!d)return[];const t=null==y?void 0:y.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||le,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=ce(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=d.y.domain()[1],t=d.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[f,d,y,x,s]),pe=e.useMemo(()=>{var e;if(!f||!d)return[];const t=null==y?void 0:y.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||le,o=null!==(e=t.ticks)&&void 0!==e?e:5;return ce(d.y.ticks(Math.min(o,Math.max(2,Math.floor(s/30)))).map(e=>({value:e,pixel:d.y(e),label:n(e)})),22)},[f,d,y,x,s]),he=e.useRef(new Map),fe=e.useRef(null!==(n=null==I?void 0:I.length)&&void 0!==n?n:0),ye=null!==(o=null==I?void 0:I.length)&&void 0!==o?o:0;fe.current!==ye&&(fe.current=ye,he.current=new Map);const ge=e.useMemo(()=>{if(!I||0===I.length)return null;const e=function(e,t,n){var o,a,s,l,c,u,d,f,y,g,m,b,v,x,k,w,A,j,E,O,S,M,C,$,z,P,L,I,B,R,D,N,T,W,_,F,H,X,K,J,Q,ee,te,ne,oe,re,ie,ae;switch(e.type){case"label":{const o=U(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Z(r,i,n)?p.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=U(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Z(r,i,n)?p.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=G(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let a;return a="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12,p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:o+4,y:a,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=V(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,s;return"left"===i?(a=4,s="start"):"center"===i?(a=(n.width||0)/2,s="middle"):(a=(n.width||0)-4,s="end"),p.createElement("g",{key:"ann-"+t},p.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:a,y:o-4,textAnchor:s,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:G(Object.assign(Object.assign({},e),{type:"point"}),n),y:V(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=r.packEnclose(o),a=e.padding||10;return p.createElement("g",{key:"ann-"+t},p.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:G(Object.assign(Object.assign({},e),{type:"point"}),n),y:V(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),s=Math.min(...i)-r,l=Math.max(...i)+r,c=Math.min(...a)-r,u=Math.max(...a)+r;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:s,y:c,width:l-s,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&p.createElement("text",{x:(s+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return p.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=G(t,n),a=V(t,n);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return p.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:a,r:s},l))}))}case"bracket":{const o=G(e,n),r=V(e,n);return p.createElement(q,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const r=n.data||[];if(2>r.length)return null;const i=n.xAccessor||"x",f=n.yAccessor||"y",y=r.map(e=>[e[i],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const g=null!==(a=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==a?a:null===(s=n.scales)||void 0===s?void 0:s.time,m=null!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!g||!m)return null;const b=e.method||"linear";let v;v="loess"===b?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,p=0,h=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],p+=t*i[e],h+=t*r[e]*r[e],f+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const y=u*h-d*d;if(1e-12>Math.abs(y))s.push([t,p/u]);else{const e=(u*f-d*p)/y;s.push([t,(p-e*d)/u+e*t])}}return s}(y,null!==(d=e.bandwidth)&&void 0!==d?d:.3):("polynomial"===b?h.default.polynomial(y,{order:e.order||2}):h.default.linear(y)).points;const x=v.map(([e,t])=>`${g(e)},${m(t)}`).join(" "),k=e.color||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("polyline",{points:x,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&p.createElement("text",{x:g(v[v.length-1][0])+4,y:m(v[v.length-1][1])-4,fill:k,fontSize:11},e.label))}case"band":{const o=null!==(y=null===(f=n.scales)||void 0===f?void 0:f.y)&&void 0!==y?y:null===(g=n.scales)||void 0===g?void 0:g.value,r=null!==(m=null==o?void 0:o(e.y0))&&void 0!==m?m:0,i=null!==(b=null==o?void 0:o(e.y1))&&void 0!==b?b:n.height||0;return p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(v=n.scales)||void 0===v?void 0:v.x)&&void 0!==x?x:null===(k=n.scales)||void 0===k?void 0:k.time,s=null!==(A=null===(w=n.scales)||void 0===w?void 0:w.y)&&void 0!==A?A:null===(j=n.scales)||void 0===j?void 0:j.value;if(!a||!s)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,d=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>d.length)return null;const h=Y[n.curve||"linear"]||i.curveLinear,f=i.area().x(e=>a(e[r])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!f)return null;const y=e.fill||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:f,fill:y,fillOpacity:null!==(E=e.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.label&&d.length>0&&p.createElement("text",{x:a(d[d.length-1][r])+4,y:s(d[d.length-1][l])-4,fill:y,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(S=null===(O=n.scales)||void 0===O?void 0:O.x)&&void 0!==S?S:null===(M=n.scales)||void 0===M?void 0:M.time,a=null!==($=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==$?$:null===(z=n.scales)||void 0===z?void 0:z.value;if(!i||!a)return null;const s=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+Math.pow(t-l,2),0)/s.length,u=Math.sqrt(c),d=null!==(P=e.threshold)&&void 0!==P?P:2,h=l-d*u,f=!1!==e.showBand,y=e.fill||"#6366f1",g=null!==(L=e.fillOpacity)&&void 0!==L?L:.1,m=e.anomalyColor||"#ef4444",b=null!==(I=e.anomalyRadius)&&void 0!==I?I:6,v=a(l+d*u),x=a(h),k=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return p.createElement("g",{key:"ann-"+t},f&&p.createElement("rect",{x:0,y:Math.min(v,x),width:n.width||0,height:Math.abs(x-v),fill:y,fillOpacity:g}),k.map((e,t)=>{const o=G(e,n),r=V(e,n);return null==o||null==r?null:p.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:b,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&p.createElement("text",{x:(n.width||0)-4,y:Math.min(v,x)-4,textAnchor:"end",fill:y,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a=null!==(R=null===(B=n.scales)||void 0===B?void 0:B.x)&&void 0!==R?R:null===(D=n.scales)||void 0===D?void 0:D.time,s=null!==(T=null===(N=n.scales)||void 0===N?void 0:N.y)&&void 0!==T?T:null===(W=n.scales)||void 0===W?void 0:W.value;if(!a||!s)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=h.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(d/Math.max(u-2,1)),y=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(_=e.confidence)&&void 0!==_?_:.95,b=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,v=null!==(F=e.steps)&&void 0!==F?F:5,x=l[u-1][0],k=(x-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;v>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(g>0?Math.pow(e-y,2)/g:0))*b;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${A.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,E=A.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),O=`${a(x)},${s(c(x))}`,S=e.strokeColor||"#6366f1";return p.createElement("g",{key:"ann-"+t},p.createElement("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:null!==(H=e.fillOpacity)&&void 0!==H?H:.15,stroke:"none"}),p.createElement("polyline",{points:`${O} ${E}`,fill:"none",stroke:S,strokeWidth:null!==(X=e.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(K=e.strokeDasharray)&&void 0!==K?K:"6,3"}),e.label&&A.length>0&&p.createElement("text",{x:a(A[A.length-1].x)+4,y:s(A[A.length-1].yCenter)-4,fill:S,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=U(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!Z(o,r,n))return null;const i=null!==(J=e.dx)&&void 0!==J?J:0,a=null!==(Q=e.dy)&&void 0!==Q?Q:0,s=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,c=null!==(ne=e.content)&&void 0!==ne?ne:p.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return p.createElement("foreignObject",{key:"ann-"+t,x:o+i-s/2,y:r+a-l/2,width:s,height:l,style:{overflow:"visible",pointerEvents:"auto"}},p.createElement("div",{style:{width:s,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=U(e,t,n);if(!o)return null;const{x:r,y:i}=o;return p.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=null===(oe=n.scales)||void 0===oe?void 0:oe.o,i=null===(re=n.scales)||void 0===re?void 0:re.x,a=null===(ie=n.scales)||void 0===ie?void 0:ie.y,s=(null==r?void 0:r.bandwidth)?r:(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:null;if(!s)return null;const l=s(o);if(null==l)return null;const c=s.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",d=null!==(ae=e.opacity)&&void 0!==ae?ae:.15,h=e.label;return(n.projection?"vertical"===n.projection:s===i)?p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:l,y:0,width:c,height:n.height||0,fill:u,fillOpacity:d}),h&&p.createElement("text",{x:l+c/2,y:12,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold"},h)):p.createElement("g",{key:"ann-"+t},p.createElement("rect",{x:0,y:l,width:n.width||0,height:c,fill:u,fillOpacity:d}),h&&p.createElement("text",{x:12,y:l+c/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold"},h))}default:return null}},t={scales:d?{x:d.x,y:d.y,time:d.x,value:d.y}:null,timeAxis:"x",xAccessor:R,yAccessor:_,width:a,height:s,data:F,frameType:"xy",pointNodes:H,curve:X,stickyPositionCache:he.current};return I.map((n,o)=>{if(B){const r=B(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[I,B,a,s,R,_,F,d,H,X]),me=function(t){var n;const o=e.useSyncExternalStore(t?ne:re,t?te:ie,t?te:ie);return t&&null!==(n=o.positions.get(t))&&void 0!==n?n:null}(J);return e.useEffect(()=>{if(!(null==me?void 0:me.locked)||!J)return;const e=e=>{"Escape"===e.key&&ee(J)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==me?void 0:me.locked,J]),f||w||A||C||z||ge&&ge.length>0||k||oe||me?p.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},p.createElement("title",null,"string"==typeof w?w:"XY Chart"),p.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),p.createElement("g",{transform:`translate(${u.left},${u.top})`},k&&d&&!K&&(()=>{var e,t;const n=ae(null===(e=null==y?void 0:y.find(e=>"bottom"===e.orient))||void 0===e?void 0:e.gridStyle),o=ae(null===(t=null==y?void 0:y.find(e=>"left"===e.orient))||void 0===t?void 0:t.gridStyle);return p.createElement("g",{className:"stream-grid"},ue.map((e,t)=>p.createElement("line",{key:"xgrid-"+t,x1:e.pixel,y1:0,x2:e.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n})),de.map((e,t)=>p.createElement("line",{key:"ygrid-"+t,x1:0,y1:e.pixel,x2:a,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})))})(),f&&d&&(()=>{const e=null==y?void 0:y.find(e=>"left"===e.orient),t=null==y?void 0:y.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,o=!t||!1!==t.baseline,r=(null==e?void 0:e.jaggedBase)||!1,i=(null==t?void 0:t.jaggedBase)||!1,l=null==t?void 0:t.landmarkTicks,c=null==e?void 0:e.landmarkTicks,d="var(--semiotic-border, #ccc)",h="var(--semiotic-text-secondary, var(--semiotic-text, #666))",f="var(--semiotic-text, #333)",v=!!(null==t?void 0:t.autoRotate)&&ue.length>1&&(()=>{const e=a/Math.max(ue.length-1,1);return ue.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return p.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!K&&o&&!i&&p.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:d,strokeWidth:1}),!K&&i&&p.createElement("path",{d:se("bottom",a,s),fill:"none",stroke:d,strokeWidth:1}),ue.map((e,t)=>{const n=!!l&&("function"==typeof l?l(e.value,t):$(e.value,t>0?ue[t-1].value:void 0));return p.createElement("g",{key:"xtick-"+t,transform:`translate(${e.pixel},${s})`},p.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?p.createElement("text",{y:v?10:18,textAnchor:v?"end":"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:h,style:{userSelect:"none"},transform:v?"rotate(-45)":void 0},e.label):p.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},p.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},e.label)))}),g&&p.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:f,style:{userSelect:"none"}},g),!K&&n&&!r&&p.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:d,strokeWidth:1}),!K&&r&&p.createElement("path",{d:se("left",a,s),fill:"none",stroke:d,strokeWidth:1}),de.map((e,t)=>{const n=!!c&&("function"==typeof c?c(e.value,t):$(e.value,t>0?de[t-1].value:void 0));return p.createElement("g",{key:"ytick-"+t,transform:`translate(0,${e.pixel})`},p.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?p.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:n?11:10,fontWeight:n?600:400,fill:h,style:{userSelect:"none"}},e.label):p.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},p.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},e.label)))}),(()=>{const t=(null==e?void 0:e.label)||m;return t?p.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},t):null})(),(()=>{const e=null==y?void 0:y.find(e=>"right"===e.orient);if(!e||0===pe.length)return null;const t=e.landmarkTicks,n=e.label||b;return p.createElement(p.Fragment,null,!1!==e.baseline&&p.createElement("line",{x1:a,y1:0,x2:a,y2:s,stroke:d,strokeWidth:1}),pe.map((e,n)=>{const o=!!t&&("function"==typeof t?t(e.value,n):$(e.value,n>0?pe[n-1].value:void 0));return p.createElement("g",{key:"ytick-r-"+n,transform:`translate(${a},${e.pixel})`},p.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?p.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:h,style:{userSelect:"none"}},e.label):p.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},p.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},e.label)))}),n&&p.createElement("text",{x:a+u.right-15,y:s/2,textAnchor:"middle",fontSize:12,fill:f,transform:`rotate(90, ${a+u.right-15}, ${s/2})`,style:{userSelect:"none"}},n))})())})(),ge,z&&d&&P&&L&&p.createElement(p.Fragment,null,z.top&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(W,{orient:"top",config:T(z.top),values:P,scale:d.x,size:u.top,length:a})),z.bottom&&p.createElement("g",{transform:`translate(0, ${s})`},p.createElement(W,{orient:"bottom",config:T(z.bottom),values:P,scale:d.x,size:u.bottom,length:a})),z.left&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(W,{orient:"left",config:T(z.left),values:L,scale:d.y,size:u.left,length:s})),z.right&&p.createElement("g",{transform:`translate(${a}, 0)`},p.createElement(W,{orient:"right",config:T(z.right),values:L,scale:d.y,size:u.right,length:s}))),C,me&&me.sourceId!==Q&&(null==d?void 0:d.x)&&(()=>{const e=d.x(me.xValue);if(null==e||0>e||e>a)return null;const t=me.locked;return p.createElement("line",{x1:e,y1:0,x2:e,y2:s,stroke:t?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:t?1.5:1,strokeDasharray:t?"6,3":"4,4",pointerEvents:"none"})})(),oe),w&&p.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",title:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const h="top"===i||"bottom"===i;let f,y;return"left"===i?(f=4,y=r.top):"top"===i?(f=0,y=a?32:8):"bottom"===i?(f=0,y=o-r.bottom+50):(f=n-r.right+10,y=r.top),p.createElement("g",{transform:`translate(${f}, ${y})`},"object"==typeof(g=t)&&null!==g&&"gradient"in g?p.createElement(D,{config:t.gradient,orientation:h?"horizontal":"vertical",width:h?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?p.createElement(N,{legendGroups:t.legendGroups,title:"",width:h?n:100,orientation:h?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t);var g}({legend:A,totalWidth:l,totalHeight:c,margin:u,legendPosition:M,title:w,legendHoverBehavior:j,legendClickBehavior:E,legendHighlightedCategory:O,legendIsolatedCategories:S})):null}function de(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const pe="undefined"==typeof window||"undefined"==typeof document,he=p.createContext(null),fe={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ye(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const ge=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},me={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"},be={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},ve={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)"},xe={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ke={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)"},we={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ae={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function je({scene:e,chartType:t,tableId:n,chartTitle:o}){var r;const[i,a]=p.useState(!1),s=p.useContext(he),l=null!==(r=null==s?void 0:s.visible)&&void 0!==r&&r,c=i||l,u=p.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t,h=p.useCallback(()=>{i||l||a(!0)},[i,l]),f=p.useCallback(e=>{var t;l||(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[l]);if(!e||0===e.length)return n?p.createElement("span",{id:n,tabIndex:-1,style:fe}):null;if(!c)return p.createElement("div",{id:n,tabIndex:-1,onFocus:h,style:fe,role:"region","aria-label":d},p.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",e.length," elements)"));const y=function(e){var t,n,o,r,i,a,s,l,c,u,d,p,h,f,y,g,m,b,v,x,k,w,A,j,E;const O=[];if(!Array.isArray(e))return O;for(const S of e)if(S&&"object"==typeof S)try{switch(S.type){case"point":O.push({label:"Point",values:{x:S.x,y:S.y}});break;case"line":{const e=S.path,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=S.topPath,t=Array.isArray(S.datum)?S.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=S.datum&&"object"==typeof S.datum?S.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:S.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;O.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":O.push({label:"Cell",values:{x:S.x,y:S.y,value:S.value}});break;case"wedge":O.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=S.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=S.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=S.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":O.push({label:"Node",values:{id:null!==(p=null===(d=S.datum)||void 0===d?void 0:d.id)&&void 0!==p?p:"",x:null!==(h=S.cx)&&void 0!==h?h:S.x,y:null!==(f=S.cy)&&void 0!==f?f:S.y}});break;case"arc":O.push({label:"Arc",values:{id:null!==(g=null===(y=S.datum)||void 0===y?void 0:y.id)&&void 0!==g?g:"",x:null!==(m=S.cx)&&void 0!==m?m:S.x,y:null!==(b=S.cy)&&void 0!==b?b:S.y}});break;case"candlestick":O.push({label:"Candlestick",values:{x:S.x,open:S.open,high:S.high,low:S.low,close:S.close}});break;case"geoarea":O.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(v=S.datum)||void 0===v?void 0:v.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=S.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(E=null===(j=S.datum)||void 0===j?void 0:j.value)&&void 0!==E?E:""}})}}catch(e){}return O}(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ge(e.min)} to ${ge(e.max)}, mean ${ge(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,g),b=y.slice(0,5),v=new Set;for(const e of b)for(const t of Object.keys(e.values))v.add(t);const x=Array.from(v);return p.createElement("div",{ref:u,id:n,tabIndex:-1,onBlur:f,style:me,role:"region","aria-label":d},p.createElement("button",{type:"button",onClick:()=>{l&&s&&s.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:ve},"×"),p.createElement("div",{role:"note",style:be},m),p.createElement("table",{role:"table","aria-label":"Sample data for "+t,style:xe},p.createElement("caption",{style:Ae},"First ",b.length," of ",y.length," data points"),p.createElement("thead",null,p.createElement("tr",null,p.createElement("th",{style:ke},"type"),x.map(e=>p.createElement("th",{key:e,style:ke},e)))),p.createElement("tbody",null,b.map((e,t)=>p.createElement("tr",{key:t},p.createElement("td",{style:we},e.label),x.map(t=>{return p.createElement("td",{key:t,style:we},null==(n=e.values[t])||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":ge(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"");var n}))))))}function Ee({summary:e}){return e?p.createElement("div",{role:"note",style:fe},e):null}function Oe({tableId:e}){return p.createElement("a",{href:"#"+e,style:fe,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,fe)}},"Skip to data table")}function Se({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return p.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:fe},t)}const Me="var(--semiotic-focus, #005fcc)";function Ce({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:a}){if(!e||!t)return null;const s=t.x+n.left,l=t.y+n.top;let c;if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);c=p.createElement("rect",{x:s-e/2-3,y:l-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Me,strokeWidth:2,strokeDasharray:"4,2"})}else c=p.createElement("circle","wedge"===r?{cx:s,cy:l,r:12,fill:"none",stroke:Me,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:l,r:8,fill:"none",stroke:Me,strokeWidth:2,strokeDasharray:"4,2"});return p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},c)}function $e({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=p.useRef(null),[c,u]=p.useState(null);p.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect();u(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,a,n,o]);let d;return d=c?`translate(${c.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${c.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`,p.createElement("div",{ref:l,className:a,style:{position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:s,width:"max-content"}},i)}const ze=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Pe=new WeakMap;function Le(e,t){var n,o;if(!t)return t;const r=ze.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;let a=Pe.get(i);if(a||(a=new Map,Pe.set(i,a)),a.has(t))return a.get(t);const s=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return a.set(t,s),s}function Ie(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Be(e,t,n=.6){var o,r,i,a,s;if(!Ie(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a: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 Re(e,t,n,o=.35){Ie(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function De(e){switch(e){case"monotoneX":return i.curveMonotoneX;case"monotoneY":return i.curveMonotoneY;case"cardinal":return i.curveCardinal;case"catmullRom":return i.curveCatmullRom;case"step":return i.curveStep;case"stepBefore":return i.curveStepBefore;case"stepAfter":return i.curveStepAfter;case"basis":return i.curveBasis;case"natural":return i.curveNatural;default:return null}}function Ne(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 Te(e,t,n,o,r,i){if(2>t.length)return;const a=[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];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function We(e){return e.k}function _e(e){return[e.x,e.y]}function Fe(e){return function(){return e}}function He([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t-Math.floor(t/o)*o,n]}function qe(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Ge(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Ve(e,t,n,o,r){return"function"==typeof e?e(t,n,o,r):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",r>1?"@2x":"")}class Ue{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 Ze{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 r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const a=n[i.lineIndex];if(!a||2>a.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const s=Ye(a),l=Xe(a,i.t*s),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.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 Ye(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],r=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+r*r)}return t}function Xe(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],a=Math.sqrt(r*r+i*i);if(n+a>=t||o===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[o-1][0]+r*s,y:e[o-1][1]+i*s,nx:-i/l,ny:r/l}}n+=a}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}function Ke(t){const n=e.createContext(null),o=Je(t);return[function({children:o}){const r=e.useMemo(()=>Je(t),[]);return p.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,a=e.useRef(t);a.current=t;const s=e.useCallback(()=>a.current(i.getState()),[i]),l=e.useCallback(()=>a.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,s,l)}]}function Je(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const Qe={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},et={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},tt={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[nt,ot]=Ke(e=>({theme:Qe,setTheme(t){e(e=>{if("light"===t)return{theme:Qe};if("dark"===t)return{theme:et};if("high-contrast"===t)return{theme:tt};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?et:Qe;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}})),rt={top:10,right:10,bottom:10,left:10},it={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"},at={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 st({data:e}){if(!e)return null;if(e.properties)return p.createElement("div",{className:"semiotic-tooltip",style:it},p.createElement("div",{style:{fontWeight:600}},e.properties.name||e.properties.NAME||e.properties.id||"Feature"));const t=Object.entries(e).slice(0,3);return p.createElement("div",{className:"semiotic-tooltip",style:it},t.map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),p.createElement("span",{style:{fontWeight:600}},t+""))))}const lt=e.forwardRef(function(t,n){var o,r,a,c,u,d,h,f,y,g;const{projection:m,projectionExtent:b,fitPadding:v,projectionTransform:x,areas:k,points:w,lines:A,xAccessor:j,yAccessor:E,lineDataAccessor:O,pointIdAccessor:M,lineType:C="geo",flowStyle:$="basic",graticule:P,zoomable:L,zoomExtent:I,onZoom:B,dragRotate:R,showParticles:D,particleStyle:N,tileURL:T,tileAttribution:W,tileCacheSize:_,size:F,width:H,height:q,responsiveWidth:G,responsiveHeight:V,margin:U,className:Z,background:Y,areaStyle:X,pointStyle:K,lineStyle:J,colorScheme:Q,enableHover:ee=!0,hoverAnnotation:te,tooltipContent:ne,customClickBehavior:oe,customHoverBehavior:re,annotations:ie,decay:ae,pulse:se,transition:le,staleness:ce,backgroundGraphics:he,foregroundGraphics:fe,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:ke,legendIsolatedCategories:we,showAxes:Ae,accessibleTable:Me=!0,description:ze,summary:Ie}=t,Ye=function(){const[t,n]=e.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return e.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),t}(),Xe=e.useRef(Ye);Xe.current=Ye;const Ke="semiotic-table-"+p.useId(),Je=F||[H||600,q||400],[Qe,et]=function(t,n,o){const r=e.useRef(null),[i,a]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(Je,G,V),tt=e.useMemo(()=>Object.assign(Object.assign({},rt),U),[U]),nt=et[0]-tt.left-tt.right,it=et[1]-tt.top-tt.bottom,lt="function"==typeof fe?fe({size:et,margin:tt}):fe,ct="function"==typeof he?he({size:et,margin:tt}):he,ut=e.useMemo(()=>null!=R?R:"orthographic"===("string"==typeof m?m:"object"==typeof m&&"type"in m?m.type:null),[R,m]),dt=e.useMemo(()=>({projection:m,projectionExtent:b,fitPadding:v,xAccessor:j,yAccessor:E,lineDataAccessor:O,lineType:C,flowStyle:$,areaStyle:X,pointStyle:K,lineStyle:J,colorScheme:Q,graticule:P,projectionTransform:x,decay:ae,pulse:se,transition:le,annotations:ie,pointIdAccessor:M}),[m,b,v,j,E,O,C,$,X,K,J,Q,P,x,ae,se,le,ie,M]),pt=e.useRef(null);pt.current||(pt.current=new S(dt));const ht=e.useRef(null),ft=e.useRef(null),yt=e.useRef(null),gt=e.useRef(null),mt=e.useRef(null);T&&!mt.current&&(mt.current=new Ue(_||256));const bt=e.useRef(0),vt=e.useRef(!0),xt=ot(e=>e.theme),kt=e.useRef(ie),wt=e.useRef(()=>{}),At=e.useRef(null),jt=e.useRef(s.zoomIdentity),Et=e.useRef(!1),Ot=e.useRef(null),St=e.useRef(null),Mt=e.useRef(null),Ct=e.useRef(null),$t=e.useRef(0);if(D&&!Ct.current){const e=null!==(o=null==N?void 0:N.maxPerLine)&&void 0!==o?o:30;Ct.current=new Ze(50*e)}const zt=e.useRef(null),Pt=e.useRef(null),[Lt,It]=e.useState(null),[Bt,Rt]=e.useState(0),[Dt,Nt]=e.useState(!1),Tt=e.useCallback(()=>{bt.current||(bt.current=requestAnimationFrame(()=>wt.current()))},[]);e.useEffect(()=>{ft.current&&Pe.delete(ft.current),vt.current=!0,Tt()},[xt,Tt]),e.useEffect(()=>{var e;null===(e=pt.current)||void 0===e||e.updateConfig(dt),vt.current=!0,Tt()},[dt,Tt]),e.useEffect(()=>{const e=pt.current;e&&(k&&e.setAreas(k),w&&e.setPoints(w),A&&e.setLines(A),vt.current=!0,Tt())},[k,w,A,Tt]);const Wt=e.useCallback(e=>{var t;null===(t=pt.current)||void 0===t||t.pushPoint(e),vt.current=!0,Tt()},[Tt]),_t=e.useCallback(e=>{var t;null===(t=pt.current)||void 0===t||t.pushMany(e),vt.current=!0,Tt()},[Tt]),Ft=e.useCallback(()=>{var e;null===(e=pt.current)||void 0===e||e.clear(),vt.current=!0,Tt()},[Tt]);e.useImperativeHandle(n,()=>({push:Wt,pushMany:_t,removePoint:e=>{var t,n;const o=null!==(n=null===(t=pt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(vt.current=!0,Tt()),o},clear:Ft,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=pt.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=pt.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=pt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>jt.current.k,resetZoom:()=>{const e=Ot.current;e&&At.current&&l.select(e).call(At.current.transform,s.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=pt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[Wt,_t,Ft,Tt]);const Ht=e.useRef(()=>{});e.useEffect(()=>{Ht.current=e=>{if(!ee)return;const t=pt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-tt.left,r=e.clientY-n.top-tt.top;if(0>o||o>nt||0>r||r>it)return zt.current=null,Pt.current=null,It(null),null==re||re(null),void Tt();gt.current||(gt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=gt.current.getContext("2d");if(!i)return;const a=z(t.scene,o,r,30,i);if(a){const e=a.node,t=e.datum,n=(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let i,s;"point"===e.type?(i=e.x,s=e.y):"geoarea"===e.type?(i=e.centroid[0],s=e.centroid[1]):(i=o,s=r);const l=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,x:i,y:s,time:0});zt.current=l,Pt.current=e,It(l),null==re||re({type:e.type,data:n,x:i,y:s}),Tt()}else zt.current&&(zt.current=null,Pt.current=null,It(null),null==re||re(null),Tt())}},[ee,nt,it,tt,re,Tt]);const qt=e.useCallback(()=>{zt.current=null,Pt.current=null,It(null),null==re||re(null),Tt()},[re,Tt]),Gt=e.useCallback(e=>{if(!oe)return;const t=pt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-tt.left,r=e.clientY-n.top-tt.top;gt.current||(gt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=gt.current.getContext("2d");if(!i)return;const a=z(t.scene,o,r,30,i);if(a){const e=a.node.datum;oe({type:a.node.type,data:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,x:o,y:r})}},[oe,tt]),Vt=e.useRef(-1),Ut=e.useRef(null),Zt=e.useCallback(e=>{const t=pt.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=Vt.current,r=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===r)return;if(e.preventDefault(),0>r)return Vt.current=-1,Ut.current=null,zt.current=null,Pt.current=null,It(null),null==re||re(null),void Tt();const i=0>o?0:r;Vt.current=i;const a=n[i];Ut.current={shape:a.shape,w:a.w,h:a.h};const s=function(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}(a);zt.current=s,It(s);const l=a.datum;let c="point",u=l;l&&"object"==typeof l&&"geometry"in l&&(c="geoarea",l.properties&&"object"==typeof l.properties&&(u=Object.assign(Object.assign({},l),l.properties))),null==re||re({type:c,data:u,x:a.x,y:a.y}),Tt()},[re,Tt]),Yt=e.useCallback(e=>{Vt.current=-1,Ut.current=null,Ht.current(e)},[]);wt.current=()=>{var e,t,n,o,r,a,s;bt.current=0;const l=ft.current,c=pt.current;if(!l||!c)return;const u=performance.now();let d=!1;const p=Mt.current;p&&(Mt.current=null,c.applyRotation(p,{width:nt,height:it}));const h=c.advanceTransition(Xe.current?u+1e6:u),f=!Xe.current&&h;if(vt.current&&!h){const e={width:nt,height:it},t=ut?c.getRotation():null;c.computeScene(e);const n=jt.current,o=1!==n.k||0!==n.x||0!==n.y;ut&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),vt.current=!1,l.setAttribute("aria-label",ye(c.scene,"Geographic chart"))}const y=Ge();if(T&&mt.current){const t=ht.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=qe(t,et,tt,y);if(e){e.clearRect(-tt.left,-tt.top,et[0],et[1]),e.save(),e.beginPath(),e.rect(0,0,nt,it),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:a,onTileLoad:s}=t,l=o.scale(),c=o.translate(),u=2*l*Math.PI,d=function(){let e=0,t=0,n=960,o=500,r=!0,i=!0,a=256,s=We,l=_e,c=0;function u(){const u=+s.apply(this,arguments),d=l.apply(this,arguments),p=Math.log2(u/a),h=Math.round(Math.max(p+c,0)),f=Math.pow(2,p-h)*a,y=+d[0]-u/2,g=+d[1]-u/2,m=Math.max(r?0:-1/0,Math.floor((e-y)/f)),b=Math.min(r?1<<h:1/0,Math.ceil((n-y)/f)),v=Math.max(i?0:-1/0,Math.floor((t-g)/f)),x=Math.min(i?1<<h:1/0,Math.ceil((o-g)/f)),k=[];for(let e=v;x>e;++e)for(let t=m;b>t;++t)k.push([t,e,h]);return k.translate=[y/f,g/f],k.scale=f,k}return u.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],u):[n-e,o-t]},u.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],u):[[e,t],[n,o]]},u.scale=function(e){return arguments.length?(s="function"==typeof e?e:Fe(+e),u):s},u.translate=function(e){return arguments.length?(l="function"==typeof e?e:Fe([+e[0],+e[1]]),u):l},u.zoomDelta=function(e){return arguments.length?(c=+e,u):c},u.tileSize=function(e){return arguments.length?(a=+e,u):a},u.clamp=function(e){return arguments.length?(r=i=!!e,u):r&&i},u.clampX=function(e){return arguments.length?(r=!!e,u):r},u.clampY=function(e){return arguments.length?(i=!!e,u):i},u}().size([r,i]).scale(u).translate(c).clamp(!0)(),p=Ge();let h=!0;for(const t of d){const[o,r,i]=He(t),l=`${i}/${o}/${r}`;let c=a.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};a.set(l,t),e.onload=()=>{t.loaded=!0,null==s||s()},e.onerror=()=>{t.loaded=!0},e.src=Ve(n,i,o,r,p),c=t}if(!c.loaded){h=!1;continue}const u=d.scale;e.drawImage(c.img,(t[0]+d.translate[0])*u-.5,(t[1]+d.translate[1])*u-.5,u+1,u+1)}return h}(e,{tileURL:T,projection:c.scales.projection,width:nt,height:it,tileCache:mt.current,onTileLoad:()=>Tt()});e.restore(),t||(d=!0)}}}const g=qe(l,et,tt,y);if(!g)return;g.clearRect(-tt.left,-tt.top,et[0],et[1]),Y&&!T&&(g.fillStyle=Y,g.fillRect(0,0,nt,it)),g.save(),g.beginPath(),g.rect(0,0,nt,it),g.clip();const m=c.scene,b={height:it};if(function(e,t){var n,o,r;const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;const i=new Path2D(t.pathData),a=t.style.fill||"#e0e0e0";if("none"!==a&&(e.fillStyle=a,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(i)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=Le(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(r=t._decayOpacity)&&void 0!==r?r:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(i)}Re(e,t,i),e.globalAlpha=1,e.setLineDash([])}}(g,m),((e,t,n,o)=>{var r,a;const s=t.filter(e=>"line"===e.type);for(const l of s){if(2>l.path.length)continue;const c=l.style.stroke||"#007bff",u=l.style.strokeWidth||2,d=l.colorThresholds,p=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=u,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const g=null!==(r=l.style.opacity)&&void 0!==r?r:1;Te(e,l.path,c,u,g,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=De(l.curve),f=d&&d.length>0&&p&&p.length===l.path.length,y=l._decayOpacities;if(y&&y.length===l.path.length&&!f){e.strokeStyle=c;const m=null!==(a=l.style.opacity)&&void 0!==a?a:1;for(let b=0;l.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*m,e.beginPath(),e.moveTo(l.path[b][0],l.path[b][1]),e.lineTo(l.path[b+1][0],l.path[b+1][1]),e.stroke()}else if(f){let v=null,x=null,k=null,w=null,A=!1;function j(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),A=!0}function E(){A&&(e.stroke(),A=!1)}for(let O=0;l.path.length>O;O++){const[S,M]=l.path[O],C=p[O],$=Ne(C,d,c);if(null!==v&&null!==w&&null!==k){if($===w)e.lineTo(S,M);else{const z=[];for(const P of d){const L=P.value;(k>L||L>C)&&(L>k||C>L)||k===L||C===L||z.push({t:(L-k)/(C-k)})}z.sort((e,t)=>e.t-t.t);for(const I of z){const B=v+(S-v)*I.t,R=x+(M-x)*I.t,D=Ne(k+(C-k)*Math.min(I.t+1e-4,1),d,c);e.lineTo(B,R),E(),j(D,B,R)}e.lineTo(S,M)}v=S,x=M,k=C,w=$}else j($,S,M),v=S,x=M,k=C,w=$}E()}else{if(e.beginPath(),!l.strokeGradient||2>l.strokeGradient.colorStops.length||2>l.path.length)e.strokeStyle=c;else{const N=e.createLinearGradient(l.path[0][0],0,l.path[l.path.length-1][0],0);for(const T of l.strokeGradient.colorStops)N.addColorStop(Math.max(0,Math.min(1,T.offset)),T.color);e.strokeStyle=N}if(h)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[W,_]=l.path[0];e.moveTo(W,_);for(let F=1;l.path.length>F;F++)e.lineTo(l.path[F][0],l.path[F][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=("string"==typeof l.style.fill?Le(e,l.style.fill):l.style.fill)||l.style.fill,h&&!f)i.line().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(l.path);else{const[q,G]=l.path[0];e.moveTo(q,G);for(let V=1;l.path.length>V;V++)e.lineTo(l.path[V][0],l.path[V][1])}const H=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(H,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(g,m,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=("string"==typeof t.style.fill?Le(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Le(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Be(e,t),e.globalAlpha=1}}finally{e.restore()}}})(g,m),D&&Ct.current){const e=Ct.current,i=m.filter(e=>"line"===e.type);if(i.length>0){const s=N||{},l=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),c=null!==(n=s.maxPerLine)&&void 0!==n?n:30,p=null!==(o=s.spawnRate)&&void 0!==o?o:.15,h=null!==(r=s.radius)&&void 0!==r?r:2,f=null!==(a=s.opacity)&&void 0!==a?a:.7,y=u/1e3,m=$t.current>0?Math.min(y-$t.current,.1):.016;$t.current=y;const b=i.map(e=>e.path),v=i.map(e=>e.style.strokeWidth||2);for(let t=0;i.length>t;t++)Math.random()<p&&e.countForLine(t)<c&&e.spawn(t);e.step(m,l,b,v),g.globalAlpha=f;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=i[n.lineIndex],r="function"==typeof s.color?s.color(null==o?void 0:o.datum):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";g.beginPath(),g.arc(n.x,n.y,h,0,2*Math.PI),g.fillStyle=r,g.fill()}g.globalAlpha=1,d=!0}}g.restore();const v=yt.current;if(v){const e=qe(v,et,tt,y);if(e){e.clearRect(-tt.left,-tt.top,et[0],et[1]);const t=Pt.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 te?te:void 0,r=(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),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}if(ce){const e=performance.now()-c.lastIngestTime>(null!==(s=ce.threshold)&&void 0!==s?s:5e3);e!==Dt&&Nt(e)}const x=ie!==kt.current;x&&(kt.current=ie),(vt.current||x)&&Rt(e=>e+1),(f||c.hasActivePulses||d)&&(bt.current=requestAnimationFrame(()=>wt.current()))},e.useEffect(()=>(Tt(),()=>{var e;bt.current&&(cancelAnimationFrame(bt.current),bt.current=0),null===(e=mt.current)||void 0===e||e.clear()}),[Tt]),e.useEffect(()=>{vt.current=!0,Tt()},[nt,it,Y,Tt]),function(t,n,o,r,i,a){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const s=n.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(ce,pt,vt,Tt,Dt,Nt),e.useEffect(()=>{if("production"!==process.env.NODE_ENV&&T){const e="string"==typeof m?m:"object"==typeof m&&"type"in m?m.type:null;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.`)}},[T,m]),e.useEffect(()=>{const e=Ot.current;if(!L||!e)return At.current&&e&&(l.select(e).on(".zoom",null),At.current=null),void(e&&l.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=I||[1,8],o={width:nt,height:it};if(ut){let r=jt.current.k;const i=e=>{var i;r=Math.max(t,Math.min(n,e)),jt.current=s.zoomIdentity.scale(r);const a=pt.current;a&&(a.applyZoomScale(r,o),vt.current=!1,Tt(),null==B||B({projection:null===(i=a.scales)||void 0===i?void 0:i.projection,zoom:a.currentZoom}))};At.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>{var n;return i(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},l=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",l);const c=.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=pt.current;if(!o)return;const r=o.getRotation();St.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=St.current;t&&(Mt.current=[t.rotation[0]+(e.clientX-t.x)*c,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*c)),t.rotation[2]],Tt())},p=t=>{var n;if(!St.current)return;St.current=null,e.releasePointerCapture(t.pointerId);const r=Mt.current;if(r){Mt.current=null;const e=pt.current;e&&(e.applyRotation(r,o),Tt())}const i=pt.current;i&&(null==B||B({projection:null===(n=i.scales)||void 0===n?void 0:n.projection,zoom:i.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),At.current=null}}const r=s.zoom().scaleExtent([t,n]).extent([[0,0],[et[0],et[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;jt.current=t,Et.current=!0;const n=pt.current;n&&(n.applyZoomTransform(t,o),vt.current=!1,Tt())}).on("end",e=>{var t;jt.current=e.transform,Et.current=!1;const n=pt.current;n&&(null==B||B({projection:null===(t=n.scales)||void 0===t?void 0:t.projection,zoom:n.currentZoom}))});return At.current=r,l.select(e).call(r),()=>{l.select(e).on(".zoom",null)}},[L,I,ut,et,nt,it,tt,B,Tt]);const Xt=ee&&!1!==te,Kt=Xt&&Lt?ne?ne(Lt):p.createElement(st,{data:Lt}):null,Jt=Kt?p.createElement($e,{x:Lt.x,y:Lt.y,containerWidth:nt,containerHeight:it,margin:tt,className:"stream-frame-tooltip",zIndex:10},Kt):null;if(pe){const e=pt.current;e&&(k||w||A)&&(k&&e.setAreas(k),w&&e.setPoints(w),A&&e.setLines(A),e.computeScene({width:nt,height:it}));const t=null!==(r=null==e?void 0:e.scene)&&void 0!==r?r:[];return p.createElement("div",{className:"stream-geo-frame"+(Z?" "+Z:""),role:"img","aria-label":ze||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:et[0],height:et[1]}},p.createElement(Ee,{summary:Ie}),p.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:et[0],height:et[1],style:{position:"absolute",left:0,top:0}},p.createElement("g",{transform:`translate(${tt.left},${tt.top})`},ct),p.createElement("g",{transform:`translate(${tt.left},${tt.top})`},Y&&p.createElement("rect",{x:0,y:0,width:nt,height:it,fill:Y}),t.map((e,t)=>function(e,t){var n,o,r,i,a,s;switch(e.type){case"geoarea":{const r=e;return r.pathData?p.createElement("path",{key:"geoarea-"+t,d:r.pathData,fill:de(r.style.fill,"#e0e0e0"),fillOpacity:null!==(n=r.style.fillOpacity)&&void 0!==n?n:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(o=r._decayOpacity)&&void 0!==o?o:1}):null}case"point":{const n=e;return p.createElement("circle",{key:"point-"+t,cx:n.x,cy:n.y,r:n.r,fill:de(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:null!==(i=n._decayOpacity)&&void 0!==i?i:null!==(a=n.style.opacity)&&void 0!==a?a:1})}case"line":{const n=e;if(2>n.path.length)return null;const o="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return p.createElement("path",{key:"line-"+t,d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:null!==(s=n.style.opacity)&&void 0!==s?s:1})}default:return null}}(e,t)))),p.createElement(ue,{width:nt,height:it,totalWidth:et[0],totalHeight:et[1],margin:tt,scales:null,showAxes:!1,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:ke,legendIsolatedCategories:we,foregroundGraphics:lt,annotations:ie,annotationFrame:0,xValues:[],yValues:[],pointNodes:t.filter(e=>"point"===e.type)}))}const Qt=e.useCallback(e=>{Ot.current=e,Qe&&"object"==typeof Qe&&(Qe.current=e)},[Qe]);return p.createElement("div",{ref:Qt,className:"stream-geo-frame"+(Z?" "+Z:""),role:"group","aria-label":ze||("string"==typeof ge?ge:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:G?"100%":et[0],height:V?"100%":et[1],overflow:"hidden"},L?{touchAction:"none"}:{}),onKeyDown:Zt},Me&&p.createElement(Oe,{tableId:Ke}),Me&&p.createElement(je,{scene:null!==(c=null===(a=pt.current)||void 0===a?void 0:a.scene)&&void 0!==c?c:[],chartType:"Geographic chart",tableId:Ke,chartTitle:"string"==typeof ge?ge:void 0}),p.createElement(Ee,{summary:Ie}),p.createElement("div",{role:"img","aria-label":ze||("string"==typeof ge?ge:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Xt?Yt:void 0,onMouseLeave:Xt?qt:void 0,onClick:oe?Gt:void 0},ct&&p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:et[0],height:et[1],pointerEvents:"none"}},p.createElement("g",{transform:`translate(${tt.left},${tt.top})`},ct)),T&&p.createElement("canvas",{ref:ht,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement("canvas",{ref:ft,"aria-label":ye(null!==(d=null===(u=pt.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),p.createElement("canvas",{ref:yt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),p.createElement(Se,{hoverPoint:Lt}),p.createElement(ue,{width:nt,height:it,totalWidth:et[0],totalHeight:et[1],margin:tt,scales:null,showAxes:null!=Ae&&Ae,title:ge,legend:me,legendPosition:be,legendHoverBehavior:ve,legendClickBehavior:xe,legendHighlightedCategory:ke,legendIsolatedCategories:we,foregroundGraphics:lt,annotations:ie,annotationFrame:Bt,xValues:[],yValues:[],pointNodes:null===(h=pt.current)||void 0===h?void 0:h.scene.filter(e=>"point"===e.type)}),(null==ce?void 0:ce.showBadge)&&p.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ce.badgePosition?{top:4,left:4}:"bottom-left"===ce.badgePosition?{bottom:4,left:4}:"bottom-right"===ce.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Dt?"#dc3545":"#28a745",color:"white"})},Dt?"STALE":"LIVE"),L&&p.createElement("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:tt.bottom+8,left:tt.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2}},p.createElement("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Ot.current,n=At.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1.5)},style:at},"+"),p.createElement("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Ot.current,n=At.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(l.select(t),1/1.5)},style:at},"−")),W&&p.createElement("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:tt.bottom+2,right:tt.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}},W),p.createElement(Ce,{active:Vt.current>=0,hoverPoint:Lt,margin:tt,size:et,shape:null===(f=Ut.current)||void 0===f?void 0:f.shape,width:null===(y=Ut.current)||void 0===y?void 0:y.w,height:null===(g=Ut.current)||void 0===g?void 0:g.h}),Jt))});lt.displayName="StreamGeoFrame";const ct={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 ut(e,t){return"function"==typeof t?t(e):e[t]}function dt(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 pt(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=ut(e,n);a=dt(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=ut(e,r);s.push({label:n,value:dt(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=dt(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=dt(e[t[0]],o))}}const l=Object.assign(Object.assign({},ct),r);return p.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},a&&p.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},a),s.map((e,t)=>p.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&p.createElement("span",null,e.label,": "),e.value)))}}function ht(e){if(!0===e)return pt();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:p.createElement("div",{className:"semiotic-tooltip",style:ct},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?pt(e):pt())}const ft={category10:c.schemeCategory10,tableau10:c.schemeTableau10,set3:c.schemeSet3,blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,oranges:c.interpolateOranges,purples:c.interpolatePurples,viridis:c.interpolateViridis,plasma:c.interpolatePlasma},yt=c.schemeCategory10,gt=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],mt=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 bt(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")||mt.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):yt[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+""))%yt.length]}function vt(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const a=ft[o]||ft.category10;if(i&&"function"==typeof a){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>a(Number(t)/e)}{const e=Array.isArray(a)?a:yt;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function xt(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}const kt=e.createContext(null);function wt(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function At(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[jt,Et]=Ke(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=At(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=At(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Ot,St]=Ke(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 Mt(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=Et(e=>e.selections.get(r)),a=Et(e=>e.setClause),s=Et(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(wt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:e.useCallback(()=>{s(r,o)},[s,r,o]),clientId:o}}function Ct(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:a,clear:s}=Mt({name:n});return{onHover:e.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&&a(t)},[o,a,s,n]),predicate:r,isActive:i}}const $t=e.createContext(!1);function zt(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 Pt(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}p.createContext(void 0);const Lt="#007bff";function It(t,n,o){const r=e.useContext(kt),i=function(){var e;const t=ot(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}();return e.useMemo(()=>{var e;if(!n)return;const a=null!==(e=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==e?e:"category10";if(0!==t.length){if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const t=vt(e.map(e=>({_cat:e})),"_cat",a);return e=>r[e]||t(e)}return vt(e.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const e=vt(t,n,a);return t=>r[t]||e(t)}return vt(t,n,a)}if(r&&Object.keys(r).length>0){const e=vt([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[t,n,o,r,i])}function Bt({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:a,chartId:s,onClick:l,hoverHighlight:c,colorByField:u}){const d=e.useId(),p=zt(n,o),h=Mt({name:(null==t?void 0:t.name)||"__unused__"}),f=Ct({name:(null==p?void 0:p.name)||"hover",fields:(null==p?void 0:p.fields)||o||[]}),y=St(e=>e.pushObservation),g=t?{isActive:h.isActive,predicate:h.predicate}:null,[m,b]=e.useState(null),v=u||o[0],x=e.useMemo(()=>{if(!c||null==m||!v)return null;const e=m,t=v;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,v]),k=e.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==p?void 0:p.mode)&&p.xField){const e=null==t?void 0:t[p.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=X.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(X={positions:new Map(X.positions).set(e,{xValue:t,sourceId:n})},J())}(p.name||"hover",Number(e),d)}"x-position"!==(null==p?void 0:p.mode)&&f.onHover(t)}else"x-position"===(null==p?void 0:p.mode)&&Q(p.name||"hover",d),"x-position"!==(null==p?void 0:p.mode)&&f.onHover(null);if(c&&v)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[v];b(null!=n?n+"":null)}else b(null);if(i||y){const n={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),y&&y(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),y&&y(e)}}},[n,f,p,d,i,a,s,y,c,v]),w=e.useCallback(e=>{var t,n,o,r;if("x-position"===(null==p?void 0:p.mode)&&p.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[p.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=X.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(X.positions);return t.delete(e),X={positions:t},J(),!1}X={positions:new Map(X.positions).set(e,{xValue:t,sourceId:n,locked:!0})},J()}(p.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||y){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const a=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(a),y&&y(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),y&&y(e)}}},[l,i,y,a,s,p,d]);return e.useEffect(()=>{if("x-position"!==(null==p?void 0:p.mode))return;const e=p.name||"hover";return()=>{ee(e,d),Q(e,d)}},[null==p?void 0:p.mode,null==p?void 0:p.name,d]),{activeSelectionHook:g,hoverSelectionHook:x,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function Rt({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40},categories:l}){const c=e.useContext($t),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):gt[i%gt.length];return{label:r+"",color:s}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:bt,categories:l})},[u,n,t,o,l]),p=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),a);return d&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[s,a,d,i]);return{legend:d,margin:p,legendPosition:i}}const Dt={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 Nt(e,t,n){var o,r,i,a,s,l,c;const u=Dt[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(r=t.height)&&void 0!==r?r:u.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Tt(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function Tt(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 Wt({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return p.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},p.createElement("div",{style:{textAlign:"center",maxWidth:400}},p.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),p.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&p.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class _t extends p.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:p.createElement(Wt,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Ft(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Ht(e,t,n=3){let o,r=n+1;for(const n of t){const t=Ft(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function qt(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Gt(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=Ht(e,t,3))&&void 0!==n?n:null)}const Vt={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Ut={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Zt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Yt=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Xt=["vertical","horizontal"],Kt={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Yt},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Yt},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Yt},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Ut),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Xt},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Xt},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Xt},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Xt},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Xt},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Xt},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Xt},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Xt},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Vt),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Vt),Zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Vt),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Vt),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Xt},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Vt),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Vt),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Vt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Vt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Vt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Jt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Qt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),en=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),tn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),nn=new Set(["LineChart","AreaChart","StackedAreaChart"]),on=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function rn(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function an(e,t){const n=rn(e),o=rn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const sn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function ln(e,t){const n=[],o=function(e,t){const n=[],o=Kt[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Kt).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!Jt(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Ht(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=function({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=qt(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Gt(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=qt(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=Gt(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Kt[e]?(function(e,t,n){const o=Kt[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=Kt[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Qt.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){en.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=Kt[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!tn.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!nn.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=Kt[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!on.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=an(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=an(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of sn)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var cn;const un="undefined"!=typeof process&&"production"!==(null===(cn=process.env)||void 0===cn?void 0:cn.NODE_ENV);function dn({componentName:e,width:t,height:n,chartProps:o,children:r}){return p.createElement(_t,{fallback:r=>{let i="";if(un&&o)try{const t=ln(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return p.createElement(Wt,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const pn={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"},hn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function fn(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?p.createElement("div",{style:Object.assign(Object.assign({},pn),{width:t,height:n})},o||"No data available"):null}function yn(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(r+i)-i))/2);return p.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>p.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},hn),{position:"absolute",top:a+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}function gn(e,t,n,o){if(!un)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function mn(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((o=o.apply(e,t||[])).next())})}function bn(e){return e}function vn(e,t){var n=t.id,o=t.bbox,r=null==t.properties?{}:t.properties,i=function(e,t){var n=function(e){if(null==e)return bn;var t,n,o=e.scale[0],r=e.scale[1],i=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+i,u[1]=(n+=e[1])*r+a;c>l;)u[l]=e[l],++l;return u}}(e.transform),o=e.arcs;function r(e,t){t.length&&t.pop();for(var r=o[0>e?~e:e],i=0,a=r.length;a>i;++i)t.push(n(r[i],i));0>e&&function(e,t){for(var n,o=e.length,r=o-t;r<--o;)n=e[r],e[r++]=e[o],e[o]=n}(t,a)}function i(e){return n(e)}function a(e){for(var t=[],n=0,o=e.length;o>n;++n)r(e[n],t);return 2>t.length&&t.push(t[0]),t}function s(e){for(var t=a(e);4>t.length;)t.push(t[0]);return t}function l(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=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:r,geometry:i}:null==o?{type:"Feature",id:n,properties:r,geometry:i}:{type:"Feature",id:n,bbox:o,properties:r,geometry:i}}"function"==typeof SuppressedError&&SuppressedError;const xn=new Map;function kn(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function wn(e){return mn(this,void 0,void 0,function*(){const t=xn.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return mn(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:kn(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:kn(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:kn(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:kn(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 r=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return vn(e,t)})}:vn(e,t)}(n,n.objects[o]),i="features"in r?r.features:[r];return xn.set(e,i),i})}function An(t){const n=e.useMemo(()=>Array.isArray(t)?t:void 0,[t]),[o,r]=e.useState(null);return e.useEffect(()=>{if(t&&!Array.isArray(t)){if("string"==typeof(e=t)&&["world-110m","world-50m","land-110m","land-50m"].includes(e)){let e=!1;return r(null),wn(t).then(t=>{e||r(t)}),()=>{e=!0}}var e;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${t}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[t]),void 0!==n?n:o}const jn={blues:c.interpolateBlues,reds:c.interpolateReds,greens:c.interpolateGreens,viridis:c.interpolateViridis};function En(t){const r=Nt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{areas:i,valueAccessor:a,colorScheme:s="blues",projection:l="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:f,onZoom:y,dragRotate:g,tileURL:m,tileAttribution:b,tileCacheSize:v,tooltip:x,areaOpacity:k=1,annotations:w,margin:A,className:j,selection:E,linkedHover:O,onObservation:S,onClick:M,chartId:C,loading:$,emptyContent:z,frameProps:P={}}=t,L=null!=h?h:!!m,I=An(i),B=e.useMemo(()=>"function"==typeof a?a:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[a])&&void 0!==n?n:null==e?void 0:e[a]},[a]),R=e.useMemo(()=>{if(!I)return n.scaleSequential(c.interpolateBlues).domain([0,1]);const e=I.map(e=>B(e)).filter(e=>null!=e&&isFinite(e)),[t,r]=o.extent(e);return n.scaleSequential(jn[s]||c.interpolateBlues).domain([null!=t?t:0,null!=r?r:1])},[I,B,s]),{activeSelectionHook:D,customHoverBehavior:N,customClickBehavior:T}=Bt({selection:E,linkedHover:O,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C}),W=e.useMemo(()=>{const e=e=>{const t=B(e);return{fill:null!=t&&isFinite(t)?R(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}};return D?Pt(e,D,E):e},[B,R,D,E,k]),_=e.useMemo(()=>e=>{var t,n;const o=(null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.name)||(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||"Feature",r=B(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},o),null!=r&&p.createElement("div",{style:{opacity:.7}},"number"==typeof(i=r)&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=i?i:"")+""));var i},[B]),F=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},A),[A]),H=yn($,r.width,r.height)||(I?null:yn(!0,r.width,r.height)),q=H?null:fn(I,r.width,r.height,z);if(Array.isArray(I)&&I.length>0){const e=I[0];if(!e||"object"!=typeof e||!e.geometry)return p.createElement(Wt,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:r.width,height:r.height})}const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:l,areas:I,areaStyle:W,size:[r.width,r.height],margin:F,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?_:ht(x)||_},null!=u&&{graticule:u}),null!=d&&{fitPadding:d}),L&&{zoomable:!0}),f&&{zoomExtent:f}),y&&{onZoom:y}),null!=g&&{dragRotate:g}),m&&{tileURL:m}),b&&{tileAttribution:b}),v&&{tileCacheSize:v}),(O||S||M)&&{customHoverBehavior:N}),(S||M)&&{customClickBehavior:T}),w&&w.length>0&&{annotations:w}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),j&&{className:j}),P);return H||q||p.createElement(dn,{componentName:"ChoroplethMap",width:r.width,height:r.height},p.createElement(lt,Object.assign({},G)))}En.displayName="ChoroplethMap";const On=e.forwardRef(function(t,n){const o=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,r,i;const a=null!==(r=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==r?r:[];for(const e of a)null===(i=o.current)||void 0===i||i.push(t(e));return a},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const r=Nt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:i,xAccessor:a="lon",yAccessor:s="lat",sizeBy:l,sizeRange:c=[3,30],colorBy:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:y,zoomable:g,zoomExtent:m,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:w,areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:E,annotations:O,margin:S,className:M,selection:C,linkedHover:$,onObservation:z,onClick:P,chartId:L,loading:I,emptyContent:B,legendInteraction:R,legendPosition:D,frameProps:N={}}=t,T=null!=g?g:!!x,W=An(A),_=i||[],{activeSelectionHook:F,customHoverBehavior:H,customClickBehavior:q}=Bt({selection:C,linkedHover:$,fallbackFields:u?["string"==typeof u?u:""]:[],onObservation:z,onClick:P,chartType:"ProportionalSymbolMap",chartId:L}),G=It(_,u,d),V=e.useMemo(()=>{if(!l)return;const e="function"==typeof l?l:e=>null==e?void 0:e[l],t=_.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[_,l]),U=e.useMemo(()=>{const e=e=>({fill:u?bt(e,u,G):Lt,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:l?xt(e,l,c,V):6});return F?Pt(e,F,C):e},[u,G,l,c,V,F,C]),Z=e.useMemo(()=>{if(!u)return[];const e="function"==typeof u?u:e=>e[u],t=new Set;for(const n of _){const o=e(n);null!=o&&t.add(o+"")}return Array.from(t)},[_,u]),Y=function(t,n,o){const[r,i]=e.useState(null),[a,s]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&s(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"isolate"===t&&a.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return a.has(o)}}:null},[t,n,r,a]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?a:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(R,u,Z),{legend:X,margin:K,legendPosition:J}=Rt({data:_,colorBy:u,colorScale:G,showLegend:r.showLegend,legendPosition:D,userMargin:S,defaults:{top:10,bottom:10,left:10,right:10}}),Q=e.useMemo(()=>e=>{const t=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e.NAME)||(null==e?void 0:e.id),n="string"==typeof l?l:null,o=("function"==typeof l?l:e=>e[l])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",i="string"==typeof u?u:null,a=i?null==e?void 0:e[i]:null;return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},t&&p.createElement("div",{style:{fontWeight:600,marginBottom:2}},t),n&&null!=o&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},n,": "),r(o)),i&&null!=a&&p.createElement("div",null,p.createElement("span",{style:{opacity:.7}},i,": "),a+""),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,": "),r(t))))},[l,u]),ee=yn(I,r.width,r.height),te=ee?null:fn(i,r.width,r.height,B);gn("ProportionalSymbolMap",_,"xAccessor",a),gn("ProportionalSymbolMap",_,"yAccessor",s);const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=i&&{points:_}),{xAccessor:a,yAccessor:s,pointStyle:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),W&&{areas:W,areaStyle:j}),null!=f&&{graticule:f}),null!=y&&{fitPadding:y}),T&&{zoomable:!0}),m&&{zoomExtent:m}),b&&{onZoom:b}),null!=v&&{dragRotate:v}),x&&{tileURL:x}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[r.width,r.height],margin:K,enableHover:!0,tooltipContent:!1===E?()=>null:ht(E)||Q}),X&&{legend:X,legendPosition:J}),R&&"none"!==R&&{legendHoverBehavior:Y.onLegendHover,legendClickBehavior:Y.onLegendClick,legendHighlightedCategory:Y.highlightedCategory,legendIsolatedCategories:Y.isolatedCategories}),($||z||P)&&{customHoverBehavior:H}),(z||P)&&{customClickBehavior:q}),O&&O.length>0&&{annotations:O}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),M&&{className:M}),N);return ee||te||p.createElement(dn,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height},p.createElement(lt,Object.assign({ref:o},ne)))});function Sn(t){const o=Nt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{flows:r,nodes:i,nodeIdAccessor:a="id",xAccessor:s="lon",yAccessor:l="lat",valueAccessor:c="value",projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:f,zoomExtent:y,onZoom:g,dragRotate:m,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:w="basic",areas:A,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:E,edgeOpacity:O=.6,edgeWidthRange:S=[1,8],edgeLinecap:M="round",colorScheme:C,showParticles:$,particleStyle:z,tooltip:P,annotations:L,margin:I,className:B,selection:R,linkedHover:D,onObservation:N,onClick:T,chartId:W,loading:_,emptyContent:F,frameProps:H={}}=t,q=null!=f?f:!!b,G=An(A),V=zt(D),U=Mt({name:(null==R?void 0:R.name)||"__unused__"}),Z=Ct({name:(null==V?void 0:V.name)||"hover",fields:(null==V?void 0:V.fields)||[]}),Y=St(e=>e.pushObservation),X=R?{isActive:U.isActive,predicate:U.predicate}:null,K=r||[],J=i||[],Q=It(K,E,C),ee=e.useMemo(()=>{const e=new Map;for(const t of J)e.set(t[a]+"",t);return e},[J,a]),te=e.useMemo(()=>{const e=new Map;for(const t of K)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},[K]),ne=e.useCallback(e=>{var t,n;if(D)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=te.get(t[a]+"");e&&Z.onHover(e)}else Z.onHover(t)}else Z.onHover(null);if(N||Y){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:W};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},o),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});N&&N(i),Y&&Y(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});N&&N(e),Y&&Y(e)}}},[D,Z,a,te,N,W,Y]),oe=e.useCallback(e=>{var t,n,o,r;if(e&&T){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),T(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(e&&(N||Y)){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n={timestamp:Date.now(),chartType:"FlowMap",chartId:W,type:"click",datum:t||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0};N&&N(n),Y&&Y(n)}},[T,N,Y,W]),re=e.useMemo(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof l?l:e=>e[l];return K.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ee.get(n.source+""),r=ee.get(n.target+"");return o&&r?Object.assign(Object.assign({},n),{coordinates:[{[s]:e(o),[l]:t(o)},{[s]:e(r),[l]:t(r)}]}):null}).filter(Boolean)},[K,ee,s,l]),ie=e.useMemo(()=>{const e=K.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[c])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>S[0]:n.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(S)},[K,c,S]),ae=e.useMemo(()=>e=>{var t;return{stroke:E?bt(e,E,Q):Lt,strokeWidth:ie(null!==(t=e[c])&&void 0!==t?t:0),strokeLinecap:M,opacity:O}},[E,Q,ie,c,O,M]),se=e.useMemo(()=>X?Pt(ae,X,Object.assign(Object.assign({},R||{}),{unselectedStyle:{opacity:.15,strokeOpacity:.15,fillOpacity:0}})):ae,[ae,X,R]),le=e.useMemo(()=>()=>({fill:"#333",r:5,fillOpacity:.8}),[]),ce=e.useMemo(()=>e=>{var t,n,o,r,i,s,l;if((null==e?void 0:e.geometry)||(null==e?void 0:e.properties)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.geometry)){const t=(null===(n=null==e?void 0:e.properties)||void 0===n?void 0:n.name)||(null===(o=null==e?void 0:e.properties)||void 0===o?void 0:o.NAME)||(null==e?void 0:e.name)||(null==e?void 0:e.NAME)||(null===(i=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.properties)||void 0===i?void 0:i.name)||(null===(l=null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.properties)||void 0===l?void 0:l.NAME);if(t)return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},t))}if(null!=(null==e?void 0:e.source)&&null!=(null==e?void 0:e.target)){const t=e[c];return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e.source," → ",e.target),null!=t&&p.createElement("div",{style:{opacity:.7}},"number"==typeof t?t.toLocaleString():t))}const u=(null==e?void 0:e.name)||(null==e?void 0:e.label)||(null==e?void 0:e[a]);return null!=u?p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},u)):null},[c,a]),ue=e.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},I),[I]),de=yn(_,o.width,o.height),pe=de?null:fn(r,o.width,o.height,F),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:u,lines:re,points:J,xAccessor:s,yAccessor:l,lineDataAccessor:"coordinates",lineType:k,flowStyle:w,lineStyle:se,pointStyle:le},G&&{areas:G,areaStyle:j}),null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),q&&{zoomable:!0}),y&&{zoomExtent:y}),g&&{onZoom:g}),null!=m&&{dragRotate:m}),$&&{showParticles:$}),z&&{particleStyle:z}),b&&{tileURL:b}),v&&{tileAttribution:v}),x&&{tileCacheSize:x}),{size:[o.width,o.height],margin:ue,enableHover:!0,tooltipContent:!1===P?()=>null:ht(P)||ce}),(D||N||T)&&{customHoverBehavior:ne}),(N||T)&&{customClickBehavior:oe}),L&&L.length>0&&{annotations:L}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),B&&{className:B}),H);return de||pe||p.createElement(dn,{componentName:"FlowMap",width:o.width,height:o.height},p.createElement(lt,Object.assign({},he)))}On.displayName="ProportionalSymbolMap",Sn.displayName="FlowMap";const Mn=e.forwardRef(function(t,n){const o=Nt(t.mode,{width:t.width,height:t.height,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),{points:r,lines:i,xAccessor:a="lon",yAccessor:s="lat",nodeIdAccessor:l="id",center:c,costAccessor:u,strength:d=1,lineMode:h="straight",projection:f="mercator",graticule:y,fitPadding:g,zoomable:m,zoomExtent:b,onZoom:v,dragRotate:x,tileURL:k,tileAttribution:w,tileCacheSize:A,transition:j,colorBy:E,colorScheme:O,pointRadius:S=5,tooltip:M,showRings:C=!0,ringStyle:$,showNorth:z=!0,costLabel:P,annotations:L,margin:I,className:B,selection:R,linkedHover:D,onObservation:N,onClick:T,chartId:W,loading:_,emptyContent:F,legendPosition:H,frameProps:q={}}=t,G=null!=m?m:!!k,V=r||[],{activeSelectionHook:U,customHoverBehavior:Z,customClickBehavior:Y}=Bt({selection:R,linkedHover:D,fallbackFields:E?["string"==typeof E?E:""]:[],onObservation:N,onClick:T,chartType:"DistanceCartogram",chartId:W}),X=It(V,E,O),K=e.useMemo(()=>{const e=e=>({fill:E?bt(e,E,X):Lt,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:S});return U?Pt(e,U,R):e},[E,X,S,U,R]),{legend:J,margin:Q,legendPosition:ee}=Rt({data:V,colorBy:E,colorScale:X,showLegend:o.showLegend,legendPosition:H,userMargin:I,defaults:{top:10,bottom:10,left:10,right:10}}),te=e.useMemo(()=>({center:c,centerAccessor:l,costAccessor:u,strength:d,lineMode:h}),[c,l,u,d,h]),ne=e.useMemo(()=>{if(!i)return;const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of V)n.set(e[l]+"",e);return i.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),i=n.get(o.target+"");return r&&i?Object.assign(Object.assign({},o),{coordinates:[{[a]:e(r),[s]:t(r)},{[a]:e(i),[s]:t(i)}]}):null}).filter(Boolean)},[i,V,a,s,l]),oe=e.useMemo(()=>e=>{const t=("function"==typeof u?u:e=>e[u])(e);return p.createElement("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12}},p.createElement("div",{style:{fontWeight:600}},e[l]||e.name||e.id||"Point"),null!=t&&p.createElement("div",{style:{opacity:.7}},"Cost: ","number"==typeof t?t.toFixed(1):t))},[u,l]),re=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=re.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o,r;const i=null!==(o=null===(n=re.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==o?o:[];for(const e of i)null===(r=re.current)||void 0===r||r.push(t(e));return i},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const[ie,ae]=e.useState(null),se=e.useCallback(()=>{var e,t;const n=null===(t=null===(e=re.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ae(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);e.useEffect(()=>{const e=requestAnimationFrame(se);return()=>cancelAnimationFrame(e)},[se,d,c,o.width,o.height,V]);const le=e.useMemo(()=>{if(!C||!ie)return[];const{maxCost:e}=ie;if(0>=e)return[];if(Array.isArray(C))return C.filter(t=>t>0&&e>=t);const t="number"==typeof C?C: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},[C,ie]),ce=e.useMemo(()=>{var e,t;if(!ie)return q.foregroundGraphics||null;const{cx:n,cy:o,maxCost:r,availableRadius:i}=ie,a=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},$),s=null!==(e=Q.left)&&void 0!==e?e:10,l=null!==(t=Q.top)&&void 0!==t?t:10;return p.createElement("g",null,le.map(e=>{const t=e/r*i;return p.createElement("g",{key:e},p.createElement("circle",{cx:n+s,cy:o+l,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),p.createElement("text",{x:n+s+t+3,y:o+l-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif"},e,P?" "+P:""))}),z&&p.createElement("g",{transform:`translate(${s+24}, ${l+24})`},p.createElement("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),p.createElement("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),p.createElement("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif"},"N"),p.createElement("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),p.createElement("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})),q.foregroundGraphics)},[ie,le,z,P,$,Q,q.foregroundGraphics]),ue=yn(_,o.width,o.height),de=ue?null:fn(r,o.width,o.height,F);gn("DistanceCartogram",V,"xAccessor",a),gn("DistanceCartogram",V,"yAccessor",s);const pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=r&&{points:V}),ne&&{lines:ne,lineDataAccessor:"coordinates"}),{xAccessor:a,yAccessor:s,pointIdAccessor:l,pointStyle:K,projectionTransform:te}),j&&{transition:{duration:j}}),null!=y&&{graticule:y}),null!=g&&{fitPadding:g}),G&&{zoomable:!0}),b&&{zoomExtent:b}),v&&{onZoom:v}),null!=x&&{dragRotate:x}),k&&{tileURL:k}),w&&{tileAttribution:w}),A&&{tileCacheSize:A}),{size:[o.width,o.height],margin:Q,enableHover:!0,tooltipContent:!1===M?()=>null:ht(M)||oe}),J&&{legend:J,legendPosition:ee}),(D||N||T)&&{customHoverBehavior:Z}),(N||T)&&{customClickBehavior:Y}),L&&L.length>0&&{annotations:L}),o.title&&{title:o.title}),o.description&&{description:o.description}),o.summary&&{summary:o.summary}),void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable}),B&&{className:B}),q),ce&&{foregroundGraphics:ce});return ue||de||p.createElement(dn,{componentName:"DistanceCartogram",width:o.width,height:o.height},p.createElement(lt,Object.assign({ref:re},pe)))});Mn.displayName="DistanceCartogram",exports.ChoroplethMap=En,exports.DistanceCartogram=Mn,exports.FlowMap=Sn,exports.ProportionalSymbolMap=On,exports.StreamGeoFrame=lt,exports.mergeData=function(e,t,n){const{featureKey:o,dataKey:r}=n,i=new Map;for(const e of t)i.set(e[r]+"",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=i.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})},exports.resolveReferenceGeography=wn;