semiotic 3.3.1 → 3.4.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 (70) hide show
  1. package/CLAUDE.md +10 -4
  2. package/README.md +1 -1
  3. package/ai/dist/mcp-server.js +104 -9
  4. package/ai/schema.json +1 -1
  5. package/dist/components/LinkedCharts.d.ts +8 -0
  6. package/dist/components/charts/index.d.ts +1 -1
  7. package/dist/components/charts/ordinal/BarChart.d.ts +7 -1
  8. package/dist/components/charts/ordinal/DotPlot.d.ts +9 -1
  9. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +2 -2
  10. package/dist/components/charts/ordinal/LikertChart.d.ts +5 -2
  11. package/dist/components/charts/ordinal/StackedBarChart.d.ts +2 -2
  12. package/dist/components/charts/shared/hooks.d.ts +15 -2
  13. package/dist/components/charts/shared/selectionUtils.d.ts +9 -7
  14. package/dist/components/charts/shared/tooltipUtils.d.ts +13 -1
  15. package/dist/components/charts/shared/types.d.ts +5 -6
  16. package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
  17. package/dist/components/charts/shared/useResolvedSelection.d.ts +2 -0
  18. package/dist/components/realtime/types.d.ts +12 -0
  19. package/dist/components/semiotic-geo.d.ts +4 -0
  20. package/dist/components/semiotic-network.d.ts +7 -0
  21. package/dist/components/semiotic-ordinal.d.ts +8 -0
  22. package/dist/components/semiotic-xy.d.ts +9 -0
  23. package/dist/components/server/renderToStaticSVG.d.ts +1 -1
  24. package/dist/components/store/ThemeStore.d.ts +2 -0
  25. package/dist/components/stream/CanvasHitTester.d.ts +8 -3
  26. package/dist/components/stream/DataSourceAdapter.d.ts +17 -0
  27. package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
  28. package/dist/components/stream/GeoPipelineStore.d.ts +19 -1
  29. package/dist/components/stream/NetworkPipelineStore.d.ts +5 -0
  30. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +3 -1
  31. package/dist/components/stream/OrdinalPipelineStore.d.ts +38 -1
  32. package/dist/components/stream/ParticlePool.d.ts +4 -0
  33. package/dist/components/stream/PipelineStore.d.ts +17 -2
  34. package/dist/components/stream/StreamXYFrame.d.ts +17 -0
  35. package/dist/components/stream/geoTypes.d.ts +7 -0
  36. package/dist/components/stream/hoverUtils.d.ts +12 -0
  37. package/dist/components/stream/networkTypes.d.ts +19 -1
  38. package/dist/components/stream/ordinalTypes.d.ts +53 -12
  39. package/dist/components/stream/pipelineTransitionUtils.d.ts +21 -0
  40. package/dist/components/stream/quadtreeHitTest.d.ts +22 -0
  41. package/dist/components/stream/renderers/resolveCSSColor.d.ts +23 -6
  42. package/dist/components/stream/types.d.ts +18 -0
  43. package/dist/components/stream/useFrame.d.ts +122 -0
  44. package/dist/geo.min.js +1 -1
  45. package/dist/geo.module.min.js +1 -1
  46. package/dist/network.min.js +1 -1
  47. package/dist/network.module.min.js +1 -1
  48. package/dist/ordinal.min.js +1 -1
  49. package/dist/ordinal.module.min.js +1 -1
  50. package/dist/realtime.min.js +1 -1
  51. package/dist/realtime.module.min.js +1 -1
  52. package/dist/semiotic-ai.min.js +1 -1
  53. package/dist/semiotic-ai.module.min.js +1 -1
  54. package/dist/semiotic-geo.d.ts +4 -0
  55. package/dist/semiotic-network.d.ts +7 -0
  56. package/dist/semiotic-ordinal.d.ts +8 -0
  57. package/dist/semiotic-themes.min.js +1 -1
  58. package/dist/semiotic-themes.module.min.js +1 -1
  59. package/dist/semiotic-utils.min.js +1 -1
  60. package/dist/semiotic-utils.module.min.js +1 -1
  61. package/dist/semiotic-xy.d.ts +9 -0
  62. package/dist/semiotic.min.js +1 -1
  63. package/dist/semiotic.module.min.js +1 -1
  64. package/dist/server.min.js +1 -1
  65. package/dist/server.module.min.js +1 -1
  66. package/dist/test-utils/canvasMock.d.ts +26 -0
  67. package/dist/test-utils/ordinalFixtures.d.ts +48 -0
  68. package/dist/xy.min.js +1 -1
  69. package/dist/xy.module.min.js +1 -1
  70. package/package.json +15 -14
