semiotic 3.1.2 → 3.2.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.
- package/CLAUDE.md +134 -216
- package/LICENSE +197 -10
- package/README.md +1 -0
- package/ai/dist/componentRegistry.js +6 -0
- package/ai/dist/mcp-server.js +115 -5
- package/ai/examples.md +93 -0
- package/ai/schema.json +3916 -878
- package/ai/system-prompt.md +27 -0
- package/dist/components/ThemeProvider.d.ts +5 -3
- package/dist/components/charts/geo/ChoroplethMap.d.ts +1 -1
- package/dist/components/charts/index.d.ts +8 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +55 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/components/charts/shared/colorManipulation.d.ts +15 -0
- package/dist/components/charts/shared/formatUtils.d.ts +28 -0
- package/dist/components/charts/shared/hatchPattern.d.ts +35 -0
- package/dist/components/charts/shared/hooks.d.ts +16 -1
- package/dist/components/charts/shared/legendUtils.d.ts +2 -1
- package/dist/components/charts/shared/selectionUtils.d.ts +11 -0
- package/dist/components/charts/shared/statisticalOverlays.d.ts +49 -5
- package/dist/components/charts/shared/types.d.ts +4 -1
- package/dist/components/charts/xy/Heatmap.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +71 -0
- package/dist/components/realtime/types.d.ts +2 -0
- package/dist/components/semiotic-ai.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-themes.d.ts +64 -0
- package/dist/components/semiotic-xy.d.ts +1 -0
- package/dist/components/semiotic.d.ts +11 -5
- package/dist/components/store/ThemeStore.d.ts +22 -2
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +1 -0
- package/dist/components/stream/PipelineStore.d.ts +2 -0
- package/dist/components/stream/SVGOverlay.d.ts +5 -3
- package/dist/components/stream/accessorUtils.d.ts +14 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +27 -0
- package/dist/components/stream/ordinalSceneBuilders/funnelScene.d.ts +26 -0
- package/dist/components/stream/ordinalTypes.d.ts +16 -2
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +12 -0
- package/dist/components/stream/renderers/trapezoidCanvasRenderer.d.ts +15 -0
- package/dist/components/stream/sceneUtils.d.ts +10 -0
- package/dist/components/stream/types.d.ts +10 -3
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +1 -0
- package/dist/semiotic-ai.d.ts +3 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-ordinal.d.ts +3 -0
- package/dist/semiotic-statisticalOverlays-D8LhSbQt.js +1 -0
- package/dist/semiotic-themes.d.ts +64 -0
- package/dist/semiotic-themes.min.js +1 -0
- package/dist/semiotic-themes.module.min.js +1 -0
- package/dist/semiotic-xy.d.ts +1 -0
- package/dist/semiotic.d.ts +11 -5
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +1 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +24 -5
- package/dist/semiotic-ai-statisticalOverlays-C1f7TYyD.js +0 -1
- package/dist/semiotic-statisticalOverlays-C1f7TYyD.js +0 -1
- package/dist/xy-statisticalOverlays-C1f7TYyD.js +0 -1
package/dist/ordinal.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-scale-chromatic"),o=require("d3-array"),r=require("d3-hierarchy"),i=require("d3-shape"),a=require("regression");function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const c=l(e),u=s(a);class d{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 h{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}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 y(e,t,n){return e+(t-e)*n}function p(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function m(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const f={category10:n.schemeCategory10,tableau10:n.schemeTableau10,set3:n.schemeSet3,blues:n.interpolateBlues,reds:n.interpolateReds,greens:n.interpolateGreens,oranges:n.interpolateOranges,purples:n.interpolatePurples,viridis:n.interpolateViridis,plasma:n.interpolatePlasma},v=n.schemeCategory10,b=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],x=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 w(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")||x.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):v[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+""))%v.length]}function A(e,n,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[n]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(r).range(o).unknown("#999");const a=f[o]||f.category10;if(i&&"function"==typeof a){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>a(Number(t)/e)}{const e=Array.isArray(a)?a:v;return t.scaleOrdinal().domain(r).range(e).unknown("#999")}}function k(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function S(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function O(e){var t,n,r;const i=e.length,a=e[0],s=e[i-1];return{n:i,min:a,q1:null!==(t=o.quantile(e,.25))&&void 0!==t?t:a,median:null!==(n=o.quantile(e,.5))&&void 0!==n?n:(a+s)/2,q3:null!==(r=o.quantile(e,.75))&&void 0!==r?r:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}const j={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const[i,c]of t){let t=c.total;g&&n>0&&(t/=n);const y=s(c.pieces[0],a?i:e.name),p=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),a=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(k(e.x,n,e.width,Math.abs(a),y,p,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),a=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(k(n,e.x,Math.abs(a),e.width,y,p,i)),0>t?r+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,l=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let i=0;d.length>i;i++){const h=l.get(d[i])||[];for(const l of h){const h=r(l),g=a(l,d[i]);if(u){const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(k(r,Math.min(a,u),o,Math.abs(a-u),g,l,d[i]))}else{const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(k(Math.min(a,u),r,Math.abs(u-a),o,g,l,d[i]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,y=s.length>0,p=2*Math.PI,m=-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:a(t),u=y&&s[r]||c,f=l(t,e.name),v=f.r||5;let b,x;if(g){const t=m+(e.pctStart+e.pct/2)*p,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:f,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),y=c?a(s):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:S,donut:S,boxplot:function(e,t){var n,r,i,a,s;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:y}=l,p=[],m="vertical"===y,f=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(n=o.quantile(t,.25))&&void 0!==n?n:l,y=null!==(r=o.quantile(t,.5))&&void 0!==r?r:(l+c)/2,v=null!==(i=o.quantile(t,.75))&&void 0!==i?i:c,b=v-u,x=u-1.5*b,w=v+1.5*b,A=null!==(a=t.find(e=>e>=x))&&void 0!==a?a:l,k=null!==(s=[...t].reverse().find(e=>w>=e))&&void 0!==s?s:c,S=h(e.pieceData[0],e.name),O=[];if(f)for(const t of e.pieceData){const n=d(t);if(x>n||n>w){const o=m?e.middle:g(n),r=m?g(n):e.middle;O.push({px:o,py:r,value:n,datum:t})}}if(p.push({type:"boxplot",x:m?e.middle:0,y:m?0:e.middle,projection:m?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(A),q1Pos:g(u),medianPos:g(y),q3Pos:g(v),maxPos:g(k),stats:{n:t.length,min:A,q1:u,median:y,q3:v,max:k,mean:t.reduce((e,t)=>e+t,0)/t.length},style:S,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:S.fill||"#999",opacity:.6},datum:e.datum})}return p},violin:function(e,t){var n,r,i;const{scales:a,columns:s,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=a,g=[],y="vertical"===h,p=l.bins||20,m=!1!==l.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const a=t[0],s=t[t.length-1],l=(s-a)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-a)/l),p-1)]++;const f=Math.max(...h,1),v=e.width/2*.9;let b="";if(y){for(let t=0;p>t;t++){const n=d(a+(t+.5)*l),o=h[t]/f*v;b+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=p-1;t>=0;t--){const n=d(a+(t+.5)*l);b+=` L ${e.middle-h[t]/f*v} ${n}`}b+=" Z"}else{for(let t=0;p>t;t++){const n=d(a+(t+.5)*l),o=h[t]/f*v;b+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=p-1;t>=0;t--)b+=` L ${d(a+(t+.5)*l)} ${e.middle+h[t]/f*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(m&&t.length>=4){const l=null!==(n=o.quantile(t,.25))&&void 0!==n?n:a,c=null!==(r=o.quantile(t,.5))&&void 0!==r?r:(a+s)/2,u=null!==(i=o.quantile(t,.75))&&void 0!==i?i:s;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:y}}const A=y?{x:e.x,y:Math.min(d(s),d(a)),width:e.width,height:Math.abs(d(s)-d(a))}:{x:Math.min(d(a),d(s)),y:e.x,width:Math.abs(d(s)-d(a)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:A,iqrLine:w,stats:O(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),g=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,a=s(n+t*o),c=s(n+(t+1)*o);l.push(k(Math.min(a,c),e.x+e.width-i,Math.abs(c-a),i,g,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=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=>a(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)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),p=s(e.pieceData[0],e.name),m=e.width*g;let f="";if(h){const t=e.x+e.width;f=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)f+=` L ${l(o+(e+.5)*i)} ${t-c[e]/y*m}`;f+=` L ${l(r)} ${t} Z`}else{const t=e.x;f=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);f+=` L ${t+c[e]/y*m} ${n}`}f+=` 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:f,translateX:0,translateY:0,bounds:v,stats:O(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.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:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(k(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(k(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class E{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.config=e,this.buffer=new h(e.windowSize),this.getO=m(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>p(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new g)):(this.getR=p(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=m(e.stackBy),this.getGroup=m(e.groupBy),this.getColor=m(e.colorAccessor),this.getConnector=m(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new h(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:n,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const r=o.toArray(),i=n.projection||"vertical",a=n.oExtent||this.resolveCategories(r),s=this.computeValueDomain(r,a),l="horizontal"===i,c=null!=n.barPadding?n.barPadding/("vertical"===i?e.width:e.height):.1;let u,d;if("radial"===i){u=t.scaleBand().domain(a).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=n.innerRadius||0;d=t.scaleLinear().domain(s).range([r,o])}else l?(u=t.scaleBand().domain(a).range([0,e.height]).padding(c),d=t.scaleLinear().domain(s).range([0,e.width])):(u=t.scaleBand().domain(a).range([0,e.width]).padding(c),d=t.scaleLinear().domain(s).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((r,i)=>{const a=this.rExtents[i];a.dirty&&a.recalculate(o,r);let[s,c]=a.extent;s===1/0&&(s=0,c=1);const u=c-s,d=u>0?u*(n.extentPadding||.05):1;return s-=d,c+=d,s>0&&(s=0),l?t.scaleLinear().domain([s,c]).range([0,e.width]):t.scaleLinear().domain([s,c]).range([e.height,0])}):[];let h=r;this.rAccessors.length>1&&(h=r.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,a,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),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=[];for(const e of t)n.has(e)?o.push(e):this.categories.delete(e);return o}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;const r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let a=0,s=0;if("bar"===r&&this.getStack&&this.config.normalize)a=0,s=1;else if("bar"===r&&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>s&&(s=e);for(const e of n.values())a>e&&(a=e)}else if("bar"===r){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>s&&(s=e),a>e&&(a=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>s&&(s=e),a>e&&(a=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(a=e),t!==-1/0&&(s=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(s=this.config.rExtent[1]));const l=s-a,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(a-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(s+=c),"bar"!==r&&"clusterbar"!==r||(a>0&&(a=0),0>s&&(s=0)),[a,s]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.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=s.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=s.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()),a[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 a}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=j[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[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};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(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:b,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){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 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 a=this.computeDecayOpacity(e,r),s=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:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=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],s=this.config.oAccessor;if(("function"==typeof s?s(r):r[s||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=s);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;a>r&&(n._pulseIntensity=1-r/a,n._pulseColor=s,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,a,s,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 y=new Set,p=new Map;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeKey(s,p);if(!l)continue;s._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===s.type?c?(y.add(l),s._targetOpacity=null!==(t=s.style.opacity)&&void 0!==t?t:1,c.x===s.x&&c.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=c.x,s.y=c.y,g=!0)):(s._targetOpacity=null!==(n=s.style.opacity)&&void 0!==n?n:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0):"rect"===s.type&&(c?(y.add(l),s._targetOpacity=null!==(o=s.style.opacity)&&void 0!==o?o:1,c.x===s.x&&c.y===s.y&&c.w===s.w&&c.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,g=!0)):(s._targetOpacity=null!==(a=s.style.opacity)&&void 0!==a?a:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)y.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(s=t.r)&&void 0!==s?s: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=y(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=y(o.x,e._targetX,i),e.y=y(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=y(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=y(n.x,e._targetX,i),e.y=y(n.y,e._targetY,i),void 0!==n.w&&(e.w=y(n.w,e._targetW,i),e.h=y(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()}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){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function M(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function P(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 C(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function L(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=M(Math.atan2(r,o)),s=M(e.startAngle),l=M(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function B(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 H(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}const R={fill:e=>c.createElement("rect",{style:e,width:16,height:16}),line:e=>c.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function D(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,R[n])(o(e,t)),r}function _(){return c.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function N(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function $({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+c.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),u=[];for(let e=0;64>=e;e++){const t=e/64;u.push(c.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return c.createElement("g",{"aria-label":i||"Gradient legend"},c.createElement("defs",null,c.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),i&&c.createElement("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),c.createElement("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),c.createElement("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])),c.createElement("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])))}const u=[];for(let e=0;64>=e;e++){const t=e/64;u.push(c.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return c.createElement("g",{"aria-label":i||"Gradient legend"},i&&c.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),c.createElement("defs",null,c.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),c.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),c.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[1])),c.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},s(r[0])))}function z(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:u=20,orientation:d="vertical"}=e,[h,g]=c.useState(0),[y,p]=c.useState(0),m=c.useCallback((e,t)=>{g(e),p(t)},[]),f="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:u})=>{let d=24;const h=[];return e.forEach((e,g)=>{d+=5,h.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:t,y2:d})),d+=8,e.label&&(d+=16,h.push(c.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),d+=8),h.push(c.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((e,t,n,o,r,i,a,s,l,u)=>{const{type:d="fill",styleFn:h,items:g}=e,y=[];let p=0;const m=!(!t&&!n),f="isolate"===u||void 0===u&&null!=r;return g.forEach((e,u)=>{const v=D(e,u,d,h),b=N(e,o,r),x=r&&r.size>0&&r.has(e.label);y.push(c.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?s===i&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&f?x||!1:void 0,"aria-current":m&&!f&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(u+("ArrowDown"===n.key?1:-1)+g.length)%g.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(s,u),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},m&&c.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&c.createElement(_,null),c.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),p+=22}),y})(e,n,o,r,i,a,s,g,l,u))),d+=22*e.items.length+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:a}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];e.forEach((e,t)=>{let n=0;e.label&&(n+=16);const y=((e,t,n,o,r,i,a,s,l,u)=>{const{type:d="fill",styleFn:h,items:g}=e,y=[];let p=0;const m=!(!t&&!n),f="isolate"===u||void 0===u&&null!=r;return g.forEach((e,u)=>{const v=D(e,u,d,h),b=N(e,o,r),x=r&&r.size>0&&r.has(e.label);y.push(c.createElement("g",{key:"legend-item-"+u,transform:`translate(${p},0)`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?s===i&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&f?x||!1:void 0,"aria-current":m&&!f&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(u+("ArrowRight"===n.key?1:-1)+g.length)%g.length;l(s,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(s,u),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},m&&c.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&c.createElement(_,null),c.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),p+=26+7*e.label.length}),{items:y,offset:p}})(e,o,r,i,a,s,l,t,u,d);n+=y.offset+5,g.push(Object.assign(Object.assign({label:e.label},y),{offset:n})),h+=n+12});let y=Math.max(0,(n-h)/2);const p=[];return g.forEach((n,o)=>{const r=e[o];r.label&&(p.push(c.createElement("text",{key:"legend-text-"+o,transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),y+=16),p.push(c.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${y},0)`},n.items)),y+=n.offset+5,e[o+1]&&p.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:y,y1:-8,x2:y,y2:t+0+8})),y+=12}),c.createElement("g",null,p)})({legendGroups:t||[],title:s,height:u,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:a}),v=!(!n&&!o);return c.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend"},void 0!==s&&""!==s&&"vertical"===d&&c.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},s),f)}function I(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function W(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 T(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,connector:l,subject:u,type:d,color:h,className:g,disable:y,events:p={},"data-testid":m}=e,f=new Set(Array.isArray(y)?y:[]);let v=o||0,b=r||0;null!=i&&(v=i-t),null!=a&&(b=a-n);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 c.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":m},p),!f.has("connector")&&function(e,t,n,o,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;s=r+a*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);s=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-s,2)+Math.pow(t-l,2))>.5&&(a.push(c.createElement("line",{key:"connector-line",x1:s,y1:l,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-s);a.push(c.createElement("path",{key:"connector-arrow",d:`M${s},${l}L${s+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${s+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"currentColor",stroke:"none"}))}return c.createElement("g",{className:"annotation-connector"},a)}(v,b,l,h,x,u),!f.has("subject")&&function(e,t,n,o,r){var i;const a=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&a.push(c.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&a.push(c.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&a.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;a.push(c.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;a.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?a.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||a.push(c.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&a.push(c.createElement("path",{key:"bracket-path",d:W((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return c.createElement("g",{className:"annotation-subject"},a)}(x,u,h,t,n),!f.has("note")&&function(e,t,n,o){if(!e)return c.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:u}=e;if(!r&&!i)return c.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=s;h&&"dynamic"!==h||(h="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>t?"end":"start";const y=16,p=i?u?[i]:I(i,l):[],m=r?u?[r]:I(r,l):[],f="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];p.length>0&&(b.push(c.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:g,fontWeight:"bold"},p.map((e,t)=>c.createElement("tspan",{key:t,x:f,dy:0===t?0:y},e)))),v=p.length*y),m.length>0&&b.push(c.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:g,y:v},m.map((e,t)=>c.createElement("tspan",{key:t,x:f,dy:0===t?0:y},e))));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(l,120);let t=0,n=e;"end"===g?(t=-e,n=0):"middle"===g&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(p.length+m.length)*y+(m.length>0?y:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const w=Math.max(0,p.length+m.length-1)*y;let A=0;return"topBottom"===d?A=0>n?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+y+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),c.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},c.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),x)}(s,v,b,h))}function q(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",a=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),a=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),s=r.map((t,n)=>{const r=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:a});return c.createElement(T,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return c.createElement("g",null,s)}const s=o.note||{title:"none",label:o.label};return c.createElement(T,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${o.i}`,events:a},o,{type:i}))}const F={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};function G(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function V(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function X(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],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=G(e,n),c=V(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Y(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Q(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:a,scales:s,showAxes:l,showGrid:u,rFormat:d}=t,h="radial"===(null==s?void 0:s.projection),g="horizontal"===(null==s?void 0:s.projection),y=e.useMemo(()=>!s||h?[]:s.r.ticks(5).map(e=>({value:e,pixel:s.r(e),label:(d||K)(e)})),[s,d,h]),p=u&&s&&!h,m=l&&s&&!h;return p||m?c.createElement("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},c.createElement("g",{transform:`translate(${a.left},${a.top})`},p&&c.createElement("g",{className:"ordinal-grid"},y.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:g?e.pixel:0,y1:g?0:e.pixel,x2:g?e.pixel:n,y2:g?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&c.createElement(c.Fragment,null,g?c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function K(e){return Math.round(100*e)/100+""}function Z(t){var n,o;const{width:a,height:s,totalWidth:l,totalHeight:d,margin:h,scales:g,showAxes:y,oLabel:p,rLabel:m,oFormat:f,rFormat:v,showGrid:b,title:x,legend:w,legendHoverBehavior:A,legendClickBehavior:k,legendHighlightedCategory:S,legendIsolatedCategories:O,legendPosition:j="right",foregroundGraphics:E,annotations:M,svgAnnotationRules:P,xAccessor:C,yAccessor:L,annotationData:B,underlayRendered:H,children:R}=t,D="radial"===(null==g?void 0:g.projection),_="horizontal"===(null==g?void 0:g.projection),N=e.useMemo(()=>y&&g&&!D?g.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2,label:f?f(e):e}}):[],[y,g,f,D]),I=e.useMemo(()=>y&&g&&!D?g.r.ticks(5).map(e=>({value:e,pixel:g.r(e),label:(v||K)(e)})):[],[y,g,v,D]),W=e.useRef(new Map),T=e.useRef(null!==(n=null==M?void 0:M.length)&&void 0!==n?n:0),Q=null!==(o=null==M?void 0:M.length)&&void 0!==o?o:0;T.current!==Q&&(T.current=Q,W.current=new Map);const Z=e.useMemo(()=>{if(!M||0===M.length)return null;const e=function(e,t,n){var o,a,s,l,d,h,g,y,p,m,f,v,b,x,w,A,k,S,O,j,E,M,P,C,L,B,H,R,D,_,N,$,z,I,W,T,Q,K,Z,U,J,ee,te,ne;switch(e.type){case"label":{const o=X(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Y(r,i,n)?c.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=X(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Y(r,i,n)?c.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=G(e,n);if(null==o)return null;const r=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:o+4,y:12,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=V(e,n);if(null==o)return null;const r=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:G(Object.assign(Object.assign({},e),{type:"point"}),n),y:V(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=r.packEnclose(o),a=e.padding||10;return c.createElement("g",{key:"ann-"+t},c.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:G(Object.assign(Object.assign({},e),{type:"point"}),n),y:V(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),s=Math.min(...i)-r,l=Math.max(...i)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:s,y:u,width:l-s,height:d-u,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:(s+l)/2,y:u-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i=e.style||{stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return c.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=G(t,n),a=V(t,n);return null==r||null==a?null:c.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:a,r:e.r||6},i))}))}case"bracket":{const o=G(e,n),r=V(e,n);return c.createElement(q,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const r=n.data||[];if(2>r.length)return null;const i=n.xAccessor||"x",y=n.yAccessor||"y",p=r.map(e=>[e[i],e[y]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const m=null!==(a=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==a?a:null===(s=n.scales)||void 0===s?void 0:s.time,f=null!==(d=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==d?d:null===(h=n.scales)||void 0===h?void 0:h.value;if(!m||!f)return null;const v=e.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,y=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],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*y-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(p,null!==(g=e.bandwidth)&&void 0!==g?g:.3):("polynomial"===v?u.default.polynomial(p,{order:e.order||2}):u.default.linear(p)).points;const x=b.map(([e,t])=>`${m(e)},${f(t)}`).join(" "),w=e.color||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:m(b[b.length-1][0])+4,y:f(b[b.length-1][1])-4,fill:w,fontSize:11},e.label))}case"band":{const o=null!==(p=null===(y=n.scales)||void 0===y?void 0:y.y)&&void 0!==p?p:null===(m=n.scales)||void 0===m?void 0:m.value,r=null!==(f=null==o?void 0:o(e.y0))&&void 0!==f?f:0,i=null!==(v=null==o?void 0:o(e.y1))&&void 0!==v?v:n.height||0;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity||.1}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"#6366f1",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(b=n.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(w=n.scales)||void 0===w?void 0:w.time,s=null!==(k=null===(A=n.scales)||void 0===A?void 0:A.y)&&void 0!==k?k:null===(S=n.scales)||void 0===S?void 0:S.value;if(!a||!s)return null;const l=e.upperAccessor||"upperBounds",u=e.lowerAccessor||"lowerBounds",d=e.filter,h=o.filter(e=>null!=e[l]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=F[n.curve||"linear"]||i.curveLinear,y=i.area().x(e=>a(e[r])).y0(e=>s(e[u])).y1(e=>s(e[l])).curve(g)(h);if(!y)return null;const p=e.fill||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:y,fill:p,fillOpacity:null!==(O=e.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),e.label&&h.length>0&&c.createElement("text",{x:a(h[h.length-1][r])+4,y:s(h[h.length-1][l])-4,fill:p,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(E=null===(j=n.scales)||void 0===j?void 0:j.x)&&void 0!==E?E:null===(M=n.scales)||void 0===M?void 0:M.time,a=null!==(C=null===(P=n.scales)||void 0===P?void 0:P.y)&&void 0!==C?C:null===(L=n.scales)||void 0===L?void 0:L.value;if(!i||!a)return null;const s=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,u=s.reduce((e,t)=>e+Math.pow(t-l,2),0)/s.length,d=Math.sqrt(u),h=null!==(B=e.threshold)&&void 0!==B?B:2,g=l-h*d,y=!1!==e.showBand,p=e.fill||"#6366f1",m=null!==(H=e.fillOpacity)&&void 0!==H?H:.1,f=e.anomalyColor||"#ef4444",v=null!==(R=e.anomalyRadius)&&void 0!==R?R:6,b=a(l+h*d),x=a(g),w=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*d});return c.createElement("g",{key:"ann-"+t},y&&c.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:m}),w.map((e,t)=>{const o=G(e,n),r=V(e,n);return null==o||null==r?null:c.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:v,fill:f,fillOpacity:.7,stroke:f,strokeWidth:1.5})}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a=null!==(_=null===(D=n.scales)||void 0===D?void 0:D.x)&&void 0!==_?_:null===(N=n.scales)||void 0===N?void 0:N.time,s=null!==(z=null===($=n.scales)||void 0===$?void 0:$.y)&&void 0!==z?z:null===(I=n.scales)||void 0===I?void 0:I.value;if(!a||!s)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let d;if("polynomial"===(e.method||"linear")){const t=u.default.polynomial(l,{order:e.order||2}).equation;d=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;d=e=>s+a*e}const h=l.length,g=l.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),y=Math.sqrt(g/Math.max(h-2,1)),p=l.reduce((e,t)=>e+t[0],0)/h,m=l.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==(W=e.confidence)&&void 0!==W?W:.95,v=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,b=null!==(T=e.steps)&&void 0!==T?T:5,x=l[h-1][0],w=(x-l[0][0])/Math.max(h-1,1),A=[];for(let e=1;b>=e;e++)A.push(x+e*w);const k=[];for(const e of A){const t=d(e),n=y*Math.sqrt(1+1/h+(m>0?Math.pow(e-p,2)/m:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,O=k.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),j=`${a(x)},${s(d(x))}`,E=e.strokeColor||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:null!==(Q=e.fillOpacity)&&void 0!==Q?Q:.15,stroke:"none"}),c.createElement("polyline",{points:`${j} ${O}`,fill:"none",stroke:E,strokeWidth:null!==(K=e.strokeWidth)&&void 0!==K?K:2,strokeDasharray:null!==(Z=e.strokeDasharray)&&void 0!==Z?Z:"6,3"}),e.label&&k.length>0&&c.createElement("text",{x:a(k[k.length-1].x)+4,y:s(k[k.length-1].yCenter)-4,fill:E,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=X(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!Y(o,r,n))return null;const i=null!==(U=e.dx)&&void 0!==U?U:0,a=null!==(J=e.dy)&&void 0!==J?J:0,s=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,u=null!==(ne=e.content)&&void 0!==ne?ne:c.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return c.createElement("foreignObject",{key:"ann-"+t,x:o+i-s/2,y:r+a-l/2,width:s,height:l,style:{overflow:"visible",pointerEvents:"auto"}},c.createElement("div",{style:{width:s,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const o=X(e,t,n);if(!o)return null;const{x:r,y:i}=o;return c.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}default:return null}},t="horizontal"===(null==g?void 0:g.projection),n=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,o={scales:g?{x:t?g.r:n||g.r,y:t&&n||g.r,time:g.r,value:g.r}:null,timeAxis:"x",xAccessor:C,yAccessor:L,width:a,height:s,data:B,frameType:"ordinal",stickyPositionCache:W.current};return M.map((t,n)=>{if(P){const r=P(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[M,P,a,s,g,C,L,B]);return y||x||w||E||Z&&Z.length>0||b||R?c.createElement("svg",{role:"img",width:l,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},c.createElement("title",null,"string"==typeof x?x:"Ordinal Chart"),c.createElement("desc",null,"string"==typeof x?x+" — ordinal data visualization":"Ordinal data visualization"),c.createElement("g",{transform:`translate(${h.left},${h.top})`},b&&g&&!D&&!H&&c.createElement("g",{className:"ordinal-grid"},I.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:_?e.pixel:0,y1:_?0:e.pixel,x2:_?e.pixel:a,y2:_?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),y&&g&&!D&&c.createElement("g",{className:"ordinal-axes"},_?c.createElement(c.Fragment,null,!H&&c.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),p&&c.createElement("text",{x:15-h.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${s/2})`,style:{userSelect:"none"}},p),!H&&c.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${s})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&c.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},m)):c.createElement(c.Fragment,null,!H&&c.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${s})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),p&&c.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p),!H&&c.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&c.createElement("text",{x:15-h.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${s/2})`,style:{userSelect:"none"}},m))),Z,E,R),x&&c.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof x?x:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",title:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const g="top"===i||"bottom"===i;let y,p;return"left"===i?(y=4,p=r.top):"top"===i?(y=0,p=a?32:8):"bottom"===i?(y=0,p=o-r.bottom+50):(y=n-r.right+10,p=r.top),c.createElement("g",{transform:`translate(${y}, ${p})`},"object"==typeof(m=t)&&null!==m&&"gradient"in m?c.createElement($,{config:t.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?c.createElement(z,{legendGroups:t.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:s,customClickBehavior:l,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t);var m}({legend:w,totalWidth:l,totalHeight:d,margin:h,legendPosition:j,title:x,legendHoverBehavior:A,legendClickBehavior:k,legendHighlightedCategory:S,legendIsolatedCategories:O})):null}const U="undefined"==typeof window||"undefined"==typeof document,J={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ee(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"},i=["point","line","area","rect","heatcell","circle","candlestick"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function te({scene:e,chartType:t}){var n,o,r,i;const a=[];for(const t of e){if(a.length>=50)break;"point"===t.type?a.push({label:"Point",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+""}}):"rect"===t.type?a.push({label:"Bar",values:{category:(null===(n=t.datum)||void 0===n?void 0:n.category)||"",value:Math.round(100*(null!==(r=null===(o=t.datum)||void 0===o?void 0:o.value)&&void 0!==r?r:0))/100+""}}):"heatcell"===t.type&&a.push({label:"Cell",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+"",value:Math.round(100*(null!==(i=t.value)&&void 0!==i?i:0))/100+""}})}if(0===a.length)return null;const s=new Set;for(const e of a)for(const t of Object.keys(e.values))s.add(t);const l=Array.from(s);return c.createElement("table",{style:J,role:"table","aria-label":"Data table for "+t},c.createElement("thead",null,c.createElement("tr",null,l.map(e=>c.createElement("th",{key:e},e)))),c.createElement("tbody",null,a.map((e,t)=>c.createElement("tr",{key:t},l.map(t=>{var n;return c.createElement("td",{key:t},null!==(n=e.values[t])&&void 0!==n?n:"")}))),e.length>50&&c.createElement("tr",null,c.createElement("td",{colSpan:l.length},"...and ",e.length-50," more items"))))}function ne({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return c.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:J},t)}function oe(t){const n=e.createContext(null),o=re(t);return[function({children:o}){const r=e.useMemo(()=>re(t),[]);return c.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,a=e.useRef(t);a.current=t;const s=e.useCallback(()=>a.current(i.getState()),[i]),l=e.useCallback(()=>a.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,s,l)}]}function re(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 ie={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},ae={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[se,le]=oe(e=>({theme:ie,setTheme(t){e(e=>"light"===t?{theme:ie}:"dark"===t?{theme:ae}:{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 ce(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ue(e,t,n=.3){ce(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 de(e,t,n=.6){var o,r,i,a,s;if(!ce(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function he(e,t,n,o=.35){ce(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const ge=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?ye(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),ue(e,t),e.globalAlpha=1};function ye(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}const pe=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);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=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),de(e,t),e.globalAlpha=1}}finally{e.restore()}};function me(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()}const fe=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)me(e,t),e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0&&(me(e,t),he(e,t)),e.globalAlpha=1},ve=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){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=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=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()}},be=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){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=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}},xe=e=>[be,...e],we={bar:xe([ge]),clusterbar:xe([ge]),point:xe([pe]),swarm:xe([pe]),pie:[fe],donut:[fe],boxplot:xe([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=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=s,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=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},pe]),violin:xe([ve]),histogram:xe([ge]),ridgeline:xe([ve]),timeline:xe([ge])},Ae={top:50,right:40,bottom:60,left:70},ke={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 Se({hover:e}){var t,n,o,r,i,a;const s=e.data||{},l=e.stats,u=e.category;if(Array.isArray(s)){const e=u||(null===(t=s[0])||void 0===t?void 0:t.category)||"";if(l)return c.createElement("div",{className:"semiotic-tooltip",style:ke},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,"n = ",l.n),c.createElement("div",null,"Min: ",l.min.toLocaleString()),c.createElement("div",null,"Q1: ",l.q1.toLocaleString()),c.createElement("div",null,"Median: ",l.median.toLocaleString()),c.createElement("div",null,"Q3: ",l.q3.toLocaleString()),c.createElement("div",null,"Max: ",l.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",l.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=s.length;return c.createElement("div",{className:"semiotic-tooltip",style:ke},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,n," items"))}if(null!=s.bin&&null!=s.count){const e=s.range||[];return c.createElement("div",{className:"semiotic-tooltip",style:ke},s.category&&c.createElement("div",{style:{fontWeight:"bold"}},s.category+""),c.createElement("div",null,"Count: ",s.count),2===e.length&&c.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const d=e.__oAccessor,h=e.__rAccessor,g=e.__chartType;if("swarm"===g||"point"===g){const e=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:ke},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}const y=(d&&null!=s[d]?s[d]:null)||s.category||s.name||s.group||s.__rName||"",p=null!==(a=null!==(i=null!==(r=null!==(o=null!==(n=s.__aggregateValue)&&void 0!==n?n:h&&null!=s[h]?s[h]:null)&&void 0!==o?o:s.value)&&void 0!==r?r:s.__rValue)&&void 0!==i?i:s.pct)&&void 0!==a?a:"";if(!y&&""===p){const e=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:ke},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return c.createElement("div",{className:"semiotic-tooltip",style:ke},y&&c.createElement("div",{style:{fontWeight:"bold"}},y+""),""!==p&&c.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const Oe=e.forwardRef(function(t,n){var o,r,a,s,l,u,h;const{chartType:g,runtimeMode:y,data:p,oAccessor:m="category",rAccessor:f="value",colorAccessor:v,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:A,valueAccessor:k,categoryAccessor:S,projection:O="vertical",size:j=[600,400],responsiveWidth:M,responsiveHeight:R,margin:D,barPadding:_,innerRadius:N,normalize:$,startAngle:z,dynamicColumnWidth:I,bins:W,showOutliers:T,showIQR:q,amplitude:F,connectorAccessor:G,connectorStyle:V,rExtent:X,oExtent:Y,extentPadding:K=.05,oSort:J,windowMode:oe="sliding",windowSize:re=200,pieceStyle:ie,summaryStyle:ae,colorScheme:se,barColors:ce,showAxes:ue=!0,oLabel:de,rLabel:he,oFormat:ge,rFormat:ye,enableHover:pe=!0,hoverAnnotation:me,tooltipContent:fe,customHoverBehavior:ve,annotations:be,svgAnnotationRules:xe,showGrid:ke=!1,legend:Oe,legendHoverBehavior:je,legendClickBehavior:Ee,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:Ce,backgroundGraphics:Le,foregroundGraphics:Be,title:He,className:Re,background:De,centerContent:_e,decay:Ne,pulse:$e,transition:ze,staleness:Ie,accessibleTable:We}=t,[Te,qe]=function(t,n,o){const r=e.useRef(null),[i,a]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(j,M,R),Fe=e.useMemo(()=>Object.assign(Object.assign({},Ae),D),[D]),Ge=qe[0]-Fe.left-Fe.right,Ve=qe[1]-Fe.top-Fe.bottom,Xe="function"==typeof Be?Be({size:qe,margin:Fe}):Be,Ye=e.useRef(null),Qe=e.useRef(!0),Ke=le(e=>e.theme),Ze=e.useRef(0),Ue=e.useRef(null),Je=e.useRef(()=>{}),[et,tt]=e.useState(null),[nt,ot]=e.useState(null),[rt,it]=e.useState(0),[at,st]=e.useState(!1),lt=pe||me,ct="streaming"===y,ut=e.useMemo(()=>({chartType:g,runtimeMode:ct?"streaming":"bounded",windowSize:re,windowMode:oe,extentPadding:K,projection:O,oAccessor:ct?void 0:m,rAccessor:ct?void 0:f,colorAccessor:v,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:ct?A:void 0,valueAccessor:ct?k||("string"==typeof f||"function"==typeof f?f:void 0):void 0,categoryAccessor:ct?S||m:void 0,rExtent:X,oExtent:Y,barPadding:_,innerRadius:N,normalize:$,startAngle:z,dynamicColumnWidth:I,bins:W,showOutliers:T,showIQR:q,amplitude:F,connectorAccessor:G,connectorStyle:V,oSort:J,pieceStyle:ie,summaryStyle:ae,colorScheme:se,barColors:ce,decay:Ne,pulse:$e,transition:ze,staleness:Ie}),[g,re,oe,K,O,m,f,v,b,x,w,A,k,S,X,Y,_,N,$,z,I,W,T,q,F,G,V,J,ie,ae,se,ce,Ne,$e,ze,Ie,ct]),dt=e.useRef(null);dt.current||(dt.current=new E(ut));const ht=e.useCallback(()=>{Ze.current||(Ze.current=requestAnimationFrame(()=>Je.current()))},[]);e.useEffect(()=>{var e;null===(e=dt.current)||void 0===e||e.updateConfig(ut),Qe.current=!0,ht()},[ut,ht]),e.useEffect(()=>{Qe.current=!0,ht()},[Ke,ht]);const gt=e.useRef(null);gt.current||(gt.current=new d(e=>{const t=dt.current;t&&t.ingest(e)&&(Qe.current=!0,ht())}));const yt=e.useCallback(e=>{var t;null===(t=gt.current)||void 0===t||t.push(e)},[]),pt=e.useCallback(e=>{var t;null===(t=gt.current)||void 0===t||t.pushMany(e)},[]),mt=e.useCallback(()=>{var e,t;null===(e=gt.current)||void 0===e||e.clear(),null===(t=dt.current)||void 0===t||t.clear(),Qe.current=!0,ht()},[ht]);e.useImperativeHandle(n,()=>({push:yt,pushMany:pt,clear:mt,getData:()=>{var e,t,n;return null===(e=gt.current)||void 0===e||e.flush(),null!==(n=null===(t=dt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[yt,pt,mt]),e.useEffect(()=>{var e;p&&(null===(e=gt.current)||void 0===e||e.setBoundedData(p))},[p]);const ft=e.useRef(()=>{}),vt=e.useRef(()=>{});ft.current=e=>{if(!lt)return;const t=Ye.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Fe.left,r=e.clientY-n.top-Fe.top;if(0>o||o>Ge||0>r||r>Ve)return void(Ue.current&&(Ue.current=null,tt(null),ve&&ve(null),ht()));const i=dt.current;if(!i||0===i.scene.length)return;const a="radial"===O,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=P(i,t,n);break;case"point":e=C(i,t,n);break;case"wedge":e=L(i,t,n);break;case"boxplot":e=B(i,t,n);break;case"violin":e=H(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-Ge/2:o,a?r-Ve/2:r);if(!s)return void(Ue.current&&(Ue.current=null,tt(null),ve&&ve(null),ht()));const l=s.datum||{},c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{data:l,time:s.x,value:s.y,x:s.x,y:s.y}),s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof m?m:void 0,__rAccessor:"string"==typeof f?f:void 0,__chartType:g});Ue.current=c,tt(c),ve&&(ve(c),Qe.current=!0),ht()},vt.current=()=>{Ue.current&&(Ue.current=null,tt(null),ve&&(ve(null),Qe.current=!0),ht())},e.useCallback(e=>ft.current(e),[]);const bt=e.useCallback(()=>vt.current(),[]),xt=e.useRef(-1),wt=e.useCallback(e=>{const t=dt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x)t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum});else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum});else if("wedge"===n.type&&null!=n.cx){const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=xt.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return xt.current=-1,Ue.current=null,tt(null),ve&&ve(null),void ht();const i=0>o?0:r;xt.current=i;const a=Object.assign(Object.assign({},function(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}(n[i])),{__oAccessor:"string"==typeof m?m:void 0,__rAccessor:"string"==typeof f?f:void 0,__chartType:g});Ue.current=a,tt(a),ve&&ve(a),ht()},[ve,ht]),At=e.useCallback(e=>{xt.current=-1,ft.current(e)},[]);Je.current=()=>{var e,t;Ze.current=0;const n=Ye.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=dt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=Qe.current;s&&!a&&(r.computeScene({width:Ge,height:Ve}),Qe.current=!1),(s||a)&&n.setAttribute("aria-label",ee(r.scene,g+" chart"));const l="undefined"!=typeof window&&window.devicePixelRatio||1,c=qe[0]*l,u=qe[1]*l;n.width===c&&n.height===u||(n.width=c,n.height=u,n.style.width=qe[0]+"px",n.style.height=qe[1]+"px"),o.setTransform(l,0,0,l,0,0),o.clearRect(0,0,qe[0],qe[1]);const d=null!==(e=null==Ie?void 0:Ie.threshold)&&void 0!==e?e:5e3,h=Ie&&r.lastIngestTime>0&&i-r.lastIngestTime>d;h&&(o.globalAlpha=null!==(t=null==Ie?void 0:Ie.dimOpacity)&&void 0!==t?t:.5);const y=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",p=De||(y&&"transparent"!==y?y:null);p&&(o.fillStyle=p,o.fillRect(0,0,qe[0],qe[1]));const m="radial"===O;m?(o.save(),o.translate(Fe.left+Ge/2,Fe.top+Ve/2)):o.translate(Fe.left,Fe.top);const f=we[g]||[],v={width:Ge,height:Ve};for(const e of f)e(o,r.scene,r.scales,v);m&&o.restore(),h&&(o.globalAlpha=1),s&&r.scales&&(ot(r.scales),it(e=>e+1)),(null==Ie?void 0:Ie.showBadge)&&st(!!h),(a||r.hasActivePulses)&&(Ze.current=requestAnimationFrame(()=>Je.current()))},e.useEffect(()=>(ht(),()=>{Ze.current&&(cancelAnimationFrame(Ze.current),Ze.current=0)}),[ht]),e.useEffect(()=>{Qe.current=!0,ht()},[g,Ge,Ve,ue,De,ht]),function(t,n,o,r,i,a){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const s=n.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(Ie,dt,Qe,ht,at,st);const kt=lt&&et?fe?fe(et):c.createElement(Se,{hover:et}):null,St="radial"===O,Ot=et?St?et.x+Ge/2:et.x:0,jt=et?St?et.y+Ve/2:et.y:0,Et=kt?c.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:Fe.left+Ot,top:Fe.top+jt,transform:`translate(${Ot>.7*Ge?"calc(-100% - 12px)":"12px"}, ${.3*Ve>jt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},kt):null;if(U){const e=dt.current;e&&p&&(e.ingest({inserts:p,bounded:!0}),e.computeScene({width:Ge,height:Ve}));const t=null!==(o=null==e?void 0:e.scene)&&void 0!==o?o:[],n=null!==(r=null==e?void 0:e.scales)&&void 0!==r?r:null,a="radial"===O,s=a?Fe.left+Ge/2:Fe.left,l=a?Fe.top+Ve/2:Fe.top;return c.createElement("div",{className:"stream-ordinal-frame"+(Re?" "+Re:""),role:"img","aria-label":"string"==typeof He?He:"Ordinal chart",style:{position:"relative",width:qe[0],height:qe[1]}},c.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:qe[0],height:qe[1],style:{position:"absolute",left:0,top:0}},Le&&c.createElement("g",{transform:`translate(${Fe.left},${Fe.top})`},Le),c.createElement("g",{transform:`translate(${s},${l})`},De&&c.createElement("rect",{x:0,y:0,width:Ge,height:Ve,fill:De}),t.map((e,t)=>function(e,t){var n,o,r,a,s;const l=e.category||e.group||"",u=n=>`ord-${e.type}-${l}-${t}-${n}`,d=`ord-${e.type}-${l}-${t}`;switch(e.type){case"rect":return c.createElement("rect",{key:d,x:e.x,y:e.y,width:e.w,height:e.h,fill:e.style.fill||"#4e79a7",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth});case"point":return c.createElement("circle",{key:d,cx:e.x,cy:e.y,r:e.r,fill:e.style.fill||"#4e79a7",opacity:null!==(n=e.style.opacity)&&void 0!==n?n:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth});case"wedge":{const t=e,n=i.arc().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle).endAngle(t.endAngle)({})||"";return c.createElement("path",{key:d,d:n,transform:`translate(${t.cx},${t.cy})`,fill:t.style.fill||"#4e79a7",stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity})}case"boxplot":{const t=e,n=t.columnWidth/2;return"vertical"===t.projection?c.createElement("g",{key:d},c.createElement("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:t.style.fill||"#4e79a7",fillOpacity:null!==(o=t.style.fillOpacity)&&void 0!==o?o:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})):c.createElement("g",{key:d},c.createElement("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:t.style.fill||"#4e79a7",fillOpacity:null!==(r=t.style.fillOpacity)&&void 0!==r?r:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}))}case"violin":{const t=e,n=[c.createElement("path",{key:u("path"),d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:t.style.fill||"#4e79a7",fillOpacity:null!==(a=t.style.fillOpacity)&&void 0!==a?a:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1})];if(t.iqrLine&&t.bounds){const e=t.bounds,o=e.x+e.width/2,r=e.y+e.height/2;e.height>e.width?n.push(c.createElement("line",{key:u("iqr"),x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:u("med"),cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1})):n.push(c.createElement("line",{key:u("iqr"),x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:u("med"),cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1}))}return c.createElement("g",{key:d},n)}case"connector":return c.createElement("line",{key:d,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:null!==(s=e.style.opacity)&&void 0!==s?s:.5});default:return null}}(e,t)).filter(Boolean))),c.createElement(Z,{width:Ge,height:Ve,totalWidth:qe[0],totalHeight:qe[1],margin:Fe,scales:n,showAxes:ue,oLabel:de,rLabel:he,oFormat:ge,rFormat:ye,showGrid:ke,title:He,legend:Oe,legendHoverBehavior:je,legendClickBehavior:Ee,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:Ce,foregroundGraphics:Xe,annotations:be,svgAnnotationRules:xe,annotationFrame:0,xAccessor:"string"==typeof m?m:void 0,yAccessor:"string"==typeof f?f:void 0,annotationData:null==e?void 0:e.getData()}),_e&&"radial"===O&&c.createElement("div",{style:{position:"absolute",left:Fe.left+Ge/2,top:Fe.top+Ve/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},_e))}return c.createElement("div",{ref:Te,className:"stream-ordinal-frame"+(Re?" "+Re:""),role:"img","aria-label":"string"==typeof He?He:"Ordinal chart",tabIndex:0,style:{position:"relative",width:M?"100%":qe[0],height:R?"100%":qe[1],overflow:"visible"},onMouseMove:lt?At:void 0,onMouseLeave:lt?bt:void 0,onKeyDown:wt},Le&&c.createElement("svg",{style:{position:"absolute",top:0,left:0,width:qe[0],height:qe[1],pointerEvents:"none"}},c.createElement("g",{transform:`translate(${Fe.left},${Fe.top})`},Le)),c.createElement(Q,{width:Ge,height:Ve,totalWidth:qe[0],totalHeight:qe[1],margin:Fe,scales:nt,showAxes:ue,showGrid:ke,rFormat:ye}),c.createElement("canvas",{ref:Ye,"aria-label":ee(null!==(s=null===(a=dt.current)||void 0===a?void 0:a.scene)&&void 0!==s?s:[],g+" chart"),style:{position:"absolute",top:0,left:0,width:qe[0],height:qe[1]}}),c.createElement(ne,{hoverPoint:et}),We&&c.createElement(te,{scene:null!==(u=null===(l=dt.current)||void 0===l?void 0:l.scene)&&void 0!==u?u:[],chartType:g+" chart"}),c.createElement(Z,{width:Ge,height:Ve,totalWidth:qe[0],totalHeight:qe[1],margin:Fe,scales:nt,showAxes:ue,oLabel:de,rLabel:he,oFormat:ge,rFormat:ye,showGrid:ke,title:He,legend:Oe,legendHoverBehavior:je,legendClickBehavior:Ee,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:Ce,foregroundGraphics:Xe,annotations:be,svgAnnotationRules:xe,annotationFrame:rt,xAccessor:"string"==typeof m?m:void 0,yAccessor:"string"==typeof f?f:void 0,annotationData:null===(h=dt.current)||void 0===h?void 0:h.getData(),underlayRendered:!0}),_e&&"radial"===O&&c.createElement("div",{style:{position:"absolute",left:Fe.left+Ge/2,top:Fe.top+Ve/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},_e),(null==Ie?void 0:Ie.showBadge)&&c.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ie.badgePosition?{top:4,left:4}:"bottom-left"===Ie.badgePosition?{bottom:4,left:4}:"bottom-right"===Ie.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:at?"#dc3545":"#28a745",color:"white"})},at?"STALE":"LIVE"),Et)});Oe.displayName="StreamOrdinalFrame";const je=e.createContext(null);function Ee(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 Me(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Pe,Ce]=oe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Me(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=Me(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}})}})),[Le,Be]=oe(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function He(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=Ce(e=>e.selections.get(r)),a=Ce(e=>e.setClause),s=Ce(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Ee(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:e.useCallback(()=>{s(r,o)},[s,r,o]),clientId:o}}const Re=e.createContext(!1);function De({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){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:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}}),label:""}]}}function _e(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}const Ne="#007bff";function $e(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const r="function"==typeof(i=o)?i:e=>e[i];var i;return e.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[t,n,o])}const ze={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 Ie(e,t,n){var o,r,i,a,s,l;const c=ze[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}const We={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Te(e,t){return"function"==typeof t?t(e):e[t]}function qe(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":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 Fe(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=Te(e,n);a=qe(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=Te(e,r);s.push({label:n,value:qe(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=qe(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=qe(e[t[0]],o))}}const l=Object.assign(Object.assign({},We),r);return c.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},a&&c.createElement("div",{style:{fontWeight:s.length>0?"bold":"normal"}},a),s.map((e,t)=>c.createElement("div",{key:t,style:{marginTop:0===t&&a?"4px":0}},e.label&&c.createElement("span",null,e.label,": "),e.value)))}}function Ge(e){if(!0===e)return Fe();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:c.createElement("div",{className:"semiotic-tooltip",style:We},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Fe(e):Fe())}function Ve(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Xe(e,t){return"function"==typeof t?t(e):e[t]}function Ye({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:r=!1}){return i=>{var a;const s=r?(null===(a=i.data)||void 0===a?void 0:a[0])||i.data||i:i.data||i,l=Xe(s,e),u=Xe(s,t),d=n?Xe(s,n):void 0;return c.createElement("div",{className:"semiotic-tooltip",style:We},c.createElement("div",{style:{fontWeight:"bold"}},Ve(l)),c.createElement("div",{style:{marginTop:4}},Ve(u)),null!=d&&c.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(h=n)?h:"value"),": ",Ve(d)));var h}}function Qe({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return c.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},c.createElement("div",{style:{textAlign:"center",maxWidth:400}},c.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),c.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&c.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class Ke extends c.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:c.createElement(Qe,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Ze(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Ue(e,t,n=3){let o,r=n+1;for(const n of t){const t=Ze(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Je(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function et(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=Ue(e,t,3))&&void 0!==n?n:null)}function tt({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=Je(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=et(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const nt={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"]},frameProps:{type:"object"}},ot={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},rt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},it=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],at=["vertical","horizontal"],st={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:it},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({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:it},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:it},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({},nt),ot),{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({},nt),ot),{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({},nt),ot),{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({},nt),ot),{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"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),ot),{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({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},nt),rt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:at},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},nt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},nt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},nt),{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({},nt),{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:at},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({},nt),{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({},nt),{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({},nt),{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({},nt),{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({},nt),{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"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function lt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const ct=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),ut=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),dt=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),ht=new Set(["LineChart","AreaChart","StackedAreaChart"]),gt=new Set(["BarChart","StackedBarChart","GroupedBarChart"]);function yt(e,t){const n=[],o=function(e,t){const n=[],o=st[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(st).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(!lt(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=Ue(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=tt({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=Je(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=et(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 st[e]?(function(e,t,n){const o=st[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=st[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){ct.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){ut.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=st[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!dt.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(!ht.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=st[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!gt.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),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var pt;const mt="undefined"!=typeof process&&"production"!==(null===(pt=process.env)||void 0===pt?void 0:pt.NODE_ENV);function ft({componentName:e,width:t,height:n,chartProps:o,children:r}){return c.createElement(Ke,{fallback:r=>{let i="";if(mt&&o)try{const t=yt(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return c.createElement(Qe,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const vt={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"},bt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function xt(e,t,n,o){if(!mt)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 wt(t){const{data:n,rawData:o,colorBy:r,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:y,chartId:p,showLegend:m,userMargin:f,marginDefaults:v,loading:b,emptyContent:x,width:k,height:S}=t,{activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:E}=function({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:a,chartId:s}){const l=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}:null}(n,o),c=He({name:(null==t?void 0:t.name)||"__unused__"}),u=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:a,clear:s}=He({name:n});return{onHover:e.useCallback(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&a(t)},[o,a,s,n]),predicate:r,isActive:i}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||o||[]}),d=Be(e=>e.pushObservation),h=t?{isActive:c.isActive,predicate:c.predicate}:null,g=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(i||d){const n={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),d&&d(e)}}},[n,u,i,a,s,d]),y=e.useCallback(e=>{var t,n;if(i||d){const o={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});i&&i(e),d&&d(e)}}},[i,d,a,s]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:y}}({selection:l,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:y,chartId:p}),M=function(t,n,o="category10"){const r=e.useContext(je);return e.useMemo(()=>{if(n){if(0===t.length)return r&&Object.keys(r).length>0?e=>r[e]||"#999":void 0;if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));return r&&Object.keys(r).length>0?e=>r[e]||"#999":A(e.map(e=>({_cat:e})),"_cat",o)}if(r&&Object.keys(r).length>0){const e=A(t,n,o);return t=>r[t]||e(t)}return A(t,n,o)}},[t,n,o,r])}(n,r,i),P=e.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of n){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[n,r]),C=function(t,n,o){const[r,i]=e.useState(null),[a,s]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&s(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"isolate"===t&&a.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return a.has(o)}}:null},[t,n,r,a]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?a:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,r,P),L=e.useMemo(()=>C.legendSelectionHook?C.legendSelectionHook:O,[C.legendSelectionHook,O]),{legend:B,margin:H,legendPosition:R}=function({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:s={top:50,bottom:60,left:70,right:40}}){const l=e.useContext(Re),c=void 0!==r?r:!l&&!!n,u=e.useMemo(()=>{if(c&&n)return De({data:t,colorBy:n,colorScale:o,getColor:w})},[c,n,t,o]),d=e.useMemo(()=>{const e=Object.assign(Object.assign({},s),a);return u&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[s,a,u,i]);return{legend:u,margin:d,legendPosition:i}}({data:n,colorBy:r,colorScale:M,showLegend:m,legendPosition:s,userMargin:f,defaults:v}),D=e.useMemo(()=>{const e={};return B&&(e.legend=B,e.legendPosition=R),a&&"none"!==a&&(e.legendHoverBehavior=C.onLegendHover,e.legendClickBehavior=C.onLegendClick,e.legendHighlightedCategory=C.highlightedCategory,e.legendIsolatedCategories=C.isolatedCategories),e},[B,R,a,C.onLegendHover,C.onLegendClick,C.highlightedCategory,C.isolatedCategories]),_=function(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(r+i)-i))/2);return c.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>c.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},bt),{position:"absolute",top:a+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}(b,k,S),N=_?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?c.createElement("div",{style:Object.assign(Object.assign({},vt),{width:t,height:n})},o||"No data available"):null}(o,k,S,x);return{colorScale:M,allCategories:P,legendState:C,effectiveSelectionHook:L,activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:E,legend:B,margin:H,legendPosition:R,earlyReturn:_||N||null,legendBehaviorProps:D}}const At=e.forwardRef(function(t,n){const o=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",sort:p=!1,barPadding:m=40,tooltip:f,annotations:v,frameProps:b={},selection:x,linkedHover:A,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M}=t,P=o.width,C=o.height,L=o.enableHover,B=o.showGrid,H=o.title,R=o.categoryLabel,D=o.valueLabel,_=i||[],N=wt({data:_,rawData:i,colorBy:g,colorScheme:y,legendInteraction:E,legendPosition:M,selection:x,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,chartType:"BarChart",chartId:S,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:P,height:C});if(N.earlyReturn)return N.earlyReturn;xt("BarChart",_,"categoryAccessor",l),xt("BarChart",_,"valueAccessor",u);const $=$e(_,p,u),z=e.useMemo(()=>e=>{const t={};return t.fill=g?w(e,g,N.colorScale):Ne,t},[g,N.colorScale]),I=e.useMemo(()=>_e(z,N.effectiveSelectionHook,x),[z,N.effectiveSelectionHook,x]),W=e.useMemo(()=>Ye({categoryAccessor:l,valueAccessor:u,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group"}),[l,u,g]),T=tt({componentName:"BarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(T)return c.createElement(Qe,{componentName:"BarChart",message:T,width:P,height:C});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:$}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:I,size:[P,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:m,enableHover:L,showAxes:o.showAxes,oLabel:R,rLabel:D,rFormat:h,showGrid:B,oSort:p}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===f?()=>null:Ge(f)||W}),(A||k)&&{customHoverBehavior:N.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(ft,{componentName:"BarChart",width:P,height:C},c.createElement(Oe,Object.assign({ref:r},q)))});function kt({isPushMode:t,colorBy:n,colorScheme:o,showLegend:r,legendPosition:i="right"}){const a=e.useRef(new Set),s=e.useRef([]),[l,c]=e.useState(0),u=e.useCallback(e=>{if(!n)return null;const t="function"==typeof n?n(e):e[n];return null!=t?t+"":null},[n]),d=e.useCallback(e=>{if(!t||!n)return;let o=!1;for(const t of e){if(!t||"object"!=typeof t)continue;const e=u(t);null==e||a.current.has(e)||(a.current.add(e),s.current.push(e),o=!0)}o&&c(e=>e+1)},[t,n,u]),h=e.useCallback(e=>t=>{d([t]),e(t)},[d]),g=e.useCallback(e=>t=>{d(t),e(t)},[d]),y=e.useCallback(()=>{a.current=new Set,s.current=[],c(e=>e+1)},[]),p=e.useMemo(()=>{if(!t||!n||!1===r)return;const e=s.current;if(0===e.length)return;const i=Array.isArray(o)?o:b,a=new Map;for(let t=0;e.length>t;t++)a.set(e[t],i[t%i.length]);const l="string"==typeof n?n:"__streamCat";return De({data:e.map(e=>({[l]:e})),colorBy:l,colorScale:e=>a.get(e)||"#999",getColor:w})},[t,n,r,o,l]),m=e.useMemo(()=>{if(p)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[p,i]);return{wrapPush:h,wrapPushMany:g,resetCategories:y,streamingLegend:p,streamingMarginAdjust:m}}At.displayName="BarChart";const St=e.forwardRef(function(t,n){const o=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),r=e.useRef(null),{data:i,margin:a,className:s,categoryAccessor:l="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:y,colorScheme:p="category10",normalize:m=!1,barPadding:f=40,tooltip:v,annotations:b,frameProps:x={},selection:A,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendInteraction:M,legendPosition:P}=t,C=o.width,L=o.height,B=o.enableHover,H=o.showGrid,R=o.showLegend,D=o.title,_=o.categoryLabel,N=o.valueLabel,$=i||[],z=y||u,I=kt({isPushMode:void 0===i,colorBy:z,colorScheme:p,showLegend:R,legendPosition:P}),W=e.useCallback(I.wrapPush(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)}),[I.wrapPush]),T=e.useCallback(I.wrapPushMany(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)}),[I.wrapPushMany]);e.useImperativeHandle(n,()=>({push:W,pushMany:T,clear:()=>{var e;I.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[W,T,I.resetCategories]);const q=wt({data:$,rawData:i,colorBy:z,colorScheme:p,legendInteraction:M,legendPosition:P,selection:A,linkedHover:k,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:S,chartType:"StackedBarChart",chartId:O,showLegend:R,userMargin:a,marginDefaults:o.marginDefaults,loading:j,emptyContent:E,width:C,height:L});if(q.earlyReturn)return q.earlyReturn;const F=e.useMemo(()=>e=>z?q.colorScale?{fill:w(e,z,q.colorScale)}:{}:{fill:Ne},[z,q.colorScale]),G=e.useMemo(()=>_e(F,q.effectiveSelectionHook,A),[F,q.effectiveSelectionHook,A]),V=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d,groupAccessor:l}),[u,l,d]),X=tt({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:d},requiredProps:{stackBy:u}});if(X)return c.createElement(Qe,{componentName:"StackedBarChart",message:X,width:C,height:L});const Y=e.useMemo(()=>I.streamingLegend?Object.assign(Object.assign({},q.legendBehaviorProps),{legend:I.streamingLegend,legendPosition:P||q.legendPosition}):q.legendBehaviorProps,[q.legendBehaviorProps,q.legendPosition,I.streamingLegend,P]),Q=e.useMemo(()=>{if(I.streamingMarginAdjust){const e=Object.assign({},q.margin);for(const[t,n]of Object.entries(I.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return q.margin},[q.margin,I.streamingMarginAdjust]),K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:$}),{oAccessor:l,rAccessor:d,stackBy:u,normalize:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:G,size:[C,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,barPadding:f,enableHover:B,showAxes:o.showAxes,oLabel:_,rLabel:N,rFormat:g,showGrid:H}),Y),D&&{title:D}),s&&{className:s}),{tooltipContent:!1===v?()=>null:Ge(v)||V}),(k||S)&&{customHoverBehavior:q.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(ft,{componentName:"StackedBarChart",width:C,height:L},c.createElement(Oe,Object.assign({ref:r},K)))});St.displayName="StackedBarChart";const Ot=e.forwardRef(function(t,n){const o=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),r=e.useRef(null),{data:i,margin:a,className:s,categoryAccessor:l="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:y,colorScheme:p="category10",barPadding:m=60,tooltip:f,annotations:v,frameProps:b={},selection:x,linkedHover:A,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M}=t,P=o.width,C=o.height,L=o.enableHover,B=o.showGrid,H=o.showLegend,R=o.title,D=o.categoryLabel,_=o.valueLabel,N=i||[],$=y||u,z=kt({isPushMode:void 0===i,colorBy:$,colorScheme:p,showLegend:H,legendPosition:M}),I=e.useCallback(z.wrapPush(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)}),[z.wrapPush]),W=e.useCallback(z.wrapPushMany(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)}),[z.wrapPushMany]);e.useImperativeHandle(n,()=>({push:I,pushMany:W,clear:()=>{var e;z.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[I,W,z.resetCategories]);const T=wt({data:N,rawData:i,colorBy:$,colorScheme:p,legendInteraction:E,legendPosition:M,selection:x,linkedHover:A,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:k,chartType:"GroupedBarChart",chartId:S,showLegend:H,userMargin:a,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:P,height:C});if(T.earlyReturn)return T.earlyReturn;const q=e.useMemo(()=>e=>$?T.colorScale?{fill:w(e,$,T.colorScale)}:{}:{fill:Ne},[$,T.colorScale]),F=e.useMemo(()=>_e(q,T.effectiveSelectionHook,x),[q,T.effectiveSelectionHook,x]),G=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d,groupAccessor:l}),[u,l,d]),V=tt({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:d},requiredProps:{groupBy:u}});if(V)return c.createElement(Qe,{componentName:"GroupedBarChart",message:V,width:P,height:C});const X=e.useMemo(()=>z.streamingLegend?Object.assign(Object.assign({},T.legendBehaviorProps),{legend:z.streamingLegend,legendPosition:M||T.legendPosition}):T.legendBehaviorProps,[T.legendBehaviorProps,T.legendPosition,z.streamingLegend,M]),Y=e.useMemo(()=>{if(z.streamingMarginAdjust){const e=Object.assign({},T.margin);for(const[t,n]of Object.entries(z.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return T.margin},[T.margin,z.streamingMarginAdjust]),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=i&&{data:N}),{oAccessor:l,rAccessor:d,groupBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:F,size:[P,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y,barPadding:m,enableHover:L,showAxes:o.showAxes,oLabel:D,rLabel:_,rFormat:g,showGrid:B}),X),R&&{title:R}),s&&{className:s}),{tooltipContent:!1===f?()=>null:Ge(f)||G}),(A||k)&&{customHoverBehavior:T.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(ft,{componentName:"GroupedBarChart",width:P,height:C},c.createElement(Oe,Object.assign({ref:r},Q)))});Ot.displayName="GroupedBarChart";const jt=e.forwardRef(function(t,n){const o=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",sizeBy:p,sizeRange:m=[3,8],pointRadius:f=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:A,frameProps:k={},selection:S,linkedHover:O,onObservation:j,chartId:E,loading:M,emptyContent:P,legendInteraction:C,legendPosition:L}=t,B=o.width,H=o.height,R=o.enableHover,D=o.showGrid,_=o.title,N=o.categoryLabel,$=o.valueLabel,z=i||[],I=wt({data:z,rawData:i,colorBy:g,colorScheme:y,legendInteraction:C,legendPosition:L,selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:j,chartType:"SwarmPlot",chartId:E,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:M,emptyContent:P,width:B,height:H});if(I.earlyReturn)return I.earlyReturn;const W=e.useMemo(()=>{if(!p)return;const e=z.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[z,p]),T=e.useMemo(()=>e=>{const t={fillOpacity:v};return t.fill=g?w(e,g,I.colorScale):Ne,t.r=p?function(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}(e,p,m,W):f,t},[g,I.colorScale,p,m,W,f,v]),q=e.useMemo(()=>_e(T,I.effectiveSelectionHook,S),[T,I.effectiveSelectionHook,S]),F=e.useMemo(()=>Ye({categoryAccessor:l,valueAccessor:u,groupAccessor:g||void 0}),[l,u,g]),G=tt({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(G)return c.createElement(Qe,{componentName:"SwarmPlot",message:G,width:B,height:H});const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=i&&{data:z}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:q,size:[B,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:I.margin,barPadding:b,enableHover:R,showAxes:o.showAxes,oLabel:N,rLabel:$,rFormat:h,showGrid:D}),I.legendBehaviorProps),_&&{title:_}),s&&{className:s}),{tooltipContent:!1===x?()=>null:Ge(x)||F}),(O||j)&&{customHoverBehavior:I.customHoverBehavior}),A&&A.length>0&&{annotations:A}),k);return c.createElement(ft,{componentName:"SwarmPlot",width:B,height:H},c.createElement(Oe,Object.assign({ref:r},V)))});jt.displayName="SwarmPlot";const Et=e.forwardRef(function(t,n){const o=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",showOutliers:p=!0,categoryPadding:m=20,tooltip:f,annotations:v,frameProps:b={},selection:x,linkedHover:A,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M}=t,P=o.width,C=o.height,L=o.enableHover,B=o.showGrid,H=o.title,R=o.categoryLabel,D=o.valueLabel,_=i||[],N=wt({data:_,rawData:i,colorBy:g,colorScheme:y,legendInteraction:E,legendPosition:M,selection:x,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"BoxPlot",chartId:S,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:P,height:C});if(N.earlyReturn)return N.earlyReturn;const $=e.useMemo(()=>e=>{const t=g?w(e,g,N.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.8}},[g,N.colorScale]),z=e.useMemo(()=>_e($,N.effectiveSelectionHook,x),[$,N.effectiveSelectionHook,x]),I=e.useMemo(()=>e=>{const t=e.stats||(e.data||e).stats||{};return c.createElement("div",{className:"semiotic-tooltip",style:We},c.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(e.category||(e.data||e).category||"")+""),null!=t.median&&c.createElement(c.Fragment,null,null!=t.n&&c.createElement("div",null,"n = ",t.n),c.createElement("div",null,"Median: ",t.median.toLocaleString()),c.createElement("div",null,"Q1: ",t.q1.toLocaleString()),c.createElement("div",null,"Q3: ",t.q3.toLocaleString()),c.createElement("div",null,"Min: ",t.min.toLocaleString()),c.createElement("div",null,"Max: ",t.max.toLocaleString())))},[]),W=tt({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(W)return c.createElement(Qe,{componentName:"BoxPlot",message:W,width:P,height:C});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=i&&{data:_}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:z,showOutliers:p,size:[P,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:m,enableHover:L,showAxes:o.showAxes,oLabel:R,rLabel:D,rFormat:h,showGrid:B}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===f?()=>null:Ge(f)||I}),(A||k)&&{customHoverBehavior:N.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(ft,{componentName:"BoxPlot",width:P,height:C},c.createElement(Oe,Object.assign({ref:r},T)))});Et.displayName="BoxPlot";const Mt=e.forwardRef(function(t,n){const o=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:y,colorScheme:p="category10",categoryPadding:m=20,tooltip:f,annotations:v,frameProps:b={},selection:x,linkedHover:A,onObservation:k,chartId:S,loading:O,emptyContent:j,legendPosition:E}=t,M=o.width,P=o.height,C=o.enableHover,L=o.showGrid,B=o.title,H=o.categoryLabel,R=o.valueLabel,D=i||[],_=wt({data:D,rawData:i,colorBy:y,colorScheme:p,legendInteraction:void 0,legendPosition:E,selection:x,linkedHover:A,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"Histogram",chartId:S,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:M,height:P});if(_.earlyReturn)return _.earlyReturn;const N=e.useMemo(()=>e=>{const t=y?w(e,y,_.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.8}},[y,_.colorScale]),$=e.useMemo(()=>_e(N,_.activeSelectionHook,x),[N,_.activeSelectionHook,x]),z=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return c.createElement("div",{className:"semiotic-tooltip",style:We},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&c.createElement("div",null,"Count: ",o),r&&2===r.length&&c.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),I=tt({componentName:"Histogram",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(I)return c.createElement(Qe,{componentName:"Histogram",message:I,width:M,height:P});const W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=i&&{data:D}),{oAccessor:l,rAccessor:u,projection:"horizontal",summaryStyle:$,bins:d,normalize:h,size:[M,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:_.margin,barPadding:m,enableHover:C,showAxes:o.showAxes,oLabel:H,rLabel:R,rFormat:g,showGrid:L}),_.legendBehaviorProps),B&&{title:B}),s&&{className:s}),{tooltipContent:!1===f?()=>null:Ge(f)||z}),(A||k)&&{customHoverBehavior:_.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(ft,{componentName:"Histogram",width:M,height:P},c.createElement(Oe,Object.assign({ref:r},W)))});Mt.displayName="Histogram";const Pt=e.forwardRef(function(t,n){const o=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:y,colorBy:p,colorScheme:m="category10",categoryPadding:f=20,tooltip:v,annotations:b,frameProps:x={},selection:A,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendPosition:M}=t,P=o.width,C=o.height,L=o.enableHover,B=o.showGrid,H=o.title,R=o.categoryLabel,D=o.valueLabel,_=i||[],N=wt({data:_,rawData:i,colorBy:p,colorScheme:m,legendInteraction:void 0,legendPosition:M,selection:A,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:S,chartType:"ViolinPlot",chartId:O,showLegend:o.showLegend,userMargin:a,marginDefaults:o.marginDefaults,loading:j,emptyContent:E,width:P,height:C});if(N.earlyReturn)return N.earlyReturn;const $=e.useMemo(()=>e=>{const t=p?w(e,p,N.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.6}},[p,N.colorScale]),z=e.useMemo(()=>_e($,N.activeSelectionHook,A),[$,N.activeSelectionHook,A]),I=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;if(o)return c.createElement("div",{className:"semiotic-tooltip",style:We},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const r=(Array.isArray(e.data)?e.data:[]).map(e=>{const t="function"==typeof u?u(e):e[u];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),i=r.length,a=i>0?r[Math.floor(i/2)]:null;return c.createElement("div",{className:"semiotic-tooltip",style:We},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),i>0&&c.createElement("div",null,"n = ",i),null!=a&&c.createElement("div",null,"Median: ",a.toLocaleString()))},[u]),W=tt({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(W)return c.createElement(Qe,{componentName:"ViolinPlot",message:W,width:P,height:C});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=i&&{data:_}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:z,bins:h,showIQR:g,size:[P,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:f,enableHover:L,showAxes:o.showAxes,oLabel:R,rLabel:D,rFormat:y,showGrid:B}),N.legendBehaviorProps),H&&{title:H}),s&&{className:s}),{tooltipContent:!1===v?()=>null:Ge(v)||I}),(k||S)&&{customHoverBehavior:N.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(ft,{componentName:"ViolinPlot",width:P,height:C},c.createElement(Oe,Object.assign({ref:r},T)))});Pt.displayName="ViolinPlot";const Ct=e.forwardRef(function(t,n){var o;const r=Ie(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),i=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:a,margin:s,className:l,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:y,colorScheme:p="category10",sort:m=!0,dotRadius:f=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:A={},selection:k,linkedHover:S,onObservation:O,chartId:j,loading:E,emptyContent:M,legendInteraction:P,legendPosition:C}=t,L=r.width,B=r.height,H=r.enableHover,R=r.showGrid,D=r.title,_=r.categoryLabel,N=r.valueLabel,$=a||[],z=wt({data:$,rawData:a,colorBy:y,colorScheme:p,legendInteraction:P,legendPosition:C,selection:k,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,chartType:"DotPlot",chartId:j,showLegend:r.showLegend,userMargin:s,marginDefaults:r.marginDefaults,loading:E,emptyContent:M,width:L,height:B});if(z.earlyReturn)return z.earlyReturn;const I=$e($,m,d),W=e.useMemo(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=y?w(e,y,z.colorScale):Ne,t},[y,z.colorScale,f]),T=e.useMemo(()=>_e(W,z.effectiveSelectionHook,k),[W,z.effectiveSelectionHook,k]),q=e.useMemo(()=>Ye({categoryAccessor:u,valueAccessor:d}),[u,d]),F=tt({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(F)return c.createElement(Qe,{componentName:"DotPlot",message:F,width:L,height:B});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=a&&{data:I}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:T,size:[L,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,barPadding:v,enableHover:H,showAxes:r.showAxes,oLabel:_,rLabel:N,rFormat:g,showGrid:R,oSort:m}),z.legendBehaviorProps),D&&{title:D}),l&&{className:l}),{tooltipContent:!1===b?()=>null:Ge(b)||q}),(S||O)&&{customHoverBehavior:z.customHoverBehavior}),x&&x.length>0&&{annotations:x}),A);return c.createElement(ft,{componentName:"DotPlot",width:L,height:B},c.createElement(Oe,Object.assign({ref:i},G)))});Ct.displayName="DotPlot";const Lt=e.forwardRef(function(t,n){var o,r;const i=Ie(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(r=t.height)&&void 0!==r?r:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title}),a=e.useRef(null),{data:s,margin:l,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:y="category10",startAngle:p=0,tooltip:m,annotations:f,frameProps:v={},selection:b,linkedHover:x,onObservation:A,chartId:k,loading:S,emptyContent:O,legendInteraction:j,legendPosition:E}=t,M=i.width,P=i.height,C=i.enableHover,L=i.showLegend,B=i.title,H=s||[],R=g||d,D=kt({isPushMode:void 0===s,colorBy:R,colorScheme:y,showLegend:L,legendPosition:E}),_=e.useCallback(D.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[D.wrapPush]),N=e.useCallback(D.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[D.wrapPushMany]);e.useImperativeHandle(n,()=>({push:_,pushMany:N,clear:()=>{var e;D.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:[]}}),[_,N,D.resetCategories]);const $=wt({data:H,rawData:s,colorBy:R,colorScheme:y,legendInteraction:j,legendPosition:E,selection:b,linkedHover:x,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:A,chartType:"PieChart",chartId:k,showLegend:L,userMargin:l,marginDefaults:i.marginDefaults,loading:S,emptyContent:O,width:M,height:P});if($.earlyReturn)return $.earlyReturn;const z=e.useMemo(()=>e=>R?$.colorScale?{fill:w(e,R,$.colorScale)}:{}:{fill:Ne},[R,$.colorScale]),I=e.useMemo(()=>_e(z,$.effectiveSelectionHook,b),[z,$.effectiveSelectionHook,b]),W=e.useMemo(()=>Ye({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),T=tt({componentName:"PieChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(T)return c.createElement(Qe,{componentName:"PieChart",message:T,width:M,height:P});const q=e.useMemo(()=>D.streamingLegend?Object.assign(Object.assign({},$.legendBehaviorProps),{legend:D.streamingLegend,legendPosition:E||$.legendPosition}):$.legendBehaviorProps,[$.legendBehaviorProps,$.legendPosition,D.streamingLegend,E]),F=e.useMemo(()=>{if(D.streamingMarginAdjust){const e=Object.assign({},$.margin);for(const[t,n]of Object.entries(D.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return $.margin},[$.margin,D.streamingMarginAdjust]),G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=s&&{data:H}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:I,startAngle:p,size:[M,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F,enableHover:C,showAxes:!1}),q),B&&{title:B}),u&&{className:u}),{tooltipContent:!1===m?()=>null:Ge(m)||W}),(x||A)&&{customHoverBehavior:$.customHoverBehavior}),f&&f.length>0&&{annotations:f}),v);return c.createElement(ft,{componentName:"PieChart",width:M,height:P},c.createElement(Oe,Object.assign({ref:a},G)))});Lt.displayName="PieChart";const Bt=e.forwardRef(function(t,n){var o,r;const i=Ie(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(r=t.height)&&void 0!==r?r:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,linkedHover:t.linkedHover}),a=e.useRef(null),{data:s,margin:l,className:u,categoryAccessor:d="category",valueAccessor:h="value",innerRadius:g=60,centerContent:y,colorBy:p,colorScheme:m="category10",startAngle:f=0,tooltip:v,annotations:b,frameProps:x={},selection:A,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendInteraction:M,legendPosition:P}=t,C=i.width,L=i.height,B=i.enableHover,H=i.showLegend,R=i.title,D=s||[],_=p||d,N=kt({isPushMode:void 0===s,colorBy:_,colorScheme:m,showLegend:H,legendPosition:P}),$=e.useCallback(N.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[N.wrapPush]),z=e.useCallback(N.wrapPushMany(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)}),[N.wrapPushMany]);e.useImperativeHandle(n,()=>({push:$,pushMany:z,clear:()=>{var e;N.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:[]}}),[$,z,N.resetCategories]);const I=wt({data:D,rawData:s,colorBy:_,colorScheme:m,legendInteraction:M,legendPosition:P,selection:A,linkedHover:k,fallbackFields:_?["string"==typeof _?_:""]:[],unwrapData:!0,onObservation:S,chartType:"DonutChart",chartId:O,showLegend:H,userMargin:l,marginDefaults:i.marginDefaults,loading:j,emptyContent:E,width:C,height:L});if(I.earlyReturn)return I.earlyReturn;const W=e.useMemo(()=>e=>_?I.colorScale?{fill:w(e,_,I.colorScale)}:{}:{fill:Ne},[_,I.colorScale]),T=e.useMemo(()=>_e(W,I.effectiveSelectionHook,A),[W,I.effectiveSelectionHook,A]),q=e.useMemo(()=>Ye({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[d,h,p]),F=tt({componentName:"DonutChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(F)return c.createElement(Qe,{componentName:"DonutChart",message:F,width:C,height:L});const G=e.useMemo(()=>N.streamingLegend?Object.assign(Object.assign({},I.legendBehaviorProps),{legend:N.streamingLegend,legendPosition:P||I.legendPosition}):I.legendBehaviorProps,[I.legendBehaviorProps,I.legendPosition,N.streamingLegend,P]),V=e.useMemo(()=>{if(N.streamingMarginAdjust){const e=Object.assign({},I.margin);for(const[t,n]of Object.entries(N.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return I.margin},[I.margin,N.streamingMarginAdjust]),X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=s&&{data:D}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:T,innerRadius:g,startAngle:f,centerContent:y,size:[C,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V,enableHover:B,showAxes:!1}),G),R&&{title:R}),u&&{className:u}),{tooltipContent:!1===v?()=>null:Ge(v)||q}),(k||S)&&{customHoverBehavior:I.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(ft,{componentName:"DonutChart",width:C,height:L},c.createElement(Oe,Object.assign({ref:a},X)))});function Ht(t){const n=Ie(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:r,className:i,categoryAccessor:a="category",valueAccessor:s="value",orientation:l="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:p=5,tooltip:m,annotations:f,frameProps:v={},selection:b,linkedHover:x,onObservation:A,chartId:k,loading:S,emptyContent:O,legendPosition:j}=t,E=n.width,M=n.height,P=n.enableHover,C=n.showGrid,L=n.title,B=n.categoryLabel,H=n.valueLabel,R=o||[],D=wt({data:R,rawData:o,colorBy:g,colorScheme:y,legendInteraction:void 0,legendPosition:j,selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,chartType:"RidgelinePlot",chartId:k,showLegend:n.showLegend,userMargin:r,marginDefaults:n.marginDefaults,loading:S,emptyContent:O,width:E,height:M});if(D.earlyReturn)return D.earlyReturn;const _=e.useMemo(()=>e=>{const t=g?w(e,g,D.colorScale):Ne;return{fill:t,stroke:t,fillOpacity:.5}},[g,D.colorScale]),N=e.useMemo(()=>_e(_,D.activeSelectionHook,b),[_,D.activeSelectionHook,b]),$=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;return o?c.createElement("div",{className:"semiotic-tooltip",style:We},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):c.createElement("div",{className:"semiotic-tooltip",style:We},c.createElement("div",{style:{fontWeight:"bold"}},n+""))},[]),z=tt({componentName:"RidgelinePlot",data:o,accessors:{categoryAccessor:a,valueAccessor:s}});if(z)return c.createElement(Qe,{componentName:"RidgelinePlot",message:z,width:E,height:M});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=o&&{data:R}),{oAccessor:a,rAccessor:s,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:N,bins:u,size:[E,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:D.margin,barPadding:p,enableHover:P,showAxes:n.showAxes,oLabel:B,rLabel:H,rFormat:h,showGrid:C,oSort:!1,amplitude:d}),D.legendBehaviorProps),L&&{title:L}),i&&{className:i}),{tooltipContent:!1===m?()=>null:Ge(m)||$}),(x||A)&&{customHoverBehavior:D.customHoverBehavior}),f&&f.length>0&&{annotations:f}),v);return c.createElement(ft,{componentName:"RidgelinePlot",width:E,height:M},c.createElement(Oe,Object.assign({},I)))}Bt.displayName="DonutChart",Ht.displayName="RidgelinePlot",exports.BarChart=At,exports.BoxPlot=Et,exports.DonutChart=Bt,exports.DotPlot=Ct,exports.GroupedBarChart=Ot,exports.Histogram=Mt,exports.PieChart=Lt,exports.RidgelinePlot=Ht,exports.StackedBarChart=St,exports.StreamOrdinalFrame=Oe,exports.SwarmPlot=jt,exports.ViolinPlot=Pt;
|
|
1
|
+
"use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-scale-chromatic"),o=require("d3-array"),r=require("d3-hierarchy"),i=require("d3-shape"),s=require("regression");function a(e){return e&&e.__esModule?e:{default:e}}function l(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const c=l(e),u=a(s);class d{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 h{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}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 y(e,t,n){return e+(t-e)*n}function p(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function f(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function m(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const v={category10:n.schemeCategory10,tableau10:n.schemeTableau10,set3:n.schemeSet3,blues:n.interpolateBlues,reds:n.interpolateReds,greens:n.interpolateGreens,oranges:n.interpolateOranges,purples:n.interpolatePurples,viridis:n.interpolateViridis,plasma:n.interpolatePlasma},b=n.schemeCategory10,x=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],w=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 A(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")||w.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):b[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+""))%b.length]}function k(e,n,o="category10"){const r=Array.from(new Set(e.map(e=>null==e?void 0:e[n]).filter(e=>null!=e))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(r).range(o).unknown("#999");const s=v[o]||v.category10;if(i&&"function"==typeof s){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:b;return t.scaleOrdinal().domain(r).range(e).unknown("#999")}}function S(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 O(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=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function j(e){var t,n,r;const i=e.length,s=e[0],a=e[i-1];return{n:i,min:s,q1:null!==(t=o.quantile(e,.25))&&void 0!==t?t:s,median:null!==(n=o.quantile(e,.5))&&void 0!==n?n:(s+a)/2,q3:null!==(r=o.quantile(e,.75))&&void 0!==r?r:a,max:a,mean:e.reduce((e,t)=>e+t,0)/i}}const E={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize,y=[];if(s){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),y.push(t))}}else y.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of y){const c=t.get(i);if(!c)continue;let y=c.total;g&&n>0&&(y/=n);const p=a(c.pieces[0],s?i:e.name),f=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const t=l(0>y?r:o+y),n=0>y?l(r+y)-l(r):l(o)-l(o+y);u.push(S(e.x,t,e.width,Math.abs(n),p,f,i)),0>y?r+=y:o+=y}else if(h){const t=l(0>y?r+y:o),n=0>y?l(r)-l(r+y):l(o+y)-l(o);u.push(S(t,e.x,Math.abs(n),e.width,p,f,i)),0>y?r+=y:o+=y}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,l=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let i=0;d.length>i;i++){const h=l.get(d[i])||[];for(const l of h){const h=r(l),g=s(l,d[i]);if(u){const r=e.x+i*t+n/2,s=a(0),u=a(h);c.push(S(r,Math.min(s,u),o,Math.abs(s-u),g,l,d[i]))}else{const r=e.x+i*t+n/2,s=a(0),u=a(h);c.push(S(Math.min(s,u),r,Math.abs(u-s),o,g,l,d[i]))}}}}return c},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,y=a.length>0,p=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=y&&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)*p,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),y=c?s(a):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:O,donut:O,boxplot:function(e,t){var n,r,i,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:y}=l,p=[],f="vertical"===y,m=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(n=o.quantile(t,.25))&&void 0!==n?n:l,y=null!==(r=o.quantile(t,.5))&&void 0!==r?r:(l+c)/2,v=null!==(i=o.quantile(t,.75))&&void 0!==i?i:c,b=v-u,x=u-1.5*b,w=v+1.5*b,A=null!==(s=t.find(e=>e>=x))&&void 0!==s?s:l,k=null!==(a=[...t].reverse().find(e=>w>=e))&&void 0!==a?a:c,S=h(e.pieceData[0],e.name),O=[];if(m)for(const t of e.pieceData){const n=d(t);if(x>n||n>w){const o=f?e.middle:g(n),r=f?g(n):e.middle;O.push({px:o,py:r,value:n,datum:t})}}if(p.push({type:"boxplot",x:f?e.middle:0,y:f?0:e.middle,projection:f?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(A),q1Pos:g(u),medianPos:g(y),q3Pos:g(v),maxPos:g(k),stats:{n:t.length,min:A,q1:u,median:y,q3:v,max:k,mean:t.reduce((e,t)=>e+t,0)/t.length},style:S,datum:e.pieceData,category:e.name,outliers:O}),m)for(const e of O)p.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:S.fill||"#999",opacity:.6},datum:e.datum})}return p},violin:function(e,t){var n,r,i;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,g=[],y="vertical"===h,p=l.bins||20,f=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),p-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(y){b=`M ${e.middle} ${d(s)}`;for(let t=0;p>t;t++){const n=d(s+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=p-1;t>=0;t--){const n=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${n}`}b+=" Z"}else{b=`M ${d(s)} ${e.middle}`;for(let t=0;p>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=p-1;t>=0;t--)b+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(f&&t.length>=4){const l=null!==(n=o.quantile(t,.25))&&void 0!==n?n:s,c=null!==(r=o.quantile(t,.5))&&void 0!==r?r:(s+a)/2,u=null!==(i=o.quantile(t,.75))&&void 0!==i?i:a;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:y}}const A=y?{x:e.x,y:Math.min(d(a),d(s)),width:e.width,height:Math.abs(d(a)-d(s))}:{x:Math.min(d(s),d(a)),y:e.x,width:Math.abs(d(a)-d(s)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:A,iqrLine:w,stats:j(t),style:x,datum:e.pieceData,category:e.name})}return g},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,y=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!=y&&isFinite(y)?y:Math.max(...t))-n)/u||1,r=Array(u).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),u-1)]++;const i=t.length,h=Math.max(...r,1),p=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const s=(d?r[t]/i:r[t]/h)*e.width*.9,a=l(n+t*o),u=l(n+(t+1)*o);c.push(S(Math.min(a,u),e.x+e.width-s,Math.abs(u-a),s,p,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],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)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),p=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]/y*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]/y*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:j(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.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(S(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(S(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,n){var o,r,i,s,a,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,y=[],p=n.width/2,f=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===m.length)return y;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(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=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=d(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 y;const k=new Map;for(const e of v){const t=w[0].groups.get(e);k.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,j=x?.95*p:.9*n.width,E=t.scaleLinear().domain([0,A]).range([0,j]),M=null!==(r=e.config.connectorOpacity)&&void 0!==r?r:.3;let C=new Map;for(let e=0;w.length>e;e++){const t=w[e],n=t.col,o=0===e,r=n.width,u=.55*r,d=n.x+(r-u)/2,h=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=E(o.total))}let r=p,i=p;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=E(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const w=g(c.pieces[0],l),A=null!==(a=k.get(l))&&void 0!==a?a: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===s&&(j.__funnelStepLabel=n.name,j.__funnelStepLabelX=p,j.__funnelStepLabelY=d,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+m/2,j.__funnelValueLabelY=d,j.__funnelBarW=m),y.push(S(x,d,m,u,w,j,l)),h.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,r=E(e),a=p-r/2,l=v[0],c="_default"!==l,m=null!==(s=null===(i=t.groups.get(l))||void 0===i?void 0:i.pieces[0])&&void 0!==s?s:n.pieceData[0],b=c?l:n.name,x=g(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=p,A.__funnelStepLabelY=d,A.__funnelRowWidth=r,A.__funnelValueLabelX=p,A.__funnelValueLabelY=d,A.__funnelBarW=r),y.push(S(a,d,r,u,x,A,b)),h.set(l,{x:a,y:d,w:r,h:u})}if(e>0&&C.size>0){const e=x?v:[v[0]];for(const o of e){const e=C.get(o),r=h.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return g(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:M},datum:null!==(c=null===(l=t.groups.get(o))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:n.pieceData[0],category:"_default"===o?n.name:o};y.push(s)}}C=h}return y},"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=[],y=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";y.has(e)||(y.add(e),g.push(e))}const p=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=p?g.length:1,x=p?.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],y=t.groups.get(h);if(!y)continue;const f=y.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),E=v(0)-j,M=c(y.pieces[0],p?h:n.name),C=Object.assign(Object.assign({},y.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:k,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+k)});if(d.push(S(O,j,u,E,M,C,p?h:n.name)),k>0){const e=v(f+k),t=j-e,o=Object.assign({},M),r=Object.assign(Object.assign({},y.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:p?h:n.name});d.push(S(O,e,u,t,o,r,p?h:n.name))}}}return d}};class M{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.config=e,this.buffer=new h(e.windowSize),this.getO=m(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>f(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new g)):(this.getR=f(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=m(e.stackBy),this.getGroup=m(e.groupBy),this.getColor=m(e.colorAccessor),this.getConnector=m(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new h(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:n,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const r=o.toArray(),i=n.projection||"vertical",s=n.oExtent||this.resolveCategories(r),a=this.computeValueDomain(r,s),l="horizontal"===i,c=null!=n.barPadding?n.barPadding/("vertical"===i?e.width:e.height):.1;let u,d;if("radial"===i){u=t.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=n.innerRadius||0;d=t.scaleLinear().domain(a).range([r,o])}else l?(u=t.scaleBand().domain(s).range([0,e.height]).padding(c),d=t.scaleLinear().domain(a).range([0,e.width])):(u=t.scaleBand().domain(s).range([0,e.width]).padding(c),d=t.scaleLinear().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((r,i)=>{const s=this.rExtents[i];s.dirty&&s.recalculate(o,r);let[a,c]=s.extent;a===1/0&&(a=0,c=1);const u=c-a,d=u>0?u*(n.extentPadding||.05):1;return a-=d,c+=d,a>0&&(a=0),l?t.scaleLinear().domain([a,c]).range([0,e.width]):t.scaleLinear().domain([a,c]).range([e.height,0])}):[];let h=r;this.rAccessors.length>1&&(h=r.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,s,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),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;const r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let s=0,a=0;if("bar"===r&&this.getStack&&this.config.normalize)s=0,a=1;else if("bar"===r&&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>a&&(a=e);for(const e of n.values())s>e&&(s=e)}else if("bar"===r){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>a&&(a=e),s>e&&(s=e)}else if("clusterbar"===r||"bar-funnel"===r)for(const t of e){const e=this.getR(t);e>a&&(a=e),s>e&&(s=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(s=e),t!==-1/0&&(a=t)}if(this.config.rExtent&&(null!=this.config.rExtent[0]&&(s=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(a=this.config.rExtent[1])),"bar-funnel"!==r){const e=a-s,t=e>0?e*i:1;null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&(s-=t),null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])&&(a+=t)}return"bar"!==r&&"clusterbar"!==r&&"bar-funnel"!==r||(s>0&&(s=0),0>a&&(a=0)),[s,a]}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=E[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:x,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){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(n=i.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>a?1:s;default:return 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 y=new Set,p=new Map;for(let e=0;this.scene.length>e;e++){const a=this.scene[e],l=this.getNodeKey(a,p);if(!l)continue;a._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===a.type?c?(y.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?(y.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)y.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=y(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=y(o.x,e._targetX,i),e.y=y(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=y(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=y(n.x,e._targetX,i),e.y=y(n.y,e._targetY,i),void 0!==n.w&&(e.w=y(n.w,e._targetW,i),e.h=y(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()}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)&&(p(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=m(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)=>!p(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>f(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new g)):(this.getR=f(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!p(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?m(this.config.stackBy):void 0),"groupBy"in e&&!p(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?m(this.config.groupBy):void 0),"colorAccessor"in e&&!p(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?m(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!p(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?m(this.config.connectorAccessor):void 0)}}function C(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function P(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 _(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function L(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=C(Math.atan2(r,o)),a=C(e.startAngle),l=C(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 B(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 H(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}}const R={fill:e=>c.createElement("rect",{style:e,width:16,height:16}),line:e=>c.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function D(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,R[n])(o(e,t)),r}function T(){return c.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function N(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function $({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+c.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),u=[];for(let e=0;64>=e;e++){const t=e/64;u.push(c.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return c.createElement("g",{"aria-label":i||"Gradient legend"},c.createElement("defs",null,c.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),i&&c.createElement("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),c.createElement("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),c.createElement("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[0])),c.createElement("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[1])))}const u=[];for(let e=0;64>=e;e++){const t=e/64;u.push(c.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return c.createElement("g",{"aria-label":i||"Gradient legend"},i&&c.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),c.createElement("defs",null,c.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),c.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),c.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[1])),c.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[0])))}function I(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:u=20,orientation:d="vertical"}=e,[h,g]=c.useState(0),[y,p]=c.useState(0),f=c.useCallback((e,t)=>{g(e),p(t)},[]),m="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:u})=>{let d=24;const h=[];return e.forEach((e,g)=>{d+=5,h.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:t,y2:d})),d+=8,e.label&&(d+=16,h.push(c.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),d+=8),h.push(c.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((e,t,n,o,r,i,s,a,l,u)=>{const{type:d="fill",styleFn:h,items:g}=e,y=[];let p=0;const f=!(!t&&!n),m="isolate"===u||void 0===u&&null!=r;return g.forEach((e,u)=>{const v=D(e,u,d,h),b=N(e,o,r),x=r&&r.size>0&&r.has(e.label);y.push(c.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:f?a===i&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:f?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(u+("ArrowDown"===n.key?1:-1)+g.length)%g.length;l(a,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:f?t=>{l(a,u),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{n&&n(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&&c.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&c.createElement(T,null),c.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),p+=22}),y})(e,n,o,r,i,s,a,g,l,u))),d+=22*e.items.length+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:y,onFocusedIndexChange:f,legendInteraction:s}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];e.forEach((e,t)=>{let n=0;e.label&&(n+=16);const y=((e,t,n,o,r,i,s,a,l,u)=>{const{type:d="fill",styleFn:h,items:g}=e,y=[];let p=0;const f=!(!t&&!n),m="isolate"===u||void 0===u&&null!=r;return g.forEach((e,u)=>{const v=D(e,u,d,h),b=N(e,o,r),x=r&&r.size>0&&r.has(e.label);y.push(c.createElement("g",{key:"legend-item-"+u,transform:`translate(${p},0)`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:f?a===i&&u===s?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:f?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(u+("ArrowRight"===n.key?1:-1)+g.length)%g.length;l(a,e);const t=null===(o=n.currentTarget.parentElement)||void 0===o?void 0:o.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:f?t=>{l(a,u),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{n&&n(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&&c.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&c.createElement(T,null),c.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),p+=26+7*e.label.length}),{items:y,offset:p}})(e,o,r,i,s,a,l,t,u,d);n+=y.offset+5,g.push(Object.assign(Object.assign({label:e.label},y),{offset:n})),h+=n+12});let y=Math.max(0,(n-h)/2);const p=[];return g.forEach((n,o)=>{const r=e[o];r.label&&(p.push(c.createElement("text",{key:"legend-text-"+o,transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),y+=16),p.push(c.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${y},0)`},n.items)),y+=n.offset+5,e[o+1]&&p.push(c.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:y,y1:-8,x2:y,y2:t+0+8})),y+=12}),c.createElement("g",null,p)})({legendGroups:t||[],title:a,height:u,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:y,onFocusedIndexChange:f,legendInteraction:s}),v=!(!n&&!o);return c.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==a&&""!==a&&"vertical"===d&&c.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},a),m)}function z(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 W(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 F(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:u,type:d,color:h,className:g,disable:y,events:p={},"data-testid":f}=e,m=new Set(Array.isArray(y)?y:[]);let v=o||0,b=r||0;null!=i&&(v=i-t),null!=s&&(b=s-n);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 c.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":f},p),!m.has("connector")&&function(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-a,2)+Math.pow(t-l,2))>.5&&(s.push(c.createElement("line",{key:"connector-line",x1:a,y1:l,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-a);s.push(c.createElement("path",{key:"connector-arrow",d:`M${a},${l}L${a+n*Math.cos(i+r)},${l+n*Math.sin(i+r)}L${a+n*Math.cos(i-r)},${l+n*Math.sin(i-r)}Z`,fill:o||"currentColor",stroke:"none"}))}return c.createElement("g",{className:"annotation-connector"},s)}(v,b,l,h,x,u),!m.has("subject")&&function(e,t,n,o,r){var i;const s=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&s.push(c.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&s.push(c.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&s.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;s.push(c.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;s.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?s.push(c.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||s.push(c.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&s.push(c.createElement("path",{key:"bracket-path",d:W((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return c.createElement("g",{className:"annotation-subject"},s)}(x,u,h,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return c.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:u}=e;if(!r&&!i)return c.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>t?"end":"start";const y=16,p=i?u?[i]:z(i,l):[],f=r?u?[r]:z(r,l):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];p.length>0&&(b.push(c.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:g,fontWeight:"bold"},p.map((e,t)=>c.createElement("tspan",{key:t,x:m,dy:0===t?0:y},e)))),v=p.length*y),f.length>0&&b.push(c.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:g,y:v},f.map((e,t)=>c.createElement("tspan",{key:t,x:m,dy:0===t?0:y},e))));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(l,120);let t=0,n=e;"end"===g?(t=-e,n=0):"middle"===g&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(p.length+f.length)*y+(f.length>0?y:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=c.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const w=Math.max(0,p.length+f.length-1)*y;let A=0;return"topBottom"===d?A=0>n?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+y+(f.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),c.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},c.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),x)}(a,v,b,h))}function q(e){var t,n;const{noteData:o}=e,{screenCoordinates:r}=o,i="string"==typeof o.type?o.type:"label",s=o.eventListeners||o.events||{};if(o.coordinates&&r){const e=o.nx||r[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),s=o.ny||r[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),a=r.map((t,n)=>{const r=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:s});return c.createElement(F,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return c.createElement("g",null,a)}const a=o.note||{title:"none",label:o.label};return c.createElement(F,Object.assign({"data-testid":"semiotic-annotation",key:`${a.label}-${a.title}-${o.i}`,events:s},o,{type:i}))}const G={linear:i.curveLinear,monotoneX:i.curveMonotoneX,monotoneY:i.curveMonotoneY,step:i.curveStep,stepAfter:i.curveStepAfter,stepBefore:i.curveStepBefore,basis:i.curveBasis,cardinal:i.curveCardinal,catmullRom:i.curveCatmullRom};function V(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 X(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 Y(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=V(e,n),c=X(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 K(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Q(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:s,scales:a,showAxes:l,showGrid:u,rFormat:d}=t,h="radial"===(null==a?void 0:a.projection),g="horizontal"===(null==a?void 0:a.projection),y=e.useMemo(()=>!a||h?[]:a.r.ticks(5).map(e=>({value:e,pixel:a.r(e),label:(d||U)(e)})),[a,d,h]),p=u&&a&&!h,f=l&&a&&!h;return p||f?c.createElement("svg",{width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},c.createElement("g",{transform:`translate(${s.left},${s.top})`},p&&c.createElement("g",{className:"ordinal-grid"},y.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:g?e.pixel:0,y1:g?0:e.pixel,x2:g?e.pixel:n,y2:g?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),f&&c.createElement(c.Fragment,null,g?c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):c.createElement(c.Fragment,null,c.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function U(e){return Math.round(100*e)/100+""}function Z(t){var n,o;const{width:s,height:a,totalWidth:l,totalHeight:d,margin:h,scales:g,showAxes:y,showCategoryTicks:p,oLabel:f,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:A,legendHoverBehavior:k,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:j,legendPosition:E="right",foregroundGraphics:M,annotations:C,svgAnnotationRules:P,xAccessor:_,yAccessor:L,annotationData:B,underlayRendered:H,children:R}=t,D="radial"===(null==g?void 0:g.projection),T="horizontal"===(null==g?void 0:g.projection),N=!1!==p,z=e.useMemo(()=>y&&N&&g&&!D?g.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2,label:v?v(e):e}}):[],[y,N,g,v,D]),W=e.useMemo(()=>y&&g&&!D?g.r.ticks(5).map(e=>({value:e,pixel:g.r(e),label:(b||U)(e)})):[],[y,g,b,D]),F=e.useRef(new Map),Q=e.useRef(null!==(n=null==C?void 0:C.length)&&void 0!==n?n:0),Z=null!==(o=null==C?void 0:C.length)&&void 0!==o?o:0;Q.current!==Z&&(Q.current=Z,F.current=new Map);const J=e.useMemo(()=>{if(!C||0===C.length)return null;const e=function(e,t,n){var o,s,a,l,d,h,g,y,p,f,m,v,b,x,w,A,k,S,O,j,E,M,C,P,_,L,B,H,R,D,T,N,$,I,z,W,F,Q,U,Z,J,ee,te,ne;switch(e.type){case"label":{const o=Y(e,t,n);if(!o)return null;const{x:r,y:i}=o;return K(r,i,n)?c.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{const o=Y(e,t,n);if(!o)return null;const{x:r,y:i}=o;return K(r,i,n)?c.createElement(q,{key:"ann-"+t,noteData:{x:r,y:i,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=V(e,n);if(null==o)return null;const r=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:o+4,y:12,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=X(e,n);if(null==o)return null;const r=e.color||"#f97316";return c.createElement("g",{key:"ann-"+t},c.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:V(Object.assign(Object.assign({},e),{type:"point"}),n),y:X(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const i=r.packEnclose(o),s=e.padding||10;return c.createElement("g",{key:"ann-"+t},c.createElement("circle",{cx:i.x,cy:i.y,r:i.r+s,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:V(Object.assign(Object.assign({},e),{type:"point"}),n),y:X(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),s=o.map(e=>e.y),a=Math.min(...i)-r,l=Math.max(...i)+r,u=Math.min(...s)-r,d=Math.max(...s)+r;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:a,y:u,width:l-a,height:d-u,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&c.createElement("text",{x:(a+l)/2,y:u-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return c.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=V(t,n),s=X(t,n);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return c.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:s,r:a},l))}))}case"bracket":{const o=V(e,n),r=X(e,n);return c.createElement(q,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=r?r:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const r=n.data||[];if(2>r.length)return null;const i=n.xAccessor||"x",y=n.yAccessor||"y",p=r.map(e=>[e[i],e[y]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const f=null!==(s=null===(o=n.scales)||void 0===o?void 0:o.x)&&void 0!==s?s:null===(a=n.scales)||void 0===a?void 0:a.time,m=null!==(d=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==d?d:null===(h=n.scales)||void 0===h?void 0:h.value;if(!f||!m)return null;const v=e.method||"linear";let b;b="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,y=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],y+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*y-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(g=e.bandwidth)&&void 0!==g?g:.3):("polynomial"===v?u.default.polynomial(p,{order:e.order||2}):u.default.linear(p)).points;const x=b.map(([e,t])=>`${f(e)},${m(t)}`).join(" "),w=e.color||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&c.createElement("text",{x:f(b[b.length-1][0])+4,y:m(b[b.length-1][1])-4,fill:w,fontSize:11},e.label))}case"band":{const o=null!==(p=null===(y=n.scales)||void 0===y?void 0:y.y)&&void 0!==p?p:null===(f=n.scales)||void 0===f?void 0:f.value,r=null!==(m=null==o?void 0:o(e.y0))&&void 0!==m?m:0,i=null!==(v=null==o?void 0:o(e.y1))&&void 0!==v?v:n.height||0;return c.createElement("g",{key:"ann-"+t},c.createElement("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(r,i)-4,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11},e.label))}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",s=null!==(x=null===(b=n.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(w=n.scales)||void 0===w?void 0:w.time,a=null!==(k=null===(A=n.scales)||void 0===A?void 0:A.y)&&void 0!==k?k:null===(S=n.scales)||void 0===S?void 0:S.value;if(!s||!a)return null;const l=e.upperAccessor||"upperBounds",u=e.lowerAccessor||"lowerBounds",d=e.filter,h=o.filter(e=>null!=e[l]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=G[n.curve||"linear"]||i.curveLinear,y=i.area().x(e=>s(e[r])).y0(e=>a(e[u])).y1(e=>a(e[l])).curve(g)(h);if(!y)return null;const p=e.fill||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:y,fill:p,fillOpacity:null!==(O=e.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),e.label&&h.length>0&&c.createElement("text",{x:s(h[h.length-1][r])+4,y:a(h[h.length-1][l])-4,fill:p,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(E=null===(j=n.scales)||void 0===j?void 0:j.x)&&void 0!==E?E:null===(M=n.scales)||void 0===M?void 0:M.time,s=null!==(P=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(_=n.scales)||void 0===_?void 0:_.value;if(!i||!s)return null;const a=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-l,2),0)/a.length,d=Math.sqrt(u),h=null!==(L=e.threshold)&&void 0!==L?L:2,g=l-h*d,y=!1!==e.showBand,p=e.fill||"#6366f1",f=null!==(B=e.fillOpacity)&&void 0!==B?B:.1,m=e.anomalyColor||"#ef4444",v=null!==(H=e.anomalyRadius)&&void 0!==H?H:6,b=s(l+h*d),x=s(g),w=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*d});return c.createElement("g",{key:"ann-"+t},y&&c.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:f}),w.map((e,t)=>{const o=V(e,n),r=X(e,n);return null==o||null==r?null:c.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&c.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",s=null!==(D=null===(R=n.scales)||void 0===R?void 0:R.x)&&void 0!==D?D:null===(T=n.scales)||void 0===T?void 0:T.time,a=null!==($=null===(N=n.scales)||void 0===N?void 0:N.y)&&void 0!==$?$:null===(I=n.scales)||void 0===I?void 0:I.value;if(!s||!a)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let d;if("polynomial"===(e.method||"linear")){const t=u.default.polynomial(l,{order:e.order||2}).equation;d=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;d=e=>a+s*e}const h=l.length,g=l.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),y=Math.sqrt(g/Math.max(h-2,1)),p=l.reduce((e,t)=>e+t[0],0)/h,f=l.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(z=e.confidence)&&void 0!==z?z:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(W=e.steps)&&void 0!==W?W:5,x=l[h-1][0],w=(x-l[0][0])/Math.max(h-1,1),A=[];for(let e=1;b>=e;e++)A.push(x+e*w);const k=[];for(const e of A){const t=d(e),n=y*Math.sqrt(1+1/h+(f>0?Math.pow(e-p,2)/f:0))*v;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),j=`${s(x)},${a(d(x))}`,E=e.strokeColor||"#6366f1";return c.createElement("g",{key:"ann-"+t},c.createElement("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:null!==(F=e.fillOpacity)&&void 0!==F?F:.15,stroke:"none"}),c.createElement("polyline",{points:`${j} ${O}`,fill:"none",stroke:E,strokeWidth:null!==(Q=e.strokeWidth)&&void 0!==Q?Q:2,strokeDasharray:null!==(U=e.strokeDasharray)&&void 0!==U?U:"6,3"}),e.label&&k.length>0&&c.createElement("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:E,fontSize:11},e.label))}case"widget":{let o=null,r=null;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=Y(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!K(o,r,n))return null;const i=null!==(Z=e.dx)&&void 0!==Z?Z:0,s=null!==(J=e.dy)&&void 0!==J?J:0,a=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,u=null!==(ne=e.content)&&void 0!==ne?ne:c.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return c.createElement("foreignObject",{key:"ann-"+t,x:o+i-a/2,y:r+s-l/2,width:a,height:l,style:{overflow:"visible",pointerEvents:"auto"}},c.createElement("div",{style:{width:a,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const o=Y(e,t,n);if(!o)return null;const{x:r,y:i}=o;return c.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}default:return null}},t="horizontal"===(null==g?void 0:g.projection),n=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,o={scales:g?{x:t?g.r:n||g.r,y:t&&n||g.r,time:g.r,value:g.r}:null,timeAxis:"x",xAccessor:_,yAccessor:L,width:s,height:a,data:B,frameType:"ordinal",stickyPositionCache:F.current};return C.map((t,n)=>{if(P){const r=P(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[C,P,s,a,g,_,L,B]);return y||w||A||M||J&&J.length>0||x||R?c.createElement("svg",{role:"img",width:l,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},c.createElement("title",null,"string"==typeof w?w:"Ordinal Chart"),c.createElement("desc",null,"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"),c.createElement("g",{transform:`translate(${h.left},${h.top})`},x&&g&&!D&&!H&&c.createElement("g",{className:"ordinal-grid"},W.map((e,t)=>c.createElement("line",{key:"grid-"+t,x1:T?e.pixel:0,y1:T?0:e.pixel,x2:T?e.pixel:s,y2:T?a:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),y&&g&&!D&&c.createElement("g",{className:"ordinal-axes"},T?c.createElement(c.Fragment,null,!H&&c.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),f&&c.createElement("text",{x:15-h.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${a/2})`,style:{userSelect:"none"}},f),!H&&c.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${a})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&c.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},m)):c.createElement(c.Fragment,null,!H&&c.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((e,t)=>c.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${a})`},c.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),f&&c.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!H&&c.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((e,t)=>c.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},c.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),c.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&c.createElement("text",{x:15-h.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${a/2})`,style:{userSelect:"none"}},m))),J,M,R),w&&c.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),function(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",title:s,legendHoverBehavior:a,legendClickBehavior:l,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const g="top"===i||"bottom"===i;let y,p;return"left"===i?(y=4,p=r.top):"top"===i?(y=0,p=s?32:8):"bottom"===i?(y=0,p=o-r.bottom+50):(y=n-r.right+10,p=r.top),c.createElement("g",{transform:`translate(${y}, ${p})`},"object"==typeof(f=t)&&null!==f&&"gradient"in f?c.createElement($,{config:t.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?c.createElement(I,{legendGroups:t.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:l,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t);var f}({legend:A,totalWidth:l,totalHeight:d,margin:h,legendPosition:E,title:w,legendHoverBehavior:k,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:j})):null}function J(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const ee="undefined"==typeof window||"undefined"==typeof document,te={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ne(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"},i=["point","line","area","rect","heatcell","circle","candlestick"],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(", ")}`}function oe({scene:e,chartType:t}){var n,o,r,i;const s=[];for(const t of e){if(s.length>=50)break;"point"===t.type?s.push({label:"Point",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+""}}):"rect"===t.type?s.push({label:"Bar",values:{category:(null===(n=t.datum)||void 0===n?void 0:n.category)||"",value:Math.round(100*(null!==(r=null===(o=t.datum)||void 0===o?void 0:o.value)&&void 0!==r?r:0))/100+""}}):"heatcell"===t.type&&s.push({label:"Cell",values:{x:Math.round(100*t.x)/100+"",y:Math.round(100*t.y)/100+"",value:Math.round(100*(null!==(i=t.value)&&void 0!==i?i:0))/100+""}})}if(0===s.length)return null;const a=new Set;for(const e of s)for(const t of Object.keys(e.values))a.add(t);const l=Array.from(a);return c.createElement("table",{style:te,role:"table","aria-label":"Data table for "+t},c.createElement("thead",null,c.createElement("tr",null,l.map(e=>c.createElement("th",{key:e},e)))),c.createElement("tbody",null,s.map((e,t)=>c.createElement("tr",{key:t},l.map(t=>{var n;return c.createElement("td",{key:t},null!==(n=e.values[t])&&void 0!==n?n:"")}))),e.length>50&&c.createElement("tr",null,c.createElement("td",{colSpan:l.length},"...and ",e.length-50," more items"))))}function re({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Focused on data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+n}return c.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:te},t)}function ie(t){const n=e.createContext(null),o=se(t);return[function({children:o}){const r=e.useMemo(()=>se(t),[]);return c.createElement(n.Provider,{value:r,children:o})},t=>{var r;const i=null!==(r=e.useContext(n))&&void 0!==r?r:o,s=e.useRef(t);s.current=t;const a=e.useCallback(()=>s.current(i.getState()),[i]),l=e.useCallback(()=>s.current(i.getState()),[i]);return e.useSyncExternalStore(i.subscribe,a,l)}]}function se(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 ae={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},le={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},ce={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"},[ue,de]=ie(e=>({theme:ae,setTheme(t){e(e=>{if("light"===t)return{theme:ae};if("dark"===t)return{theme:le};if("high-contrast"===t)return{theme:ce};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?le:ae;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 he(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ge(e,t,n=.3){he(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 ye(e,t,n=.6){var o,r,i,s,a;if(!he(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 pe(e,t,n,o=.35){he(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const fe=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?me(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),ge(e,t),e.globalAlpha=1};function me(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 ve=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);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=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),ye(e,t),e.globalAlpha=1}}finally{e.restore()}};function be(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()}const xe=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"wedge"===e.type);for(const t of s)be(e,t),e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0&&(be(e,t),pe(e,t)),e.globalAlpha=1},we=(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=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=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()}},Ae=(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=n.style.stroke||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 ke(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 Se(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Oe=null;function je(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):(Oe||(Oe=document.createElement("canvas")),Oe.width=e,Oe.height=e,Oe)}(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 Ee=new Map;function Me(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Ee.get(n);if(void 0!==o)return o;const r=je({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ee.set(n,r),r}function Ce(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 Pe(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 _e(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Le=e=>[Ae,...e],Be={bar:Le([fe]),clusterbar:Le([fe]),point:Le([ve]),swarm:Le([ve]),pie:[xe],donut:[xe],boxplot:Le([(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()}},ve]),violin:Le([we]),histogram:Le([fe]),ridgeline:Le([we]),timeline:Le([fe]),funnel:[fe,(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=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?ke(r):null!=i?`${ke(r)} (${Se(i)})`:ke(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=ke(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":[fe,(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=Me(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?_e(r):"",a=Pe(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,y=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(),Ce(e,g,y,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Ce(e,g,y,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,y+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(a,h,y+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(a,h,y+3))}e.lineWidth=1}}]},He={top:50,right:40,bottom:60,left:70},Re={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 De({hover:e}){var t,n,o,r,i,s;const a=e.data||{},l=e.stats,u=e.category;if(Array.isArray(a)){const e=u||(null===(t=a[0])||void 0===t?void 0:t.category)||"";if(l)return c.createElement("div",{className:"semiotic-tooltip",style:Re},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,"n = ",l.n),c.createElement("div",null,"Min: ",l.min.toLocaleString()),c.createElement("div",null,"Q1: ",l.q1.toLocaleString()),c.createElement("div",null,"Median: ",l.median.toLocaleString()),c.createElement("div",null,"Q3: ",l.q3.toLocaleString()),c.createElement("div",null,"Max: ",l.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",l.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=a.length;return c.createElement("div",{className:"semiotic-tooltip",style:Re},e&&c.createElement("div",{style:{fontWeight:"bold"}},e+""),c.createElement("div",null,n," items"))}if(null!=a.bin&&null!=a.count){const e=a.range||[];return c.createElement("div",{className:"semiotic-tooltip",style:Re},a.category&&c.createElement("div",{style:{fontWeight:"bold"}},a.category+""),c.createElement("div",null,"Count: ",a.count),2===e.length&&c.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const d=e.__oAccessor,h=e.__rAccessor,g=e.__chartType;if("swarm"===g||"point"===g){const e=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:Re},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}const y=(d&&null!=a[d]?a[d]:null)||a.category||a.name||a.group||a.__rName||"",p=null!==(s=null!==(i=null!==(r=null!==(o=null!==(n=a.__aggregateValue)&&void 0!==n?n:h&&null!=a[h]?a[h]:null)&&void 0!==o?o:a.value)&&void 0!==r?r:a.__rValue)&&void 0!==i?i:a.pct)&&void 0!==s?s:"";if(!y&&""===p){const e=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return c.createElement("div",{className:"semiotic-tooltip",style:Re},e.map(([e,t])=>c.createElement("div",{key:e},c.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return c.createElement("div",{className:"semiotic-tooltip",style:Re},y&&c.createElement("div",{style:{fontWeight:"bold"}},y+""),""!==p&&c.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const Te=e.forwardRef(function(t,n){var o,r,s,a,l,u,h;const{chartType:g,runtimeMode:y,data:p,oAccessor:f="category",rAccessor:m="value",colorAccessor:v,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:A,valueAccessor:k,categoryAccessor:S,projection:O="vertical",size:j=[600,400],responsiveWidth:E,responsiveHeight:C,margin:R,barPadding:D,innerRadius:T,normalize:N,startAngle:$,dynamicColumnWidth:I,bins:z,showOutliers:W,showIQR:F,amplitude:q,connectorOpacity:G,showLabels:V,connectorAccessor:X,connectorStyle:Y,rExtent:K,oExtent:U,extentPadding:te=.05,oSort:ie,windowMode:se="sliding",windowSize:ae=200,pieceStyle:le,summaryStyle:ce,colorScheme:ue,barColors:he,showAxes:ge=!0,showCategoryTicks:ye,oLabel:pe,rLabel:fe,oFormat:me,rFormat:ve,enableHover:be=!0,hoverAnnotation:xe,tooltipContent:we,customHoverBehavior:Ae,annotations:ke,svgAnnotationRules:Se,showGrid:Oe=!1,legend:je,legendHoverBehavior:Ee,legendClickBehavior:Me,legendHighlightedCategory:Ce,legendIsolatedCategories:Pe,legendPosition:_e,backgroundGraphics:Le,foregroundGraphics:Re,title:Te,className:Ne,background:$e,centerContent:Ie,decay:ze,pulse:We,transition:Fe,staleness:qe,accessibleTable:Ge}=t,[Ve,Xe]=function(t,n,o){const r=e.useRef(null),[i,s]=e.useState(null);return e.useEffect(()=>{if(!n&&!o)return;const e=r.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[r,[n&&i?i.w:t[0],o&&i?i.h:t[1]]]}(j,E,C),Ye=e.useMemo(()=>Object.assign(Object.assign({},He),R),[R]),Ke=Xe[0]-Ye.left-Ye.right,Qe=Xe[1]-Ye.top-Ye.bottom,Ue="function"==typeof Re?Re({size:Xe,margin:Ye}):Re,Ze=e.useRef(null),Je=e.useRef(!0),et=de(e=>e.theme),tt=e.useRef(0),nt=e.useRef(null),ot=e.useRef(()=>{}),[rt,it]=e.useState(null),[st,at]=e.useState(null),[lt,ct]=e.useState(0),[ut,dt]=e.useState(!1),ht=be||xe,gt="streaming"===y,yt=e.useMemo(()=>({chartType:g,runtimeMode:gt?"streaming":"bounded",windowSize:ae,windowMode:se,extentPadding:te,projection:O,oAccessor:gt?void 0:f,rAccessor:gt?void 0:m,colorAccessor:v,stackBy:b,groupBy:x,multiAxis:w,timeAccessor:gt?A:void 0,valueAccessor:gt?k||("string"==typeof m||"function"==typeof m?m:void 0):void 0,categoryAccessor:gt?S||f:void 0,rExtent:K,oExtent:U,barPadding:D,innerRadius:T,normalize:N,startAngle:$,dynamicColumnWidth:I,bins:z,showOutliers:W,showIQR:F,amplitude:q,connectorOpacity:G,showLabels:V,connectorAccessor:X,connectorStyle:Y,oSort:ie,pieceStyle:le,summaryStyle:ce,colorScheme:ue,barColors:he,decay:ze,pulse:We,transition:Fe,staleness:qe}),[g,ae,se,te,O,f,m,v,b,x,w,A,k,S,K,U,D,T,N,$,I,z,W,F,q,G,V,X,Y,ie,le,ce,ue,he,ze,We,Fe,qe,gt]),pt=e.useRef(null);pt.current||(pt.current=new M(yt));const ft=e.useCallback(()=>{tt.current||(tt.current=requestAnimationFrame(()=>ot.current()))},[]);e.useEffect(()=>{var e;null===(e=pt.current)||void 0===e||e.updateConfig(yt),Je.current=!0,ft()},[yt,ft]),e.useEffect(()=>{Je.current=!0,ft()},[et,ft]);const mt=e.useRef(null);mt.current||(mt.current=new d(e=>{const t=pt.current;t&&t.ingest(e)&&(Je.current=!0,ft())}));const vt=e.useCallback(e=>{var t;null===(t=mt.current)||void 0===t||t.push(e)},[]),bt=e.useCallback(e=>{var t;null===(t=mt.current)||void 0===t||t.pushMany(e)},[]),xt=e.useCallback(()=>{var e,t;null===(e=mt.current)||void 0===e||e.clear(),null===(t=pt.current)||void 0===t||t.clear(),Je.current=!0,ft()},[ft]);e.useImperativeHandle(n,()=>({push:vt,pushMany:bt,clear:xt,getData:()=>{var e,t,n;return null===(e=mt.current)||void 0===e||e.flush(),null!==(n=null===(t=pt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=pt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[vt,bt,xt]),e.useEffect(()=>{var e;p&&(null===(e=mt.current)||void 0===e||e.setBoundedData(p))},[p]);const wt=e.useRef(()=>{}),At=e.useRef(()=>{});wt.current=e=>{if(!ht)return;const t=Ze.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ye.left,r=e.clientY-n.top-Ye.top;if(0>o||o>Ke||0>r||r>Qe)return void(nt.current&&(nt.current=null,it(null),Ae&&Ae(null),ft()));const i=pt.current;if(!i||0===i.scene.length)return;const s="radial"===O,a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=P(i,t,n);break;case"point":e=_(i,t,n);break;case"wedge":e=L(i,t,n);break;case"boxplot":e=B(i,t,n);break;case"violin":e=H(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,s?o-Ke/2:o,s?r-Qe/2:r);if(!a)return void(nt.current&&(nt.current=null,it(null),Ae&&Ae(null),ft()));const l=a.datum||{},c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{data:l,time:a.x,value:a.y,x:a.x,y:a.y}),a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof f?f:void 0,__rAccessor:"string"==typeof m?m:void 0,__chartType:g});nt.current=c,it(c),Ae&&(Ae(c),Je.current=!0),ft()},At.current=()=>{nt.current&&(nt.current=null,it(null),Ae&&(Ae(null),Je.current=!0),ft())},e.useCallback(e=>wt.current(e),[]);const kt=e.useCallback(()=>At.current(),[]),St=e.useRef(-1),Ot=e.useCallback(e=>{const t=pt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x)t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum});else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum});else if("wedge"===n.type&&null!=n.cx){const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=St.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return St.current=-1,nt.current=null,it(null),Ae&&Ae(null),void ft();const i=0>o?0:r;St.current=i;const s=Object.assign(Object.assign({},function(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}(n[i])),{__oAccessor:"string"==typeof f?f:void 0,__rAccessor:"string"==typeof m?m:void 0,__chartType:g});nt.current=s,it(s),Ae&&Ae(s),ft()},[Ae,ft]),jt=e.useCallback(e=>{St.current=-1,wt.current(e)},[]);ot.current=()=>{var e,t;tt.current=0;const n=Ze.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=pt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(i),a=Je.current;a&&!s&&(r.computeScene({width:Ke,height:Qe}),Je.current=!1),(a||s)&&n.setAttribute("aria-label",ne(r.scene,g+" chart"));const l="undefined"!=typeof window&&window.devicePixelRatio||1,c=Xe[0]*l,u=Xe[1]*l;n.width===c&&n.height===u||(n.width=c,n.height=u,n.style.width=Xe[0]+"px",n.style.height=Xe[1]+"px"),o.setTransform(l,0,0,l,0,0),o.clearRect(0,0,Xe[0],Xe[1]);const d=null!==(e=null==qe?void 0:qe.threshold)&&void 0!==e?e:5e3,h=qe&&r.lastIngestTime>0&&i-r.lastIngestTime>d;h&&(o.globalAlpha=null!==(t=null==qe?void 0:qe.dimOpacity)&&void 0!==t?t:.5);const y=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",p=$e||(y&&"transparent"!==y?y:null);p&&(o.fillStyle=p,o.fillRect(0,0,Xe[0],Xe[1]));const f="radial"===O;f?(o.save(),o.translate(Ye.left+Ke/2,Ye.top+Qe/2)):o.translate(Ye.left,Ye.top);const m=Be[g]||[],v={width:Ke,height:Qe};for(const e of m)e(o,r.scene,r.scales,v);f&&o.restore(),h&&(o.globalAlpha=1),a&&r.scales&&(at(r.scales),ct(e=>e+1)),(null==qe?void 0:qe.showBadge)&&dt(!!h),(s||r.hasActivePulses)&&(tt.current=requestAnimationFrame(()=>ot.current()))},e.useEffect(()=>(ft(),()=>{tt.current&&(cancelAnimationFrame(tt.current),tt.current=0)}),[ft]),e.useEffect(()=>{Je.current=!0,ft()},[g,Ke,Qe,ge,$e,ft]),function(t,n,o,r,i,s){e.useEffect(()=>{if(!t)return;const e=setInterval(()=>{var e;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(e=t.threshold)&&void 0!==e?e:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),o.current=!0,r())},1e3);return()=>clearInterval(e)},[t,i,r])}(qe,pt,Je,ft,ut,dt);const Et=ht&&rt?we?we(rt):c.createElement(De,{hover:rt}):null,Mt="radial"===O,Ct=rt?Mt?rt.x+Ke/2:rt.x:0,Pt=rt?Mt?rt.y+Qe/2:rt.y:0,_t=Et?c.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:Ye.left+Ct,top:Ye.top+Pt,transform:`translate(${Ct>.7*Ke?"calc(-100% - 12px)":"12px"}, ${.3*Qe>Pt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1,width:"max-content"}},Et):null;if(ee){const e=pt.current;e&&p&&(e.ingest({inserts:p,bounded:!0}),e.computeScene({width:Ke,height:Qe}));const t=null!==(o=null==e?void 0:e.scene)&&void 0!==o?o:[],n=null!==(r=null==e?void 0:e.scales)&&void 0!==r?r:null,s="radial"===O,a=s?Ye.left+Ke/2:Ye.left,l=s?Ye.top+Qe/2:Ye.top;return c.createElement("div",{className:"stream-ordinal-frame"+(Ne?" "+Ne:""),role:"img","aria-label":"string"==typeof Te?Te:"Ordinal chart",style:{position:"relative",width:Xe[0],height:Xe[1]}},c.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Xe[0],height:Xe[1],style:{position:"absolute",left:0,top:0}},Le&&c.createElement("g",{transform:`translate(${Ye.left},${Ye.top})`},Le),c.createElement("g",{transform:`translate(${a},${l})`},$e&&c.createElement("rect",{x:0,y:0,width:Ke,height:Qe,fill:$e}),t.map((e,t)=>function(e,t){var n,o,r,s,a;const l=e.category||e.group||"",u=n=>`ord-${e.type}-${l}-${t}-${n}`,d=`ord-${e.type}-${l}-${t}`;switch(e.type){case"rect":{const t=e;return c.createElement("rect",{key:d,x:t.x,y:t.y,width:t.w,height:t.h,fill:J(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}case"point":{const t=e;return c.createElement("circle",{key:d,cx:t.x,cy:t.y,r:t.r,fill:J(t.style.fill),opacity:null!==(n=t.style.opacity)&&void 0!==n?n:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}case"wedge":{const t=e,n=i.arc().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle).endAngle(t.endAngle)({})||"";return c.createElement("path",{key:d,d:n,transform:`translate(${t.cx},${t.cy})`,fill:J(t.style.fill),stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity})}case"boxplot":{const t=e,n=t.columnWidth/2;return"vertical"===t.projection?c.createElement("g",{key:d},c.createElement("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:J(t.style.fill),fillOpacity:null!==(o=t.style.fillOpacity)&&void 0!==o?o:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})):c.createElement("g",{key:d},c.createElement("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:J(t.style.fill),fillOpacity:null!==(r=t.style.fillOpacity)&&void 0!==r?r:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),c.createElement("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}))}case"violin":{const t=e,n=[c.createElement("path",{key:u("path"),d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:J(t.style.fill),fillOpacity:null!==(s=t.style.fillOpacity)&&void 0!==s?s:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1})];if(t.iqrLine&&t.bounds){const e=t.bounds,o=e.x+e.width/2,r=e.y+e.height/2;e.height>e.width?n.push(c.createElement("line",{key:u("iqr"),x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:u("med"),cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1})):n.push(c.createElement("line",{key:u("iqr"),x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2}),c.createElement("circle",{key:u("med"),cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1}))}return c.createElement("g",{key:d},n)}case"connector":return c.createElement("line",{key:d,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:null!==(a=e.style.opacity)&&void 0!==a?a:.5});case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return c.createElement("polygon",{key:d,points:n,fill:J(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}default:return null}}(e,t)).filter(Boolean))),c.createElement(Z,{width:Ke,height:Qe,totalWidth:Xe[0],totalHeight:Xe[1],margin:Ye,scales:n,showAxes:ge,showCategoryTicks:ye,oLabel:pe,rLabel:fe,oFormat:me,rFormat:ve,showGrid:Oe,title:Te,legend:je,legendHoverBehavior:Ee,legendClickBehavior:Me,legendHighlightedCategory:Ce,legendIsolatedCategories:Pe,legendPosition:_e,foregroundGraphics:Ue,annotations:ke,svgAnnotationRules:Se,annotationFrame:0,xAccessor:"string"==typeof f?f:void 0,yAccessor:"string"==typeof m?m:void 0,annotationData:null==e?void 0:e.getData()}),Ie&&"radial"===O&&c.createElement("div",{style:{position:"absolute",left:Ye.left+Ke/2,top:Ye.top+Qe/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ie))}return c.createElement("div",{ref:Ve,className:"stream-ordinal-frame"+(Ne?" "+Ne:""),role:"img","aria-label":"string"==typeof Te?Te:"Ordinal chart",tabIndex:0,style:{position:"relative",width:E?"100%":Xe[0],height:C?"100%":Xe[1],overflow:"visible"},onMouseMove:ht?jt:void 0,onMouseLeave:ht?kt:void 0,onKeyDown:Ot},Le&&c.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Xe[0],height:Xe[1],pointerEvents:"none"}},c.createElement("g",{transform:`translate(${Ye.left},${Ye.top})`},Le)),c.createElement(Q,{width:Ke,height:Qe,totalWidth:Xe[0],totalHeight:Xe[1],margin:Ye,scales:st,showAxes:ge,showGrid:Oe,rFormat:ve}),c.createElement("canvas",{ref:Ze,"aria-label":ne(null!==(a=null===(s=pt.current)||void 0===s?void 0:s.scene)&&void 0!==a?a:[],g+" chart"),style:{position:"absolute",top:0,left:0,width:Xe[0],height:Xe[1]}}),c.createElement(re,{hoverPoint:rt}),Ge&&c.createElement(oe,{scene:null!==(u=null===(l=pt.current)||void 0===l?void 0:l.scene)&&void 0!==u?u:[],chartType:g+" chart"}),c.createElement(Z,{width:Ke,height:Qe,totalWidth:Xe[0],totalHeight:Xe[1],margin:Ye,scales:st,showAxes:ge,showCategoryTicks:ye,oLabel:pe,rLabel:fe,oFormat:me,rFormat:ve,showGrid:Oe,title:Te,legend:je,legendHoverBehavior:Ee,legendClickBehavior:Me,legendHighlightedCategory:Ce,legendIsolatedCategories:Pe,legendPosition:_e,foregroundGraphics:Ue,annotations:ke,svgAnnotationRules:Se,annotationFrame:lt,xAccessor:"string"==typeof f?f:void 0,yAccessor:"string"==typeof m?m:void 0,annotationData:null===(h=pt.current)||void 0===h?void 0:h.getData(),underlayRendered:!0}),Ie&&"radial"===O&&c.createElement("div",{style:{position:"absolute",left:Ye.left+Ke/2,top:Ye.top+Qe/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ie),(null==qe?void 0:qe.showBadge)&&c.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===qe.badgePosition?{top:4,left:4}:"bottom-left"===qe.badgePosition?{bottom:4,left:4}:"bottom-right"===qe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:ut?"#dc3545":"#28a745",color:"white"})},ut?"STALE":"LIVE"),_t)});Te.displayName="StreamOrdinalFrame";const Ne=e.createContext(null);function $e(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 Ie(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[ze,We]=ie(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Ie(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=Ie(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}})}})),[Fe,qe]=ie(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Ge(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=We(e=>e.selections.get(r)),s=We(e=>e.setClause),a=We(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push($e(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(r,{clientId:o,type:"point",fields:t})},[o,r,s]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(r,{clientId:o,type:"interval",fields:t})},[o,r,s]),clear:e.useCallback(()=>{a(r,o)},[a,r,o]),clientId:o}}const Ve=e.createContext(!1);function Xe({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):x[i%x.length];return{label:r+"",color:a}}),label:""}]}}function Ye(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 Ke(){var e;const t=de(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 Qe(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=v[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 Ue(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const r="function"==typeof(i=o)?i:e=>e[i];var i;return e.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[t,n,o])}c.createContext(void 0);const Ze={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 Je(e,t,n){var o,r,i,s,a,l;const c=Ze[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(r=t.height)&&void 0!==r?r:c.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||c.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:et(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function et(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 tt={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 nt(e,t){return"function"==typeof t?t(e):e[t]}function ot(e,t){return t?t(e):null==e?"":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":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 rt(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=nt(e,n);s=ot(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=nt(e,r);a.push({label:n,value:ot(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=ot(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=ot(e[t[0]],o))}}const l=Object.assign(Object.assign({},tt),r);return c.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},s&&c.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},s),a.map((e,t)=>c.createElement("div",{key:t,style:{marginTop:0===t&&s?"4px":0}},e.label&&c.createElement("span",null,e.label,": "),e.value)))}}function it(e){if(!0===e)return rt();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:c.createElement("div",{className:"semiotic-tooltip",style:tt},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?rt(e):rt())}function st(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function at(e,t){return"function"==typeof t?t(e):e[t]}function lt({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:r=!1}){return i=>{var s;const a=r?(null===(s=i.data)||void 0===s?void 0:s[0])||i.data||i:i.data||i,l=at(a,e),u=at(a,t),d=n?at(a,n):void 0;return c.createElement("div",{className:"semiotic-tooltip",style:tt},c.createElement("div",{style:{fontWeight:"bold"}},st(l)),c.createElement("div",{style:{marginTop:4}},st(u)),null!=d&&c.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(h=n)?h:"value"),": ",st(d)));var h}}function ct({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return c.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},c.createElement("div",{style:{textAlign:"center",maxWidth:400}},c.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),c.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&c.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},n)))}class ut extends c.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:c.createElement(ct,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function dt(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 ht(e,t,n=3){let o,r=n+1;for(const n of t){const t=dt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function gt(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function yt(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=ht(e,t,3))&&void 0!==n?n:null)}function pt({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=gt(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=yt(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const ft={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"}},mt={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},vt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},bt=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],xt=["vertical","horizontal"],wt={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),mt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:bt},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({},ft),mt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:bt},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),mt),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:bt},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({},ft),mt),{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({},ft),mt),{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({},ft),mt),{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({},ft),mt),{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({},ft),mt),{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({},ft),mt),{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({},ft),vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),vt),{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({},ft),vt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:xt},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},ft),vt),{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"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},ft),{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({},ft),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:xt},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},ft),{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({},ft),{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({},ft),{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({},ft),{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({},ft),{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"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function At(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const kt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),St=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Ot=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),jt=new Set(["LineChart","AreaChart","StackedAreaChart"]),Et=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Mt(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 Ct(e,t){const n=Mt(e),o=Mt(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Pt=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function _t(e,t){const n=[],o=function(e,t){const n=[],o=wt[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(wt).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(!At(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=ht(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const s=pt({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=gt(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=yt(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 wt[e]?(function(e,t,n){const o=wt[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=wt[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){kt.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){St.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=wt[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(!Ot.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(!jt.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=wt[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(!Et.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=Ct(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=[];for(const e of Pt)"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 Lt;const Bt="undefined"!=typeof process&&"production"!==(null===(Lt=process.env)||void 0===Lt?void 0:Lt.NODE_ENV);function Ht({componentName:e,width:t,height:n,chartProps:o,children:r}){return c.createElement(ut,{fallback:r=>{let i="";if(Bt&&o)try{const t=_t(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return c.createElement(ct,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const Rt={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"},Dt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Tt(e,t,n,o){if(!Bt)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 Nt(t){const{data:n,rawData:o,colorBy:r,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:y,chartId:p,showLegend:f,userMargin:m,marginDefaults:v,loading:b,emptyContent:x,width:w,height:S}=t,{activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:E}=function({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:s,chartId:a}){const l=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}:null}(n,o),c=Ge({name:(null==t?void 0:t.name)||"__unused__"}),u=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:s,clear:a}=Ge({name:n});return{onHover:e.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:r,isActive:i}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||o||[]}),d=qe(e=>e.pushObservation),h=t?{isActive:c.isActive,predicate:c.predicate}:null,g=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}else u.onHover(null);if(i||d){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},n),{type:"hover",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(s),d&&d(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),d&&d(e)}}},[n,u,i,s,a,d]),y=e.useCallback(e=>{var t,n;if(i||d){const o={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const s=Object.assign(Object.assign({},o),{type:"click",datum:r||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});i&&i(s),d&&d(s)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});i&&i(e),d&&d(e)}}},[i,d,s,a]);return{activeSelectionHook:h,customHoverBehavior:g,customClickBehavior:y}}({selection:l,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:y,chartId:p}),M=function(t,n,o="category10"){const r=e.useContext(Ne);return e.useMemo(()=>{if(n){if(0===t.length)return r&&Object.keys(r).length>0?e=>r[e]||"#999":void 0;if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));return r&&Object.keys(r).length>0?e=>r[e]||"#999":k(e.map(e=>({_cat:e})),"_cat",o)}if(r&&Object.keys(r).length>0){const e=k(t,n,o);return t=>r[t]||e(t)}return k(t,n,o)}},[t,n,o,r])}(n,r,i),C=e.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of n){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[n,r]),P=function(t,n,o){const[r,i]=e.useState(null),[s,a]=e.useState(new Set),l=e.useCallback(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=e.useCallback(e=>{"isolate"===t&&a(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===o.length?new Set:n})},[t,o.length]),u=e.useMemo(()=>{if(!t||"none"===t||!n)return null;const e="string"==typeof n?n:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(e?t[e]:"function"==typeof n?n(t):null)===r}:"isolate"===t&&s.size>0?{isActive:!0,predicate:t=>{const o=e?t[e]:"function"==typeof n?n(t):null;return s.has(o)}}:null},[t,n,r,s]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(s,r,C),_=e.useMemo(()=>P.legendSelectionHook?P.legendSelectionHook:O,[P.legendSelectionHook,O]),{legend:L,margin:B,legendPosition:H}=function({data:t,colorBy:n,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=e.useContext(Ve),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return Xe({data:t,colorBy:n,colorScale:o,getColor:A,categories:l})},[u,n,t,o,l]),h=e.useMemo(()=>{const e=Object.assign(Object.assign({},a),s);return d&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[a,s,d,i]);return{legend:d,margin:h,legendPosition:i}}({data:n,colorBy:r,colorScale:M,showLegend:f,legendPosition:a,userMargin:m,defaults:v}),R=e.useMemo(()=>{const e={};return L&&(e.legend=L,e.legendPosition=H),s&&"none"!==s&&(e.legendHoverBehavior=P.onLegendHover,e.legendClickBehavior=P.onLegendClick,e.legendHighlightedCategory=P.highlightedCategory,e.legendIsolatedCategories=P.isolatedCategories),e},[L,H,s,P.onLegendHover,P.onLegendClick,P.highlightedCategory,P.isolatedCategories]),D=function(e,t,n){if(!e)return null;const o=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*o))),i=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(r+i)-i))/2);return c.createElement("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:o},(e,n)=>c.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Dt),{position:"absolute",top:s+n*(r+i),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})})))}(b,w,S),T=D?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?c.createElement("div",{style:Object.assign(Object.assign({},Rt),{width:t,height:n})},o||"No data available"):null}(o,w,S,x);return{colorScale:M,allCategories:C,legendState:P,effectiveSelectionHook:_,activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:E,legend:L,margin:B,legendPosition:H,earlyReturn:D||T||null,legendBehaviorProps:R}}const $t=e.forwardRef(function(t,n){const o=Je(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",sort:p=!1,barPadding:f=40,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M,color:C,showCategoryTicks:P}=t,_=o.width,L=o.height,B=o.enableHover,H=o.showGrid,R=o.title,D=o.categoryLabel,T=o.valueLabel,N=i||[],$=Nt({data:N,rawData:i,colorBy:g,colorScheme:y,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,chartType:"BarChart",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:_,height:L});if($.earlyReturn)return $.earlyReturn;Tt("BarChart",N,"categoryAccessor",l),Tt("BarChart",N,"valueAccessor",u);const I=Ue(N,p,u),z=Ke(),W=e.useMemo(()=>new Map,[N]),F=e.useMemo(()=>(e,t)=>{const n={};return n.fill=g?A(e,g,$.colorScale):Qe(C,z,y,void 0,W),n},[g,$.colorScale,C,z,y,W]),q=e.useMemo(()=>Ye(F,$.effectiveSelectionHook,x),[F,$.effectiveSelectionHook,x]),G=e.useMemo(()=>lt({categoryAccessor:l,valueAccessor:u,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group"}),[l,u,g]),V=pt({componentName:"BarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(V)return c.createElement(ct,{componentName:"BarChart",message:V,width:_,height:L});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:I}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:q,size:[_,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:$.margin,barPadding:f,enableHover:B,showAxes:o.showAxes,oLabel:D,rLabel:T,rFormat:h,showGrid:H,showCategoryTicks:P,oSort:p}),$.legendBehaviorProps),R&&{title:R}),a&&{className:a}),{tooltipContent:!1===m?()=>null:it(m)||G}),(w||k)&&{customHoverBehavior:$.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Ht,{componentName:"BarChart",width:_,height:L},c.createElement(Te,Object.assign({ref:r},X)))});function It({isPushMode:t,colorBy:n,colorScheme:o,showLegend:r,legendPosition:i="right"}){const s=e.useRef(new Set),a=e.useRef([]),[l,c]=e.useState(0),u=e.useCallback(e=>{if(!n)return null;const t="function"==typeof n?n(e):e[n];return null!=t?t+"":null},[n]),d=e.useCallback(e=>{if(!t||!n)return;let o=!1;for(const t of e){if(!t||"object"!=typeof t)continue;const e=u(t);null==e||s.current.has(e)||(s.current.add(e),a.current.push(e),o=!0)}o&&c(e=>e+1)},[t,n,u]),h=e.useCallback(e=>t=>{d([t]),e(t)},[d]),g=e.useCallback(e=>t=>{d(t),e(t)},[d]),y=e.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]),p=e.useMemo(()=>{if(!t||!n||!1===r)return;const e=a.current;if(0===e.length)return;const i=Array.isArray(o)?o:x,s=new Map;for(let t=0;e.length>t;t++)s.set(e[t],i[t%i.length]);const l="string"==typeof n?n:"__streamCat";return Xe({data:e.map(e=>({[l]:e})),colorBy:l,colorScale:e=>s.get(e)||"#999",getColor:A})},[t,n,r,o,l]),f=e.useMemo(()=>{if(p)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[p,i]);return{wrapPush:h,wrapPushMany:g,resetCategories:y,streamingLegend:p,streamingMarginAdjust:f}}$t.displayName="BarChart";const zt=e.forwardRef(function(t,n){const o=Je(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:y,colorScheme:p="category10",normalize:f=!1,barPadding:m=40,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendInteraction:M,legendPosition:C,color:P}=t,_=o.width,L=o.height,B=o.enableHover,H=o.showGrid,R=o.showLegend,D=o.title,T=o.categoryLabel,N=o.valueLabel,$=i||[],I=y||u,z=It({isPushMode:void 0===i,colorBy:I,colorScheme:p,showLegend:R,legendPosition:C}),W=e.useCallback(z.wrapPush(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)}),[z.wrapPush]),F=e.useCallback(z.wrapPushMany(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)}),[z.wrapPushMany]);e.useImperativeHandle(n,()=>({push:W,pushMany:F,clear:()=>{var e;z.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[W,F,z.resetCategories]);const q=Nt({data:$,rawData:i,colorBy:I,colorScheme:p,legendInteraction:M,legendPosition:C,selection:w,linkedHover:k,fallbackFields:I?["string"==typeof I?I:""]:[],unwrapData:!0,onObservation:S,chartType:"StackedBarChart",chartId:O,showLegend:R,userMargin:s,marginDefaults:o.marginDefaults,loading:j,emptyContent:E,width:_,height:L});if(q.earlyReturn)return q.earlyReturn;const G=Ke(),V=e.useMemo(()=>new Map,[$]),X=e.useMemo(()=>(e,t)=>I?q.colorScale?{fill:A(e,I,q.colorScale)}:{}:{fill:Qe(P,G,p,t,V)},[I,q.colorScale,P,G,p,V]),Y=e.useMemo(()=>Ye(X,q.effectiveSelectionHook,w),[X,q.effectiveSelectionHook,w]),K=e.useMemo(()=>lt({categoryAccessor:u,valueAccessor:d,groupAccessor:l}),[u,l,d]),Q=pt({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:d},requiredProps:{stackBy:u}}),U=e.useMemo(()=>z.streamingLegend?Object.assign(Object.assign({},q.legendBehaviorProps),{legend:z.streamingLegend,legendPosition:C||q.legendPosition}):q.legendBehaviorProps,[q.legendBehaviorProps,q.legendPosition,z.streamingLegend,C]),Z=e.useMemo(()=>{if(z.streamingMarginAdjust){const e=Object.assign({},q.margin);for(const[t,n]of Object.entries(z.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return q.margin},[q.margin,z.streamingMarginAdjust]),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:$}),{oAccessor:l,rAccessor:d,stackBy:u,normalize:f,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:Y,size:[_,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,barPadding:m,enableHover:B,showAxes:o.showAxes,oLabel:T,rLabel:N,rFormat:g,showGrid:H}),U),D&&{title:D}),a&&{className:a}),{tooltipContent:!1===v?()=>null:it(v)||K}),(k||S)&&{customHoverBehavior:q.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return Q?c.createElement(ct,{componentName:"StackedBarChart",message:Q,width:_,height:L}):c.createElement(Ht,{componentName:"StackedBarChart",width:_,height:L},c.createElement(Te,Object.assign({ref:r},J)))});zt.displayName="StackedBarChart";const Wt=e.forwardRef(function(t,n){const o=Je(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:y,colorScheme:p="category10",barPadding:f=60,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M,color:C}=t,P=o.width,_=o.height,L=o.enableHover,B=o.showGrid,H=o.showLegend,R=o.title,D=o.categoryLabel,T=o.valueLabel,N=i||[],$=y||u,I=It({isPushMode:void 0===i,colorBy:$,colorScheme:p,showLegend:H,legendPosition:M}),z=e.useCallback(I.wrapPush(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)}),[I.wrapPush]),W=e.useCallback(I.wrapPushMany(e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)}),[I.wrapPushMany]);e.useImperativeHandle(n,()=>({push:z,pushMany:W,clear:()=>{var e;I.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[z,W,I.resetCategories]);const F=Nt({data:N,rawData:i,colorBy:$,colorScheme:p,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:k,chartType:"GroupedBarChart",chartId:S,showLegend:H,userMargin:s,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:P,height:_});if(F.earlyReturn)return F.earlyReturn;const q=Ke(),G=e.useMemo(()=>new Map,[N]),V=e.useMemo(()=>(e,t)=>$?F.colorScale?{fill:A(e,$,F.colorScale)}:{}:{fill:Qe(C,q,p,t,G)},[$,F.colorScale,C,q,p,G]),X=e.useMemo(()=>Ye(V,F.effectiveSelectionHook,x),[V,F.effectiveSelectionHook,x]),Y=e.useMemo(()=>lt({categoryAccessor:u,valueAccessor:d,groupAccessor:l}),[u,l,d]),K=pt({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:d},requiredProps:{groupBy:u}}),Q=e.useMemo(()=>I.streamingLegend?Object.assign(Object.assign({},F.legendBehaviorProps),{legend:I.streamingLegend,legendPosition:M||F.legendPosition}):F.legendBehaviorProps,[F.legendBehaviorProps,F.legendPosition,I.streamingLegend,M]),U=e.useMemo(()=>{if(I.streamingMarginAdjust){const e=Object.assign({},F.margin);for(const[t,n]of Object.entries(I.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return F.margin},[F.margin,I.streamingMarginAdjust]),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=i&&{data:N}),{oAccessor:l,rAccessor:d,groupBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:X,size:[P,_],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,barPadding:f,enableHover:L,showAxes:o.showAxes,oLabel:D,rLabel:T,rFormat:g,showGrid:B}),Q),R&&{title:R}),a&&{className:a}),{tooltipContent:!1===m?()=>null:it(m)||Y}),(w||k)&&{customHoverBehavior:F.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return K?c.createElement(ct,{componentName:"GroupedBarChart",message:K,width:P,height:_}):c.createElement(Ht,{componentName:"GroupedBarChart",width:P,height:_},c.createElement(Te,Object.assign({ref:r},Z)))});Wt.displayName="GroupedBarChart";const Ft=e.forwardRef(function(t,n){const o=Je(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",sizeBy:p,sizeRange:f=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:w,frameProps:k={},selection:S,linkedHover:O,onObservation:j,chartId:E,loading:M,emptyContent:C,legendInteraction:P,legendPosition:_,color:L,showCategoryTicks:B}=t,H=o.width,R=o.height,D=o.enableHover,T=o.showGrid,N=o.title,$=o.categoryLabel,I=o.valueLabel,z=i||[],W=Nt({data:z,rawData:i,colorBy:g,colorScheme:y,legendInteraction:P,legendPosition:_,selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:j,chartType:"SwarmPlot",chartId:E,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:M,emptyContent:C,width:H,height:R});if(W.earlyReturn)return W.earlyReturn;const F=e.useMemo(()=>{if(!p)return;const e=z.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[z,p]),q=Ke(),G=e.useMemo(()=>new Map,[z]),V=e.useMemo(()=>(e,t)=>{const n={fillOpacity:v};return n.fill=g?A(e,g,W.colorScale):Qe(L,q,y,void 0,G),n.r=p?function(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}(e,p,f,F):m,n},[g,W.colorScale,p,f,F,m,v,L,q,y,G]),X=e.useMemo(()=>Ye(V,W.effectiveSelectionHook,S),[V,W.effectiveSelectionHook,S]),Y=e.useMemo(()=>lt({categoryAccessor:l,valueAccessor:u,groupAccessor:g||void 0}),[l,u,g]),K=pt({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(K)return c.createElement(ct,{componentName:"SwarmPlot",message:K,width:H,height:R});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=i&&{data:z}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:X,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,barPadding:b,enableHover:D,showAxes:o.showAxes,oLabel:$,rLabel:I,rFormat:h,showGrid:T,showCategoryTicks:B}),W.legendBehaviorProps),N&&{title:N}),a&&{className:a}),{tooltipContent:!1===x?()=>null:it(x)||Y}),(O||j)&&{customHoverBehavior:W.customHoverBehavior}),w&&w.length>0&&{annotations:w}),k);return c.createElement(Ht,{componentName:"SwarmPlot",width:H,height:R},c.createElement(Te,Object.assign({ref:r},Q)))});Ft.displayName="SwarmPlot";const qt=e.forwardRef(function(t,n){const o=Je(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:y="category10",showOutliers:p=!0,categoryPadding:f=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M,color:C,showCategoryTicks:P}=t,_=o.width,L=o.height,B=o.enableHover,H=o.showGrid,R=o.title,D=o.categoryLabel,T=o.valueLabel,N=i||[],$=Nt({data:N,rawData:i,colorBy:g,colorScheme:y,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"BoxPlot",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:_,height:L});if($.earlyReturn)return $.earlyReturn;const I=Ke(),z=e.useMemo(()=>new Map,[N]),W=e.useMemo(()=>e=>{const t=g?A(e,g,$.colorScale):Qe(C,I,y,void 0,z);return{fill:t,stroke:t,fillOpacity:.8}},[g,$.colorScale,C,I,y,z]),F=e.useMemo(()=>Ye(W,$.effectiveSelectionHook,x),[W,$.effectiveSelectionHook,x]),q=e.useMemo(()=>e=>{const t=e.stats||(e.data||e).stats||{};return c.createElement("div",{className:"semiotic-tooltip",style:tt},c.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(e.category||(e.data||e).category||"")+""),null!=t.median&&c.createElement(c.Fragment,null,null!=t.n&&c.createElement("div",null,"n = ",t.n),c.createElement("div",null,"Median: ",t.median.toLocaleString()),c.createElement("div",null,"Q1: ",t.q1.toLocaleString()),c.createElement("div",null,"Q3: ",t.q3.toLocaleString()),c.createElement("div",null,"Min: ",t.min.toLocaleString()),c.createElement("div",null,"Max: ",t.max.toLocaleString())))},[]),G=pt({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(G)return c.createElement(ct,{componentName:"BoxPlot",message:G,width:_,height:L});const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=i&&{data:N}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:F,showOutliers:p,size:[_,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:$.margin,barPadding:f,enableHover:B,showAxes:o.showAxes,oLabel:D,rLabel:T,rFormat:h,showGrid:H,showCategoryTicks:P}),$.legendBehaviorProps),R&&{title:R}),a&&{className:a}),{tooltipContent:!1===m?()=>null:it(m)||q}),(w||k)&&{customHoverBehavior:$.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Ht,{componentName:"BoxPlot",width:_,height:L},c.createElement(Te,Object.assign({ref:r},V)))});qt.displayName="BoxPlot";const Gt=e.forwardRef(function(t,n){const o=Je(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:"horizontal"}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:y,colorScheme:p="category10",categoryPadding:f=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:S,loading:O,emptyContent:j,legendPosition:E,color:M,showCategoryTicks:C}=t,P=o.width,_=o.height,L=o.enableHover,B=o.showGrid,H=o.title,R=o.categoryLabel,D=o.valueLabel,T=i||[],N=Nt({data:T,rawData:i,colorBy:y,colorScheme:p,legendInteraction:void 0,legendPosition:E,selection:x,linkedHover:w,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"Histogram",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:O,emptyContent:j,width:P,height:_});if(N.earlyReturn)return N.earlyReturn;const $=e.useMemo(()=>{if(0===T.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of T){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[T,u]),I=Ke(),z=e.useMemo(()=>new Map,[T]),W=e.useMemo(()=>e=>{const t=y?A(e,y,N.colorScale):Qe(M,I,p,void 0,z);return{fill:t,stroke:t,fillOpacity:.8}},[y,N.colorScale,M,I,p,z]),F=e.useMemo(()=>Ye(W,N.activeSelectionHook,x),[W,N.activeSelectionHook,x]),q=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return c.createElement("div",{className:"semiotic-tooltip",style:tt},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&c.createElement("div",null,"Count: ",o),r&&2===r.length&&c.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),G=pt({componentName:"Histogram",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(G)return c.createElement(ct,{componentName:"Histogram",message:G,width:P,height:_});const V=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!=i&&{data:T}),{oAccessor:l,rAccessor:u,projection:"horizontal",summaryStyle:F,bins:d,normalize:h}),$&&{rExtent:$}),{size:[P,_],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,barPadding:f,enableHover:L,showAxes:o.showAxes,oLabel:R,rLabel:D,rFormat:g,showGrid:B,showCategoryTicks:C}),N.legendBehaviorProps),H&&{title:H}),a&&{className:a}),{tooltipContent:!1===m?()=>null:it(m)||q}),(w||k)&&{customHoverBehavior:N.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Ht,{componentName:"Histogram",width:P,height:_},c.createElement(Te,Object.assign({ref:r},V)))});Gt.displayName="Histogram";const Vt=e.forwardRef(function(t,n){const o=Je(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:s,className:a,categoryAccessor:l="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:y,colorBy:p,colorScheme:f="category10",categoryPadding:m=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendPosition:M,color:C,showCategoryTicks:P}=t,_=o.width,L=o.height,B=o.enableHover,H=o.showGrid,R=o.title,D=o.categoryLabel,T=o.valueLabel,N=i||[],$=Nt({data:N,rawData:i,colorBy:p,colorScheme:f,legendInteraction:void 0,legendPosition:M,selection:w,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:S,chartType:"ViolinPlot",chartId:O,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:j,emptyContent:E,width:_,height:L});if($.earlyReturn)return $.earlyReturn;const I=Ke(),z=e.useMemo(()=>new Map,[N]),W=e.useMemo(()=>e=>{const t=p?A(e,p,$.colorScale):Qe(C,I,f,void 0,z);return{fill:t,stroke:t,fillOpacity:.6}},[p,$.colorScale,C,I,f,z]),F=e.useMemo(()=>Ye(W,$.activeSelectionHook,w),[W,$.activeSelectionHook,w]),q=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;if(o)return c.createElement("div",{className:"semiotic-tooltip",style:tt},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const r=(Array.isArray(e.data)?e.data:[]).map(e=>{const t="function"==typeof u?u(e):e[u];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),i=r.length,s=i>0?r[Math.floor(i/2)]:null;return c.createElement("div",{className:"semiotic-tooltip",style:tt},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),i>0&&c.createElement("div",null,"n = ",i),null!=s&&c.createElement("div",null,"Median: ",s.toLocaleString()))},[u]),G=pt({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:u}});if(G)return c.createElement(ct,{componentName:"ViolinPlot",message:G,width:_,height:L});const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=i&&{data:N}),{oAccessor:l,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:F,bins:h,showIQR:g,size:[_,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:$.margin,barPadding:m,enableHover:B,showAxes:o.showAxes,oLabel:D,rLabel:T,rFormat:y,showGrid:H,showCategoryTicks:P}),$.legendBehaviorProps),R&&{title:R}),a&&{className:a}),{tooltipContent:!1===v?()=>null:it(v)||q}),(k||S)&&{customHoverBehavior:$.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return c.createElement(Ht,{componentName:"ViolinPlot",width:_,height:L},c.createElement(Te,Object.assign({ref:r},V)))});Vt.displayName="ViolinPlot";const Xt=e.forwardRef(function(t,n){var o;const r=Je(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:s,margin:a,className:l,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:y,colorScheme:p="category10",sort:f=!0,dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:S,onObservation:O,chartId:j,loading:E,emptyContent:M,legendInteraction:C,legendPosition:P,color:_}=t,L=r.width,B=r.height,H=r.enableHover,R=r.showGrid,D=r.title,T=r.categoryLabel,N=r.valueLabel,$=s||[],I=Nt({data:$,rawData:s,colorBy:y,colorScheme:p,legendInteraction:C,legendPosition:P,selection:k,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,chartType:"DotPlot",chartId:j,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:E,emptyContent:M,width:L,height:B});if(I.earlyReturn)return I.earlyReturn;const z=Ue($,f,d),W=Ke(),F=e.useMemo(()=>new Map,[$]),q=e.useMemo(()=>(e,t)=>{const n={r:m,fillOpacity:.8};return n.fill=y?A(e,y,I.colorScale):Qe(_,W,p,void 0,F),n},[y,I.colorScale,m,_,W,p,F]),G=e.useMemo(()=>Ye(q,I.effectiveSelectionHook,k),[q,I.effectiveSelectionHook,k]),V=e.useMemo(()=>lt({categoryAccessor:u,valueAccessor:d}),[u,d]),X=pt({componentName:"DotPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(X)return c.createElement(ct,{componentName:"DotPlot",message:X,width:L,height:B});const Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=s&&{data:z}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:G,size:[L,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:I.margin,barPadding:v,enableHover:H,showAxes:r.showAxes,oLabel:T,rLabel:N,rFormat:g,showGrid:R,oSort:f}),I.legendBehaviorProps),D&&{title:D}),l&&{className:l}),{tooltipContent:!1===b?()=>null:it(b)||V}),(S||O)&&{customHoverBehavior:I.customHoverBehavior}),x&&x.length>0&&{annotations:x}),w);return c.createElement(Ht,{componentName:"DotPlot",width:L,height:B},c.createElement(Te,Object.assign({ref:i},Y)))});Xt.displayName="DotPlot";const Yt=e.forwardRef(function(t,n){var o,r;const i=Je(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(r=t.height)&&void 0!==r?r:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,showCategoryTicks:t.showCategoryTicks}),s=e.useRef(null),{data:a,margin:l,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:y="category10",startAngle:p=0,tooltip:f,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:S,emptyContent:O,legendInteraction:j,legendPosition:E,color:M}=t,C=i.width,P=i.height,_=i.enableHover,L=i.showLegend,B=i.title,H=a||[],R=g||d,D=It({isPushMode:void 0===a,colorBy:R,colorScheme:y,showLegend:L,legendPosition:E}),T=e.useCallback(D.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[D.wrapPush]),N=e.useCallback(D.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[D.wrapPushMany]);e.useImperativeHandle(n,()=>({push:T,pushMany:N,clear:()=>{var e;D.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:[]}}),[T,N,D.resetCategories]);const $=Nt({data:H,rawData:a,colorBy:R,colorScheme:y,legendInteraction:j,legendPosition:E,selection:b,linkedHover:x,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:w,chartType:"PieChart",chartId:k,showLegend:L,userMargin:l,marginDefaults:i.marginDefaults,loading:S,emptyContent:O,width:C,height:P});if($.earlyReturn)return $.earlyReturn;const I=Ke(),z=e.useMemo(()=>new Map,[H]),W=e.useMemo(()=>(e,t)=>R?$.colorScale?{fill:A(e,R,$.colorScale)}:{}:{fill:Qe(M,I,y,t,z)},[R,$.colorScale,M,I,y,z]),F=e.useMemo(()=>Ye(W,$.effectiveSelectionHook,b),[W,$.effectiveSelectionHook,b]),q=e.useMemo(()=>lt({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),G=pt({componentName:"PieChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h}}),V=e.useMemo(()=>D.streamingLegend?Object.assign(Object.assign({},$.legendBehaviorProps),{legend:D.streamingLegend,legendPosition:E||$.legendPosition}):$.legendBehaviorProps,[$.legendBehaviorProps,$.legendPosition,D.streamingLegend,E]),X=e.useMemo(()=>{if(D.streamingMarginAdjust){const e=Object.assign({},$.margin);for(const[t,n]of Object.entries(D.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return $.margin},[$.margin,D.streamingMarginAdjust]),Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=a&&{data:H}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:F,startAngle:p,size:[C,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,enableHover:_,showAxes:!1}),V),B&&{title:B}),u&&{className:u}),{tooltipContent:!1===f?()=>null:it(f)||q}),(x||w)&&{customHoverBehavior:$.customHoverBehavior}),m&&m.length>0&&{annotations:m}),v);return G?c.createElement(ct,{componentName:"PieChart",message:G,width:C,height:P}):c.createElement(Ht,{componentName:"PieChart",width:C,height:P},c.createElement(Te,Object.assign({ref:s},Y)))});Yt.displayName="PieChart";const Kt=e.forwardRef(function(t,n){var o,r;const i=Je(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(r=t.height)&&void 0!==r?r:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks}),s=e.useRef(null),{data:a,margin:l,className:u,categoryAccessor:d="category",valueAccessor:h="value",innerRadius:g=60,centerContent:y,colorBy:p,colorScheme:f="category10",startAngle:m=0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:S,chartId:O,loading:j,emptyContent:E,legendInteraction:M,legendPosition:C,color:P}=t,_=i.width,L=i.height,B=i.enableHover,H=i.showLegend,R=i.title,D=a||[],T=p||d,N=It({isPushMode:void 0===a,colorBy:T,colorScheme:f,showLegend:H,legendPosition:C}),$=e.useCallback(N.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[N.wrapPush]),I=e.useCallback(N.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[N.wrapPushMany]);e.useImperativeHandle(n,()=>({push:$,pushMany:I,clear:()=>{var e;N.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:[]}}),[$,I,N.resetCategories]);const z=Nt({data:D,rawData:a,colorBy:T,colorScheme:f,legendInteraction:M,legendPosition:C,selection:w,linkedHover:k,fallbackFields:T?["string"==typeof T?T:""]:[],unwrapData:!0,onObservation:S,chartType:"DonutChart",chartId:O,showLegend:H,userMargin:l,marginDefaults:i.marginDefaults,loading:j,emptyContent:E,width:_,height:L});if(z.earlyReturn)return z.earlyReturn;const W=Ke(),F=e.useMemo(()=>new Map,[D]),q=e.useMemo(()=>(e,t)=>T?z.colorScale?{fill:A(e,T,z.colorScale)}:{}:{fill:Qe(P,W,f,t,F)},[T,z.colorScale,P,W,f,F]),G=e.useMemo(()=>Ye(q,z.effectiveSelectionHook,w),[q,z.effectiveSelectionHook,w]),V=e.useMemo(()=>lt({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group",pieData:!0}),[d,h,p]),X=pt({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h}}),Y=e.useMemo(()=>N.streamingLegend?Object.assign(Object.assign({},z.legendBehaviorProps),{legend:N.streamingLegend,legendPosition:C||z.legendPosition}):z.legendBehaviorProps,[z.legendBehaviorProps,z.legendPosition,N.streamingLegend,C]),K=e.useMemo(()=>{if(N.streamingMarginAdjust){const e=Object.assign({},z.margin);for(const[t,n]of Object.entries(N.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return z.margin},[z.margin,N.streamingMarginAdjust]),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:D}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:G,innerRadius:g,startAngle:m,centerContent:y,size:[_,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K,enableHover:B,showAxes:!1}),Y),R&&{title:R}),u&&{className:u}),{tooltipContent:!1===v?()=>null:it(v)||V}),(k||S)&&{customHoverBehavior:z.customHoverBehavior}),b&&b.length>0&&{annotations:b}),x);return X?c.createElement(ct,{componentName:"DonutChart",message:X,width:_,height:L}):c.createElement(Ht,{componentName:"DonutChart",width:_,height:L},c.createElement(Te,Object.assign({ref:s},Q)))});function Qt(t){const n=Je(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),{data:o,margin:r,className:i,categoryAccessor:s="category",valueAccessor:a="value",orientation:l="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:p=5,tooltip:f,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k,loading:S,emptyContent:O,legendPosition:j,color:E,showCategoryTicks:M}=t,C=n.width,P=n.height,_=n.enableHover,L=n.showGrid,B=n.title,H=n.categoryLabel,R=n.valueLabel,D=o||[],T=Nt({data:D,rawData:o,colorBy:g,colorScheme:y,legendInteraction:void 0,legendPosition:j,selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"RidgelinePlot",chartId:k,showLegend:n.showLegend,userMargin:r,marginDefaults:n.marginDefaults,loading:S,emptyContent:O,width:C,height:P});if(T.earlyReturn)return T.earlyReturn;const N=Ke(),$=e.useMemo(()=>new Map,[D]),I=e.useMemo(()=>e=>{const t=g?A(e,g,T.colorScale):Qe(E,N,y,void 0,$);return{fill:t,stroke:t,fillOpacity:.5}},[g,T.colorScale,E,N,y,$]),z=e.useMemo(()=>Ye(I,T.activeSelectionHook,b),[I,T.activeSelectionHook,b]),W=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;return o?c.createElement("div",{className:"semiotic-tooltip",style:tt},n&&c.createElement("div",{style:{fontWeight:"bold"}},n+""),c.createElement("div",null,"n = ",o.n),c.createElement("div",null,"Min: ",o.min.toLocaleString()),c.createElement("div",null,"Q1: ",o.q1.toLocaleString()),c.createElement("div",null,"Median: ",o.median.toLocaleString()),c.createElement("div",null,"Q3: ",o.q3.toLocaleString()),c.createElement("div",null,"Max: ",o.max.toLocaleString()),c.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):c.createElement("div",{className:"semiotic-tooltip",style:tt},c.createElement("div",{style:{fontWeight:"bold"}},n+""))},[]),F=pt({componentName:"RidgelinePlot",data:o,accessors:{categoryAccessor:s,valueAccessor:a}});if(F)return c.createElement(ct,{componentName:"RidgelinePlot",message:F,width:C,height:P});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=o&&{data:D}),{oAccessor:s,rAccessor:a,projection:"horizontal"===l?"horizontal":"vertical",summaryStyle:z,bins:u,size:[C,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:T.margin,barPadding:p,enableHover:_,showAxes:n.showAxes,oLabel:H,rLabel:R,rFormat:h,showGrid:L,showCategoryTicks:M,oSort:!1,amplitude:d}),T.legendBehaviorProps),B&&{title:B}),i&&{className:i}),{tooltipContent:!1===f?()=>null:it(f)||W}),(x||w)&&{customHoverBehavior:T.customHoverBehavior}),m&&m.length>0&&{annotations:m}),v);return c.createElement(Ht,{componentName:"RidgelinePlot",width:C,height:P},c.createElement(Te,Object.assign({},q)))}Kt.displayName="DonutChart",Qt.displayName="RidgelinePlot";const Ut=e.forwardRef(function(t,n){const o=Je(t.mode,{width:t.width,height:t.height,showGrid:!1,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,showCategoryTicks:!1}),r=e.useRef(null);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=r.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const{data:i,margin:s,className:a,stepAccessor:l="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g="category10",orientation:y="horizontal",connectorOpacity:p=.3,showLabels:f=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:S,loading:O,emptyContent:j,legendInteraction:E,legendPosition:M,color:C}=t,P="vertical"===y,_=o.width,L=o.height,B=o.enableHover,H=o.title,R=i||[],D=h||d,T=!D,N=Nt({data:R,rawData:i,colorBy:D,colorScheme:g,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:D?["string"==typeof D?D:""]:[],unwrapData:!0,onObservation:k,chartType:"FunnelChart",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:P?{top:H?60:40,right:20,bottom:60,left:60}:{top:H?40:10,right:10,bottom:10,left:10},loading:O,emptyContent:j,width:_,height:L});if(N.earlyReturn)return N.earlyReturn;Tt("FunnelChart",R,"stepAccessor",l),Tt("FunnelChart",R,"valueAccessor",u);const $=Ke(),I=e.useMemo(()=>new Map,[R]),z=e.useMemo(()=>{if(T)return C||((null==$?void 0:$[0])?$[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[T,C,$,g]),W=e.useMemo(()=>(e,t)=>{const n={};return n.fill=z||(D?A(e,D,N.colorScale):Qe(C,$,g,t,I)),n},[z,D,N.colorScale,C,$,g,I]),F=e.useMemo(()=>Ye(W,N.effectiveSelectionHook,x),[W,N.effectiveSelectionHook,x]),q=e.useMemo(()=>e=>{var t,n,o,r,i,s;const a=(null==e?void 0:e.data)||e,l=(null==a?void 0:a.__funnelStep)||(null==a?void 0:a.__barFunnelStep)||(null==a?void 0:a.step)||"",u=null!==(o=null!==(n=null!==(t=null==a?void 0:a.__funnelValue)&&void 0!==t?t:null==a?void 0:a.__barFunnelValue)&&void 0!==n?n:null==a?void 0:a.value)&&void 0!==o?o:"",d=null!==(r=null==a?void 0:a.__funnelPercent)&&void 0!==r?r:null==a?void 0:a.__barFunnelPercent,h=null!==(i=null==a?void 0:a.__funnelIsFirstStep)&&void 0!==i?i:null==a?void 0:a.__barFunnelIsFirstStep,g=null==a?void 0:a.__barFunnelIsDropoff,y=null!==(s=null==a?void 0:a.__barFunnelCategory)&&void 0!==s?s:null==a?void 0:a.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return c.createElement("div",{className:"semiotic-tooltip",style:tt},l&&c.createElement("div",{style:{fontWeight:"bold"}},l+""),y&&y!==l&&c.createElement("div",{style:{marginTop:2,opacity:.8}},y+""),g&&c.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),c.createElement("div",{style:{marginTop:4}},u+"",p))},[]),G=pt({componentName:"FunnelChart",data:i,accessors:{stepAccessor:l,valueAccessor:u}});if(G)return c.createElement(ct,{componentName:"FunnelChart",message:G,width:_,height:L});const V=Object.assign(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:P?"bar-funnel":"funnel"},null!=i&&{data:R}),{oAccessor:l,rAccessor:u}),d&&{stackBy:d}),{projection:P?"vertical":"horizontal",barPadding:P?40:0,pieceStyle:F,size:[_,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:N.margin,enableHover:B,showAxes:P,showCategoryTicks:P,showGrid:P}),!P&&{connectorOpacity:p}),{showLabels:f}),N.legendBehaviorProps),H&&{title:H}),a&&{className:a}),{tooltipContent:!1===m?()=>null:!0===m||null==m?q:it(m)||q}),(w||k)&&{customHoverBehavior:N.customHoverBehavior}),v&&v.length>0&&{annotations:v}),b);return c.createElement(Ht,{componentName:"FunnelChart",width:_,height:L},c.createElement(Te,Object.assign({ref:r},V)))});Ut.displayName="FunnelChart",exports.BarChart=$t,exports.BoxPlot=qt,exports.DonutChart=Kt,exports.DotPlot=Xt,exports.FunnelChart=Ut,exports.GroupedBarChart=Wt,exports.Histogram=Gt,exports.PieChart=Yt,exports.RidgelinePlot=Qt,exports.StackedBarChart=zt,exports.StreamOrdinalFrame=Te,exports.SwarmPlot=Ft,exports.ViolinPlot=Vt,exports.createHatchPattern=je;
|