@@ -1 +1 @@
1
- import*as e from"react";import{useRef as t,useState as n,useEffect as o,useMemo as r,createContext as i,useContext as s,useCallback as a,useSyncExternalStore as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{scaleOrdinal as h,scaleLinear as g,scaleBand as p}from"d3-scale";import{schemeCategory10 as y,interpolatePlasma as f,interpolateViridis as m,interpolatePurples as v,interpolateOranges as b,interpolateGreens as x,interpolateReds as w,interpolateBlues as A,schemeSet3 as k,schemeTableau10 as O}from"d3-scale-chromatic";import{quantile as j}from"d3-array";import{packEnclose as S}from"d3-hierarchy";import{area as E,curveCatmullRom as _,curveCardinal as C,curveBasis as P,curveStepBefore as M,curveStepAfter as L,curveStep as B,curveMonotoneY as T,curveMonotoneX as I,curveLinear as H,arc as $}from"d3-shape";import N from"regression";import{select as D}from"d3-selection";import{brushX as R,brushY as z}from"d3-brush";class F{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class W{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,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class q{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function G(e,t,n){return e+(t-e)*n}function V(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function X(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Y(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const K={category10:y,tableau10:O,set3:k,blues:A,reds:w,greens:x,oranges:b,purples:v,viridis:m,plasma:f},Z=y,U=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Q=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 J(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")||Q.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Z[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+""))%Z.length]}function ee(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return h().domain(o).range(n).unknown("#999");const i=K[n]||K.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Z;return h().domain(o).range(e).unknown("#999")}}function te(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function ne(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=r(e.pieceData[0],e.name);i.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return i}function oe(e){var t,n,o;const r=e.length,i=e[0],s=e[r-1];return{n:r,min:i,q1:null!==(t=j(e,.25))&&void 0!==t?t:i,median:null!==(n=j(e,.5))&&void 0!==n?n:(i+s)/2,q3:null!==(o=j(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/r}}const re={bar:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,getStack:a,resolvePieceStyle:l}=e,{r:c,projection:u}=o,d=[],h="vertical"===u,g="horizontal"===u,p=i.normalize,y=[];if(a){const e=new Set;for(const t of Object.values(r))for(const n of t.pieceData){const t=a(n);e.has(t)||(e.add(t),y.push(t))}}else y.push("_default");for(const e of Object.values(r)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=s(n),o.pieces.push(n)}let n=0;if(p)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of y){const s=t.get(i);if(!s)continue;let u=s.total;p&&n>0&&(u/=n);const y=l(s.pieces[0],a?i:e.name),f=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(h){const t=c(0>u?r:o+u),n=0>u?c(r+u)-c(r):c(o)-c(o+u);d.push(te(e.x,t,e.width,Math.abs(n),y,f,i)),0>u?r+=u:o+=u}else if(g){const t=c(0>u?r+u:o),n=0>u?c(r)-c(r+u):c(o+u)-c(o);d.push(te(t,e.x,Math.abs(n),e.width,y,f,i)),0>u?r+=u:o+=u}}}if(i.roundedTop&&i.roundedTop>0){const e=Math.max(0,i.roundedTop),t=new Map;for(const e of d){if("rect"!==e.type)continue;const o=(null===(n=e.datum)||void 0===n?void 0:n.category)||"";t.has(o)||t.set(o,[]),t.get(o).push(e)}const o="vertical"===u;for(const n of t.values()){if(0===n.length)continue;const t=n.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),r=n.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});if(t.length>0){const n=t.reduce(o?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t);n.roundedTop=e,n.roundedEdge=o?"top":"right"}if(r.length>0){const t=r.reduce(o?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t);t.roundedTop=e,t.roundedEdge=o?"bottom":"left"}}}return d},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),g=a(r,h[s]);if(d){const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(te(i,Math.min(a,d),o,Math.abs(a-d),g,r,h[s]))}else{const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(te(Math.min(a,d),i,Math.abs(d-a),o,g,r,h[s]))}}}}if(r.roundedTop&&r.roundedTop>0){const e=Math.max(0,r.roundedTop);for(const t of u){if("rect"!==t.type)continue;const n=i(t.datum);t.roundedTop=e,t.roundedEdge=d?0>n?"bottom":"top":0>n?"left":"right"}}return u},point:function(e,t){var n,o;const{scales:r,columns:i,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:ne,donut:ne,boxplot:function(e,t){var n,o,r,i,s;const{scales:a,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=a,p=[],y="vertical"===g,f=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const a=t[0],l=t[t.length-1],c=null!==(n=j(t,.25))&&void 0!==n?n:a,g=null!==(o=j(t,.5))&&void 0!==o?o:(a+l)/2,m=null!==(r=j(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,w=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:a,A=null!==(s=[...t].reverse().find(e=>x>=e))&&void 0!==s?s:l,k=d(e.pieceData[0],e.name),O=[];if(f)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=y?e.middle:h(n),r=y?h(n):e.middle;O.push({px:o,py:r,value:n,datum:t})}}if(p.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(w),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(A),stats:{n:t.length,min:w,q1:c,median:g,q3:m,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:k,datum:e.pieceData,category:e.name,outliers:O}),f)for(const e of O)p.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:k.fill||"#999",opacity:.6},datum:e.datum})}return p},violin:function(e,t){var n,o,r;const{scales:i,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],s=t[t.length-1],a=(s-i)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/a),p-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;p>t;t++){const n=u(i+(t+.5)*a);v+=` L ${e.middle+d[t]/f*m} ${n}`}v+=` L ${e.middle} ${u(s)}`;for(let t=p-1;t>=0;t--){const n=u(i+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;p>t;t++)v+=` L ${u(i+(t+.5)*a)} ${e.middle-d[t]/f*m}`;v+=` L ${u(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)v+=` L ${u(i+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const a=null!==(n=j(t,.25))&&void 0!==n?n:i,l=null!==(o=j(t,.5))&&void 0!==o?o:(i+s)/2,c=null!==(r=j(t,.75))&&void 0!==r?r:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(s),u(i)),width:e.width,height:Math.abs(u(s)-u(i))}:{x:Math.min(u(i),u(s)),y:e.x,width:Math.abs(u(s)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:oe(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=i.bins||25,d=i.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,y=Math.max(...i,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/y)*e.width*.9,s=l(n+t*r),a=l(n+(t+1)*r);c.push(te(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/p*f}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/p*f} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:oe(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(te(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(te(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,s,a,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,p=[],y=t.width/2,f=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>c[e]).filter(Boolean);if(0===m.length)return p;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=d?d(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let A=0;for(const e of m){const t=new Map;let n=0;for(const o of e.pieceData){const e=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}w.push({col:e,groups:t,stepTotal:n}),x||n>A&&(A=n)}if(x)for(const e of w){let t=0,n=0;for(let o=0;v.length>o;o++){const r=e.groups.get(v[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return p;const k=new Map;for(const e of v){const t=w[0].groups.get(e);k.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=w[0].stepTotal,j=x?.95*y:.9*t.width,S=g().domain([0,A]).range([0,j]),E=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let _=new Map;for(let e=0;w.length>e;e++){const t=w[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,g=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=S(o.total))}let r=y,i=y;for(let a=0;v.length>a;a++){const l=v[a],c=t.groups.get(l);if(!c)continue;const m=S(c.total),b=a%2==0,x=b?r:i-m;b?r+=m:i-=m;const w=h(c.pieces[0],l),A=null!==(s=k.get(l))&&void 0!==s?s:c.total,O=A>0?c.total/A*100:0,j=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:O,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});f&&(0===a&&(j.__funnelStepLabel=n.name,j.__funnelStepLabelX=y,j.__funnelStepLabelY=d,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+m/2,j.__funnelValueLabelY=d,j.__funnelBarW=m),p.push(te(x,d,m,u,w,j,l)),g.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,s=S(e),a=y-s/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),w=O>0?e/O*100:0,A=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});f&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=y,A.__funnelStepLabelY=d,A.__funnelRowWidth=s,A.__funnelValueLabelX=y,A.__funnelValueLabelY=d,A.__funnelBarW=s),p.push(te(a,d,s,u,x,A,b)),g.set(l,{x:a,y:d,w:s,h:u})}if(e>0&&_.size>0){const e=x?v:[v[0]];for(const o of e){const e=_.get(o),r=g.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),s={type:"trapezoid",points:[[e.x,e.y+e.h],[e.x+e.w,e.y+e.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:i.fill||"#999",opacity:E},datum:null!==(l=null===(a=t.groups.get(o))||void 0===a?void 0:a.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};p.push(s)}}_=g}return p},"bar-funnel":function(e,t){var n,o,r,i;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=a(o);r.total+=i,r.pieces.push(o),n+=i}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),A=null!==(i=null==w?void 0:w.total)&&void 0!==i?i:f,k=o?0:Math.max(0,A-f),O=n.x+e*a+l/2,j=v(f),S=v(0)-j,E=c(p.pieces[0],y?h:n.name),_=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+k)});if(d.push(te(O,j,u,S,E,_,y?h:n.name)),k>0){const e=v(f+k),t=j-e,o=Object.assign({},E),r=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:k,__barFunnelPercent:b>0?k/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(te(O,e,u,t,o,r,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=s(n,l);if(u){const r=a(t),i=a(t+o);c.push(te(r,e.x,i-r,e.width,d,n,l))}else{const r=a(t+o),i=a(t);c.push(te(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class ie{constructor(e){this.rExtent=new q,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new W(e.windowSize),this.getO=Y(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>X(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new q)):(this.getR=X(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Y(e.stackBy),this.getGroup=Y(e.groupBy),this.getColor=Y(e.colorAccessor),this.getConnector=Y(e.connectorAccessor),this.getDataId=Y(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new W(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,i),a="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=p().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=g().domain(s).range([o,n])}else a?(c=p().domain(i).range([0,e.height]).padding(l),u=g().domain(s).range([0,e.width])):(c=p().domain(i).range([0,e.width]).padding(l),u=g().domain(s).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{var i;const s=this.rExtents[r];s.dirty&&s.recalculate(n,o);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(i=t.extentPadding)&&void 0!==i?i:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?g().domain([l,c]).range([0,e.width]):g().domain([l,c]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if(("streaming"===this.config.runtimeMode||this._hasStreamingData)&&void 0===n){const n=new Set;for(const t of e)n.add(this.getO(t));const o=Math.max(50,3*n.size);if(this.categories.size>o){let e=this.categories.size-o;for(const t of this.categories){if(0>=e)break;n.has(t)||(this.categories.delete(t),e--)}}return t.filter(e=>n.has(e))}if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o,r,i,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var i;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=re[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return s}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:U,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}(n,e,t):1}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,r),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;let o=0;for(let n=0;t.length>n;n++){const r=t[n],a=this.config.oAccessor;if(("function"==typeof a?a(r):r[a||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(s>c){const e=1-c/s;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;s>r&&(n._pulseIntensity=1-r/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}getNodeKey(e,t){var n,o;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,r,i,s,a,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let g=!1;const p=new Set,y=new Map;for(let e=0;this.scene.length>e;e++){const a=this.scene[e],l=this.getNodeKey(a,y);if(!l)continue;a._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===a.type?c?(p.add(l),a._targetOpacity=null!==(t=a.style.opacity)&&void 0!==t?t:1,c.x===a.x&&c.y===a.y||(a._targetX=a.x,a._targetY=a.y,a.x=c.x,a.y=c.y,g=!0)):(a._targetOpacity=null!==(n=a.style.opacity)&&void 0!==n?n:1,a.style=Object.assign(Object.assign({},a.style),{opacity:0}),g=!0):"rect"===a.type&&(c?(p.add(l),a._targetOpacity=null!==(o=a.style.opacity)&&void 0!==o?o:1,c.x===a.x&&c.y===a.y&&c.w===a.w&&c.h===a.h||(a._targetX=a.x,a._targetY=a.y,a._targetW=a.w,a._targetH=a.h,a.x=c.x,a.y=c.y,a.w=null!==(r=c.w)&&void 0!==r?r:a.w,a.h=null!==(i=c.h)&&void 0!==i?i:a.h,g=!0)):(a._targetOpacity=null!==(s=a.style.opacity)&&void 0!==s?s:1,a.style=Object.assign(Object.assign({},a.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)p.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(a=t.r)&&void 0!==a?a:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=G(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=G(o.x,e._targetX,i),e.y=G(o.y,e._targetY,i)}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=G(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=G(n.x,e._targetX,i),e.y=G(n.y,e._targetY,i),void 0!==n.w&&(e.w=G(n.w,e._targetW,i),e.h=G(n.h,e._targetH,i))}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this.version++,r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this.version++,i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e),(void 0!==e.oAccessor||void 0!==e.categoryAccessor)&&(V(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=Y(this.config.oAccessor||this.config.categoryAccessor,"category"),this.categories.clear())),void 0!==e.rAccessor){const n=Array.isArray(e.rAccessor)?e.rAccessor:[e.rAccessor],o=Array.isArray(t.rAccessor)?t.rAccessor:[t.rAccessor];if(n.length!==o.length||n.some((e,t)=>!V(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>X(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new q)):(this.getR=X(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!V(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Y(this.config.stackBy):void 0),"groupBy"in e&&!V(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Y(this.config.groupBy):void 0),"colorAccessor"in e&&!V(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Y(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!V(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Y(this.config.connectorAccessor):void 0)}}function se(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function ae(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function le(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i),a=function(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}(e.r,o);return s>a?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function ce(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=se(Math.atan2(r,o)),a=se(e.startAngle),l=se(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function ue(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function de(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}function he(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function ge(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})}const pe={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function ye(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,pe[n])(o(e,t)),r}function fe(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function me(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function ve({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),s&&e.createElement("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},s&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function be(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[p,y]=e.useState(0),f=e.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=ye(t,u,d,h),b=me(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===s&&u===a?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(fe,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),y+=22}),p})(t,o,r,i,s,a,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const y=((t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,y=[];let f=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;p.forEach((t,u)=>{const x=ye(t,u,h,g),w=me(t,r,i),A=i&&i.size>0&&i.has(t.label),k=26+7*t.label.length;d&&d>0&&f>0&&f+k>d&&(m++,f=0),y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?A||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,A&&e.createElement(fe,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),f+=k});let x=0,w=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&w>0&&w+t>d?(x=Math.max(x,w),w=t):w+=t}x=Math.max(x,w);const A=m+1;return{items:y,offset:x,totalRows:A,totalHeight:22*A}})(t,r,i,s,a,l,c,n,u,d,o);p+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const y=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(y.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),p+=16),y.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${p},0)`},o.items)),p+=o.offset+5,t[r+1]&&y.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8})),p+=12}),e.createElement("g",null,y)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function xe(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function we(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 Ae(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.createElement("path",{key:"bracket-path",d:we((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,y=s?u?[s]:xe(s,c):[],f=i?u?[i]:xe(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=y.length*p),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t))));let w=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+f.length)*p+(f.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),w=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+f.length-1)*p;let k=0;return"topBottom"===d?k=0>o?-(A+2):18:"leftRight"===d&&(k="middle"===h?-(A+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>o?-(A+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),w)}(l,v,b,h))}function ke(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.createElement(Ae,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:s}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Ae,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:a},r,{type:s}))}function Oe(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 je(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 Se(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){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,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.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===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(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=Oe(e,n),c=je(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"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ee(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const _e={linear:H,monotoneX:I,monotoneY:T,step:B,stepAfter:L,stepBefore:M,basis:P,cardinal:C,catmullRom:_};function Ce(t){const{width:n,height:o,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,{rTickValues:h}=t,g="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),y=r(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||Pe)(e)})),[l,d,g,h]),f=u&&l&&!g,m=c&&l&&!g;return f||m?e.createElement("svg",{width:i,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},f&&e.createElement("g",{className:"ordinal-grid"},y.map((t,r)=>e.createElement("line",{key:"grid-"+r,x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:n,y2:p?o:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&e.createElement(e.Fragment,null,p?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Pe(e){return Math.round(100*e)/100+""}function Me(n){var o,i;const{width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:p,rLabel:y,oFormat:f,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:k,legendIsolatedCategories:O,legendPosition:j="right",foregroundGraphics:_,annotations:C,svgAnnotationRules:P,xAccessor:M,yAccessor:L,annotationData:B,underlayRendered:T,children:I}=n,$="radial"===(null==d?void 0:d.projection),D="horizontal"===(null==d?void 0:d.projection),R=!1!==g,z=r(()=>h&&R&&d&&!$?d.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=d.o(e))&&void 0!==n?n:0)+d.o.bandwidth()/2,label:f?f(e,t):e}}):[],[h,R,d,f,$]),F=n.rTickValues,W=n.tickLabelEdgeAlign,q=r(()=>h&&d&&!$?(F||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(m||Pe)(e)})):[],[h,d,m,$,F]),G=t(new Map),V=t(null!==(o=null==C?void 0:C.length)&&void 0!==o?o:0),X=null!==(i=null==C?void 0:C.length)&&void 0!==i?i:0;V.current!==X&&(V.current=X,G.current=new Map);const Y=r(()=>{if(!C||0===C.length)return null;const t=function(t,n,o){var r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j,_,C,P,M,L,B,T,I,$,D,R,z,F,W,q,G,V,X,Y,K,Z,U,Q,J,ee,te;switch(t.type){case"label":{const r=Se(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ee(i,s,o)?e.createElement(ke,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=Se(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ee(i,s,o)?e.createElement(ke,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Oe(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:a,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=je(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:a,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:je(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=S(r),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:je(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Oe(n,o),a=je(n,o);if(null==i||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:a,r:l},c))}))}case"bracket":{const r=Oe(t,o),i=je(t,o);return e.createElement(ke,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",p=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(s=o.scales)||void 0===s?void 0:s.time,f=null!==(l=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!y||!f)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?N.polynomial(p,{order:t.order||2}):N.linear(p)).points;const b=v.map(([e,t])=>`${y(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:y(v[v.length-1][0])+4,y:f(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(p=null==r?void 0:r(t.y0))&&void 0!==p?p:0,s=null!==(y=null==r?void 0:r(t.y1))&&void 0!==y?y:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=_e[o.curve||"linear"]||H,g=E().x(e=>s(e[i])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(h)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:p,fillOpacity:null!==(A=t.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:s(d[d.length-1][i])+4,y:a(d[d.length-1][l])-4,fill:p,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(O=null===(k=o.scales)||void 0===k?void 0:k.x)&&void 0!==O?O:null===(j=o.scales)||void 0===j?void 0:j.time,a=null!==(C=null===(_=o.scales)||void 0===_?void 0:_.y)&&void 0!==C?C:null===(P=o.scales)||void 0===P?void 0:P.value;if(!s||!a)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(M=t.threshold)&&void 0!==M?M:2,g=c-h*d,p=!1!==t.showBand,y=t.fill||"#6366f1",f=null!==(L=t.fillOpacity)&&void 0!==L?L:.1,m=t.anomalyColor||"#ef4444",v=null!==(B=t.anomalyRadius)&&void 0!==B?B:6,b=a(c+h*d),x=a(g),w=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},p&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),w.map((t,n)=>{const r=Oe(t,o),i=je(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(I=null===(T=o.scales)||void 0===T?void 0:T.x)&&void 0!==I?I:null===($=o.scales)||void 0===$?void 0:$.time,l=null!==(R=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==R?R:null===(z=o.scales)||void 0===z?void 0:z.value;if(!a||!l)return null;const c=r.map(e=>[e[i],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=N.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),p=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==(F=t.confidence)&&void 0!==F?F:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,v=null!==(W=t.steps)&&void 0!==W?W:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;v>=e;e++)w.push(b+e*x);const A=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const k=`M${A.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=A.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),j=`${a(b)},${l(u(b))}`,S=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:k,fill:t.fill||"#6366f1",fillOpacity:null!==(q=t.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e.createElement("polyline",{points:`${j} ${O}`,fill:"none",stroke:S,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(V=t.strokeDasharray)&&void 0!==V?V:"6,3"}),t.label&&A.length>0&&e.createElement("text",{x:a(A[A.length-1].x)+4,y:l(A[A.length-1].yCenter)-4,fill:S,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=Se(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Ee(r,i,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,a=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(K=t.width)&&void 0!==K?K:32,c=null!==(Z=t.height)&&void 0!==Z?Z:32,u=null!==(U=t.content)&&void 0!==U?U:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=Se(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(Q=o.scales)||void 0===Q?void 0:Q.o,s=null===(J=o.scales)||void 0===J?void 0:J.x,a=null===(ee=o.scales)||void 0===ee?void 0:ee.y,l=(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(te=t.opacity)&&void 0!==te?te:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===s)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}},n="horizontal"===(null==d?void 0:d.projection),o=(null==d?void 0:d.o)?e=>{var t;return(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2}:null,r={scales:d?{x:n?d.r:o||d.r,y:n&&o||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:M,yAccessor:L,width:s,height:a,data:B,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:G.current};return C.map((e,n)=>{if(P){const o=P(e,n,r);return null!=o?o:t(e,n,r)}return t(e,n,r)}).filter(Boolean)},[C,P,s,a,d,M,L,B]);return h||b||x||_||Y&&Y.length>0||v||I?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!$&&!T&&e.createElement("g",{className:"ordinal-grid"},q.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:D?t.pixel:0,y1:D?0:t.pixel,x2:D?t.pixel:s,y2:D?a:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!$&&e.createElement("g",{className:"ordinal-axes"},D?e.createElement(e.Fragment,null,!T&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))),p&&e.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},p),!T&&e.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!T&&(null==d?void 0:d.r)&&(()=>{const t=d.r(0);return t>1&&s-1>t?e.createElement("line",{x1:t,y1:0,x2:t,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((t,n)=>{const o=W?0===n?"start":n===q.length-1?"end":"middle":"middle";return e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))}),y&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},y)):e.createElement(e.Fragment,null,!T&&(()=>{const t=(null==d?void 0:d.r)?d.r(0):a,n=0>t||t>a?a:t;return e.createElement("line",{x1:0,y1:n,x2:s,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),z.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))),p&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p),!T&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),y&&e.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},y))),Y,_,I),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=i.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=r-i.bottom+50):(p=o-i.right+10,y=i.top),e.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(ve,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(be,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var f}({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:j,title:b,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:k,legendIsolatedCategories:O})):null}function Le({width:n,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,onBrush:c}){const u=t(null),d=t(null),h=t(c);h.current=c;const g=t(l);g.current=l;const p=t(!1),y=t(null),f="horizontal"===(null==l?void 0:l.projection),m=t(f);return m.current=f,o(()=>{if(!u.current)return;const e=D(u.current).select(".brush-g"),t=f?R():z();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(p.current)return;const t=g.current;if(!t)return;if(!e.selection)return y.current=null,void h.current(null);const[n,o]=e.selection;let r;r=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};y.current=i,h.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,f]),o(()=>{if(!l||!d.current||!y.current)return;if(!u.current)return;const e=y.current,t=D(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);f?(p.current=!0,t.call(d.current.move,[n,o]),p.current=!1):(p.current=!0,t.call(d.current.move,[o,n]),p.current=!1)},[l,f]),e.createElement("svg",{ref:u,width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}}))}function Be(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Te="undefined"==typeof window||"undefined"==typeof document,Ie=e.createContext(null),He={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function $e(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"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const Ne=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},De={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"},Re={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},ze={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)"},Fe={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},We={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)"},qe={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Ge={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ve({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[s,a]=e.useState(!1),l=e.useContext(Ie),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=s||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{s||c||a(!0)},[s,c]),p=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:He}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:He,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",t.length," elements)"));const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j;const S=[];if(!Array.isArray(e))return S;for(const E of e)if(E&&"object"==typeof E)try{switch(E.type){case"point":S.push({label:"Point",values:{x:E.x,y:E.y}});break;case"line":{const e=E.path,t=Array.isArray(E.datum)?E.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=E.topPath,t=Array.isArray(E.datum)?E.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=E.datum&&"object"==typeof E.datum?E.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:E.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:E.x,y:E.y,value:E.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=E.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=E.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=E.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=E.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=E.cx)&&void 0!==g?g:E.x,y:null!==(p=E.cy)&&void 0!==p?p:E.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=E.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=E.cx)&&void 0!==m?m:E.x,y:null!==(v=E.cy)&&void 0!==v?v:E.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:E.x,open:E.open,high:E.high,low:E.low,close:E.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(w=null===(x=null===(b=E.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(A=E.datum)||void 0===A?void 0:A.name)&&void 0!==k?k:"",value:null!==(j=null===(O=E.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(t),f=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}: ${Ne(e.min)} to ${Ne(e.max)}, mean ${Ne(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,f),v=y.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:p,style:De,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:ze},"×"),e.createElement("div",{role:"note",style:Re},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:Fe},e.createElement("caption",{style:Ge},"First ",v.length," of ",y.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:We},"type"),x.map(t=>e.createElement("th",{key:t,style:We},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:qe},t.label),x.map(n=>{return e.createElement("td",{key:n,style:qe},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ne(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function Xe({summary:t}){return t?e.createElement("div",{role:"note",style:He},t):null}function Ye({tableId:t}){return e.createElement("a",{href:"#"+t,style:He,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,He)}},"Skip to data table")}function Ke({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:He},n)}const Ze="var(--semiotic-focus, #005fcc)";function Ue({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ze,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ze,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ze,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function Qe({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:a,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},s)}function Je(n){const o=i(null),c=et(n);return[function({children:t}){const i=r(()=>et(n),[]);return e.createElement(o.Provider,{value:i,children:t})},e=>{var n;const r=null!==(n=s(o))&&void 0!==n?n:c,i=t(e);i.current=e;const u=a(()=>i.current(r.getState()),[r]),d=a(()=>i.current(r.getState()),[r]);return l(r.subscribe,u,d)}]}function et(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 tt={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},nt={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},ot={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"},[rt,it]=Je(e=>({theme:tt,setTheme(t){e(e=>{if("light"===t)return{theme:tt};if("dark"===t)return{theme:nt};if("high-contrast"===t)return{theme:ot};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?nt:tt;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||{})})}})}}));function st(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function at(e,t,n=.3){st(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function lt(e,t,n=.6){var o,r,i,s,a;if(!st(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!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a: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 ct(e,t,n,o=.35){st(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const ut=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,dt=new WeakMap;function ht(e,t){var n,o;if(!t)return t;const r=ut.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 s=dt.get(i);if(s||(s=new Map,dt.set(i,s)),s.has(t))return s.get(t);const a=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.set(t,a),a}const gt=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)pt(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?ht(e,t.style.fill):t.style.fill)||"#007bff";const n=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:o,y:r,w:i,h:s}=t;switch(t.roundedEdge){case"right":e.moveTo(o,r),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o,r+s);break;case"left":e.moveTo(o+i,r),e.lineTo(o+n,r),e.arcTo(o,r,o,r+n,n),e.lineTo(o,r+s-n),e.arcTo(o,r+s,o+n,r+s,n),e.lineTo(o+i,r+s);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o+n,r+s),e.arcTo(o,r+s,o,r+s-n,n);break;default:e.moveTo(o,r+s),e.lineTo(o,r+n),e.arcTo(o,r,o+n,r,n),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ht(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?ht(e,t.style.fill):t.style.fill)||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ht(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));at(e,t),e.globalAlpha=1}};function pt(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}const yt=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?ht(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?ht(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),lt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function ft(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function mt(e,t){const n=$().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const vt=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"wedge"===e.type);for(const t of s)e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=("string"==typeof t.style.fill?ht(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ht(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),mt(e,t)):(ft(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ht(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(ft(e,t),ct(e,t)),e.globalAlpha=1};const bt=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=("string"==typeof t.style.fill?ht(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ht(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},xt=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=ht(e,n.style.stroke)||("string"==typeof n.style.fill?ht(e,n.style.fill):n.style.fill)||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function wt(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function At(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let kt=null;function Ot(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(kt||(kt=document.createElement("canvas")),kt.width=e,kt.height=e,kt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const jt=new Map;function St(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=jt.get(n);if(void 0!==o)return o;const r=Ot({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return jt.set(n,r),r}function Et(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function _t(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Ct(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Pt=e=>[xt,...e],Mt={bar:Pt([gt]),clusterbar:Pt([gt]),point:Pt([yt]),swarm:Pt([yt]),pie:[vt],donut:[vt],boxplot:Pt([(e,t,n,o)=>{var r,i;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=t.style.fill||"#007bff",a=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=a,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},yt]),violin:Pt([bt]),histogram:Pt([gt]),ridgeline:Pt([bt]),timeline:Pt([gt]),funnel:[gt,(e,t,n,o)=>{var r,i,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(i=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==i?i:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=ht(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,i,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(i=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==i?i:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?wt(r):null!=i?`${wt(r)} (${At(i)})`:wt(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=wt(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[gt,(e,t,n,o)=>{var r,i;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n="string"==typeof t.style.fill?t.style.fill:"#999",o=St(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(i=t.style.opacity)&&void 0!==i?i:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0!==r.length){for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,s=i?Ct(r):"",a=_t(o);e.font="bold 13px sans-serif";const l=i?e.measureText(s).width:0;e.font="11px sans-serif";const c=e.measureText(a).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,p=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),Et(e,g,p,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Et(e,g,p,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(s,h,p+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(a,h,p+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(a,h,p+3))}e.lineWidth=1}}],swimlane:Pt([gt])},Lt={top:50,right:40,bottom:60,left:70},Bt={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Tt({hover:t}){var n,o,r,i,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:Bt},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:Bt},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:Bt},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Bt},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const p=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",y=null!==(a=null!==(s=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!p&&""===y){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Bt},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:Bt},p&&e.createElement("div",{style:{fontWeight:"bold"}},p+""),""!==y&&e.createElement("div",null,"number"==typeof y?y.toLocaleString():y+""))}const It=c(function(i,s){var l,c,d,h,g,p,y,f,m,v;const{chartType:b,runtimeMode:x,data:w,oAccessor:A="category",rAccessor:k="value",colorAccessor:O,stackBy:j,groupBy:S,multiAxis:E,timeAccessor:_,valueAccessor:C,categoryAccessor:P,projection:M="vertical",size:L=[600,400],responsiveWidth:B,responsiveHeight:T,margin:I,barPadding:H,roundedTop:N,baselinePadding:D,innerRadius:R,cornerRadius:z,normalize:W,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:K,amplitude:Z,connectorOpacity:U,showLabels:Q,connectorAccessor:J,connectorStyle:ee,dataIdAccessor:te,rExtent:ne,oExtent:oe,extentPadding:re=.05,oSort:se,windowMode:pe="sliding",windowSize:ye=200,pieceStyle:fe,summaryStyle:me,colorScheme:ve,barColors:be,showAxes:xe=!0,showCategoryTicks:we,oLabel:Ae,rLabel:ke,oFormat:Oe,rFormat:je,rTickValues:Se,tickLabelEdgeAlign:Ee,enableHover:_e=!0,hoverAnnotation:Pe,tooltipContent:Ie,customHoverBehavior:He,annotations:Ne,svgAnnotationRules:De,showGrid:Re=!1,legend:ze,legendHoverBehavior:Fe,legendClickBehavior:We,legendHighlightedCategory:qe,legendIsolatedCategories:Ge,legendPosition:Ze,backgroundGraphics:Je,foregroundGraphics:et,title:tt,className:nt,background:ot,centerContent:rt,decay:st,pulse:at,transition:lt,staleness:ct,brush:ut,onBrush:ht,accessibleTable:gt=!0,description:pt,summary:yt}=i,ft=function(){const[e,t]=n(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return o(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(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=>t(e.matches))},[]),e}(),mt=t(ft);mt.current=ft;const[vt,bt]=function(e,r,i){const s=t(null),[a,l]=n(null);return o(()=>{if(!r&&!i)return;const e=s.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[r,i]),[s,[r&&a?a.w:e[0],i&&a?a.h:e[1]]]}(L,B,T),xt=r(()=>Object.assign(Object.assign({},Lt),I),[I]),wt=bt[0]-xt.left-xt.right,At=bt[1]-xt.top-xt.bottom,kt="function"==typeof et?et({size:bt,margin:xt}):et,Ot=t(null),jt=t(!0),St=it(e=>e.theme),Et=t(0),_t=t(null),Ct=t(()=>{}),[Pt,Bt]=n(null),[It,Ht]=n(null),[$t,Nt]=n(0),[Dt,Rt]=n(!1),zt=_e||Pe,Ft="streaming"===x,Wt=r(()=>({chartType:b,runtimeMode:Ft?"streaming":"bounded",windowSize:ye,windowMode:pe,extentPadding:re,projection:M,oAccessor:Ft?void 0:A,rAccessor:Ft?void 0:k,colorAccessor:O,stackBy:j,groupBy:S,multiAxis:E,timeAccessor:Ft?_:void 0,valueAccessor:Ft?C||("string"==typeof k||"function"==typeof k?k:void 0):void 0,categoryAccessor:Ft?P||A:void 0,rExtent:ne,oExtent:oe,barPadding:H,roundedTop:N,baselinePadding:D,innerRadius:R,cornerRadius:z,normalize:W,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:K,amplitude:Z,connectorOpacity:U,showLabels:Q,connectorAccessor:J,connectorStyle:ee,dataIdAccessor:te,oSort:se,pieceStyle:fe,summaryStyle:me,colorScheme:ve,barColors:be,decay:st,pulse:at,transition:lt,staleness:ct}),[b,ye,pe,re,M,A,k,O,j,S,E,_,C,P,ne,oe,H,N,D,R,z,W,q,G,V,X,Y,K,Z,U,Q,J,ee,te,se,fe,me,ve,be,st,at,lt,ct,Ft]),qt=t(null);qt.current||(qt.current=new ie(Wt));const Gt=a(()=>{Et.current||(Et.current=requestAnimationFrame(()=>Ct.current()))},[]);o(()=>{var e;null===(e=qt.current)||void 0===e||e.updateConfig(Wt),jt.current=!0,Gt()},[Wt,Gt]),o(()=>{Ot.current&&dt.delete(Ot.current),jt.current=!0,Gt()},[St,Gt]);const Vt=t(null);Vt.current||(Vt.current=new F(e=>{const t=qt.current;t&&t.ingest(e)&&(jt.current=!0,Gt())}));const Xt=a(e=>{var t;null===(t=Vt.current)||void 0===t||t.push(e)},[]),Yt=a(e=>{var t;null===(t=Vt.current)||void 0===t||t.pushMany(e)},[]),Kt=a(()=>{var e,t;null===(e=Vt.current)||void 0===e||e.clear(),null===(t=qt.current)||void 0===t||t.clear(),jt.current=!0,Gt()},[Gt]);u(s,()=>({push:Xt,pushMany:Yt,remove:e=>{var t,n,o,r;null===(t=Vt.current)||void 0===t||t.flush();const i=null!==(o=null===(n=qt.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(i.length>0){const e=null===(r=_t.current)||void 0===r?void 0:r.data;!!_t.current&&i.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(_t.current=null,Bt(null)),jt.current=!0,Gt()}return i},update:(e,t)=>{var n,o,r;null===(n=Vt.current)||void 0===n||n.flush();const i=null!==(r=null===(o=qt.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(jt.current=!0,Gt()),i},clear:Kt,getData:()=>{var e,t,n;return null===(e=Vt.current)||void 0===e||e.flush(),null!==(n=null===(t=qt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=qt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Xt,Yt,Kt,Gt]),o(()=>{var e;w&&(null===(e=Vt.current)||void 0===e||e.setBoundedData(w))},[w]);const Zt=t(()=>{}),Ut=t(()=>{});Zt.current=e=>{if(!zt)return;const t=Ot.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-xt.left,r=e.clientY-n.top-xt.top;if(0>o||o>wt||0>r||r>At)return void(_t.current&&(_t.current=null,Bt(null),He&&He(null),Gt()));const i=qt.current;if(!i||0===i.scene.length)return;const s="radial"===M,a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=ae(i,t,n);break;case"point":e=le(i,t,n,o);break;case"wedge":e=ce(i,t,n);break;case"boxplot":e=ue(i,t,n);break;case"violin":e=de(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,s?o-wt/2:o,s?r-At/2:r);if(!a)return void(_t.current&&(_t.current=null,Bt(null),He&&He(null),Gt()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;_t.current=l,Bt(l),He&&(He(l),jt.current=!0),Gt()},Ut.current=()=>{_t.current&&(_t.current=null,Bt(null),He&&(He(null),jt.current=!0),Gt())},a(e=>Zt.current(e),[]);const Qt=a(()=>Ut.current(),[]),Jt=t(-1),en=t(null),tn=t(null),nn=a(e=>{const t=qt.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(tn.current&&tn.current.version===n)o=tn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(r=s.group)&&void 0!==r?r:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;i.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),tn.current={version:n,graph:o}}const r=Jt.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Jt.current=0;const t=o.flat[0];en.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},ge(t)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b});return _t.current=n,Bt(n),He&&He(n),void Gt()}const i=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?he(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?he(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return Jt.current=-1,en.current=null,_t.current=null,Bt(null),He&&He(null),void Gt();Jt.current=s;const a=o.flat[s];en.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},ge(a)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b});_t.current=l,Bt(l),He&&He(l),Gt()},[He,Gt]),on=a(e=>{Jt.current=-1,en.current=null,Zt.current(e)},[]);Ct.current=()=>{var e,t;Et.current=0;const n=Ot.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=qt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(mt.current?i+1e6:i),a=!mt.current&&s,l=jt.current;l&&!s&&(r.computeScene({width:wt,height:At}),jt.current=!1),(l||a)&&n.setAttribute("aria-label",$e(r.scene,b+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=bt[0]*c,d=bt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=bt[0]+"px",n.style.height=bt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,bt[0],bt[1]);const h=null!==(e=null==ct?void 0:ct.threshold)&&void 0!==e?e:5e3,g=ct&&r.lastIngestTime>0&&i-r.lastIngestTime>h;g&&(o.globalAlpha=null!==(t=null==ct?void 0:ct.dimOpacity)&&void 0!==t?t:.5);const p=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",y=ot||(p&&"transparent"!==p?p:null);y&&(o.fillStyle=y,o.fillRect(0,0,bt[0],bt[1]));const f="radial"===M;o.save(),o.beginPath(),o.rect(xt.left,xt.top,wt,At),o.clip(),f?(o.save(),o.translate(xt.left+wt/2,xt.top+At/2)):o.translate(xt.left,xt.top);const m=Mt[b]||[],v={width:wt,height:At};for(const e of m)e(o,r.scene,r.scales,v);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(Ht(r.scales),Nt(e=>e+1)),(null==ct?void 0:ct.showBadge)&&Rt(!!g),(a||r.hasActivePulses)&&(Et.current=requestAnimationFrame(()=>Ct.current()))},o(()=>(Gt(),()=>{Et.current&&(cancelAnimationFrame(Et.current),Et.current=0)}),[Gt]),o(()=>{jt.current=!0,Gt()},[b,wt,At,xe,ot,Gt]),function(e,t,n,r,i,s){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(ct,qt,jt,Gt,Dt,Rt);const rn=zt&&Pt?Ie?Ie(Pt):e.createElement(Tt,{hover:Pt}):null,sn="radial"===M,an=rn?e.createElement(Qe,{x:Pt?sn?Pt.x+wt/2:Pt.x:0,y:Pt?sn?Pt.y+At/2:Pt.y:0,containerWidth:wt,containerHeight:At,margin:xt,className:"stream-ordinal-tooltip"},rn):null;if(Te){const t=qt.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:wt,height:At}));const n=null!==(l=null==t?void 0:t.scene)&&void 0!==l?l:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===M,i=r?xt.left+wt/2:xt.left,s=r?xt.top+At/2:xt.top;return e.createElement("div",{className:"stream-ordinal-frame"+(nt?" "+nt:""),role:"img","aria-label":pt||("string"==typeof tt?tt:"Ordinal chart"),style:{position:"relative",width:bt[0],height:bt[1]}},e.createElement(Xe,{summary:yt}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:bt[0],height:bt[1],style:{position:"absolute",left:0,top:0}},Je&&e.createElement("g",{transform:`translate(${xt.left},${xt.top})`},Je),e.createElement("g",{transform:`translate(${i},${s})`},ot&&e.createElement("rect",{x:0,y:0,width:wt,height:At,fill:ot}),n.map((t,n)=>function(t,n){var o,r,i,s,a;const l=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:r,w:i,h:s}=n;let a;switch(n.roundedEdge){case"right":a=`M${o},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+s-t} A${t},${t} 0 0 1 ${o+i-t},${r+s} L${o},${r+s} Z`;break;case"left":a=`M${o+i},${r} L${o+t},${r} A${t},${t} 0 0 0 ${o},${r+t} L${o},${r+s-t} A${t},${t} 0 0 0 ${o+t},${r+s} L${o+i},${r+s} Z`;break;case"bottom":a=`M${o},${r} L${o+i},${r} L${o+i},${r+s-t} A${t},${t} 0 0 1 ${o+i-t},${r+s} L${o+t},${r+s} A${t},${t} 0 0 1 ${o},${r+s-t} Z`;break;default:a=`M${o},${r+s} L${o},${r+t} A${t},${t} 0 0 1 ${o+t},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+s} Z`}return e.createElement("path",{key:u,d:a,fill:Be(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:Be(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:Be(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=$().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&o.cornerRadius(n.cornerRadius);const r=o({})||"";return e.createElement("path",{key:u,d:r,transform:`translate(${n.cx},${n.cy})`,fill:Be(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:Be(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:Be(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:Be(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(a=t.style.opacity)&&void 0!==a?a:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:Be(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(Me,{width:wt,height:At,totalWidth:bt[0],totalHeight:bt[1],margin:xt,scales:o,showAxes:xe,showCategoryTicks:we,oLabel:Ae,rLabel:ke,oFormat:Oe,rFormat:je,rTickValues:Se,tickLabelEdgeAlign:Ee,showGrid:Re,title:tt,legend:ze,legendHoverBehavior:Fe,legendClickBehavior:We,legendHighlightedCategory:qe,legendIsolatedCategories:Ge,legendPosition:Ze,foregroundGraphics:kt,annotations:Ne,svgAnnotationRules:De,annotationFrame:0,xAccessor:"string"==typeof A?A:void 0,yAccessor:"string"==typeof k?k:void 0,annotationData:null==t?void 0:t.getData()}),rt&&"radial"===M&&e.createElement("div",{style:{position:"absolute",left:xt.left+wt/2,top:xt.top+At/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},rt))}const ln="semiotic-table-"+e.useId();return e.createElement("div",{ref:vt,className:"stream-ordinal-frame"+(nt?" "+nt:""),role:"group","aria-label":pt||("string"==typeof tt?tt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:B?"100%":bt[0],height:T?"100%":bt[1],overflow:"visible"},onKeyDown:nn},gt&&e.createElement(Ye,{tableId:ln}),gt&&e.createElement(Ve,{scene:null!==(h=null===(d=qt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:ln,chartTitle:"string"==typeof tt?tt:void 0}),e.createElement(Xe,{summary:yt}),e.createElement("div",{role:"img","aria-label":pt||("string"==typeof tt?tt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:zt?on:void 0,onMouseLeave:zt?Qt:void 0},Je&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${xt.left},${xt.top})`},Je)),e.createElement(Ce,{width:wt,height:At,totalWidth:bt[0],totalHeight:bt[1],margin:xt,scales:It,showAxes:xe,showGrid:Re,rFormat:je,rTickValues:Se}),e.createElement("canvas",{ref:Ot,"aria-label":$e(null!==(p=null===(g=qt.current)||void 0===g?void 0:g.scene)&&void 0!==p?p:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1]}}),e.createElement(Ke,{hoverPoint:Pt}),e.createElement(Me,{width:wt,height:At,totalWidth:bt[0],totalHeight:bt[1],margin:xt,scales:It,showAxes:xe,showCategoryTicks:we,oLabel:Ae,rLabel:ke,oFormat:Oe,rFormat:je,showGrid:Re,title:tt,legend:ze,legendHoverBehavior:Fe,legendClickBehavior:We,legendHighlightedCategory:qe,legendIsolatedCategories:Ge,legendPosition:Ze,foregroundGraphics:kt,annotations:Ne,svgAnnotationRules:De,annotationFrame:$t,xAccessor:"string"==typeof A?A:void 0,yAccessor:"string"==typeof k?k:void 0,annotationData:null===(y=qt.current)||void 0===y?void 0:y.getData(),underlayRendered:!0}),(ut||ht)&&"radial"!==M&&e.createElement(Le,{width:wt,height:At,totalWidth:bt[0],totalHeight:bt[1],margin:xt,scales:It,onBrush:ht||(()=>{})}),rt&&"radial"===M&&e.createElement("div",{style:{position:"absolute",left:xt.left+wt/2,top:xt.top+At/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},rt),(null==ct?void 0:ct.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ct.badgePosition?{top:4,left:4}:"bottom-left"===ct.badgePosition?{bottom:4,left:4}:"bottom-right"===ct.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"),e.createElement(Ue,{active:Jt.current>=0,hoverPoint:Pt,margin:xt,size:bt,shape:null===(f=en.current)||void 0===f?void 0:f.shape,width:null===(m=en.current)||void 0===m?void 0:m.w,height:null===(v=en.current)||void 0===v?void 0:v.h}),an))});It.displayName="StreamOrdinalFrame";const Ht=i(null);function $t(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 Nt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Dt,Rt]=Je(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Nt(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=Nt(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}})}})),[zt,Ft]=Je(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}))}}));let Wt={positions:new Map};const qt=new Set;function Gt(){for(const e of qt)e()}function Vt(e,t){const n=Wt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Wt.positions);o.delete(e),Wt={positions:o},Gt()}function Xt(e){const t=d(),n=e.clientId||t,{name:o}=e,i=Rt(e=>e.selections.get(o)),s=Rt(e=>e.setClause),l=Rt(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push($t(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:a(()=>{l(o,n)},[l,o,n]),clientId:n}}const Yt=i(!1);function Kt({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):U[i%U.length];return{label:r+"",color:a}}),label:""}]}}function Zt(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}function Ut(){var e;const t=it(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}function Qt(e,t,n,o,r){if(e)return e;let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=K[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:"#007bff"}function Jt(e,t,n){return r(()=>{if(!t)return e;const o=[...e];if("function"==typeof t)return o.sort(t);const r="function"==typeof(i=n)?i:e=>e[i];var i;return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}e.createContext(void 0);const en={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 tn(e,t,n){var o,r,i,s,a,l,c;const u=en[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!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!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:nn(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function nn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}const on={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 rn(e,t){return"function"==typeof t?t(e):e[t]}function sn(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 an(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=rn(t,o);a=sn(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=rn(t,o);l.push({label:n,value:sn(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=sn(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=sn(t[e[0]],r))}}const c=Object.assign(Object.assign({},on),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function ln(t){if(!0===t)return an();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:on},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?an(t):an())}function cn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function un(e,t){return"function"==typeof t?t(e):e[t]}function dn({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return s=>{var a;const l=i?(null===(a=s.data)||void 0===a?void 0:a[0])||s.data||s:s.data||s,c=un(l,t),u=un(l,n),d=o?un(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:on},e.createElement("div",{style:{fontWeight:"bold"}},cn(c)),e.createElement("div",{style:{marginTop:4}},cn(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||("string"==typeof(h=o)?h:"value"),": ",cn(d)));var h}}function hn({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.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}},o)))}class gn extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(hn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function pn(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function yn(e,t,n=3){let o,r=n+1;for(const n of t){const t=pn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function fn(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function mn(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=yn(e,t,3))&&void 0!==n?n:null)}function vn({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=fn(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=mn(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const bn={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"}},xn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},wn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},An=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],kn=["vertical","horizontal"],On={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},bn),xn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:An},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({},bn),xn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:An},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},bn),xn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:An},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({},bn),xn),{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({},bn),xn),{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({},bn),xn),{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({},bn),xn),{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({},bn),xn),{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({},bn),xn),{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({},bn),wn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},bn),wn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kn},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},bn),wn),{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:kn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},bn),wn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},bn),wn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kn},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({},bn),wn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},bn),wn),{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({},bn),wn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kn},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({},bn),wn),{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({},bn),wn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},bn),{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({},bn),wn),{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({},bn),wn),{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({},bn),{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({},bn),{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:kn},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({},bn),{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({},bn),{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({},bn),{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({},bn),{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({},bn),{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"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},bn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},bn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},bn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},bn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},bn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},bn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function jn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Sn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),En=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),_n=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Cn=new Set(["LineChart","AreaChart","StackedAreaChart"]),Pn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Mn(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 Ln(e,t){const n=Mn(e),o=Mn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Bn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Tn(e,t){const n=[],o=function(e,t){const n=[],o=On[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(On).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(!jn(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=yn(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 s=vn({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}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=fn(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=mn(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 On[e]?(function(e,t,n){const o=On[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=On[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 s=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: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Sn.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=On[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 s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" 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(!_n.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(!Cn.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,s=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.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."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=On[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(i.length,5);for(const e of s){let t=!0;for(let n=0;a>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(!Pn.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=Ln(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=Ln(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 Bn)"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 In;const Hn="undefined"!=typeof process&&"production"!==(null===(In=process.env)||void 0===In?void 0:In.NODE_ENV);function $n({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(gn,{fallback:i=>{let s="";if(Hn&&r)try{const e=Tn(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(hn,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})}},i)}const Nn={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"},Dn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Rn(e,t,n,o){if(!Hn)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 zn(t){const{data:i,rawData:l,colorBy:c,colorScheme:u,legendInteraction:h,legendPosition:g,selection:p,linkedHover:y,fallbackFields:f,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:A,marginDefaults:k,onClick:O,hoverHighlight:j,loading:S,emptyContent:E,width:_,height:C}=t,P="string"==typeof t.colorBy?t.colorBy:void 0,{activeSelectionHook:M,hoverSelectionHook:L,customHoverBehavior:B,customClickBehavior:T,crosshairSourceId:I}=function({selection:e,linkedHover:t,fallbackFields:i=[],unwrapData:s=!1,onObservation:l,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:p}){const y=d(),f=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,i),m=Xt({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Xt({name:t});return{onHover:a(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||i||[]}),b=Ft(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,A]=n(null),k=p||i[0],O=r(()=>{if(!g||null==w||!k)return null;const e=w,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[g,w,k]),j=a(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=Wt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Wt={positions:new Map(Wt.positions).set(e,{xValue:t,sourceId:n})},Gt())}(f.name||"hover",Number(e),y)}"x-position"!==(null==f?void 0:f.mode)&&v.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&Vt(f.name||"hover",y),"x-position"!==(null==f?void 0:f.mode)&&v.onHover(null);if(g&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];A(null!=n?n+"":null)}else A(null);if(l||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});l&&l(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});l&&l(e),b&&b(e)}}},[t,v,f,y,l,c,u,b,g,k]),S=a(e=>{var t,n,o,r;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[f.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=Wt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Wt.positions);return t.delete(e),Wt={positions:t},Gt(),!1}Wt={positions:new Map(Wt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Gt()}(f.name||"hover",Number(n),y)}if(e&&h){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),h(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(l||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=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});l&&l(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});l&&l(e),b&&b(e)}}},[h,l,b,c,u,f,y]);return o(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{!function(e,t){const n=Wt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Wt.positions);o.delete(e),Wt={positions:o},Gt()}(e,y),Vt(e,y)}},[null==f?void 0:f.mode,null==f?void 0:f.name,y]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:j,customClickBehavior:S,crosshairSourceId:y}}({selection:p,linkedHover:y,fallbackFields:f,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:j,colorByField:P}),H=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(y,I),$=function(e,t,n){const o=s(Ht),i=Ut();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=ee(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return ee(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=ee(e,t,s);return e=>o[e]||n(e)}return ee(e,t,s)}if(o&&Object.keys(o).length>0){const e=ee([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(i,c,u),N=r(()=>{if(!c)return[];const e=new Set;for(const t of i){const n="function"==typeof c?c(t):t[c];null!=n&&e.add(n+"")}return Array.from(e)},[i,c]),D=function(e,t,o){const[i,s]=n(null),[l,c]=n(new Set),u=a(t=>{"highlight"===e&&s(t?t.label:null)},[e]),d=a(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,i,l]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?l:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}(h,c,N),R=r(()=>L||(D.legendSelectionHook?D.legendSelectionHook:M),[L,D.legendSelectionHook,M]),{legend:z,margin:F,legendPosition:W}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(Yt),d=void 0!==o?o:!u&&!!t,h=r(()=>{if(d&&t)return Kt({data:e,colorBy:t,colorScale:n,getColor:J,categories:c})},[d,t,e,n,c]),g=r(()=>{const e=Object.assign(Object.assign({},l),a);return h&&("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},[l,a,h,i]);return{legend:h,margin:g,legendPosition:i}}({data:i,colorBy:c,colorScale:$,showLegend:w,legendPosition:g,userMargin:A,defaults:k}),q=r(()=>{const e={};return z&&(e.legend=z,e.legendPosition=W),h&&"none"!==h&&(e.legendHoverBehavior=D.onLegendHover,e.legendClickBehavior=D.onLegendClick,e.legendHighlightedCategory=D.highlightedCategory,e.legendIsolatedCategories=D.isolatedCategories),e},[z,W,h,D.onLegendHover,D.onLegendClick,D.highlightedCategory,D.isolatedCategories]),G=function(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Dn),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}(S,_,C),V=G?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},Nn),{width:n,height:o})},r||"No data available"):null}(l,_,C,E);return{colorScale:$,allCategories:N,legendState:D,effectiveSelectionHook:R,activeSelectionHook:M,customHoverBehavior:B,customClickBehavior:T,legend:z,margin:F,legendPosition:W,earlyReturn:G||V||null,legendBehaviorProps:q,crosshairProps:H}}const Fn=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null);u(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:E,hoverHighlight:_,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:B,color:T,showCategoryTicks:I,categoryFormat:H,dataIdAccessor:$}=n,N=i.width,D=i.height,R=i.enableHover,z=i.showGrid,F=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],K=zn({data:Y,rawData:a,colorBy:y,colorScheme:f,legendInteraction:L,legendPosition:B,selection:O,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:S,onClick:E,hoverHighlight:_,chartType:"BarChart",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:N,height:D});if(K.earlyReturn)return K.earlyReturn;Rn("BarChart",Y,"categoryAccessor",d),Rn("BarChart",Y,"valueAccessor",h);const Z=Jt(Y,m,h),U=Ut(),Q=r(()=>new Map,[Y]),ee=r(()=>(e,t)=>{const n={};return n.fill=y?J(e,y,K.colorScale):Qt(T,U,f,void 0,Q),n},[y,K.colorScale,T,U,f,Q]),te=r(()=>{const e=null==k?void 0:k.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},ee(t,n)),e(t,n)||{}):ee},[ee,k]),ne=r(()=>Zt(te,K.effectiveSelectionHook,O),[te,K.effectiveSelectionHook,O]),oe=r(()=>dn({categoryAccessor:d,valueAccessor:h,groupAccessor:y&&y!==d?y:void 0,groupLabel:"string"==typeof y?y:"group"}),[d,h,y]),re=vn({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(hn,{componentName:"BarChart",message:re,width:N,height:D});const ie=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({chartType:"bar"},null!=a&&{data:Z}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[N,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:v}),null!=b&&{roundedTop:b}),$&&{dataIdAccessor:$}),{baselinePadding:x,enableHover:R,showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:p}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:I,oSort:m}),K.legendBehaviorProps),F&&{title:F}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),{tooltipContent:!1===w?()=>null:ln(w)||oe}),(j||S||E||_)&&{customHoverBehavior:K.customHoverBehavior}),(S||E||j)&&{customClickBehavior:K.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement($n,{componentName:"BarChart",width:N,height:D},e.createElement(It,Object.assign({ref:s},ie)))});function Wn({isPushMode:e,colorBy:o,colorScheme:i,showLegend:s,legendPosition:l="right"}){const c=t(new Set),u=t([]),[d,h]=n(0),g=a(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),p=a(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),y=a(e=>t=>{p([t]),e(t)},[p]),f=a(e=>t=>{p(t),e(t)},[p]),m=a(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=r(()=>{if(!e||!o||!1===s)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:U,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const a="string"==typeof o?o:"__streamCat";return Kt({data:t.map(e=>({[a]:e})),colorBy:a,colorScale:e=>r.get(e)||"#999",getColor:J})},[e,o,s,i,d]),b=r(()=>{if(v)return"right"===l?{right:110}:"left"===l?{left:110}:"top"===l?{top:50}:"bottom"===l?{bottom:80}:{right:110}},[v,l]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}function qn({ref:e,frameRef:t,isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:l,setup:c}){const d=Wn({isPushMode:n,colorBy:o,colorScheme:i,showLegend:s,legendPosition:l}),h=a(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=a(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,r;return null!==(r=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==r?r:[]},clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:r(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:l||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,l]),effectiveMargin:r(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}Fn.displayName="BarChart";const Gn=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:E,onClick:_,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:B,legendPosition:T,color:I,categoryFormat:H}=n,$=i.width,N=i.height,D=i.enableHover,R=i.showGrid,z=i.showLegend,F=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],K=y||d,Z=void 0===a,U=zn({data:Y,rawData:a,colorBy:K,colorScheme:f,legendInteraction:B,legendPosition:T,selection:j,linkedHover:S,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:E,onClick:_,hoverHighlight:C,chartType:"StackedBarChart",chartId:P,showLegend:z,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:$,height:N});if(U.earlyReturn)return U.earlyReturn;const Q=Ut(),ee=r(()=>new Map,[Y]),te=r(()=>(e,t)=>K?U.colorScale?{fill:J(e,K,U.colorScale)}:{}:{fill:Qt(I,Q,f,t,ee)},[K,U.colorScale,I,Q,f,ee]),ne=r(()=>{const e=null==O?void 0:O.pieceStyle;return e&&"function"==typeof e?(t,n)=>{const o=te(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:te},[te,O]),oe=r(()=>Zt(ne,U.effectiveSelectionHook,j),[ne,U.effectiveSelectionHook,j]),re=r(()=>dn({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ie=vn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:se,effectiveMargin:ae}=qn({ref:o,frameRef:s,isPushMode:Z,colorBy:K,colorScheme:f,showLegend:z,legendPosition:T,setup:U}),le=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({chartType:"bar"},null!=a&&{data:Y}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[$,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ae,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:p}),H&&{oFormat:H}),{showGrid:R}),se),F&&{title:F}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),{tooltipContent:!1===A?()=>null:ln(A)||re}),(S||E||_||C)&&{customHoverBehavior:U.customHoverBehavior}),(E||_||S)&&{customClickBehavior:U.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ie?e.createElement(hn,{componentName:"StackedBarChart",message:ie,width:$,height:N}):e.createElement($n,{componentName:"StackedBarChart",width:$,height:N},e.createElement(It,Object.assign({ref:s},le)))});Gn.displayName="StackedBarChart";const Vn=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:E,hoverHighlight:_,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:B,color:T,categoryFormat:I}=n,H=i.width,$=i.height,N=i.enableHover,D=i.showGrid,R=i.showLegend,z=i.title,F=i.description,W=i.summary,q=i.accessibleTable,G=i.categoryLabel,V=i.valueLabel,X=a||[],Y=y||d,K=void 0===a,Z=zn({data:X,rawData:a,colorBy:Y,colorScheme:f,legendInteraction:L,legendPosition:B,selection:O,linkedHover:j,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:S,onClick:E,hoverHighlight:_,chartType:"GroupedBarChart",chartId:C,showLegend:R,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:H,height:$});if(Z.earlyReturn)return Z.earlyReturn;const U=Ut(),Q=r(()=>new Map,[X]),ee=r(()=>(e,t)=>Y?Z.colorScale?{fill:J(e,Y,Z.colorScale)}:{}:{fill:Qt(T,U,f,t,Q)},[Y,Z.colorScale,T,U,f,Q]),te=r(()=>Zt(ee,Z.effectiveSelectionHook,O),[ee,Z.effectiveSelectionHook,O]),ne=r(()=>dn({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),oe=vn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:re,effectiveMargin:ie}=qn({ref:o,frameRef:s,isPushMode:K,colorBy:Y,colorScheme:f,showLegend:R,legendPosition:B,setup:Z}),se=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({chartType:"clusterbar"},null!=a&&{data:X}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:te,size:[H,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:V,rFormat:p}),I&&{oFormat:I}),{showGrid:D}),re),z&&{title:z}),F&&{description:F}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),{tooltipContent:!1===w?()=>null:ln(w)||ne}),(j||S||E||_)&&{customHoverBehavior:Z.customHoverBehavior}),(S||E||j)&&{customClickBehavior:Z.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return oe?e.createElement(hn,{componentName:"GroupedBarChart",message:oe,width:H,height:$}):e.createElement($n,{componentName:"GroupedBarChart",width:H,height:$},e.createElement(It,Object.assign({ref:s},se)))});function Xn({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:i}){const s=(l="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof l?{name:l}:l:null;var l;const c=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:l,clear:c}=Xt({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=a(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,n,o,l,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}({name:(null==s?void 0:s.name)||"__unused_ordinal_brush__",xField:(null==s?void 0:s.xField)||("string"==typeof i?i:"value")}),u=t(c.brushInteraction);u.current=c.brushInteraction;const d=a(e=>{if(s){u.current.end(e?e.r:null)}null==n||n(e)},[n,s]),h=!!(e||o||n);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}Vn.displayName="GroupedBarChart";const Yn=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m=40,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:E,hoverHighlight:_,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:B,color:T,categoryFormat:I,rTickValues:H,tickLabelEdgeAlign:$,showCategoryTicks:N}=n,D=i.width,R=i.height,z=i.enableHover,F=i.showGrid,W=i.showLegend,q=i.title,G=i.description,V=i.summary,X=i.accessibleTable,Y=i.categoryLabel,K=i.valueLabel,Z=a||[],U=y||d,Q=void 0===a,ee=zn({data:Z,rawData:a,colorBy:U,colorScheme:f,legendInteraction:L,legendPosition:B,selection:O,linkedHover:j,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:E,hoverHighlight:_,chartType:"SwimlaneChart",chartId:C,showLegend:W,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:D,height:R}),te=Xn({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(ee.earlyReturn)return ee.earlyReturn;const ne=Ut(),oe=r(()=>new Map,[Z]),re=r(()=>(e,t)=>U?ee.colorScale?{fill:J(e,U,ee.colorScale)}:{}:{fill:Qt(T,ne,f,t,oe)},[U,ee.colorScale,T,ne,f,oe]),ie=r(()=>Zt(re,ee.effectiveSelectionHook,O),[re,ee.effectiveSelectionHook,O]),se=r(()=>dn({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ae=vn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:le,effectiveMargin:ce}=qn({ref:o,frameRef:s,isPushMode:Q,colorBy:U,colorScheme:f,showLegend:W,legendPosition:B,setup:ee}),ue=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({chartType:"swimlane"},null!=a&&{data:Z}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[D,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ce,barPadding:m,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===N?void 0:Y,rLabel:K,rFormat:p}),H&&{rTickValues:H}),null!=$&&{tickLabelEdgeAlign:$}),I&&{oFormat:I}),void 0!==N&&{showCategoryTicks:N}),{showGrid:F}),le),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),{tooltipContent:!1===v?()=>null:ln(v)||se}),(j||S||E||_)&&{customHoverBehavior:ee.customHoverBehavior}),(S||E||j)&&{customClickBehavior:ee.customClickBehavior}),b&&b.length>0&&{annotations:b}),te.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ae?e.createElement(hn,{componentName:"SwimlaneChart",message:ae,width:D,height:R}):e.createElement($n,{componentName:"SwimlaneChart",width:D,height:R},e.createElement(It,Object.assign({ref:s},ue)))});Yn.displayName="SwimlaneChart";const Kn=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null);u(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:k,brush:O,onBrush:j,linkedBrush:S,frameProps:E={},selection:_,linkedHover:C,onObservation:P,onClick:M,hoverHighlight:L,chartId:B,loading:T,emptyContent:I,legendInteraction:H,legendPosition:$,color:N,showCategoryTicks:D,categoryFormat:R}=n,z=i.width,F=i.height,W=i.enableHover,q=i.showGrid,G=i.title,V=i.description,X=i.summary,Y=i.accessibleTable,K=i.categoryLabel,Z=i.valueLabel,U=a||[],Q=zn({data:U,rawData:a,colorBy:y,colorScheme:f,legendInteraction:H,legendPosition:$,selection:_,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:M,hoverHighlight:L,chartType:"SwarmPlot",chartId:B,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:T,emptyContent:I,width:z,height:F}),ee=Xn({brushProp:O,onBrushProp:j,linkedBrush:S,valueAccessor:h});if(Q.earlyReturn)return Q.earlyReturn;const te=r(()=>{if(!m)return;const e=U.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[U,m]),ne=Ut(),oe=r(()=>new Map,[U]),re=r(()=>(e,t)=>{const n={fillOpacity:x};return n.fill=y?J(e,y,Q.colorScale):Qt(N,ne,f,void 0,oe),n.r=m?function(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,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}(e,m,v,te):b,n},[y,Q.colorScale,m,v,te,b,x,N,ne,f,oe]),ie=r(()=>Zt(re,Q.effectiveSelectionHook,_),[re,Q.effectiveSelectionHook,_]),se=r(()=>dn({categoryAccessor:d,valueAccessor:h,groupAccessor:y||void 0}),[d,h,y]),ae=vn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(ae)return e.createElement(hn,{componentName:"SwarmPlot",message:ae,width:z,height:F});const le=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({chartType:"swarm"},null!=a&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[z,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,barPadding:w,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z,rFormat:p}),R&&{oFormat:R}),{showGrid:q,showCategoryTicks:D}),Q.legendBehaviorProps),G&&{title:G}),V&&{description:V}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===A?()=>null:ln(A)||se}),(C||P||M||L)&&{customHoverBehavior:Q.customHoverBehavior}),(P||M||C)&&{customClickBehavior:Q.customClickBehavior}),k&&k.length>0&&{annotations:k}),ee.brushStreamProps),Object.fromEntries(Object.entries(E).filter(([e])=>"pieceStyle"!==e)));return e.createElement($n,{componentName:"SwarmPlot",width:z,height:F},e.createElement(It,Object.assign({ref:s},le)))});function Zn(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:on},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=i.length,a=s>0?s%2!=0?i[Math.floor(s/2)]:(i[s/2-1]+i[s/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:on},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),s>0&&e.createElement("div",null,"n = ",s),null!=a&&e.createElement("div",null,"Median: ",a.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:on},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}Kn.displayName="SwarmPlot";const Un=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null);u(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:E,loading:_,emptyContent:C,legendInteraction:P,legendPosition:M,color:L,showCategoryTicks:B,categoryFormat:T}=n,I=i.width,H=i.height,$=i.enableHover,N=i.showGrid,D=i.title,R=i.description,z=i.summary,F=i.accessibleTable,W=i.categoryLabel,q=i.valueLabel,G=a||[],V=zn({data:G,rawData:a,colorBy:y,colorScheme:f,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"BoxPlot",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:C,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const X=Ut(),Y=r(()=>new Map,[G]),K=r(()=>e=>{const t=y?J(e,y,V.colorScale):Qt(L,X,f,void 0,Y);return{fill:t,stroke:t,fillOpacity:.8}},[y,V.colorScale,L,X,f,Y]),Z=r(()=>Zt(K,V.effectiveSelectionHook,A),[K,V.effectiveSelectionHook,A]),U=r(()=>Zn(),[]),Q=vn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(Q)return e.createElement(hn,{componentName:"BoxPlot",message:Q,width:I,height:H});const ee=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({chartType:"boxplot"},null!=a&&{data:G}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:Z,showOutliers:m,size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V.margin,barPadding:v,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:W,rLabel:q,rFormat:p}),T&&{oFormat:T}),{showGrid:N,showCategoryTicks:B}),V.legendBehaviorProps),D&&{title:D}),R&&{description:R}),z&&{summary:z}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),{tooltipContent:!1===b?()=>null:ln(b)||U}),(k||O||j||S)&&{customHoverBehavior:V.customHoverBehavior}),(O||j||k)&&{customClickBehavior:V.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement($n,{componentName:"BoxPlot",width:I,height:H},e.createElement(It,Object.assign({ref:s},ee)))});Un.displayName="BoxPlot";const Qn=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),s=t(null);u(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:p=!1,valueFormat:y,colorBy:f,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:w,onBrush:A,linkedBrush:k,frameProps:O={},selection:j,linkedHover:S,onObservation:E,onClick:_,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:B,legendPosition:T,color:I,showCategoryTicks:H,categoryFormat:$}=n,N=i.width,D=i.height,R=i.enableHover,z=i.showGrid,F=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],K=zn({data:Y,rawData:a,colorBy:f,colorScheme:m,legendInteraction:B,legendPosition:T,selection:j,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,onClick:_,hoverHighlight:C,chartType:"Histogram",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:N,height:D}),Z=Xn({brushProp:w,onBrushProp:A,linkedBrush:k,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const U=r(()=>{if(0===Y.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of Y){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[Y,h]),Q=Ut(),ee=r(()=>new Map,[Y]),te=r(()=>e=>{const t=f?J(e,f,K.colorScale):Qt(I,Q,m,void 0,ee);return{fill:t,stroke:t,fillOpacity:.8}},[f,K.colorScale,I,Q,m,ee]),ne=r(()=>Zt(te,K.effectiveSelectionHook,j),[te,K.effectiveSelectionHook,j]),oe=r(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:on},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),re=vn({componentName:"Histogram",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(hn,{componentName:"Histogram",message:re,width:N,height:D});const ie=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({chartType:"histogram"},null!=a&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:ne,bins:g,normalize:p}),U&&{rExtent:U}),{size:[N,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:v,enableHover:R}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:y}),$&&{oFormat:$}),{showGrid:z,showCategoryTicks:H}),K.legendBehaviorProps),F&&{title:F}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),{tooltipContent:!1===b?()=>null:ln(b)||oe}),(S||E||_||C)&&{customHoverBehavior:K.customHoverBehavior}),(E||_||S)&&{customClickBehavior:K.customClickBehavior}),x&&x.length>0&&{annotations:x}),Z.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.createElement($n,{componentName:"Histogram",width:N,height:D},e.createElement(It,Object.assign({ref:s},ie)))});Qn.displayName="Histogram";const Jn=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null);u(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:p=25,showIQR:y=!0,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:E,onObservation:_,onClick:C,hoverHighlight:P,chartId:M,loading:L,emptyContent:B,legendInteraction:T,legendPosition:I,color:H,showCategoryTicks:$,categoryFormat:N}=n,D=i.width,R=i.height,z=i.enableHover,F=i.showGrid,W=i.title,q=i.description,G=i.summary,V=i.accessibleTable,X=i.categoryLabel,Y=i.valueLabel,K=a||[],Z=zn({data:K,rawData:a,colorBy:m,colorScheme:v,legendInteraction:T,legendPosition:I,selection:S,linkedHover:E,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"ViolinPlot",chartId:M,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:B,width:D,height:R}),U=Xn({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:h});if(Z.earlyReturn)return Z.earlyReturn;const Q=Ut(),ee=r(()=>new Map,[K]),te=r(()=>e=>{const t=m?J(e,m,Z.colorScale):Qt(H,Q,v,void 0,ee);return{fill:t,stroke:t,fillOpacity:.6}},[m,Z.colorScale,H,Q,v,ee]),ne=r(()=>Zt(te,Z.effectiveSelectionHook,S),[te,Z.effectiveSelectionHook,S]),oe=r(()=>Zn({valueAccessor:h}),[h]),re=vn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(hn,{componentName:"ViolinPlot",message:re,width:D,height:R});const ie=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({chartType:"violin"},null!=a&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:ne,bins:p,showIQR:y,size:[D,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,barPadding:b,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Y,rFormat:f}),N&&{oFormat:N}),{showGrid:F,showCategoryTicks:$}),Z.legendBehaviorProps),W&&{title:W}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),{tooltipContent:!1===x?()=>null:ln(x)||oe}),(E||_||C||P)&&{customHoverBehavior:Z.customHoverBehavior}),(_||C||E)&&{customClickBehavior:Z.customClickBehavior}),w&&w.length>0&&{annotations:w}),U.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.createElement($n,{componentName:"ViolinPlot",width:D,height:R},e.createElement(It,Object.assign({ref:s},ie)))});Jn.displayName="ViolinPlot";const eo=c(function(n,o){var i;const s=tn(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),a=t(null);u(o,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:p="horizontal",valueFormat:y,colorBy:f,colorScheme:m,sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:E,hoverHighlight:_,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:B,color:T,categoryFormat:I}=n,H=s.width,$=s.height,N=s.enableHover,D=s.showGrid,R=s.title,z=s.description,F=s.summary,W=s.accessibleTable,q=s.categoryLabel,G=s.valueLabel,V=l||[],X=zn({data:V,rawData:l,colorBy:f,colorScheme:m,legendInteraction:L,legendPosition:B,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:S,onClick:E,hoverHighlight:_,chartType:"DotPlot",chartId:C,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:P,emptyContent:M,width:H,height:$});if(X.earlyReturn)return X.earlyReturn;const Y=Jt(V,v,g),K=Ut(),Z=r(()=>new Map,[V]),U=r(()=>(e,t)=>{const n={r:b,fillOpacity:.8};return n.fill=f?J(e,f,X.colorScale):Qt(T,K,m,void 0,Z),n},[f,X.colorScale,b,T,K,m,Z]),Q=r(()=>Zt(U,X.effectiveSelectionHook,O),[U,X.effectiveSelectionHook,O]),ee=r(()=>dn({categoryAccessor:h,valueAccessor:g}),[h,g]),te=vn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(te)return e.createElement(hn,{componentName:"DotPlot",message:te,width:H,height:$});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({chartType:"point"},null!=l&&{data:Y}),{oAccessor:h,rAccessor:g,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:Q,size:[H,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:X.margin,barPadding:x,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:s.showAxes,oLabel:q,rLabel:G,rFormat:y}),I&&{oFormat:I}),{showGrid:D,oSort:v}),X.legendBehaviorProps),R&&{title:R}),z&&{description:z}),F&&{summary:F}),void 0!==W&&{accessibleTable:W}),d&&{className:d}),{tooltipContent:!1===w?()=>null:ln(w)||ee}),(j||S||E||_)&&{customHoverBehavior:X.customHoverBehavior}),(S||E||j)&&{customClickBehavior:X.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement($n,{componentName:"DotPlot",width:H,height:$},e.createElement(It,Object.assign({ref:a},ne)))});eo.displayName="DotPlot";const to=c(function(n,o){var i,s;const a=tn(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(s=n.height)&&void 0!==s?s:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:E,emptyContent:_,legendInteraction:C,legendPosition:P,color:M}=n,L=a.width,B=a.height,T=a.enableHover,I=a.showLegend,H=a.title,$=a.description,N=a.summary,D=a.accessibleTable,R=c||[],z=p||h,F=void 0===c,W=zn({data:R,rawData:c,colorBy:z,colorScheme:y,legendInteraction:C,legendPosition:P,selection:w,linkedHover:A,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"PieChart",chartId:S,showLegend:I,userMargin:u,marginDefaults:a.marginDefaults,loading:E,emptyContent:_,width:L,height:B});if(W.earlyReturn)return W.earlyReturn;const q=Ut(),G=r(()=>new Map,[R]),V=r(()=>(e,t)=>z?W.colorScale?{fill:J(e,z,W.colorScale)}:{}:{fill:Qt(M,q,y,t,G)},[z,W.colorScale,M,q,y,G]),X=r(()=>{const e=null==x?void 0:x.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},V(t,n)),e(t,n)||{}):V},[V,x]),Y=r(()=>Zt(X,W.effectiveSelectionHook,w),[X,W.effectiveSelectionHook,w]),K=r(()=>dn({categoryAccessor:h,valueAccessor:g,groupAccessor:p&&p!==h?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[h,g,p]),Z=vn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:U,effectiveMargin:Q}=qn({ref:o,frameRef:l,isPushMode:F,colorBy:z,colorScheme:y,showLegend:I,legendPosition:P,setup:W}),ee=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({chartType:"pie"},null!=c&&{data:R}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Y,startAngle:f}),null!=m&&{cornerRadius:m}),{size:[L,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q,enableHover:T}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),U),H&&{title:H}),$&&{description:$}),N&&{summary:N}),void 0!==D&&{accessibleTable:D}),d&&{className:d}),{tooltipContent:!1===v?()=>null:ln(v)||K}),(A||k||O||j)&&{customHoverBehavior:W.customHoverBehavior}),(k||O||A)&&{customClickBehavior:W.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Z?e.createElement(hn,{componentName:"PieChart",message:Z,width:L,height:B}):e.createElement($n,{componentName:"PieChart",width:L,height:B},e.createElement(It,Object.assign({ref:l},ee)))});to.displayName="PieChart";const no=c(function(n,o){var i,s;const a=tn(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(s=n.height)&&void 0!==s?s:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:p=60,centerContent:y,colorBy:f,colorScheme:m,startAngle:v=0,cornerRadius:b,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:E,chartId:_,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:B}=n,T=a.width,I=a.height,H=a.enableHover,$=a.showLegend,N=a.title,D=a.description,R=a.summary,z=a.accessibleTable,F=c||[],W=f||h,q=void 0===c,G=zn({data:F,rawData:c,colorBy:W,colorScheme:m,legendInteraction:M,legendPosition:L,selection:k,linkedHover:O,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:E,chartType:"DonutChart",chartId:_,showLegend:$,userMargin:u,marginDefaults:a.marginDefaults,loading:C,emptyContent:P,width:T,height:I});if(G.earlyReturn)return G.earlyReturn;const V=Ut(),X=r(()=>new Map,[F]),Y=r(()=>(e,t)=>W?G.colorScale?{fill:J(e,W,G.colorScale)}:{}:{fill:Qt(B,V,m,t,X)},[W,G.colorScale,B,V,m,X]),K=r(()=>Zt(Y,G.effectiveSelectionHook,k),[Y,G.effectiveSelectionHook,k]),Z=r(()=>dn({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),U=vn({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Q,effectiveMargin:ee}=qn({ref:o,frameRef:l,isPushMode:q,colorBy:W,colorScheme:m,showLegend:$,legendPosition:L,setup:G}),te=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({chartType:"donut"},null!=c&&{data:F}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,innerRadius:p,startAngle:v}),null!=b&&{cornerRadius:b}),{centerContent:y,size:[T,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee,enableHover:H}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),Q),N&&{title:N}),D&&{description:D}),R&&{summary:R}),void 0!==z&&{accessibleTable:z}),d&&{className:d}),{tooltipContent:!1===x?()=>null:ln(x)||Z}),(O||j||S||E)&&{customHoverBehavior:G.customHoverBehavior}),(j||S||O)&&{customClickBehavior:G.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return U?e.createElement(hn,{componentName:"DonutChart",message:U,width:T,height:I}):e.createElement($n,{componentName:"DonutChart",width:T,height:I},e.createElement(It,Object.assign({ref:l},te)))});no.displayName="DonutChart";const oo=c(function(n,o){var i,s,a;const l=tn(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:300,height:null!==(s=n.height)&&void 0!==s?s:250,enableHover:null===(a=n.enableHover)||void 0===a||a,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),c=t(null),{value:u,min:d=0,max:h=100,thresholds:g,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!0,sweep:A=240,fillZones:k=!0,tooltip:O,annotations:j,frameProps:S={},className:E}=n,_=l.width,C=l.height,P=l.title,M=l.description,L=l.summary,B=l.accessibleTable,T=Math.max(d,Math.min(h,u)),I=h-d||1,H=(T-d)/I,{gaugeData:$,pieceStyle:N,gaugeAnnotations:D}=r(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:p||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let r=d;for(let n=0;o.length>n;n++){const i=o[n],s=(i.value-r)/I;if(k){const o=(r-d)/I,a=Math.max(0,Math.min(H,(i.value-d)/I)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:i.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:y,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}r=i.value}if(w&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:y},gaugeAnnotations:n}},[u,d,h,g,p,y,H,I,w,k]),R=A*Math.PI/180,z=180+(360-A)/2,F=-Math.PI/2+z*Math.PI/180,W=[[Math.cos(F),Math.sin(F)],[Math.cos(F+R),Math.sin(F+R)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-F)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>R+.001||W.push([Math.cos(e),Math.sin(e)]);const q=Math.min(...W.map(e=>e[0])),G=Math.max(...W.map(e=>e[0])),V=Math.min(...W.map(e=>e[1])),X=Math.max(...W.map(e=>e[1])),Y=(V+X)/2,K=(q+G)/2,Z=Math.max(10,Math.min((_-20)/(G-q),(C-20)/(X-V))-4),U=Math.max(10,Z*(1-f)),Q=_/2-K*Z,J=C/2-Y*Z,ee=2*(Z+4),te=r(()=>{if(null!=b)return"function"==typeof b?b(T,d,h):b;const t=x?x(T):Math.round(T)+"";return e.createElement("div",{style:{textAlign:"center",lineHeight:1.2}},e.createElement("div",{style:{fontSize:Math.max(16,.3*Z),fontWeight:700,color:"var(--semiotic-text, #333)"}},t),w&&e.createElement("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"}},d," – ",h))},[b,T,d,h,x,w,Z]),ne=r(()=>{if(!m)return null;const e=-Math.PI/2+z*Math.PI/180+H*R,t=U-8;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,H,z,R,U,v]),oe=r(()=>(t,n,o)=>{if("gauge-needle"===t.type)return e.createElement("g",{key:"gauge-needle-"+n,transform:`translate(${(o.width||_)/2},${(o.height||C)/2})`},e.createElement("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:2.5,strokeLinecap:"round"}),e.createElement("circle",{cx:0,cy:0,r:5,fill:t.color}));if("gauge-label"===t.type){const r=-Math.PI/2+z*Math.PI/180+(t.value-d)/I*R,i=U-14,s=(o.height||C)/2;return e.createElement("text",{key:"gauge-label-"+n,x:(o.width||_)/2+Math.cos(r)*i,y:s+Math.sin(r)*i,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label)}return null},[_,C,d,I,z,R,U]),re=r(()=>{const e=[...D,...j||[]];return ne&&e.push(ne),e},[D,j,ne]),ie=r(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,r=null==o?void 0:o._isFill;return e.createElement("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"}},e.createElement("div",{style:{fontWeight:600}},(null==o?void 0:o._zone)||""),e.createElement("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"}},r?"Current: "+Math.round(T):"Remaining"))},[T]);if(0===$.length)return e.createElement(hn,{componentName:"GaugeChart",message:"No data to display",width:_,height:C});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:$,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:N,innerRadius:U,startAngle:z,sweepAngle:A,centerContent:te,size:[_,C],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:J-ee/2,bottom:C-J-ee/2,left:Q-ee/2,right:_-Q-ee/2},enableHover:l.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:ln(O)||ie,svgAnnotationRules:oe},re.length>0&&{annotations:re}),P&&{title:P}),M&&{description:M}),L&&{summary:L}),void 0!==B&&{accessibleTable:B}),E&&{className:E}),S);return e.createElement($n,{componentName:"GaugeChart",width:_,height:C},e.createElement(It,Object.assign({ref:c},se)))});oo.displayName="GaugeChart";const ro=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null);u(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:p=20,amplitude:y=1.5,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:E,chartId:_,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:B,showCategoryTicks:T,categoryFormat:I}=n,H=i.width,$=i.height,N=i.enableHover,D=i.showGrid,R=i.title,z=i.description,F=i.summary,W=i.accessibleTable,q=i.categoryLabel,G=i.valueLabel,V=a||[],X=zn({data:V,rawData:a,colorBy:m,colorScheme:v,legendInteraction:M,legendPosition:L,selection:k,linkedHover:O,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:E,chartType:"RidgelinePlot",chartId:_,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:H,height:$});if(X.earlyReturn)return X.earlyReturn;const Y=Ut(),K=r(()=>new Map,[V]),Z=r(()=>e=>{const t=m?J(e,m,X.colorScale):Qt(B,Y,v,void 0,K);return{fill:t,stroke:t,fillOpacity:.5}},[m,X.colorScale,B,Y,v,K]),U=r(()=>Zt(Z,X.effectiveSelectionHook,k),[Z,X.effectiveSelectionHook,k]),Q=r(()=>Zn(),[]),ee=vn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(ee)return e.createElement(hn,{componentName:"RidgelinePlot",message:ee,width:H,height:$});const te=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({chartType:"ridgeline"},null!=a&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:U,bins:p,size:[H,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:X.margin,barPadding:b,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:G,rFormat:f}),I&&{oFormat:I}),{showGrid:D,showCategoryTicks:T,oSort:!1,amplitude:y}),X.legendBehaviorProps),R&&{title:R}),z&&{description:z}),F&&{summary:F}),void 0!==W&&{accessibleTable:W}),c&&{className:c}),{tooltipContent:!1===x?()=>null:ln(x)||Q}),(O||j||S||E)&&{customHoverBehavior:X.customHoverBehavior}),(j||S||O)&&{customClickBehavior:X.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement($n,{componentName:"RidgelinePlot",width:H,height:$},e.createElement(It,Object.assign({ref:s},te)))});ro.displayName="RidgelinePlot";const io=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),s=t(null);u(o,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:p,colorScheme:y,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:E,loading:_,emptyContent:C,legendInteraction:P,legendPosition:M,color:L,categoryFormat:B}=n,T="vertical"===f,I=i.width,H=i.height,$=i.enableHover,N=i.title,D=i.description,R=i.summary,z=i.accessibleTable,F=a||[],W=p||g,q=!W,G=zn({data:F,rawData:a,colorBy:W,colorScheme:y,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"FunnelChart",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:T?{top:N?60:40,right:20,bottom:60,left:60}:{top:N?40:10,right:10,bottom:10,left:10},loading:_,emptyContent:C,width:I,height:H});if(G.earlyReturn)return G.earlyReturn;Rn("FunnelChart",F,"stepAccessor",d),Rn("FunnelChart",F,"valueAccessor",h);const V=Ut(),X=r(()=>new Map,[F]),Y=r(()=>{if(q)return L||((null==V?void 0:V[0])?V[0]:Array.isArray(y)&&y[0]?y[0]:"#4e79a7")},[q,L,V,y]),K=r(()=>(e,t)=>{const n={};return n.fill=Y||(W?J(e,W,G.colorScale):Qt(L,V,y,t,X)),n},[Y,W,G.colorScale,L,V,y,X]),Z=r(()=>Zt(K,G.effectiveSelectionHook,A),[K,G.effectiveSelectionHook,A]),U=r(()=>t=>{var n,o,r,i,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,p=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,y=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:on},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),p&&p!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},p+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",y))},[]),Q=vn({componentName:"FunnelChart",data:a,accessors:{stepAccessor:d,valueAccessor:h}});if(Q)return e.createElement(hn,{componentName:"FunnelChart",message:Q,width:I,height:H});const ee=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({chartType:T?"bar-funnel":"funnel"},null!=a&&{data:F}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:T?"vertical":"horizontal",barPadding:T?40:0,pieceStyle:Z,size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:G.margin,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:T,showCategoryTicks:T}),B&&{oFormat:B}),{showGrid:T}),!T&&{connectorOpacity:m}),{showLabels:v}),G.legendBehaviorProps),N&&{title:N}),D&&{description:D}),R&&{summary:R}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:!0===b||null==b?U:ln(b)||U}),(k||O||j||S)&&{customHoverBehavior:G.customHoverBehavior}),(O||j||k)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement($n,{componentName:"FunnelChart",width:I,height:H},e.createElement(It,Object.assign({ref:s},ee)))});io.displayName="FunnelChart";const so="__likert_neutral_neg",ao="__likert_neutral_pos";function lo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function co(e,t,n,o,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function uo(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:so,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:ao,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function ho(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===so?i=n:n.__likertLevel===ao?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const go=c(function(n,o){const i=tn(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t(null),{data:l,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:p,countAccessor:y="count",levels:f,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:E,chartId:_,valueFormat:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:B,categoryFormat:T}=n,I=i.width,H=i.height,$=i.enableHover,N=i.showGrid,D=i.showLegend,R=i.title,z=i.description,F=i.summary,W=i.accessibleTable,q=i.categoryLabel,G=i.valueLabel,V="horizontal"===m,X=void 0===l,Y=!p,K=r(()=>v&&Array.isArray(v)&&v.length>=f.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),s=[];for(let e=0;i>e;e++)s.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&s.push(o);for(let e=0;i>e;e++)s.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return s}(f.length),[v,f.length]),Z=r(()=>{const e=new Map;for(let t=0;f.length>t;t++)e.set(f[t],K[t]||"#888");return e},[f,K]),{processedData:U,reAggregate:Q,accumulatorRef:J}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:i,levelAccessor:s,countAccessor:l,isDiverging:c,frameRef:u}){const d=!s,h=r(()=>lo(o,"question"),[o]),g=r(()=>d?lo(i,"score"):null,[d,i]),p=r(()=>d?null:lo(s,"level"),[d,s]),y=r(()=>d?null:lo(l,"count"),[d,l]),f=e||[],m=t([]),v=r(()=>{if(0===f.length)return[];let e=co(f,n,h,g,p,y);return c&&(e=uo(e,n),e=ho(e,n)),e},[f,n,h,g,p,y,c]),b=a(e=>{var t,o;let r=co(e,n,h,g,p,y);c&&(r=uo(r,n),r=ho(r,n)),null===(t=u.current)||void 0===t||t.clear(),r.length>0&&(null===(o=u.current)||void 0===o||o.pushMany(r))},[n,h,g,p,y,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:f,categoryAccessor:h,valueAccessor:g,levelAccessor:p,countAccessor:y,isDiverging:V,frameRef:s}),ee="__likertLevelLabel",te=Wn({isPushMode:X,colorBy:ee,colorScheme:K,showLegend:D,legendPosition:B}),ne=a(te.wrapPush(e=>{J.current.push(e),Q(J.current)}),[te.wrapPush,Q,J]),oe=a(te.wrapPushMany(e=>{J.current.push(...e),Q(J.current)}),[te.wrapPushMany,Q,J]);u(o,()=>({push:ne,pushMany:oe,remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;J.current=[],te.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[ne,oe,te.resetCategories,J]);const re=zn({data:U,rawData:l,colorBy:ee,colorScheme:K,legendInteraction:L,legendPosition:B,selection:k,linkedHover:O,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:E,chartType:"LikertChart",chartId:_,showLegend:D,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:I,height:H});if(re.earlyReturn)return re.earlyReturn;const ie=r(()=>{const e=f.length;return e%2!=0&&Z.get(f[Math.floor(e/2)])||"#888"},[f,Z]),se=r(()=>e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(r===so||r===ao)return{fill:ie};const i=o||r;return i&&Z.has(i)?{fill:Z.get(i)}:{fill:"#888"}},[Z,ie]),ae=r(()=>Zt(se,re.effectiveSelectionHook,k),[se,re.effectiveSelectionHook,k]),le=r(()=>{const e=f.length;return e%2!=0?f[Math.floor(e/2)]:""},[f]),ce=r(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===so||o===ao?le:o,i=n.__likertCategory||"",s=Math.abs(n.__likertPct||0),a=o===so||o===ao?2*s:s,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:on},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${a.toFixed(1)}% (n=${l})`))},[le]),ue=r(()=>{if(!f||2>f.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&p)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(p&&!y)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return Y?g&&(e.valueAccessor=g):(p&&(e.levelAccessor=p),y&&(e.countAccessor=y)),vn({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:f}})},[l,h,g,p,y,f,Y]),de=r(()=>[{styleFn:e=>({fill:Z.get(e.label)||"#888"}),items:f.map(e=>({label:e})),label:""}],[f,Z]),he=r(()=>!1!==D?Object.assign(Object.assign({},re.legendBehaviorProps),{legend:{legendGroups:de},legendPosition:B||re.legendPosition||"bottom"}):re.legendBehaviorProps,[re.legendBehaviorProps,re.legendPosition,B,D,de]),ge=r(()=>{const e=Object.assign({},re.margin);if(X&&!1!==D){const t=B||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(te.streamingMarginAdjust)for(const[t,n]of Object.entries(te.streamingMarginAdjust))n>e[t]&&(e[t]=n);return V&&100>e.left&&(e.left=100),e},[re.margin,te.streamingMarginAdjust,V,X,D,B]),pe=r(()=>C||(V?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[V,C]),ye=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({chartType:"bar"},null!=l&&{data:U}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:V?"horizontal":"vertical",pieceStyle:ae,size:[I,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ge,barPadding:b,enableHover:$}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:G||(V?void 0:"Percentage"),rFormat:pe}),T&&{oFormat:T}),{showGrid:N}),he),R&&{title:R}),z&&{description:z}),F&&{summary:F}),void 0!==W&&{accessibleTable:W}),d&&{className:d}),{tooltipContent:!1===x?()=>null:!0===x?ce:ln(x)||ce}),(O||j||S||E)&&{customHoverBehavior:re.customHoverBehavior}),(j||S||O)&&{customClickBehavior:re.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ue?e.createElement(hn,{componentName:"LikertChart",message:ue,width:I,height:H}):e.createElement($n,{componentName:"LikertChart",width:I,height:H},e.createElement(It,Object.assign({ref:s},ye)))});go.displayName="LikertChart";export{Fn as BarChart,Un as BoxPlot,no as DonutChart,eo as DotPlot,io as FunnelChart,oo as GaugeChart,Vn as GroupedBarChart,Qn as Histogram,go as LikertChart,to as PieChart,ro as RidgelinePlot,Gn as StackedBarChart,It as StreamOrdinalFrame,Kn as SwarmPlot,Yn as SwimlaneChart,Jn as ViolinPlot,Ot as createHatchPattern};
1
+ import*as e from"react";import{useEffect as t,useMemo as n,useRef as o,createContext as r,useContext as i,useCallback as s,useSyncExternalStore as a,useState as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{scaleOrdinal as h,scaleLinear as g,scaleBand as p}from"d3-scale";import{quadtree as y}from"d3-quadtree";import{schemeCategory10 as f,interpolatePlasma as m,interpolateViridis as v,interpolatePurples as b,interpolateOranges as x,interpolateGreens as w,interpolateReds as A,interpolateBlues as k,schemeSet3 as O,schemeTableau10 as j}from"d3-scale-chromatic";import{quantile as S}from"d3-array";import{packEnclose as _}from"d3-hierarchy";import{area as E,curveCatmullRom as C,curveCardinal as P,curveBasis as M,curveStepBefore as L,curveStepAfter as T,curveStep as B,curveMonotoneY as I,curveMonotoneX as H,curveLinear as R,arc as $}from"d3-shape";import D from"regression";import{select as N}from"d3-selection";import{brushX as F,brushY as z}from"d3-brush";class W{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class q{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,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class G{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function V(e,t,n){return e+(t-e)*n}function X(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Y(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const K={category10:f,tableau10:j,set3:O,blues:k,reds:A,greens:w,oranges:x,purples:b,viridis:v,plasma:m},U=f,Z=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],J=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 ee(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")||J.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):U[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+""))%U.length]}function te(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return h().domain(o).range(n).unknown("#999");const i=K[n]||K.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:U;return h().domain(o).range(e).unknown("#999")}}function ne(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function oe(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=r(e.pieceData[0],e.name);i.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return i}function re(e){var t,n,o;const r=e.length,i=e[0],s=e[r-1];return{n:r,min:i,q1:null!==(t=S(e,.25))&&void 0!==t?t:i,median:null!==(n=S(e,.5))&&void 0!==n?n:(i+s)/2,q3:null!==(o=S(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/r}}const ie={bar:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,getStack:a,resolvePieceStyle:l}=e,{r:c,projection:u}=o,d=[],h="vertical"===u,g="horizontal"===u,p=i.normalize,y=[];if(a){const e=new Set;for(const t of Object.values(r))for(const n of t.pieceData){const t=a(n);e.has(t)||(e.add(t),y.push(t))}}else y.push("_default");for(const e of Object.values(r)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=s(n),o.pieces.push(n)}let n=0;if(p)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of y){const s=t.get(i);if(!s)continue;let u=s.total;p&&n>0&&(u/=n);const y=l(s.pieces[0],a?i:e.name),f=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(h){const t=c(0>u?r:o+u),n=0>u?c(r+u)-c(r):c(o)-c(o+u);d.push(ne(e.x,t,e.width,Math.abs(n),y,f,i)),0>u?r+=u:o+=u}else if(g){const t=c(0>u?r+u:o),n=0>u?c(r)-c(r+u):c(o+u)-c(o);d.push(ne(t,e.x,Math.abs(n),e.width,y,f,i)),0>u?r+=u:o+=u}}}if(i.roundedTop&&i.roundedTop>0){const e=Math.max(0,i.roundedTop),t=new Map;for(const e of d){if("rect"!==e.type)continue;const o=(null===(n=e.datum)||void 0===n?void 0:n.category)||"";t.has(o)||t.set(o,[]),t.get(o).push(e)}const o="vertical"===u;for(const n of t.values()){if(0===n.length)continue;const t=n.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),r=n.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});if(t.length>0){const n=t.reduce(o?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t);n.roundedTop=e,n.roundedEdge=o?"top":"right"}if(r.length>0){const t=r.reduce(o?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t);t.roundedTop=e,t.roundedEdge=o?"bottom":"left"}}}return d},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(o)){const t=e.width/p,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),g=a(r,h[s]);if(d){const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ne(i,Math.min(a,d),o,Math.abs(a-d),g,r,h[s]))}else{const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ne(Math.min(a,d),i,Math.abs(d-a),o,g,r,h[s]))}}}}if(r.roundedTop&&r.roundedTop>0){const e=Math.max(0,r.roundedTop);for(const t of u){if("rect"!==t.type)continue;const n=i(t.datum);t.roundedTop=e,t.roundedEdge=d?0>n?"bottom":"top":0>n?"left":"right"}}return u},point:function(e,t){var n,o;const{scales:r,columns:i,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:oe,donut:oe,boxplot:function(e,t){var n,o,r,i,s;const{scales:a,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=a,p=[],y="vertical"===g,f=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const a=t[0],l=t[t.length-1],c=null!==(n=S(t,.25))&&void 0!==n?n:a,g=null!==(o=S(t,.5))&&void 0!==o?o:(a+l)/2,m=null!==(r=S(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,w=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:a,A=null!==(s=[...t].reverse().find(e=>x>=e))&&void 0!==s?s:l,k=d(e.pieceData[0],e.name),O=[];if(f)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=y?e.middle:h(n),r=y?h(n):e.middle;O.push({px:o,py:r,value:n,datum:t})}}if(p.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(w),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(A),stats:{n:t.length,min:w,q1:c,median:g,q3:m,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:k,datum:e.pieceData,category:e.name,outliers:O}),f)for(const e of O)p.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:k.fill||"#999",opacity:.6},datum:e.datum})}return p},violin:function(e,t){var n,o,r;const{scales:i,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,p=a.bins||20,y=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],s=t[t.length-1],a=(s-i)/p||1,d=Array(p).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/a),p-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;p>t;t++){const n=u(i+(t+.5)*a);v+=` L ${e.middle+d[t]/f*m} ${n}`}v+=` L ${e.middle} ${u(s)}`;for(let t=p-1;t>=0;t--){const n=u(i+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;p>t;t++)v+=` L ${u(i+(t+.5)*a)} ${e.middle-d[t]/f*m}`;v+=` L ${u(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)v+=` L ${u(i+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(y&&t.length>=4){const a=null!==(n=S(t,.25))&&void 0!==n?n:i,l=null!==(o=S(t,.5))&&void 0!==o?o:(i+s)/2,c=null!==(r=S(t,.75))&&void 0!==r?r:s;x={q1Pos:u(a),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const w=g?{x:e.x,y:Math.min(u(s),u(i)),width:e.width,height:Math.abs(u(s)-u(i))}:{x:Math.min(u(i),u(s)),y:e.x,width:Math.abs(u(s)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,stats:re(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=i.bins||25,d=i.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,y=Math.max(...i,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/y)*e.width*.9,s=l(n+t*r),a=l(n+(t+1)*r);c.push(ne(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/p*f}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/p*f} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:re(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(ne(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(ne(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,s,a,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,p=[],y=t.width/2,f=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>c[e]).filter(Boolean);if(0===m.length)return p;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=d?d(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let A=0;for(const e of m){const t=new Map;let n=0;for(const o of e.pieceData){const e=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}w.push({col:e,groups:t,stepTotal:n}),x||n>A&&(A=n)}if(x)for(const e of w){let t=0,n=0;for(let o=0;v.length>o;o++){const r=e.groups.get(v[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return p;const k=new Map;for(const e of v){const t=w[0].groups.get(e);k.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=w[0].stepTotal,j=x?.95*y:.9*t.width,S=g().domain([0,A]).range([0,j]),_=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let E=new Map;for(let e=0;w.length>e;e++){const t=w[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,g=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=S(o.total))}let r=y,i=y;for(let a=0;v.length>a;a++){const l=v[a],c=t.groups.get(l);if(!c)continue;const m=S(c.total),b=a%2==0,x=b?r:i-m;b?r+=m:i-=m;const w=h(c.pieces[0],l),A=null!==(s=k.get(l))&&void 0!==s?s:c.total,O=A>0?c.total/A*100:0,j=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:O,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});f&&(0===a&&(j.__funnelStepLabel=n.name,j.__funnelStepLabelX=y,j.__funnelStepLabelY=d,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+m/2,j.__funnelValueLabelY=d,j.__funnelBarW=m),p.push(ne(x,d,m,u,w,j,l)),g.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,s=S(e),a=y-s/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),w=O>0?e/O*100:0,A=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});f&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=y,A.__funnelStepLabelY=d,A.__funnelRowWidth=s,A.__funnelValueLabelX=y,A.__funnelValueLabelY=d,A.__funnelBarW=s),p.push(ne(a,d,s,u,x,A,b)),g.set(l,{x:a,y:d,w:s,h:u})}if(e>0&&E.size>0){const e=x?v:[v[0]];for(const o of e){const e=E.get(o),r=g.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),s={type:"trapezoid",points:[[e.x,e.y+e.h],[e.x+e.w,e.y+e.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:i.fill||"#999",opacity:_},datum:null!==(l=null===(a=t.groups.get(o))||void 0===a?void 0:a.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};p.push(s)}}E=g}return p},"bar-funnel":function(e,t){var n,o,r,i;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=a(o);r.total+=i,r.pieces.push(o),n+=i}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),A=null!==(i=null==w?void 0:w.total)&&void 0!==i?i:f,k=o?0:Math.max(0,A-f),O=n.x+e*a+l/2,j=v(f),S=v(0)-j,_=c(p.pieces[0],y?h:n.name),E=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+k)});if(d.push(ne(O,j,u,S,_,E,y?h:n.name)),k>0){const e=v(f+k),t=j-e,o=Object.assign({},_),r=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:k,__barFunnelPercent:b>0?k/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(ne(O,e,u,t,o,r,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=s(n,l);if(u){const r=a(t),i=a(t+o);c.push(ne(r,e.x,i-r,e.width,d,n,l))}else{const r=a(t+o),i=a(t);c.push(ne(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class se{constructor(e){this.rExtent=new G,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new q(e.windowSize),this.getO=Q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new G)):(this.getR=Y(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Q(e.stackBy),this.getGroup=Q(e.groupBy),this.getColor=Q(e.colorAccessor),this.getConnector=Q(e.connectorAccessor),this.getDataId=Q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new q(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,i),a="horizontal"===r,l="radial"===r,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let u,d;if(l){u=p().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=g().domain(s).range([o,n])}else a?(u=p().domain(i).range([0,e.height]).padding(c),d=g().domain(s).range([0,e.width])):(u=p().domain(i).range([0,e.width]).padding(c),d=g().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{var i;const s=this.rExtents[r];s.dirty&&s.recalculate(n,o);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const u=null!==(i=t.extentPadding)&&void 0!==i?i:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),a?g().domain([l,c]).range([0,e.width]):g().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,i,u,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let r=null;if(n){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===o)return i;if("function"==typeof o)return i.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,r,i,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var i;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=ie[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return s}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Z,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=n?t(s):s[o];let l=r.get(a);l||(l=[],r.set(a,l)),l.push(i)}return this._categoryIndexCache={version:this._dataVersion,map:r},r}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,se.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=y().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,r),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let r=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=i-t;if(s>n){const e=1-n/s;e>r&&(r=e)}}r>0&&(n._pulseIntensity=r,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;s>r&&(n._pulseIntensity=1-r/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,r;this.prevPositionMap.clear();const i=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,i);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(r=t.style.opacity)&&void 0!==r?r:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,r;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(r=e.category)&&void 0!==r?r:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],r=this.getNodeKey(o,t);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(r,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let A=!1;const k=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,O);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(k.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),A=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("rect"===c.type)d?(k.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(r=d.w)&&void 0!==r?r:c.w,c.h=null!==(i=d.h)&&void 0!==i?i:c.h,A=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),A=!0);else if("wedge"===c.type)if(d)k.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,A=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),A=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!k.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(p=t.startAngle)&&void 0!==p?p:0)+(null!==(y=t.endAngle)&&void 0!==y?y:0))/2;this.exitNodes.push({type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(f=t.innerRadius)&&void 0!==f?f:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e})}A=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),A&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,r;if(!this.activeTransition)return!1;const i=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(i,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=V(r,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=V(o.x,e._targetX,s),e.y=V(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=V(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=V(r,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=V(n.x,e._targetX,s),e.y=V(n.y,e._targetY,s),void 0!==n.w&&(e.w=V(n.w,e._targetW,s),e.h=V(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:V(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=V(n.startAngle,e._targetStartAngle,s),e.endAngle=V(n.endAngle,e._targetEndAngle,s))}}}if(i>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!X(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!X(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!X(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(X(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=Q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,r=Array.isArray(n)?n:[n],i=Array.isArray(o)?o:[o];if(r.length!==i.length||r.some((e,t)=>!X(e,i[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new G)):(this.getR=Y(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!X(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Q(this.config.stackBy):void 0),"groupBy"in e&&!X(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Q(this.config.groupBy):void 0),"colorAccessor"in e&&!X(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!X(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Q(this.config.connectorAccessor):void 0)}}function ae(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function le(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function ce(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function ue(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>ae(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function de(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=le(Math.atan2(r,o)),a=le(e.startAngle),l=le(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function he(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ge(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}function pe(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function ye(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})}se.QUADTREE_THRESHOLD=500;const fe={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function me(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,fe[n])(o(e,t)),r}function ve(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function be(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function xe({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),s&&e.createElement("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},s&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function we(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[p,y]=e.useState(0),f=e.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=me(t,u,d,h),b=be(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===s&&u===a?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(ve,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),y+=22}),p})(t,o,r,i,s,a,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const y=((t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,y=[];let f=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;p.forEach((t,u)=>{const x=me(t,u,h,g),w=be(t,r,i),A=i&&i.size>0&&i.has(t.label),k=26+7*t.label.length;d&&d>0&&f>0&&f+k>d&&(m++,f=0),y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?A||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,A&&e.createElement(ve,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),f+=k});let x=0,w=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&w>0&&w+t>d?(x=Math.max(x,w),w=t):w+=t}x=Math.max(x,w);const A=m+1;return{items:y,offset:x,totalRows:A,totalHeight:22*A}})(t,r,i,s,a,l,c,n,u,d,o);p+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const y=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(y.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},i.label)),p+=16),y.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${p},0)`},o.items)),p+=o.offset+5,t[r+1]&&y.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8})),p+=12}),e.createElement("g",null,y)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},l),m)}function Ae(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function ke(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 Oe(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.createElement("path",{key:"bracket-path",d:ke((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,y=s?u?[s]:Ae(s,c):[],f=i?u?[i]:Ae(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=y.length*p),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t))));let w=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+f.length)*p+(f.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),w=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+f.length-1)*p;let k=0;return"topBottom"===d?k=0>o?-(A+2):18:"leftRight"===d&&(k="middle"===h?-(A+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>o?-(A+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),w)}(l,v,b,h))}function je(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.createElement(Oe,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:s}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Oe,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:a},r,{type:s}))}function Se(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 _e(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 Ee(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){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,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.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===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(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=Se(e,n),c=_e(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"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ce(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Pe={linear:R,monotoneX:H,monotoneY:I,step:B,stepAfter:T,stepBefore:L,basis:M,cardinal:P,catmullRom:C};function Me(t){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,{rTickValues:h}=t,g="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),y=n(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||Le)(e)})),[l,d,g,h]),f=u&&l&&!g,m=c&&l&&!g;return f||m?e.createElement("svg",{width:i,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},f&&e.createElement("g",{className:"ordinal-grid"},y.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:o,y2:p?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&e.createElement(e.Fragment,null,p?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Le(e){return Math.round(100*e)/100+""}function Te(t){var r,i;const{width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:p,rLabel:y,oFormat:f,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:k,legendIsolatedCategories:O,legendPosition:j="right",foregroundGraphics:S,annotations:C,svgAnnotationRules:P,xAccessor:M,yAccessor:L,annotationData:T,underlayRendered:B,children:I}=t,H="radial"===(null==d?void 0:d.projection),$="horizontal"===(null==d?void 0:d.projection),N=!1!==g,F=n(()=>h&&N&&d&&!H?d.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=d.o(e))&&void 0!==n?n:0)+d.o.bandwidth()/2,label:f?f(e,t):e}}):[],[h,N,d,f,H]),z=t.rTickValues,W=t.tickLabelEdgeAlign,q=n(()=>h&&d&&!H?(z||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(m||Le)(e)})):[],[h,d,m,H,z]),G=o(new Map),V=o(null!==(r=null==C?void 0:C.length)&&void 0!==r?r:0),X=null!==(i=null==C?void 0:C.length)&&void 0!==i?i:0;V.current!==X&&(V.current=X,G.current=new Map);const Y=n(()=>{if(!C||0===C.length)return null;const t=function(t,n,o){var r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j,S,C,P,M,L,T,B,I,H,$,N,F,z,W,q,G,V,X,Y,Q,K,U,Z,J,ee,te;switch(t.type){case"label":{const r=Ee(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ce(i,s,o)?e.createElement(je,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=Ee(t,n,o);if(!r)return null;const{x:i,y:s}=r;return Ce(i,s,o)?e.createElement(je,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Se(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:a,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=_e(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:a,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Se(Object.assign(Object.assign({},e),{type:"point"}),o),y:_e(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=_(r),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Se(Object.assign(Object.assign({},e),{type:"point"}),o),y:_e(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Se(n,o),a=_e(n,o);if(null==i||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:a,r:l},c))}))}case"bracket":{const r=Se(t,o),i=_e(t,o);return e.createElement(je,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",p=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(s=o.scales)||void 0===s?void 0:s.time,f=null!==(l=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!y||!f)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?D.polynomial(p,{order:t.order||2}):D.linear(p)).points;const b=v.map(([e,t])=>`${y(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:y(v[v.length-1][0])+4,y:f(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(p=null==r?void 0:r(t.y0))&&void 0!==p?p:0,s=null!==(y=null==r?void 0:r(t.y1))&&void 0!==y?y:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=Pe[o.curve||"linear"]||R,g=E().x(e=>s(e[i])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(h)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:p,fillOpacity:null!==(A=t.fillOpacity)&&void 0!==A?A:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:s(d[d.length-1][i])+4,y:a(d[d.length-1][l])-4,fill:p,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(O=null===(k=o.scales)||void 0===k?void 0:k.x)&&void 0!==O?O:null===(j=o.scales)||void 0===j?void 0:j.time,a=null!==(C=null===(S=o.scales)||void 0===S?void 0:S.y)&&void 0!==C?C:null===(P=o.scales)||void 0===P?void 0:P.value;if(!s||!a)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(M=t.threshold)&&void 0!==M?M:2,g=c-h*d,p=!1!==t.showBand,y=t.fill||"#6366f1",f=null!==(L=t.fillOpacity)&&void 0!==L?L:.1,m=t.anomalyColor||"#ef4444",v=null!==(T=t.anomalyRadius)&&void 0!==T?T:6,b=a(c+h*d),x=a(g),w=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},p&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),w.map((t,n)=>{const r=Se(t,o),i=_e(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(I=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(H=o.scales)||void 0===H?void 0:H.time,l=null!==(N=null===($=o.scales)||void 0===$?void 0:$.y)&&void 0!==N?N:null===(F=o.scales)||void 0===F?void 0:F.value;if(!a||!l)return null;const c=r.map(e=>[e[i],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=D.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),p=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==(z=t.confidence)&&void 0!==z?z:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,v=null!==(W=t.steps)&&void 0!==W?W:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;v>=e;e++)w.push(b+e*x);const A=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-p,2)/y:0))*m;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const k=`M${A.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=A.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),j=`${a(b)},${l(u(b))}`,S=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:k,fill:t.fill||"#6366f1",fillOpacity:null!==(q=t.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),e.createElement("polyline",{points:`${j} ${O}`,fill:"none",stroke:S,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(V=t.strokeDasharray)&&void 0!==V?V:"6,3"}),t.label&&A.length>0&&e.createElement("text",{x:a(A[A.length-1].x)+4,y:l(A[A.length-1].yCenter)-4,fill:S,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=Ee(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Ce(r,i,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,a=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(Q=t.width)&&void 0!==Q?Q:32,c=null!==(K=t.height)&&void 0!==K?K:32,u=null!==(U=t.content)&&void 0!==U?U:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=Ee(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(Z=o.scales)||void 0===Z?void 0:Z.o,s=null===(J=o.scales)||void 0===J?void 0:J.x,a=null===(ee=o.scales)||void 0===ee?void 0:ee.y,l=(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(te=t.opacity)&&void 0!==te?te:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===s)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}},n="horizontal"===(null==d?void 0:d.projection),o=(null==d?void 0:d.o)?e=>{var t;return(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2}:null,r={scales:d?{x:n?d.r:o||d.r,y:n&&o||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:M,yAccessor:L,width:s,height:a,data:T,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:G.current};return C.map((e,n)=>{if(P){const o=P(e,n,r);return null!=o?o:t(e,n,r)}return t(e,n,r)}).filter(Boolean)},[C,P,s,a,d,M,L,T]);return h||b||x||S||Y&&Y.length>0||v||I?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!H&&!B&&e.createElement("g",{className:"ordinal-grid"},q.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:$?t.pixel:0,y1:$?0:t.pixel,x2:$?t.pixel:s,y2:$?a:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!H&&e.createElement("g",{className:"ordinal-axes"},$?e.createElement(e.Fragment,null,!B&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))),p&&e.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},p),!B&&e.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!B&&(null==d?void 0:d.r)&&(()=>{const t=d.r(0);return t>1&&s-1>t?e.createElement("line",{x1:t,y1:0,x2:t,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((t,n)=>{const o=W?0===n?"start":n===q.length-1?"end":"middle":"middle";return e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))}),y&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},y)):e.createElement(e.Fragment,null,!B&&(()=>{const t=(null==d?void 0:d.r)?d.r(0):a,n=0>t||t>a?a:t;return e.createElement("line",{x1:0,y1:n,x2:s,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${a})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))),p&&e.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p),!B&&e.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),y&&e.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},y))),Y,S,I),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=i.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=r-i.bottom+50):(p=o-i.right+10,y=i.top),e.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(xe,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(we,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var f}({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:j,title:b,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:k,legendIsolatedCategories:O})):null}function Be({width:n,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,onBrush:c}){const u=o(null),d=o(null),h=o(c);h.current=c;const g=o(l);g.current=l;const p=o(!1),y=o(null),f="horizontal"===(null==l?void 0:l.projection),m=o(f);return m.current=f,t(()=>{if(!u.current)return;const e=N(u.current).select(".brush-g"),t=f?F():z();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(p.current)return;const t=g.current;if(!t)return;if(!e.selection)return y.current=null,void h.current(null);const[n,o]=e.selection;let r;r=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};y.current=i,h.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,f]),t(()=>{if(!l||!d.current||!y.current)return;if(!u.current)return;const e=y.current,t=N(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);f?(p.current=!0,t.call(d.current.move,[n,o]),p.current=!1):(p.current=!0,t.call(d.current.move,[o,n]),p.current=!1)},[l,f]),e.createElement("svg",{ref:u,width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}}))}function Ie(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const He="undefined"==typeof window||"undefined"==typeof document,Re=e.createContext(null),$e={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function De(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"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const Ne=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Fe={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"},ze={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},We={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)"},qe={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ge={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)"},Ve={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Xe={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ye({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[s,a]=e.useState(!1),l=e.useContext(Re),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=s||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{s||c||a(!0)},[s,c]),p=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:$e}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:$e,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",t.length," elements)"));const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,A,k,O,j;const S=[];if(!Array.isArray(e))return S;for(const _ of e)if(_&&"object"==typeof _)try{switch(_.type){case"point":S.push({label:"Point",values:{x:_.x,y:_.y}});break;case"line":{const e=_.path,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=_.topPath,t=Array.isArray(_.datum)?_.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=_.datum&&"object"==typeof _.datum?_.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:_.x,y:_.y,value:_.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=_.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=_.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=_.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=_.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=_.cx)&&void 0!==g?g:_.x,y:null!==(p=_.cy)&&void 0!==p?p:_.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=_.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:_.x,open:_.open,high:_.high,low:_.low,close:_.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(k=null!==(w=null===(x=null===(b=_.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(A=_.datum)||void 0===A?void 0:A.name)&&void 0!==k?k:"",value:null!==(j=null===(O=_.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(t),f=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}: ${Ne(e.min)} to ${Ne(e.max)}, mean ${Ne(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,f),v=y.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:p,style:Fe,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:We},"×"),e.createElement("div",{role:"note",style:ze},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:qe},e.createElement("caption",{style:Xe},"First ",v.length," of ",y.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:Ge},"type"),x.map(t=>e.createElement("th",{key:t,style:Ge},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:Ve},t.label),x.map(n=>{return e.createElement("td",{key:n,style:Ve},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ne(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function Qe({summary:t}){return t?e.createElement("div",{role:"note",style:$e},t):null}function Ke({tableId:t}){return e.createElement("a",{href:"#"+t,style:$e,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,$e)}},"Skip to data table")}function Ue({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:$e},n)}const Ze="var(--semiotic-focus, #005fcc)";function Je({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ze,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ze,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ze,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function et({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:a,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},s)}function tt(t){const l=r(null),c=nt(t);return[function({children:o}){const r=n(()=>nt(t),[]);return e.createElement(l.Provider,{value:r,children:o})},e=>{var t;const n=null!==(t=i(l))&&void 0!==t?t:c,r=o(e);r.current=e;const u=s(()=>r.current(n.getState()),[n]),d=s(()=>r.current(n.getState()),[n]);return a(n.subscribe,u,d)}]}function nt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function ot(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:rt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const rt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],it={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},st={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},at={mode:"light",colors:{primary:"#0000cc",categorical:rt,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"},[lt,ct]=tt(e=>({theme:it,setTheme(t){e(e=>{if("light"===t)return{theme:it};if("dark"===t)return{theme:st};if("high-contrast"===t)return{theme:at};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?st:it;return{theme:ot(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:ot(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||{})}))}})}}));const ut=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,dt=new WeakMap;let ht=0,gt=!1,pt=null,yt=null,ft=null;function mt(e,t){var n,o;if(!t)return t;const r=ut.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;!function(){if(gt)return;if("undefined"==typeof window||"undefined"==typeof document)return;gt=!0;const e=()=>{ht++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(pt=new MutationObserver(e),pt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{yt=window.matchMedia("(prefers-color-scheme: dark)"),ft=e,"function"==typeof yt.addEventListener?yt.addEventListener("change",ft):"function"==typeof yt.addListener&&yt.addListener(ft)}catch(e){}}();let s=dt.get(i);s&&s.version===ht||(s={version:ht,map:new Map},dt.set(i,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function vt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function bt(r){const i=function(){const[e,n]=l(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t(()=>{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))},[]),e}(),a=o(i);a.current=i;const[c,u]=function(e,n,r){const i=o(null),[s,a]=l(null);return t(()=>{if(!n&&!r)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,r]),[i,[n&&s?s.w:e[0],r&&s?s.h:e[1]]]}(r.sizeProp,r.responsiveWidth,r.responsiveHeight),d=n(()=>Object.assign(Object.assign({},r.marginDefault),r.userMargin),[r.marginDefault,r.userMargin]),h=u[0]-d.left-d.right,g=u[1]-d.top-d.bottom,p=vt(r.foregroundGraphics,u,d),y=vt(r.backgroundGraphics,u,d),f=ct(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(r.animate,r.transitionProp),b="semiotic-table-"+e.useId(),x=o(0),w=o(()=>{}),A=s(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);t(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const k=o(()=>{}),O=o(()=>{}),j=o(null),S=o(0),_=s(()=>{S.current=0;const e=j.current;j.current=null,e&&k.current(e)},[]),E=s(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===S.current&&(S.current=requestAnimationFrame(_))},[_]),C=s(()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0),O.current()},[]);t(()=>()=>{j.current=null,0!==S.current&&(cancelAnimationFrame(S.current),S.current=0)},[]);const P=r.themeDirtyRef;return t(()=>{P&&(ht++,P.current=!0,A())},[f,A,P]),{reducedMotion:i,reducedMotionRef:a,responsiveRef:c,size:u,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:y,currentTheme:f,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:A,hoverHandlerRef:k,hoverLeaveRef:O,onPointerMove:E,onPointerLeave:C}}function xt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function wt(e,t,n=.3){xt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function At(e,t,n=.6){var o,r,i,s,a;if(!xt(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!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a: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 kt(e,t,n,o=.35){xt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const Ot=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)jt(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#007bff";const n=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:o,y:r,w:i,h:s}=t;switch(t.roundedEdge){case"right":e.moveTo(o,r),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o,r+s);break;case"left":e.moveTo(o+i,r),e.lineTo(o+n,r),e.arcTo(o,r,o,r+n,n),e.lineTo(o,r+s-n),e.arcTo(o,r+s,o+n,r+s,n),e.lineTo(o+i,r+s);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o+n,r+s),e.arcTo(o,r+s,o,r+s-n,n);break;default:e.moveTo(o,r+s),e.lineTo(o,r+n),e.arcTo(o,r,o+n,r,n),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));wt(e,t),e.globalAlpha=1}};function jt(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}const St=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?mt(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),At(e,t),e.globalAlpha=1}}finally{e.restore()}}};function _t(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Et(e,t){const n=$().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const Ct=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:1,o=null!==(i=t.style.opacity)&&void 0!==i?i:1;e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Et(e,t)):(_t(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(_t(e,t),kt(e,t)),e.globalAlpha=1}};const Pt=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=("string"==typeof t.style.fill?mt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Mt=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=mt(e,n.style.stroke)||("string"==typeof n.style.fill?mt(e,n.style.fill):n.style.fill)||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}};function Lt(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Tt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Bt=null;function It(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Bt||(Bt=document.createElement("canvas")),Bt.width=e,Bt.height=e,Bt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Ht=new Map;function Rt(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Ht.get(n);if(void 0!==o)return o;const r=It({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ht.set(n,r),r}function $t(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Dt(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Nt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Ft=e=>[Mt,...e],zt={bar:Ft([Ot]),clusterbar:Ft([Ot]),point:Ft([St]),swarm:Ft([St]),pie:[Ct],donut:[Ct],boxplot:Ft([(e,t,n,o)=>{var r,i;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=t.style.fill||"#007bff",a=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=a,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},St]),violin:Ft([Pt]),histogram:Ft([Ot]),ridgeline:Ft([Pt]),timeline:Ft([Ot]),funnel:[Ot,(e,t,n,o)=>{var r,i,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(i=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==i?i:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=mt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,i,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(i=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==i?i:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Lt(r):null!=i?`${Lt(r)} (${Tt(i)})`:Lt(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=Lt(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ot,(e,t,n,o)=>{var r,i;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n="string"==typeof t.style.fill?t.style.fill:"#999",o=Rt(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(i=t.style.opacity)&&void 0!==i?i:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0!==r.length){for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,s=i?Nt(r):"",a=Dt(o);e.font="bold 13px sans-serif";const l=i?e.measureText(s).width:0;e.font="11px sans-serif";const c=e.measureText(a).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,p=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),$t(e,g,p,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),$t(e,g,p,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(s,h,p+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(a,h,p+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(a,h,p+3))}e.lineWidth=1}}],swimlane:Ft([Ot])},Wt={top:50,right:40,bottom:60,left:70},qt={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Gt({hover:t}){var n,o,r,i,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:qt},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:qt},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:qt},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:qt},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const p=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",y=null!==(a=null!==(s=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!p&&""===y){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:qt},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:qt},p&&e.createElement("div",{style:{fontWeight:"bold"}},p+""),""!==y&&e.createElement("div",null,"number"==typeof y?y.toLocaleString():y+""))}const Vt=c(function(r,i){var a,c,d,h,g,p,y,f,m,v;const{chartType:b,runtimeMode:x,data:w,oAccessor:A="category",rAccessor:k="value",colorAccessor:O,stackBy:j,groupBy:S,multiAxis:_,timeAccessor:E,valueAccessor:C,categoryAccessor:P,projection:M="vertical",size:L=[600,400],responsiveWidth:T,responsiveHeight:B,margin:I,barPadding:H,roundedTop:R,baselinePadding:D,innerRadius:N,cornerRadius:F,normalize:z,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:K,connectorOpacity:U,showLabels:Z,connectorAccessor:J,connectorStyle:ee,dataIdAccessor:te,rExtent:ne,oExtent:oe,extentPadding:re=.05,oSort:ie,windowMode:le="sliding",windowSize:fe=200,pieceStyle:me,summaryStyle:ve,colorScheme:be,barColors:xe,showAxes:we=!0,showCategoryTicks:Ae,categoryLabel:ke,valueLabel:Oe,categoryFormat:je,valueFormat:Se,oLabel:_e,rLabel:Ee,oFormat:Ce,rFormat:Pe,rTickValues:Le,tickLabelEdgeAlign:Re,enableHover:$e=!0,hoverAnnotation:Ne,tooltipContent:Fe,customHoverBehavior:ze,annotations:We,svgAnnotationRules:qe,showGrid:Ge=!1,legend:Ve,legendHoverBehavior:Xe,legendClickBehavior:Ze,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,backgroundGraphics:rt,foregroundGraphics:it,title:st,className:at,background:lt,centerContent:ct,decay:ut,pulse:dt,transition:ht,animate:gt,staleness:pt,brush:yt,onBrush:ft,accessibleTable:mt=!0,description:vt,summary:xt}=r,wt=o(!0),At=bt({sizeProp:L,responsiveWidth:T,responsiveHeight:B,userMargin:I,marginDefault:Wt,foregroundGraphics:it,backgroundGraphics:rt,animate:gt,transitionProp:ht,themeDirtyRef:wt}),{reducedMotionRef:kt,responsiveRef:Ot,size:jt,margin:St,adjustedWidth:_t,adjustedHeight:Et,resolvedForeground:Ct,resolvedBackground:Pt,currentTheme:Mt,transition:Lt,introEnabled:Tt,tableId:Bt,rafRef:It,renderFnRef:Ht,scheduleRender:Rt}=At,$t=null!=ke?ke:_e,Dt=null!=Oe?Oe:Ee,Nt=null!=je?je:Ce,Ft=null!=Se?Se:Pe,qt=o(null),Vt=o(null),[Xt,Yt]=l(null),[Qt,Kt]=l(null),[Ut,Zt]=l(0),[Jt,en]=l(!1),tn=$e||Ne,nn="streaming"===x,on=n(()=>{var e;return{chartType:b,runtimeMode:nn?"streaming":"bounded",windowSize:fe,windowMode:le,extentPadding:re,projection:M,oAccessor:nn?void 0:A,rAccessor:nn?void 0:k,colorAccessor:O,stackBy:j,groupBy:S,multiAxis:_,timeAccessor:nn?E:void 0,valueAccessor:nn?C||("string"==typeof k||"function"==typeof k?k:void 0):void 0,categoryAccessor:nn?P||A:void 0,rExtent:ne,oExtent:oe,barPadding:H,roundedTop:R,baselinePadding:D,innerRadius:N,cornerRadius:F,normalize:z,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:K,connectorOpacity:U,showLabels:Z,connectorAccessor:J,connectorStyle:ee,dataIdAccessor:te,oSort:ie,pieceStyle:me,summaryStyle:ve,colorScheme:be,themeCategorical:null===(e=null==Mt?void 0:Mt.colors)||void 0===e?void 0:e.categorical,barColors:xe,decay:ut,pulse:dt,transition:Lt,introAnimation:Tt,staleness:pt}},[b,fe,le,re,M,A,k,O,j,S,_,E,C,P,ne,oe,H,R,D,N,F,z,q,G,V,X,Y,Q,K,U,Z,J,ee,te,ie,me,ve,be,xe,ut,dt,null==Lt?void 0:Lt.duration,null==Lt?void 0:Lt.easing,Tt,pt,nn,Mt]),rn=o(null);rn.current||(rn.current=new se(on)),t(()=>{var e;null===(e=rn.current)||void 0===e||e.updateConfig(on),wt.current=!0,Rt()},[on,Rt]);const sn=o(null);sn.current||(sn.current=new W(e=>{const t=rn.current;t&&t.ingest(e)&&(wt.current=!0,Rt())}));const an=s(e=>{var t;null===(t=sn.current)||void 0===t||t.push(e)},[]),ln=s(e=>{var t;null===(t=sn.current)||void 0===t||t.pushMany(e)},[]),cn=s(()=>{var e,t;null===(e=sn.current)||void 0===e||e.clear(),null===(t=rn.current)||void 0===t||t.clear(),wt.current=!0,Rt()},[Rt]),un=s(e=>{var t,n;null===(t=sn.current)||void 0===t||t.clearLastData(),null===(n=sn.current)||void 0===n||n.setReplacementData(e)},[]);u(i,()=>({push:an,pushMany:ln,replace:un,remove:e=>{var t,n,o,r;null===(t=sn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=rn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(i.length>0){const e=null===(r=Vt.current)||void 0===r?void 0:r.data;!!Vt.current&&i.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Vt.current=null,Yt(null)),wt.current=!0,Rt()}return i},update:(e,t)=>{var n,o,r;null===(n=sn.current)||void 0===n||n.flush();const i=null!==(r=null===(o=rn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(wt.current=!0,Rt()),i},clear:cn,getData:()=>{var e,t,n;return null===(e=sn.current)||void 0===e||e.flush(),null!==(n=null===(t=rn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=rn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[an,ln,un,cn,Rt]),t(()=>{var e;w&&(null===(e=sn.current)||void 0===e||e.setBoundedData(w))},[w]);const{hoverHandlerRef:dn,hoverLeaveRef:hn,onPointerMove:gn,onPointerLeave:pn}=At;dn.current=e=>{if(!tn)return;const t=qt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-St.left,r=e.clientY-n.top-St.top;if(0>o||o>_t||0>r||r>Et)return void(Vt.current&&(Vt.current=null,Yt(null),ze&&ze(null),Rt()));const i=rn.current;if(!i||0===i.scene.length)return;const s="radial"===M,a=function(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),s=t-i,a=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,h,g)=>{if(r>a||s>h||i>c||l>g)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,s=e.y-n,a=Math.sqrt(i*i+s*s);ae(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":e=ce(i,t,n);break;case"point":if(r)break;e=ue(i,t,n,o);break;case"wedge":e=de(i,t,n);break;case"boxplot":e=he(i,t,n);break;case"violin":e=ge(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(i.scene,s?o-_t/2:o,s?r-Et/2:r,30,i.pointQuadtree,i.maxPointRadius);if(!a)return void(Vt.current&&(Vt.current=null,Yt(null),ze&&ze(null),Rt()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b}),Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(c)),{data:c,x:u,y:d,time:u,value:d}),h));var c,u,d,h;Vt.current=l,Yt(l),ze&&(ze(l),wt.current=!0),Rt()},hn.current=()=>{Vt.current&&(Vt.current=null,Yt(null),ze&&(ze(null),wt.current=!0),Rt())};const yn=o(-1),fn=o(null),mn=o(null),vn=s(e=>{const t=rn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(mn.current&&mn.current.version===n)o=mn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(r=s.group)&&void 0!==r?r:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;i.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),mn.current={version:n,graph:o}}const r=yn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),yn.current=0;const t=o.flat[0];fn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},ye(t)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b});return Vt.current=n,Yt(n),ze&&ze(n),void Rt()}const i=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?pe(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?pe(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return yn.current=-1,fn.current=null,Vt.current=null,Yt(null),ze&&ze(null),void Rt();yn.current=s;const a=o.flat[s];fn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},ye(a)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof k?k:void 0,__chartType:b});Vt.current=l,Yt(l),ze&&ze(l),Rt()},[ze,Rt]),bn=s(e=>{yn.current=-1,fn.current=null,gn(e)},[gn]);Ht.current=()=>{var e,t;It.current=0;const n=qt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=rn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(kt.current?i+1e6:i),a=!kt.current&&s,l=wt.current;l&&!s&&(r.computeScene({width:_t,height:Et}),wt.current=!1),(l||a)&&n.setAttribute("aria-label",De(r.scene,b+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=jt[0]*c,d=jt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=jt[0]+"px",n.style.height=jt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,jt[0],jt[1]);const h=null!==(e=null==pt?void 0:pt.threshold)&&void 0!==e?e:5e3,g=pt&&r.lastIngestTime>0&&i-r.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==pt?void 0:pt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==lt&&!rt){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=lt||(e&&"transparent"!==e?e:null);t&&(o.fillStyle=t,o.fillRect(0,0,jt[0],jt[1]))}const p="radial"===M;o.save(),o.beginPath(),o.rect(St.left,St.top,_t,Et),o.clip(),p?(o.save(),o.translate(St.left+_t/2,St.top+Et/2)):o.translate(St.left,St.top);const y=zt[b]||[],f={width:_t,height:Et};for(const e of y)e(o,r.scene,r.scales,f);p&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(Kt(r.scales),Zt(e=>e+1)),(null==pt?void 0:pt.showBadge)&&en(!!g),(a||null!=r.activeTransition||r.hasActivePulses)&&(It.current=requestAnimationFrame(()=>Ht.current()))},t(()=>(Rt(),()=>{var e;null===(e=sn.current)||void 0===e||e.clear()}),[Rt]),t(()=>{wt.current=!0,Rt()},[b,_t,Et,we,lt,Rt]),function(e,n,o,r,i,s){t(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),o.current=!0,r())},1e3);return()=>clearInterval(t)},[e,i,r])}(pt,rn,wt,Rt,Jt,en);const xn=tn&&Xt?Fe?Fe(Xt):e.createElement(Gt,{hover:Xt}):null,wn="radial"===M,An=xn?e.createElement(et,{x:Xt?wn?Xt.x+_t/2:Xt.x:0,y:Xt?wn?Xt.y+Et/2:Xt.y:0,containerWidth:_t,containerHeight:Et,margin:St,className:"stream-ordinal-tooltip"},xn):null;if(He){const t=rn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:_t,height:Et}));const n=null!==(a=null==t?void 0:t.scene)&&void 0!==a?a:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r="radial"===M,i=r?St.left+_t/2:St.left,s=r?St.top+Et/2:St.top;return e.createElement("div",{className:"stream-ordinal-frame"+(at?" "+at:""),role:"img","aria-label":vt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:jt[0],height:jt[1]}},e.createElement(Qe,{summary:xt}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:jt[0],height:jt[1],style:{position:"absolute",left:0,top:0}},Pt&&e.createElement("g",{transform:`translate(${St.left},${St.top})`},Pt),e.createElement("g",{transform:`translate(${i},${s})`},lt&&e.createElement("rect",{x:0,y:0,width:_t,height:Et,fill:lt}),n.map((t,n)=>function(t,n){var o,r,i,s,a;const l=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:r,w:i,h:s}=n;let a;switch(n.roundedEdge){case"right":a=`M${o},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+s-t} A${t},${t} 0 0 1 ${o+i-t},${r+s} L${o},${r+s} Z`;break;case"left":a=`M${o+i},${r} L${o+t},${r} A${t},${t} 0 0 0 ${o},${r+t} L${o},${r+s-t} A${t},${t} 0 0 0 ${o+t},${r+s} L${o+i},${r+s} Z`;break;case"bottom":a=`M${o},${r} L${o+i},${r} L${o+i},${r+s-t} A${t},${t} 0 0 1 ${o+i-t},${r+s} L${o+t},${r+s} A${t},${t} 0 0 1 ${o},${r+s-t} Z`;break;default:a=`M${o},${r+s} L${o},${r+t} A${t},${t} 0 0 1 ${o+t},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+s} Z`}return e.createElement("path",{key:u,d:a,fill:Ie(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:Ie(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:Ie(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=$().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&o.cornerRadius(n.cornerRadius);const r=o({})||"";return e.createElement("path",{key:u,d:r,transform:`translate(${n.cx},${n.cy})`,fill:Ie(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:Ie(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:Ie(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:Ie(n.style.fill),fillOpacity:null!==(s=n.style.fillOpacity)&&void 0!==s?s:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(a=t.style.opacity)&&void 0!==a?a:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:Ie(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(Te,{width:_t,height:Et,totalWidth:jt[0],totalHeight:jt[1],margin:St,scales:o,showAxes:we,showCategoryTicks:Ae,oLabel:$t,rLabel:Dt,oFormat:Nt,rFormat:Ft,rTickValues:Le,tickLabelEdgeAlign:Re,showGrid:Ge,title:st,legend:Ve,legendHoverBehavior:Xe,legendClickBehavior:Ze,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,foregroundGraphics:Ct,annotations:We,svgAnnotationRules:qe,annotationFrame:0,xAccessor:"string"==typeof A?A:void 0,yAccessor:"string"==typeof k?k:void 0,annotationData:null==t?void 0:t.getData()}),ct&&"radial"===M&&e.createElement("div",{style:{position:"absolute",left:St.left+_t/2,top:St.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ct))}return e.createElement("div",{ref:Ot,className:"stream-ordinal-frame"+(at?" "+at:""),role:"group","aria-label":vt||("string"==typeof st?st:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":jt[0],height:B?"100%":jt[1],overflow:"visible"},onKeyDown:vn},mt&&e.createElement(Ke,{tableId:Bt}),mt&&e.createElement(Ye,{scene:null!==(h=null===(d=rn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:Bt,chartTitle:"string"==typeof st?st:void 0}),e.createElement(Qe,{summary:xt}),e.createElement("div",{role:"img","aria-label":vt||("string"==typeof st?st:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:tn?bn:void 0,onMouseLeave:tn?pn:void 0},Pt&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:jt[0],height:jt[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${St.left},${St.top})`},Pt)),e.createElement(Me,{width:_t,height:Et,totalWidth:jt[0],totalHeight:jt[1],margin:St,scales:Qt,showAxes:we,showGrid:Ge,rFormat:Ft,rTickValues:Le}),e.createElement("canvas",{ref:qt,"aria-label":De(null!==(p=null===(g=rn.current)||void 0===g?void 0:g.scene)&&void 0!==p?p:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:jt[0],height:jt[1]}}),e.createElement(Ue,{hoverPoint:Xt}),e.createElement(Te,{width:_t,height:Et,totalWidth:jt[0],totalHeight:jt[1],margin:St,scales:Qt,showAxes:we,showCategoryTicks:Ae,oLabel:$t,rLabel:Dt,oFormat:Nt,rFormat:Ft,showGrid:Ge,title:st,legend:Ve,legendHoverBehavior:Xe,legendClickBehavior:Ze,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,foregroundGraphics:Ct,annotations:We,svgAnnotationRules:qe,annotationFrame:Ut,xAccessor:"string"==typeof A?A:void 0,yAccessor:"string"==typeof k?k:void 0,annotationData:null===(y=rn.current)||void 0===y?void 0:y.getData(),underlayRendered:!0}),(yt||ft)&&"radial"!==M&&e.createElement(Be,{width:_t,height:Et,totalWidth:jt[0],totalHeight:jt[1],margin:St,scales:Qt,onBrush:ft||(()=>{})}),ct&&"radial"===M&&e.createElement("div",{style:{position:"absolute",left:St.left+_t/2,top:St.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ct),(null==pt?void 0:pt.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===pt.badgePosition?{top:4,left:4}:"bottom-left"===pt.badgePosition?{bottom:4,left:4}:"bottom-right"===pt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Jt?"#dc3545":"#28a745",color:"white"})},Jt?"STALE":"LIVE"),e.createElement(Je,{active:yn.current>=0,hoverPoint:Xt,margin:St,size:jt,shape:null===(f=fn.current)||void 0===f?void 0:f.shape,width:null===(m=fn.current)||void 0===m?void 0:m.w,height:null===(v=fn.current)||void 0===v?void 0:v.h}),An))});Vt.displayName="StreamOrdinalFrame";const Xt=r(null);function Yt(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 Qt(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Kt,Ut]=tt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Qt(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=Qt(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}})}})),[Zt,Jt]=tt(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}))}}));let en={positions:new Map};const tn=new Set;function nn(){for(const e of tn)e()}function on(e,t){const n=en.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(en.positions);o.delete(e),en={positions:o},nn()}function rn(e){const t=d(),o=e.clientId||t,{name:r}=e,i=Ut(e=>e.selections.get(r)),a=Ut(e=>e.setClause),l=Ut(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Yt(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:c,selectPoints:s(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:s(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:s(()=>{l(r,o)},[l,r,o]),clientId:o}}const sn=r(!1);function an({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):Z[i%Z.length];return{label:r+"",color:a}}),label:""}]}}function ln(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:.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}function cn(){var e;const t=ct(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}function un(e,t,n,o,r){if(e)return e;let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=K[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:"#007bff"}function dn(e,t,o){return n(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r="function"==typeof(i=o)?i:e=>e[i];var i;return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}e.createContext(void 0);const hn={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 gn(e,t,n){var o,r,i,s,a,l,c;const u=hn[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!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!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:pn(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function pn(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}const yn={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 fn(e,t){return"function"==typeof t?t(e):e[t]}function mn(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 vn(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=fn(t,o);a=mn(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=fn(t,o);l.push({label:n,value:mn(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=mn(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=mn(t[e[0]],r))}}const c=Object.assign(Object.assign({},yn),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function bn(t){if(!0===t)return vn();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:yn},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?vn(t):vn())}function xn(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function wn(e,t){return"function"==typeof t?t(e):e[t]}function An({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1,valueFormat:s}){return a=>{var l;const c=i?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=wn(c,t),d=wn(c,n),h=o?wn(c,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:yn},e.createElement("div",{style:{fontWeight:"bold"}},xn(u)),e.createElement("div",{style:{marginTop:4}},function(e,t){if(!t)return xn(e);try{const n=t(e);return null==n?xn(e):n}catch(t){return xn(e)}}(d,s)),null!=h&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||("string"==typeof(g=o)?g:"value"),": ",xn(h)));var g}}function kn({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.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}},o)))}class On extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(kn,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function jn(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Sn(e,t,n=3){let o,r=n+1;for(const n of t){const t=jn(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function _n(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function En(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=Sn(e,t,3))&&void 0!==n?n:null)}function Cn({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=_n(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=En(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Pn={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"}},Mn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Ln={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Tn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Bn=["vertical","horizontal"],In={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tn},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({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Mn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Tn},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({},Pn),Mn),{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({},Pn),Mn),{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({},Pn),Mn),{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({},Pn),Mn),{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({},Pn),Mn),{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({},Pn),Mn),{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({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{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:Bn},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},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({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Pn),Ln),{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({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},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({},Pn),Ln),{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({},Pn),Ln),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bn},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Pn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Pn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{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({},Pn),Ln),{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({},Pn),Ln),{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({},Pn),{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({},Pn),{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:Bn},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({},Pn),{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({},Pn),{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({},Pn),{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({},Pn),{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({},Pn),{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"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Pn),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},Pn),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Pn),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Hn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Rn=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),$n=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Dn=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Nn=new Set(["LineChart","AreaChart","StackedAreaChart"]),Fn=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function zn(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 Wn(e,t){const n=zn(e),o=zn(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const qn=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Gn(e,t){const n=[],o=function(e,t){const n=[],o=In[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(In).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(!Hn(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=Sn(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 s=Cn({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}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=_n(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=En(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 In[e]?(function(e,t,n){const o=In[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=In[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 s=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: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Rn.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){$n.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=In[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 s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" 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(!Dn.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,s=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.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."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=In[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(i.length,5);for(const e of s){let t=!0;for(let n=0;a>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(!Fn.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=Wn(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=Wn(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 qn)"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 Vn;const Xn="undefined"!=typeof process&&"production"!==(null===(Vn=process.env)||void 0===Vn?void 0:Vn.NODE_ENV);function Yn({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(On,{fallback:i=>{let s="";if(Xn&&r)try{const e=Gn(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(kn,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})}},i)}const Qn={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"},Kn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Un(e,t,n,o){if(!Xn)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 Zn(o){const{data:r,rawData:a,colorBy:c,colorScheme:u,legendInteraction:h,legendPosition:g,selection:p,linkedHover:y,fallbackFields:f,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:A,marginDefaults:k,onClick:O,hoverHighlight:j,loading:S,emptyContent:_,width:E,height:C}=o,P="string"==typeof o.colorBy?o.colorBy:void 0,{activeSelectionHook:M,hoverSelectionHook:L,customHoverBehavior:T,customClickBehavior:B,crosshairSourceId:I}=function({selection:e,linkedHover:o,fallbackFields:r=[],unwrapData:i=!1,onObservation:a,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:p}){const y=d(),f=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(o,r),m=rn({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=rn({name:t});return{onHover:s(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||r||[]}),b=Jt(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,A]=l(null),k=p||r[0],O=n(()=>{if(!g||null==w||!k)return null;const e=w,t=k;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[g,w,k]),j=s(e=>{var t,n;if(o)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=en.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(en={positions:new Map(en.positions).set(e,{xValue:t,sourceId:n})},nn())}(f.name||"hover",Number(e),y)}"x-position"!==(null==f?void 0:f.mode)&&v.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&on(f.name||"hover",y),"x-position"!==(null==f?void 0:f.mode)&&v.onHover(null);if(g&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[k];A(null!=n?n+"":null)}else A(null);if(a||b){const o={timestamp:Date.now(),chartType:c||"unknown",chartId:u};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});a&&a(i),b&&b(i)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});a&&a(e),b&&b(e)}}},[o,v,f,y,a,c,u,b,g,k]),S=s(e=>{var t,n,o,r;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[f.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=en.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(en.positions);return t.delete(e),en={positions:t},nn(),!1}en={positions:new Map(en.positions).set(e,{xValue:t,sourceId:n,locked:!0})},nn()}(f.name||"hover",Number(n),y)}if(e&&h){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),h(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(a||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=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});a&&a(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});a&&a(e),b&&b(e)}}},[h,a,b,c,u,f,y]);return t(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{!function(e,t){const n=en.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(en.positions);o.delete(e),en={positions:o},nn()}(e,y),on(e,y)}},[null==f?void 0:f.mode,null==f?void 0:f.name,y]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:j,customClickBehavior:S,crosshairSourceId:y}}({selection:p,linkedHover:y,fallbackFields:f,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:j,colorByField:P}),H=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(y,I),R=function(e,t,o){const r=i(Xt),s=cn();return n(()=>{var n;if(!t)return;const i=null!==(n=null!=o?o:s&&s.length>0?s:void 0)&&void 0!==n?n:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(r&&Object.keys(r).length>0){const e=te(n.map(e=>({_cat:e})),"_cat",i);return t=>r[t]||e(t)}return te(n.map(e=>({_cat:e})),"_cat",i)}if(r&&Object.keys(r).length>0){const n=te(e,t,i);return e=>r[e]||n(e)}return te(e,t,i)}if(r&&Object.keys(r).length>0){const e=te([{_:"a"}],"_",i);return t=>r[t]||e(t)}},[e,t,o,r,s])}(r,c,u),$=n(()=>{if(!c)return[];const e=new Set;for(const t of r){const n="function"==typeof c?c(t):t[c];null!=n&&e.add(n+"")}return Array.from(e)},[r,c]),D=function(e,t,o){const[r,i]=l(null),[a,c]=l(new Set),u=s(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=s(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,r,a]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}(h,c,$),N=n(()=>L||(D.legendSelectionHook?D.legendSelectionHook:M),[L,D.legendSelectionHook,M]),F=function(e){const t=ct(e=>e.theme.colors.selectionOpacity);return n(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(p),{legend:z,margin:W,legendPosition:q}=function({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:s="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=i(sn),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return an({data:e,colorBy:t,colorScale:o,getColor:ee,categories:c})},[d,t,e,o,c]),g=n(()=>{const e=Object.assign(Object.assign({},l),a);return h&&("right"===s&&110>e.right?e.right=110:"left"===s&&110>e.left?e.left=110:"top"===s&&50>e.top?e.top=50:"bottom"===s&&80>e.bottom&&(e.bottom=80)),e},[l,a,h,s]);return{legend:h,margin:g,legendPosition:s}}({data:r,colorBy:c,colorScale:R,showLegend:w,legendPosition:g,userMargin:A,defaults:k}),G=n(()=>{const e={};return z&&(e.legend=z,e.legendPosition=q),h&&"none"!==h&&(e.legendHoverBehavior=D.onLegendHover,e.legendClickBehavior=D.onLegendClick,e.legendHighlightedCategory=D.highlightedCategory,e.legendIsolatedCategories=D.isolatedCategories),e},[z,q,h,D.onLegendHover,D.onLegendClick,D.highlightedCategory,D.isolatedCategories]),V=function(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Kn),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}(S,E,C),X=V?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},Qn),{width:n,height:o})},r||"No data available"):null}(a,E,C,_);return{colorScale:R,allCategories:$,legendState:D,effectiveSelectionHook:N,activeSelectionHook:M,customHoverBehavior:T,customClickBehavior:B,legend:z,margin:W,legendPosition:q,earlyReturn:V||X||null,legendBehaviorProps:G,crosshairProps:H,resolvedSelection:F}}const Jn=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:E,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,showCategoryTicks:I,categoryFormat:H,dataIdAccessor:R}=t,$=i.width,D=i.height,N=i.enableHover,F=i.showGrid,z=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],Q=Zn({data:Y,rawData:a,colorBy:y,colorScheme:f,legendInteraction:L,legendPosition:T,selection:O,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:E,chartType:"BarChart",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:$,height:D});if(Q.earlyReturn)return Q.earlyReturn;Un("BarChart",Y,"categoryAccessor",d),Un("BarChart",Y,"valueAccessor",h);const K=dn(Y,m,h),U=cn(),Z=n(()=>new Map,[Y]),J=n(()=>(e,t)=>{const n={};return n.fill=y?ee(e,y,Q.colorScale):un(B,U,f,void 0,Z),n},[y,Q.colorScale,B,U,f,Z]),te=n(()=>{const e=null==k?void 0:k.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},J(t,n)),e(t,n)||{}):J},[J,k]),ne=n(()=>ln(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:y&&y!==d?y:void 0,groupLabel:"string"==typeof y?y:"group",valueFormat:p}),[d,h,y,p]),re=Cn({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(kn,{componentName:"BarChart",message:re,width:$,height:D});const ie=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({chartType:"bar"},null!=a&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[$,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:v}),null!=b&&{roundedTop:b}),R&&{dataIdAccessor:R}),{baselinePadding:x,enableHover:N,showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:p}),H&&{oFormat:H}),{showGrid:F,showCategoryTicks:I,oSort:m}),Q.legendBehaviorProps),z&&{title:z}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:bn(w)||oe}),(j||S||_||E)&&{customHoverBehavior:Q.customHoverBehavior}),(S||_||j)&&{customClickBehavior:Q.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"BarChart",width:$,height:D},e.createElement(Vt,Object.assign({ref:s},ie)))});function eo({isPushMode:e,colorBy:t,colorScheme:r,showLegend:i,legendPosition:a="right"}){const c=o(new Set),u=o([]),[d,h]=l(0),g=s(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),p=s(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,g]),y=s(e=>t=>{p([t]),e(t)},[p]),f=s(e=>t=>{p(t),e(t)},[p]),m=s(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!t||!1===i)return;const n=u.current;if(0===n.length)return;const o=Array.isArray(r)?r:Z,s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],o[e%o.length]);const a="string"==typeof t?t:"__streamCat";return an({data:n.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:ee})},[e,t,i,r,d]),b=n(()=>{if(v)return"right"===a?{right:110}:"left"===a?{left:110}:"top"===a?{top:50}:"bottom"===a?{bottom:80}:{right:110}},[v,a]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}function to({ref:e,frameRef:t,isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:l,setup:c}){const d=eo({isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:l}),h=s(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=s(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,r;return null!==(r=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==r?r:[]},clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:n(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:l||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,l]),effectiveMargin:n(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}Jn.displayName="BarChart";const no=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null),{data:a,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:A,annotations:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:E,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,categoryFormat:H}=t,R=i.width,$=i.height,D=i.enableHover,N=i.showGrid,F=i.showLegend,z=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],Q=y||d,K=void 0===a,U=Zn({data:Y,rawData:a,colorBy:Q,colorScheme:f,legendInteraction:T,legendPosition:B,selection:j,linkedHover:S,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:_,onClick:E,hoverHighlight:C,chartType:"StackedBarChart",chartId:P,showLegend:F,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:R,height:$});if(U.earlyReturn)return U.earlyReturn;const Z=cn(),J=n(()=>new Map,[Y]),te=n(()=>(e,t)=>Q?U.colorScale?{fill:ee(e,Q,U.colorScale)}:{}:{fill:un(I,Z,f,t,J)},[Q,U.colorScale,I,Z,f,J]),ne=n(()=>{const e=null==O?void 0:O.pieceStyle;return e&&"function"==typeof e?(t,n)=>{const o=te(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:te},[te,O]),oe=n(()=>ln(ne,U.effectiveSelectionHook,U.resolvedSelection),[ne,U.effectiveSelectionHook,U.resolvedSelection]),re=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),ie=Cn({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:se,effectiveMargin:ae}=to({ref:r,frameRef:s,isPushMode:K,colorBy:Q,colorScheme:f,showLegend:F,legendPosition:B,setup:U}),le=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({chartType:"bar"},null!=a&&{data:Y}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[R,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:D}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:p}),H&&{oFormat:H}),{showGrid:N}),se),z&&{title:z}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===A?()=>null:bn(A)||re}),(S||_||E||C)&&{customHoverBehavior:U.customHoverBehavior}),(_||E||S)&&{customClickBehavior:U.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ie?e.createElement(kn,{componentName:"StackedBarChart",message:ie,width:R,height:$}):e.createElement(Yn,{componentName:"StackedBarChart",width:R,height:$},e.createElement(Vt,Object.assign({ref:s},le)))});no.displayName="StackedBarChart";const oo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null),{data:a,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:E,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,categoryFormat:I}=t,H=i.width,R=i.height,$=i.enableHover,D=i.showGrid,N=i.showLegend,F=i.title,z=i.description,W=i.summary,q=i.accessibleTable,G=i.categoryLabel,V=i.valueLabel,X=a||[],Y=y||d,Q=void 0===a,K=Zn({data:X,rawData:a,colorBy:Y,colorScheme:f,legendInteraction:L,legendPosition:T,selection:O,linkedHover:j,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:E,chartType:"GroupedBarChart",chartId:C,showLegend:N,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:H,height:R});if(K.earlyReturn)return K.earlyReturn;const U=cn(),Z=n(()=>new Map,[X]),J=k.pieceStyle,te=n(()=>(e,t)=>{const n=Y?K.colorScale?{fill:ee(e,Y,K.colorScale)}:{}:{fill:un(B,U,f,t,Z)};if(J){const o=J(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Y,K.colorScale,B,U,f,Z,J]),ne=n(()=>ln(te,K.effectiveSelectionHook,K.resolvedSelection),[te,K.effectiveSelectionHook,K.resolvedSelection]),oe=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),re=Cn({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:ie,effectiveMargin:se}=to({ref:r,frameRef:s,isPushMode:Q,colorBy:Y,colorScheme:f,showLegend:N,legendPosition:T,setup:K}),ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:X}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:V,rFormat:p}),I&&{oFormat:I}),{showGrid:D}),ie),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:bn(w)||oe}),(j||S||_||E)&&{customHoverBehavior:K.customHoverBehavior}),(S||_||j)&&{customClickBehavior:K.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return re?e.createElement(kn,{componentName:"GroupedBarChart",message:re,width:H,height:R}):e.createElement(Yn,{componentName:"GroupedBarChart",width:H,height:R},e.createElement(Vt,Object.assign({ref:s},ae)))});function ro({brushProp:e,onBrushProp:t,linkedBrush:r,valueAccessor:i}){const a=(l="string"==typeof r?r:r?{name:r.name,xField:r.rField}:void 0)?"string"==typeof l?{name:l}:l:null;var l;const c=function(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:a,selectInterval:l,clear:c}=rn({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=s(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,o,r,l,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}({name:(null==a?void 0:a.name)||"__unused_ordinal_brush__",xField:(null==a?void 0:a.xField)||("string"==typeof i?i:"value")}),u=o(c.brushInteraction);u.current=c.brushInteraction;const d=s(e=>{if(a){u.current.end(e?e.r:null)}null==t||t(e)},[t,a]),h=!!(e||r||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}oo.displayName="GroupedBarChart";const io=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null),{data:a,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:p,colorBy:y,colorScheme:f,barPadding:m=40,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:E,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,categoryFormat:I,rTickValues:H,tickLabelEdgeAlign:R,showCategoryTicks:$}=t,D=i.width,N=i.height,F=i.enableHover,z=i.showGrid,W=i.showLegend,q=i.title,G=i.description,V=i.summary,X=i.accessibleTable,Y=i.categoryLabel,Q=i.valueLabel,K=a||[],U=y||d,Z=void 0===a,J=Zn({data:K,rawData:a,colorBy:U,colorScheme:f,legendInteraction:L,legendPosition:T,selection:O,linkedHover:j,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:E,chartType:"SwimlaneChart",chartId:C,showLegend:W,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:D,height:N}),te=ro({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(J.earlyReturn)return J.earlyReturn;const ne=cn(),oe=n(()=>new Map,[K]),re=k.pieceStyle,ie=n(()=>(e,t)=>{const n=U?J.colorScale?{fill:ee(e,U,J.colorScale)}:{}:{fill:un(B,ne,f,t,oe)};if(re){const o=re(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[U,J.colorScale,B,ne,f,oe,re]),se=n(()=>ln(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),ae=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:p}),[d,u,h,p]),le=Cn({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:ce,effectiveMargin:ue}=to({ref:r,frameRef:s,isPushMode:Z,colorBy:U,colorScheme:f,showLegend:W,legendPosition:T,setup:J}),de=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({chartType:"swimlane"},null!=a&&{data:K}),{oAccessor:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:se,size:[D,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue,barPadding:m,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===$?void 0:Y,rLabel:Q,rFormat:p}),H&&{rTickValues:H}),null!=R&&{tickLabelEdgeAlign:R}),I&&{oFormat:I}),void 0!==$&&{showCategoryTicks:$}),{showGrid:z}),ce),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===v?()=>null:bn(v)||ae}),(j||S||_||E)&&{customHoverBehavior:J.customHoverBehavior}),(S||_||j)&&{customClickBehavior:J.customClickBehavior}),b&&b.length>0&&{annotations:b}),te.brushStreamProps),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return le?e.createElement(kn,{componentName:"SwimlaneChart",message:le,width:D,height:N}):e.createElement(Yn,{componentName:"SwimlaneChart",width:D,height:N},e.createElement(Vt,Object.assign({ref:s},de)))});io.displayName="SwimlaneChart";const so=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:k,brush:O,onBrush:j,linkedBrush:S,frameProps:_={},selection:E,linkedHover:C,onObservation:P,onClick:M,hoverHighlight:L,chartId:T,loading:B,emptyContent:I,legendInteraction:H,legendPosition:R,color:$,showCategoryTicks:D,categoryFormat:N}=t,F=i.width,z=i.height,W=i.enableHover,q=i.showGrid,G=i.title,V=i.description,X=i.summary,Y=i.accessibleTable,Q=i.categoryLabel,K=i.valueLabel,U=a||[],Z=Zn({data:U,rawData:a,colorBy:y,colorScheme:f,legendInteraction:H,legendPosition:R,selection:E,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:M,hoverHighlight:L,chartType:"SwarmPlot",chartId:T,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:B,emptyContent:I,width:F,height:z}),J=ro({brushProp:O,onBrushProp:j,linkedBrush:S,valueAccessor:h});if(Z.earlyReturn)return Z.earlyReturn;const te=n(()=>{if(!m)return;const e=U.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[U,m]),ne=cn(),oe=n(()=>new Map,[U]),re=_.pieceStyle,ie=n(()=>(e,t)=>{const n={fillOpacity:x};if(n.fill=y?ee(e,y,Z.colorScale):un($,ne,f,void 0,oe),n.r=m?function(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,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}(e,m,v,te):b,re){const o=re(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[y,Z.colorScale,m,v,te,b,x,$,ne,f,oe,re]),se=n(()=>ln(ie,Z.effectiveSelectionHook,Z.resolvedSelection),[ie,Z.effectiveSelectionHook,Z.resolvedSelection]),ae=n(()=>An({categoryAccessor:d,valueAccessor:h,groupAccessor:y||void 0,valueFormat:p}),[d,h,y,p]),le=Cn({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return e.createElement(kn,{componentName:"SwarmPlot",message:le,width:F,height:z});const ce=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({chartType:"swarm"},null!=a&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:se,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,barPadding:w,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K,rFormat:p}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:D}),Z.legendBehaviorProps),G&&{title:G}),V&&{description:V}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===A?()=>null:bn(A)||ae}),(C||P||M||L)&&{customHoverBehavior:Z.customHoverBehavior}),(P||M||C)&&{customClickBehavior:Z.customClickBehavior}),k&&k.length>0&&{annotations:k}),J.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"SwarmPlot",width:F,height:z},e.createElement(Vt,Object.assign({ref:s},ce)))});function ao(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:yn},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=i.length,a=s>0?s%2!=0?i[Math.floor(s/2)]:(i[s/2-1]+i[s/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:yn},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),s>0&&e.createElement("div",null,"n = ",s),null!=a&&e.createElement("div",null,"Median: ",a.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:yn},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}so.displayName="SwarmPlot";const lo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:p,colorBy:y,colorScheme:f,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:_,loading:E,emptyContent:C,legendInteraction:P,legendPosition:M,color:L,showCategoryTicks:T,categoryFormat:B}=t,I=i.width,H=i.height,R=i.enableHover,$=i.showGrid,D=i.title,N=i.description,F=i.summary,z=i.accessibleTable,W=i.categoryLabel,q=i.valueLabel,G=a||[],V=Zn({data:G,rawData:a,colorBy:y,colorScheme:f,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"BoxPlot",chartId:_,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:E,emptyContent:C,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;const X=cn(),Y=n(()=>new Map,[G]),Q=n(()=>e=>{const t=y?ee(e,y,V.colorScale):un(L,X,f,void 0,Y);return{fill:t,stroke:t,fillOpacity:.8}},[y,V.colorScale,L,X,f,Y]),K=n(()=>ln(Q,V.effectiveSelectionHook,V.resolvedSelection),[Q,V.effectiveSelectionHook,V.resolvedSelection]),U=n(()=>ao(),[]),Z=Cn({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(Z)return e.createElement(kn,{componentName:"BoxPlot",message:Z,width:I,height:H});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:G}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:K,showOutliers:m,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V.margin,barPadding:v,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:W,rLabel:q,rFormat:p}),B&&{oFormat:B}),{showGrid:$,showCategoryTicks:T}),V.legendBehaviorProps),D&&{title:D}),N&&{description:N}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:bn(b)||U}),(k||O||j||S)&&{customHoverBehavior:V.customHoverBehavior}),(O||j||k)&&{customClickBehavior:V.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"BoxPlot",width:I,height:H},e.createElement(Vt,Object.assign({ref:s},J)))});lo.displayName="BoxPlot";const co=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:"horizontal"}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:p=!1,valueFormat:y,colorBy:f,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:w,onBrush:A,linkedBrush:k,frameProps:O={},selection:j,linkedHover:S,onObservation:_,onClick:E,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:T,legendPosition:B,color:I,showCategoryTicks:H,categoryFormat:R}=t,$=i.width,D=i.height,N=i.enableHover,F=i.showGrid,z=i.title,W=i.description,q=i.summary,G=i.accessibleTable,V=i.categoryLabel,X=i.valueLabel,Y=a||[],Q=Zn({data:Y,rawData:a,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:B,selection:j,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:_,onClick:E,hoverHighlight:C,chartType:"Histogram",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:$,height:D}),K=ro({brushProp:w,onBrushProp:A,linkedBrush:k,valueAccessor:h});if(Q.earlyReturn)return Q.earlyReturn;const U=n(()=>{if(0===Y.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of Y){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[Y,h]),Z=cn(),J=n(()=>new Map,[Y]),te=n(()=>e=>{const t=f?ee(e,f,Q.colorScale):un(I,Z,m,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[f,Q.colorScale,I,Z,m,J]),ne=n(()=>ln(te,Q.effectiveSelectionHook,Q.resolvedSelection),[te,Q.effectiveSelectionHook,Q.resolvedSelection]),oe=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:yn},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),re=Cn({componentName:"Histogram",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(kn,{componentName:"Histogram",message:re,width:$,height:D});const ie=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({chartType:"histogram"},null!=a&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:ne,bins:g,normalize:p}),U&&{rExtent:U}),{size:[$,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:v,enableHover:N}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:X,rFormat:y}),R&&{oFormat:R}),{showGrid:F,showCategoryTicks:H}),Q.legendBehaviorProps),z&&{title:z}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:bn(b)||oe}),(S||_||E||C)&&{customHoverBehavior:Q.customHoverBehavior}),(_||E||S)&&{customClickBehavior:Q.customClickBehavior}),x&&x.length>0&&{annotations:x}),K.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"Histogram",width:$,height:D},e.createElement(Vt,Object.assign({ref:s},ie)))});co.displayName="Histogram";const uo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:p=25,showIQR:y=!0,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,brush:A,onBrush:k,linkedBrush:O,frameProps:j={},selection:S,linkedHover:_,onObservation:E,onClick:C,hoverHighlight:P,chartId:M,loading:L,emptyContent:T,legendInteraction:B,legendPosition:I,color:H,showCategoryTicks:R,categoryFormat:$}=t,D=i.width,N=i.height,F=i.enableHover,z=i.showGrid,W=i.title,q=i.description,G=i.summary,V=i.accessibleTable,X=i.categoryLabel,Y=i.valueLabel,Q=a||[],K=Zn({data:Q,rawData:a,colorBy:m,colorScheme:v,legendInteraction:B,legendPosition:I,selection:S,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:E,onClick:C,hoverHighlight:P,chartType:"ViolinPlot",chartId:M,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:D,height:N}),U=ro({brushProp:A,onBrushProp:k,linkedBrush:O,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Z=cn(),J=n(()=>new Map,[Q]),te=n(()=>e=>{const t=m?ee(e,m,K.colorScale):un(H,Z,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.6}},[m,K.colorScale,H,Z,v,J]),ne=n(()=>ln(te,K.effectiveSelectionHook,K.resolvedSelection),[te,K.effectiveSelectionHook,K.resolvedSelection]),oe=n(()=>ao({valueAccessor:h}),[h]),re=Cn({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e.createElement(kn,{componentName:"ViolinPlot",message:re,width:D,height:N});const ie=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({chartType:"violin"},null!=a&&{data:Q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:ne,bins:p,showIQR:y,size:[D,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:b,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Y,rFormat:f}),$&&{oFormat:$}),{showGrid:z,showCategoryTicks:R}),K.legendBehaviorProps),W&&{title:W}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:bn(x)||oe}),(_||E||C||P)&&{customHoverBehavior:K.customHoverBehavior}),(E||C||_)&&{customClickBehavior:K.customClickBehavior}),w&&w.length>0&&{annotations:w}),U.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"ViolinPlot",width:D,height:N},e.createElement(Vt,Object.assign({ref:s},ie)))});uo.displayName="ViolinPlot";const ho=c(function(t,r){var i;const s=gn(t.mode,{width:t.width,height:t.height,showGrid:null===(i=t.showGrid)||void 0===i||i,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=o(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:p="horizontal",valueFormat:y,colorBy:f,colorScheme:m,sort:v="auto",dotRadius:b=5,categoryPadding:x=10,tooltip:w,annotations:A,frameProps:k={},selection:O,linkedHover:j,onObservation:S,onClick:_,hoverHighlight:E,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,color:B,categoryFormat:I}=t,H=s.width,R=s.height,$=s.enableHover,D=s.showGrid,N=s.title,F=s.description,z=s.summary,W=s.accessibleTable,q=s.categoryLabel,G=s.valueLabel,V=l||[],X=Zn({data:V,rawData:l,colorBy:f,colorScheme:m,legendInteraction:L,legendPosition:T,selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:S,onClick:_,hoverHighlight:E,chartType:"DotPlot",chartId:C,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:P,emptyContent:M,width:H,height:R});if(X.earlyReturn)return X.earlyReturn;const Y=dn(V,v,g),Q=cn(),K=n(()=>new Map,[V]),U=k.pieceStyle,Z=n(()=>(e,t)=>{const n={r:b,fillOpacity:.8};if(n.fill=f?ee(e,f,X.colorScale):un(B,Q,m,void 0,K),U){const o=U(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[f,X.colorScale,b,B,Q,m,K,U]),J=n(()=>ln(Z,X.effectiveSelectionHook,X.resolvedSelection),[Z,X.effectiveSelectionHook,X.resolvedSelection]),te=n(()=>An({categoryAccessor:h,valueAccessor:g,valueFormat:y}),[h,g,y]),ne=Cn({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(ne)return e.createElement(kn,{componentName:"DotPlot",message:ne,width:H,height:R});const oe=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({chartType:"point"},null!=l&&{data:Y}),{oAccessor:h,rAccessor:g,projection:"horizontal"===p?"horizontal":"vertical",pieceStyle:J,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X.margin,barPadding:x,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:s.showAxes,oLabel:q,rLabel:G,rFormat:y}),I&&{oFormat:I}),{showGrid:D,oSort:v}),X.legendBehaviorProps),N&&{title:N}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===w?()=>null:bn(w)||te}),(j||S||_||E)&&{customHoverBehavior:X.customHoverBehavior}),(S||_||j)&&{customClickBehavior:X.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"DotPlot",width:H,height:R},e.createElement(Vt,Object.assign({ref:a},oe)))});ho.displayName="DotPlot";const go=c(function(t,r){var i,s;const a=gn(t.mode,{width:null!==(i=t.width)&&void 0!==i?i:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=o(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:p,colorScheme:y,startAngle:f=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:O,hoverHighlight:j,chartId:S,loading:_,emptyContent:E,legendInteraction:C,legendPosition:P,color:M}=t,L=a.width,T=a.height,B=a.enableHover,I=a.showLegend,H=a.title,R=a.description,$=a.summary,D=a.accessibleTable,N=c||[],F=p||h,z=void 0===c,W=Zn({data:N,rawData:c,colorBy:F,colorScheme:y,legendInteraction:C,legendPosition:P,selection:w,linkedHover:A,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:k,onClick:O,hoverHighlight:j,chartType:"PieChart",chartId:S,showLegend:I,userMargin:u,marginDefaults:a.marginDefaults,loading:_,emptyContent:E,width:L,height:T});if(W.earlyReturn)return W.earlyReturn;const q=cn(),G=n(()=>new Map,[N]),V=n(()=>(e,t)=>F?W.colorScale?{fill:ee(e,F,W.colorScale)}:{}:{fill:un(M,q,y,t,G)},[F,W.colorScale,M,q,y,G]),X=n(()=>{const e=null==x?void 0:x.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},V(t,n)),e(t,n)||{}):V},[V,x]),Y=n(()=>ln(X,W.effectiveSelectionHook,W.resolvedSelection),[X,W.effectiveSelectionHook,W.resolvedSelection]),Q=n(()=>An({categoryAccessor:h,valueAccessor:g,groupAccessor:p&&p!==h?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[h,g,p]),K=Cn({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:U,effectiveMargin:Z}=to({ref:r,frameRef:l,isPushMode:z,colorBy:F,colorScheme:y,showLegend:I,legendPosition:P,setup:W}),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:N}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Y,startAngle:f}),null!=m&&{cornerRadius:m}),{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,enableHover:B}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),U),H&&{title:H}),R&&{description:R}),$&&{summary:$}),void 0!==D&&{accessibleTable:D}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===v?()=>null:bn(v)||Q}),(A||k||O||j)&&{customHoverBehavior:W.customHoverBehavior}),(k||O||A)&&{customClickBehavior:W.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e.createElement(kn,{componentName:"PieChart",message:K,width:L,height:T}):e.createElement(Yn,{componentName:"PieChart",width:L,height:T},e.createElement(Vt,Object.assign({ref:l},J)))});go.displayName="PieChart";const po=c(function(t,r){var i,s;const a=gn(t.mode,{width:null!==(i=t.width)&&void 0!==i?i:400,height:null!==(s=t.height)&&void 0!==s?s:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks}),l=o(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:p=60,centerContent:y,colorBy:f,colorScheme:m,startAngle:v=0,cornerRadius:b,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:E,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:T}=t,B=a.width,I=a.height,H=a.enableHover,R=a.showLegend,$=a.title,D=a.description,N=a.summary,F=a.accessibleTable,z=c||[],W=f||h,q=void 0===c,G=Zn({data:z,rawData:c,colorBy:W,colorScheme:m,legendInteraction:M,legendPosition:L,selection:k,linkedHover:O,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"DonutChart",chartId:E,showLegend:R,userMargin:u,marginDefaults:a.marginDefaults,loading:C,emptyContent:P,width:B,height:I});if(G.earlyReturn)return G.earlyReturn;const V=cn(),X=n(()=>new Map,[z]),Y=A.pieceStyle,Q=n(()=>(e,t)=>{let n;if(n=W?G.colorScale?{fill:ee(e,W,G.colorScale)}:{}:{fill:un(T,V,m,t,X)},Y){const o=Y(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[W,G.colorScale,T,V,m,X,Y]),K=n(()=>ln(Q,G.effectiveSelectionHook,G.resolvedSelection),[Q,G.effectiveSelectionHook,G.resolvedSelection]),U=n(()=>An({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),Z=Cn({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:J,effectiveMargin:te}=to({ref:r,frameRef:l,isPushMode:q,colorBy:W,colorScheme:m,showLegend:R,legendPosition:L,setup:G}),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({chartType:"donut"},null!=c&&{data:z}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:K,innerRadius:p,startAngle:v}),null!=b&&{cornerRadius:b}),{centerContent:y,size:[B,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,enableHover:H}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),$&&{title:$}),D&&{description:D}),N&&{summary:N}),void 0!==F&&{accessibleTable:F}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:bn(x)||U}),(O||j||S||_)&&{customHoverBehavior:G.customHoverBehavior}),(j||S||O)&&{customClickBehavior:G.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return Z?e.createElement(kn,{componentName:"DonutChart",message:Z,width:B,height:I}):e.createElement(Yn,{componentName:"DonutChart",width:B,height:I},e.createElement(Vt,Object.assign({ref:l},ne)))});po.displayName="DonutChart";const yo=c(function(t,r){var i,s,a;const l=gn(t.mode,{width:null!==(i=t.width)&&void 0!==i?i:300,height:null!==(s=t.height)&&void 0!==s?s:250,enableHover:null===(a=t.enableHover)||void 0===a||a,showLegend:!1,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),c=o(null),{value:u,min:d=0,max:h=100,thresholds:g,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!0,sweep:A=240,fillZones:k=!0,tooltip:O,annotations:j,frameProps:S={},className:_}=t,E=l.width,C=l.height,P=l.title,M=l.description,L=l.summary,T=l.accessibleTable,B=Math.max(d,Math.min(h,u)),I=h-d||1,H=(B-d)/I,{gaugeData:R,pieceStyle:$,gaugeAnnotations:D}=n(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:p||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(d,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let r=d;for(let n=0;o.length>n;n++){const i=o[n],s=(i.value-r)/I;if(k){const o=(r-d)/I,a=Math.max(0,Math.min(H,(i.value-d)/I)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:i.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:y,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}r=i.value}if(w&&g&&g.length>0)for(const e of g)e.value>d&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:y},gaugeAnnotations:n}},[u,d,h,g,p,y,H,I,w,k]),N=A*Math.PI/180,F=180+(360-A)/2,z=-Math.PI/2+F*Math.PI/180,W=[[Math.cos(z),Math.sin(z)],[Math.cos(z+N),Math.sin(z+N)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-z)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>N+.001||W.push([Math.cos(e),Math.sin(e)]);const q=Math.min(...W.map(e=>e[0])),G=Math.max(...W.map(e=>e[0])),V=Math.min(...W.map(e=>e[1])),X=Math.max(...W.map(e=>e[1])),Y=(V+X)/2,Q=(q+G)/2,K=Math.max(10,Math.min((E-20)/(G-q),(C-20)/(X-V))-4),U=Math.max(10,K*(1-f)),Z=E/2-Q*K,J=C/2-Y*K,ee=2*(K+4),te=n(()=>{if(null!=b)return"function"==typeof b?b(B,d,h):b;const t=x?x(B):Math.round(B)+"";return e.createElement("div",{style:{textAlign:"center",lineHeight:1.2}},e.createElement("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"}},t),w&&e.createElement("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"}},d," – ",h))},[b,B,d,h,x,w,K]),ne=n(()=>{if(!m)return null;const e=-Math.PI/2+F*Math.PI/180+H*N,t=U-8;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,H,F,N,U,v]),oe=n(()=>(t,n,o)=>{if("gauge-needle"===t.type)return e.createElement("g",{key:"gauge-needle-"+n,transform:`translate(${(o.width||E)/2},${(o.height||C)/2})`},e.createElement("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:2.5,strokeLinecap:"round"}),e.createElement("circle",{cx:0,cy:0,r:5,fill:t.color}));if("gauge-label"===t.type){const r=-Math.PI/2+F*Math.PI/180+(t.value-d)/I*N,i=U-14,s=(o.height||C)/2;return e.createElement("text",{key:"gauge-label-"+n,x:(o.width||E)/2+Math.cos(r)*i,y:s+Math.sin(r)*i,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label)}return null},[E,C,d,I,F,N,U]),re=n(()=>{const e=[...D,...j||[]];return ne&&e.push(ne),e},[D,j,ne]),ie=n(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,r=null==o?void 0:o._isFill;return e.createElement("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"}},e.createElement("div",{style:{fontWeight:600}},(null==o?void 0:o._zone)||""),e.createElement("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"}},r?"Current: "+Math.round(B):"Remaining"))},[B]);if(0===R.length)return e.createElement(kn,{componentName:"GaugeChart",message:"No data to display",width:E,height:C});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:R,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:$,innerRadius:U,startAngle:F,sweepAngle:A,centerContent:te,size:[E,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:{top:J-ee/2,bottom:C-J-ee/2,left:Z-ee/2,right:E-Z-ee/2},enableHover:l.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===O?()=>null:bn(O)||ie,svgAnnotationRules:oe},re.length>0&&{annotations:re}),P&&{title:P}),M&&{description:M}),L&&{summary:L}),void 0!==T&&{accessibleTable:T}),_&&{className:_}),null!=t.animate&&{animate:t.animate}),S);return e.createElement(Yn,{componentName:"GaugeChart",width:E,height:C},e.createElement(Vt,Object.assign({ref:c},se)))});yo.displayName="GaugeChart";const fo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:p=20,amplitude:y=1.5,valueFormat:f,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:E,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:T,showCategoryTicks:B,categoryFormat:I}=t,H=i.width,R=i.height,$=i.enableHover,D=i.showGrid,N=i.title,F=i.description,z=i.summary,W=i.accessibleTable,q=i.categoryLabel,G=i.valueLabel,V=a||[],X=Zn({data:V,rawData:a,colorBy:m,colorScheme:v,legendInteraction:M,legendPosition:L,selection:k,linkedHover:O,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"RidgelinePlot",chartId:E,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:H,height:R});if(X.earlyReturn)return X.earlyReturn;const Y=cn(),Q=n(()=>new Map,[V]),K=n(()=>e=>{const t=m?ee(e,m,X.colorScale):un(T,Y,v,void 0,Q);return{fill:t,stroke:t,fillOpacity:.5}},[m,X.colorScale,T,Y,v,Q]),U=n(()=>ln(K,X.effectiveSelectionHook,X.resolvedSelection),[K,X.effectiveSelectionHook,X.resolvedSelection]),Z=n(()=>ao(),[]),J=Cn({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:h}});if(J)return e.createElement(kn,{componentName:"RidgelinePlot",message:J,width:H,height:R});const te=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({chartType:"ridgeline"},null!=a&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:U,bins:p,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X.margin,barPadding:b,enableHover:$}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:G,rFormat:f}),I&&{oFormat:I}),{showGrid:D,showCategoryTicks:B,oSort:!1,amplitude:y}),X.legendBehaviorProps),N&&{title:N}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:bn(x)||Z}),(O||j||S||_)&&{customHoverBehavior:X.customHoverBehavior}),(j||S||O)&&{customClickBehavior:X.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"RidgelinePlot",width:H,height:R},e.createElement(Vt,Object.assign({ref:s},te)))});fo.displayName="RidgelinePlot";const mo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:!1,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:!1}),s=o(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const{data:a,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:p,colorScheme:y,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:k,onObservation:O,onClick:j,hoverHighlight:S,chartId:_,loading:E,emptyContent:C,legendInteraction:P,legendPosition:M,color:L,categoryFormat:T}=t,B="vertical"===f,I=i.width,H=i.height,R=i.enableHover,$=i.title,D=i.description,N=i.summary,F=i.accessibleTable,z=a||[],W=p||g,q=!W,G=Zn({data:z,rawData:a,colorBy:W,colorScheme:y,legendInteraction:P,legendPosition:M,selection:A,linkedHover:k,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:O,onClick:j,hoverHighlight:S,chartType:"FunnelChart",chartId:_,showLegend:i.showLegend,userMargin:l,marginDefaults:B?{top:$?60:40,right:20,bottom:60,left:60}:{top:$?40:10,right:10,bottom:10,left:10},loading:E,emptyContent:C,width:I,height:H});if(G.earlyReturn)return G.earlyReturn;Un("FunnelChart",z,"stepAccessor",d),Un("FunnelChart",z,"valueAccessor",h);const V=cn(),X=n(()=>new Map,[z]),Y=n(()=>{if(q)return L||((null==V?void 0:V[0])?V[0]:Array.isArray(y)&&y[0]?y[0]:"#4e79a7")},[q,L,V,y]),Q=w.pieceStyle,K=n(()=>(e,t)=>{const n={};if(n.fill=Y||(W?ee(e,W,G.colorScale):un(L,V,y,t,X)),Q){const o=Q(e,t);o.stroke&&(n.stroke=o.stroke),null!=o.strokeWidth&&(n.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(n.strokeOpacity=o.strokeOpacity)}return n},[Y,W,G.colorScale,L,V,y,X,Q]),U=n(()=>ln(K,G.effectiveSelectionHook,G.resolvedSelection),[K,G.effectiveSelectionHook,G.resolvedSelection]),Z=n(()=>t=>{var n,o,r,i,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,p=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,y=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:yn},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),p&&p!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},p+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",y))},[]),J=Cn({componentName:"FunnelChart",data:a,accessors:{stepAccessor:d,valueAccessor:h}});if(J)return e.createElement(kn,{componentName:"FunnelChart",message:J,width:I,height:H});const te=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({chartType:B?"bar-funnel":"funnel"},null!=a&&{data:z}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:U,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:B,showCategoryTicks:B}),T&&{oFormat:T}),{showGrid:B}),!B&&{connectorOpacity:m}),{showLabels:v}),G.legendBehaviorProps),$&&{title:$}),D&&{description:D}),N&&{summary:N}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?Z:bn(b)||Z}),(k||O||j||S)&&{customHoverBehavior:G.customHoverBehavior}),(O||j||k)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Yn,{componentName:"FunnelChart",width:I,height:H},e.createElement(Vt,Object.assign({ref:s},te)))});mo.displayName="FunnelChart";const vo="__likert_neutral_neg",bo="__likert_neutral_pos";function xo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function wo(e,t,n,o,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function Ao(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:vo,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:bo,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function ko(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===vo?i=n:n.__likertLevel===bo?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Oo=c(function(t,r){const i=gn(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=o(null),{data:l,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:p,countAccessor:y="count",levels:f,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:w,frameProps:A={},selection:k,linkedHover:O,onObservation:j,onClick:S,hoverHighlight:_,chartId:E,valueFormat:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:T,categoryFormat:B}=t,I=i.width,H=i.height,R=i.enableHover,$=i.showGrid,D=i.showLegend,N=i.title,F=i.description,z=i.summary,W=i.accessibleTable,q=i.categoryLabel,G=i.valueLabel,V="horizontal"===m,X=void 0===l,Y=!p,Q=n(()=>v&&Array.isArray(v)&&v.length>=f.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),s=[];for(let e=0;i>e;e++)s.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&s.push(o);for(let e=0;i>e;e++)s.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return s}(f.length),[v,f.length]),K=n(()=>{const e=new Map;for(let t=0;f.length>t;t++)e.set(f[t],Q[t]||"#888");return e},[f,Q]),{processedData:U,reAggregate:Z,accumulatorRef:J}=function({data:e,levels:t,categoryAccessor:r,valueAccessor:i,levelAccessor:a,countAccessor:l,isDiverging:c,frameRef:u}){const d=!a,h=n(()=>xo(r,"question"),[r]),g=n(()=>d?xo(i,"score"):null,[d,i]),p=n(()=>d?null:xo(a,"level"),[d,a]),y=n(()=>d?null:xo(l,"count"),[d,l]),f=e||[],m=o([]),v=n(()=>{if(0===f.length)return[];let e=wo(f,t,h,g,p,y);return c&&(e=Ao(e,t),e=ko(e,t)),e},[f,t,h,g,p,y,c]),b=s(e=>{var n;let o=wo(e,t,h,g,p,y);c&&(o=Ao(o,t),o=ko(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,p,y,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:l,levels:f,categoryAccessor:h,valueAccessor:g,levelAccessor:p,countAccessor:y,isDiverging:V,frameRef:a}),ee="__likertLevelLabel",te=eo({isPushMode:X,colorBy:ee,colorScheme:Q,showLegend:D,legendPosition:T}),ne=s(te.wrapPush(e=>{J.current.push(e),Z(J.current)}),[te.wrapPush,Z,J]),oe=s(te.wrapPushMany(e=>{J.current.push(...e),Z(J.current)}),[te.wrapPushMany,Z,J]);u(r,()=>({push:ne,pushMany:oe,remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;J.current=[],te.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ne,oe,te.resetCategories,J]);const re=Zn({data:U,rawData:l,colorBy:ee,colorScheme:Q,legendInteraction:L,legendPosition:T,selection:k,linkedHover:O,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:_,chartType:"LikertChart",chartId:E,showLegend:D,userMargin:c,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:I,height:H});if(re.earlyReturn)return re.earlyReturn;const ie=n(()=>{const e=f.length;return e%2!=0&&K.get(f[Math.floor(e/2)])||"#888"},[f,K]),se=A.pieceStyle,ae=n(()=>(e,t)=>{var n,o;const r=e.__likertLevelLabel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevelLabel),i=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);let s;if(i===vo||i===bo)s={fill:ie};else{const e=r||i;s=e&&K.has(e)?{fill:K.get(e)}:{fill:"#888"}}if(se){const n=se(e,t);n.stroke&&(s.stroke=n.stroke),null!=n.strokeWidth&&(s.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(s.strokeOpacity=n.strokeOpacity)}return s},[K,ie,se]),le=n(()=>ln(ae,re.effectiveSelectionHook,re.resolvedSelection),[ae,re.effectiveSelectionHook,re.resolvedSelection]),ce=n(()=>{const e=f.length;return e%2!=0?f[Math.floor(e/2)]:""},[f]),ue=n(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===vo||o===bo?ce:o,i=n.__likertCategory||"",s=Math.abs(n.__likertPct||0),a=o===vo||o===bo?2*s:s,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:yn},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${a.toFixed(1)}% (n=${l})`))},[ce]),de=n(()=>{if(!f||2>f.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&p)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(p&&!y)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==l&&0===l.length)return null;const e={categoryAccessor:h};return Y?g&&(e.valueAccessor=g):(p&&(e.levelAccessor=p),y&&(e.countAccessor=y)),Cn({componentName:"LikertChart",data:l,accessors:e,requiredProps:{levels:f}})},[l,h,g,p,y,f,Y]),he=n(()=>[{styleFn:e=>({fill:K.get(e.label)||"#888"}),items:f.map(e=>({label:e})),label:""}],[f,K]),ge=n(()=>!1!==D?Object.assign(Object.assign({},re.legendBehaviorProps),{legend:{legendGroups:he},legendPosition:T||re.legendPosition||"bottom"}):re.legendBehaviorProps,[re.legendBehaviorProps,re.legendPosition,T,D,he]),pe=n(()=>{const e=Object.assign({},re.margin);if(X&&!1!==D){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(te.streamingMarginAdjust)for(const[t,n]of Object.entries(te.streamingMarginAdjust))n>e[t]&&(e[t]=n);return V&&100>e.left&&(e.left=100),e},[re.margin,te.streamingMarginAdjust,V,X,D,T]),ye=n(()=>C||(V?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[V,C]),fe=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({chartType:"bar"},null!=l&&{data:U}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:V?"horizontal":"vertical",pieceStyle:le,size:[I,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe,barPadding:b,enableHover:R}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:G||(V?void 0:"Percentage"),rFormat:ye}),B&&{oFormat:B}),{showGrid:$}),ge),N&&{title:N}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),d&&{className:d}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===x?()=>null:!0===x?ue:bn(x)||ue}),(O||j||S||_)&&{customHoverBehavior:re.customHoverBehavior}),(j||S||O)&&{customClickBehavior:re.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return de?e.createElement(kn,{componentName:"LikertChart",message:de,width:I,height:H}):e.createElement(Yn,{componentName:"LikertChart",width:I,height:H},e.createElement(Vt,Object.assign({ref:a},fe)))});Oo.displayName="LikertChart";export{Jn as BarChart,lo as BoxPlot,po as DonutChart,ho as DotPlot,mo as FunnelChart,yo as GaugeChart,oo as GroupedBarChart,co as Histogram,Oo as LikertChart,go as PieChart,fo as RidgelinePlot,no as StackedBarChart,Vt as StreamOrdinalFrame,so as SwarmPlot,io as SwimlaneChart,uo as ViolinPlot,It as createHatchPattern};