semiotic 3.2.1 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +47 -5
- package/ai/dist/mcp-server.js +31925 -528
- package/ai/schema.json +76 -1
- package/dist/components/Tooltip/Tooltip.d.ts +6 -1
- package/dist/components/charts/index.d.ts +2 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +2 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +55 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/components/charts/shared/hooks.d.ts +4 -1
- package/dist/components/charts/shared/types.d.ts +10 -5
- package/dist/components/charts/shared/useChartSetup.d.ts +2 -0
- package/dist/components/charts/xy/AreaChart.d.ts +17 -2
- package/dist/components/charts/xy/LineChart.d.ts +14 -3
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-utils.d.ts +2 -1
- package/dist/components/semiotic.d.ts +3 -3
- package/dist/components/store/LinkedCrosshairStore.d.ts +6 -2
- package/dist/components/stream/CanvasHitTester.d.ts +13 -0
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +17 -1
- package/dist/components/stream/SVGOverlay.d.ts +11 -5
- package/dist/components/stream/devDataAccessWarning.d.ts +13 -0
- package/dist/components/stream/hitTestUtils.d.ts +15 -0
- package/dist/components/stream/ordinalTypes.d.ts +7 -1
- package/dist/components/stream/types.d.ts +54 -5
- package/dist/components/stream/xySceneBuilders/mixedScene.d.ts +12 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +15 -0
- 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.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-utils.d.ts +2 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic.d.ts +3 -3
- 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.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +12 -8
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"),s=require("regression"),a=require("d3-selection"),l=require("d3-brush");function c(e){return e&&e.__esModule?e:{default:e}}function u(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 d=u(e),h=c(s);class g{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 p{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 y{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 f(e,t,n){return e+(t-e)*n}function m(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function v(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function b(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const x={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},w=n.schemeCategory10,k=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],A=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 O(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")||A.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):w[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+""))%w.length]}function j(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=x[o]||x.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:w;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 C(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 E(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 M={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,p=[];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),p.push(t))}}else p.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 p){const c=t.get(i);if(!c)continue;let p=c.total;g&&n>0&&(p/=n);const y=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>p?r:o+p),n=0>p?l(r+p)-l(r):l(o)-l(o+p);u.push(S(e.x,t,e.width,Math.abs(n),y,f,i)),0>p?r+=p:o+=p}else if(h){const t=l(0>p?r+p:o),n=0>p?l(r)-l(r+p):l(o+p)-l(o);u.push(S(t,e.x,Math.abs(n),e.width,y,f,i)),0>p?r+=p:o+=p}}}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,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:C,donut:C,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:p}=l,y=[],f="vertical"===p,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,p=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,k=null!==(s=t.find(e=>e>=x))&&void 0!==s?s:l,A=null!==(a=[...t].reverse().find(e=>w>=e))&&void 0!==a?a:c,O=h(e.pieceData[0],e.name),j=[];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;j.push({px:o,py:r,value:n,datum:t})}}if(y.push({type:"boxplot",x:f?e.middle:0,y:f?0:e.middle,projection:f?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(k),q1Pos:g(u),medianPos:g(p),q3Pos:g(v),maxPos:g(A),stats:{n:t.length,min:k,q1:u,median:p,q3:v,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:O,datum:e.pieceData,category:e.name,outliers:j}),m)for(const e of j)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:O.fill||"#999",opacity:.6},datum:e.datum})}return y},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=[],p="vertical"===h,y=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)/y||1,h=Array(y).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),y-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(p){b=`M ${e.middle} ${d(s)}`;for(let t=0;y>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=y-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;y>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=y-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:p}}const k=p?{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:k,iqrLine:w,stats:E(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,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,y=Math.max(...i,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/y)*e.width*.9,s=l(n+t*r),a=l(n+(t+1)*r);c.push(S(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/p*f}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/p*f} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:E(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(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,p=[],y=n.width/2,f=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===m.length)return p;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let k=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>k&&(k=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>k&&(k=o)}if(0===k)return p;const A=new Map;for(const e of v){const t=w[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,j=x?.95*y:.9*n.width,C=t.scaleLinear().domain([0,k]).range([0,j]),E=null!==(r=e.config.connectorOpacity)&&void 0!==r?r:.3;let M=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+=C(o.total))}let r=y,i=y;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=C(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const w=g(c.pieces[0],l),k=null!==(a=A.get(l))&&void 0!==a?a:c.total,O=k>0?c.total/k*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=y,j.__funnelStepLabelY=d,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+m/2,j.__funnelValueLabelY=d,j.__funnelBarW=m),p.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=C(e),a=y-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,k=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});f&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=y,k.__funnelStepLabelY=d,k.__funnelRowWidth=r,k.__funnelValueLabelX=y,k.__funnelValueLabelY=d,k.__funnelBarW=r),p.push(S(a,d,r,u,x,k,b)),h.set(l,{x:a,y:d,w:r,h:u})}if(e>0&&M.size>0){const e=x?v:[v[0]];for(const o of e){const e=M.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:E},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};p.push(s)}}M=h}return p},"bar-funnel":function(e,t){var n,o,r,i;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=a(o);r.total+=i,r.pieces.push(o),n+=i}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(i=null==w?void 0:w.total)&&void 0!==i?i:f,A=o?0:Math.max(0,k-f),O=n.x+e*a+l/2,j=v(f),C=v(0)-j,E=c(p.pieces[0],y?h:n.name),M=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+A)});if(d.push(S(O,j,u,C,E,M,y?h:n.name)),A>0){const e=v(f+A),t=j-e,o=Object.assign({},E),r=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(S(O,e,u,t,o,r,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=s(n,l);if(u){const r=a(t),i=a(t+o);c.push(S(r,e.x,i-r,e.width,d,n,l))}else{const r=a(t+o),i=a(t);c.push(S(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class _{constructor(e){this.rExtent=new y,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 p(e.windowSize),this.getO=b(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>v(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new y)):(this.getR=v(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=b(e.stackBy),this.getGroup=b(e.groupBy),this.getColor=b(e.colorAccessor),this.getConnector=b(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new p(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,r,i;const s=this.config.chartType,a=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let l=0,c=0;if("bar"===s&&this.getStack&&this.config.normalize)l=0,c=1;else if("bar"===s&&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>c&&(c=e);for(const e of n.values())l>e&&(l=e)}else if("bar"===s){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>c&&(c=e),l>e&&(l=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>c&&(c=e)}else if("clusterbar"===s||"bar-funnel"===s)for(const t of e){const e=this.getR(t);e>c&&(c=e),l>e&&(l=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(l=e),t!==-1/0&&(c=t)}if(this.config.rExtent&&(null!=this.config.rExtent[0]&&(l=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(c=this.config.rExtent[1])),"bar-funnel"!==s){const e=c-l,t=e>0?e*a:1;null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&(l-=t),null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])&&(c+=t)}return"bar"!==s&&"clusterbar"!==s&&"bar-funnel"!==s&&"swimlane"!==s||null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(l>0&&(l=0),0>c&&(c=0)),[l,c]}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=M[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:k,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 p=new Set,y=new Map;for(let e=0;this.scene.length>e;e++){const a=this.scene[e],l=this.getNodeKey(a,y);if(!l)continue;a._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===a.type?c?(p.add(l),a._targetOpacity=null!==(t=a.style.opacity)&&void 0!==t?t:1,c.x===a.x&&c.y===a.y||(a._targetX=a.x,a._targetY=a.y,a.x=c.x,a.y=c.y,g=!0)):(a._targetOpacity=null!==(n=a.style.opacity)&&void 0!==n?n:1,a.style=Object.assign(Object.assign({},a.style),{opacity:0}),g=!0):"rect"===a.type&&(c?(p.add(l),a._targetOpacity=null!==(o=a.style.opacity)&&void 0!==o?o:1,c.x===a.x&&c.y===a.y&&c.w===a.w&&c.h===a.h||(a._targetX=a.x,a._targetY=a.y,a._targetW=a.w,a._targetH=a.h,a.x=c.x,a.y=c.y,a.w=null!==(r=c.w)&&void 0!==r?r:a.w,a.h=null!==(i=c.h)&&void 0!==i?i:a.h,g=!0)):(a._targetOpacity=null!==(s=a.style.opacity)&&void 0!==s?s:1,a.style=Object.assign(Object.assign({},a.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)p.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(a=t.r)&&void 0!==a?a:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=f(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=f(o.x,e._targetX,i),e.y=f(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=f(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=f(n.x,e._targetX,i),e.y=f(n.y,e._targetY,i),void 0!==n.w&&(e.w=f(n.w,e._targetW,i),e.h=f(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)&&(m(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=b(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)=>!m(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>v(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new y)):(this.getR=v(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!m(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?b(this.config.stackBy):void 0),"groupBy"in e&&!m(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?b(this.config.groupBy):void 0),"colorAccessor"in e&&!m(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?b(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!m(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?b(this.config.connectorAccessor):void 0)}}function P(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function L(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 B(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,12)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function T(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=P(Math.atan2(r,o)),a=P(e.startAngle),l=P(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 R(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}}function I(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function D(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}const N={fill:e=>d.createElement("rect",{style:e,width:16,height:16}),line:e=>d.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function $(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,N[n])(o(e,t)),r}function F(){return d.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function z(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function W({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-"+d.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(d.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return d.createElement("g",{"aria-label":i||"Gradient legend"},d.createElement("defs",null,d.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&d.createElement("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),d.createElement("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),d.createElement("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[0])),d.createElement("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[1])))}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(d.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return d.createElement("g",{"aria-label":i||"Gradient legend"},i&&d.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),d.createElement("defs",null,d.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),d.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),d.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[1])),d.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[0])))}function q(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical"}=e,[h,g]=d.useState(0),[p,y]=d.useState(0),f=d.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c})=>{let u=24;const h=[];return e.forEach((e,g)=>{u+=5,h.push(d.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,h.push(d.createElement("text",{key:"legend-text-"+g,y:u,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),u+=8),h.push(d.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,s,a,l,c)=>{const{type:u="fill",styleFn:h,items:g}=e,p=[];let y=0;const f=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return g.forEach((e,c)=>{const v=$(e,c,u,h),b=z(e,o,r),x=r&&r.size>0&&r.has(e.label);p.push(d.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:f?a===i&&c===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=(c+("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,c),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&&d.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&&d.createElement(F,null),d.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),y+=22}),p})(e,n,o,r,i,s,a,g,l,c))),u+=22*e.items.length+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:s}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let h=0;const g=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const y=((e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:g,items:p}=e,y=[];let f=0,m=0;const v=!(!t&&!n),b="isolate"===c||void 0===c&&null!=r;p.forEach((e,c)=>{const x=$(e,c,h,g),w=z(e,o,r),k=r&&r.size>0&&r.has(e.label),A=26+7*e.label.length;u&&u>0&&f>0&&f+A>u&&(m++,f=0),y.push(d.createElement("g",{key:"legend-item-"+c,transform:`translate(${f},${22*m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:v?a===i&&c===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?k||!1:void 0,"aria-current":v&&!b&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:v?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(c+("ArrowRight"===n.key?1:-1)+p.length)%p.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:v?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&d.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&d.createElement(F,null),d.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=A});let x=0,w=0;for(const e of p){const t=26+7*e.label.length;u&&u>0&&w>0&&w+t>u?(x=Math.max(x,w),w=t):w+=t}x=Math.max(x,w);const k=m+1;return{items:y,offset:x,totalRows:k,totalHeight:22*k}})(e,o,r,i,s,a,l,t,c,u,n);p+=y.offset+5,g.push(Object.assign(Object.assign({label:e.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),h+=p+12});let p=h>n?0:Math.max(0,(n-h)/2);const y=[];return g.forEach((n,o)=>{const r=e[o];r.label&&(y.push(d.createElement("text",{key:"legend-text-"+o,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),p+=16),y.push(d.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${p},0)`},n.items)),p+=n.offset+5,e[o+1]&&y.push(d.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8})),p+=12}),d.createElement("g",null,y)})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:s}),v=!(!n&&!o);return d.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"===u&&d.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},a),m)}function G(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 V(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 X(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:g,disable:p,events:y={},"data-testid":f}=e,m=new Set(Array.isArray(p)?p:[]);let v=o||0,b=r||0;null!=i&&(v=i-t),null!=s&&(b=s-n);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===v&&0===b)if(void 0!==c.width){v=c.width/2;const e=c.depth||30;b=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;v=e+(0>e?-5:5),b=c.height/2}return d.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":f},y),!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(d.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(d.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 d.createElement("g",{className:"annotation-connector"},s)}(v,b,l,h,x,c),!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(d.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(d.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(d.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(d.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(d.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(d.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(d.createElement("path",{key:"bracket-path",d:V((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 d.createElement("g",{className:"annotation-subject"},s)}(x,c,h,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return d.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return d.createElement("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===u?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>t?"end":"start";const p=16,y=i?c?[i]:G(i,l):[],f=r?c?[r]:G(r,l):[],m="leftRight"===u?"end"===g?-4:4:0;let v=0;const b=[];y.length>0&&(b.push(d.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:g,fontWeight:"bold"},y.map((e,t)=>d.createElement("tspan",{key:t,x:m,dy:0===t?0:p},e)))),v=y.length*p),f.length>0&&b.push(d.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:g,y:v},f.map((e,t)=>d.createElement("tspan",{key:t,x:m,dy:0===t?0:p},e))));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===g?(t=-e,n=0):"middle"===g&&(t=-e/2,n=e/2),x=d.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(y.length+f.length)*p+(f.length>0?p:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=d.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const w=Math.max(0,y.length+f.length-1)*p;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===h?-(w+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),d.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},d.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(a,v,b,h))}function Y(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 d.createElement(X,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return d.createElement("g",null,a)}const a=o.note||{title:"none",label:o.label};return d.createElement(X,Object.assign({"data-testid":"semiotic-annotation",key:`${a.label}-${a.title}-${o.i}`,events:s},o,{type:i}))}function K(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 U(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 Q(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=K(e,n),c=U(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 Z(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const J={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 ee(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:s,scales:a,showAxes:l,showGrid:c,rFormat:u}=t,h="radial"===(null==a?void 0:a.projection),g="horizontal"===(null==a?void 0:a.projection),p=e.useMemo(()=>!a||h?[]:a.r.ticks(5).map(e=>({value:e,pixel:a.r(e),label:(u||te)(e)})),[a,u,h]),y=c&&a&&!h,f=l&&a&&!h;return y||f?d.createElement("svg",{width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},d.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&d.createElement("g",{className:"ordinal-grid"},p.map((e,t)=>d.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&&d.createElement(d.Fragment,null,g?d.createElement(d.Fragment,null,d.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):d.createElement(d.Fragment,null,d.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function te(e){return Math.round(100*e)/100+""}function ne(t){var n,o;const{width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:g,showAxes:p,showCategoryTicks:y,oLabel:f,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:k,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:C="right",foregroundGraphics:E,annotations:M,svgAnnotationRules:_,xAccessor:P,yAccessor:L,annotationData:B,underlayRendered:T,children:R}=t,H="radial"===(null==g?void 0:g.projection),I="horizontal"===(null==g?void 0:g.projection),D=!1!==y,N=e.useMemo(()=>p&&D&&g&&!H?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[p,D,g,v,H]),$=e.useMemo(()=>p&&g&&!H?g.r.ticks(5).map(e=>({value:e,pixel:g.r(e),label:(b||te)(e)})):[],[p,g,b,H]),F=e.useRef(new Map),z=e.useRef(null!==(n=null==M?void 0:M.length)&&void 0!==n?n:0),G=null!==(o=null==M?void 0:M.length)&&void 0!==o?o:0;z.current!==G&&(z.current=G,F.current=new Map);const V=e.useMemo(()=>{if(!M||0===M.length)return null;const e=function(e,t,n){var o,s,a,l,c,u,g,p,y,f,m,v,b,x,w,k,A,O,j,S,C,E,M,_,P,L,B,T,R,H,I,D,N,$,F,z,W,q,G,V,X,ee,te,ne,oe,re,ie,se;switch(e.type){case"label":{const o=Q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Z(r,i,n)?d.createElement(Y,{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=Q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Z(r,i,n)?d.createElement(Y,{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=K(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;return s="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12,d.createElement("g",{key:"ann-"+t},d.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&&d.createElement("text",{x:o+4,y:s,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=U(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(n.width||0)/2,a="middle"):(s=(n.width||0)-4,a="end"),d.createElement("g",{key:"ann-"+t},d.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&&d.createElement("text",{x:s,y:o-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:K(Object.assign(Object.assign({},e),{type:"point"}),n),y:U(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 d.createElement("g",{key:"ann-"+t},d.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&&d.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:K(Object.assign(Object.assign({},e),{type:"point"}),n),y:U(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,c=Math.min(...s)-r,u=Math.max(...s)+r;return d.createElement("g",{key:"ann-"+t},d.createElement("rect",{x:a,y:c,width:l-a,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&d.createElement("text",{x:(a+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return d.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=K(t,n),s=U(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 d.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:s,r:a},l))}))}case"bracket":{const o=K(e,n),r=U(e,n);return d.createElement(Y,{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",p=n.yAccessor||"y",y=r.map(e=>[e[i],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.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!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!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,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(y,null!==(g=e.bandwidth)&&void 0!==g?g:.3):("polynomial"===v?h.default.polynomial(y,{order:e.order||2}):h.default.linear(y)).points;const x=b.map(([e,t])=>`${f(e)},${m(t)}`).join(" "),w=e.color||"#6366f1";return d.createElement("g",{key:"ann-"+t},d.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&d.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!==(y=null===(p=n.scales)||void 0===p?void 0:p.y)&&void 0!==y?y: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 d.createElement("g",{key:"ann-"+t},d.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&&d.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!==(A=null===(k=n.scales)||void 0===k?void 0:k.y)&&void 0!==A?A:null===(O=n.scales)||void 0===O?void 0:O.value;if(!s||!a)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,h=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=J[n.curve||"linear"]||i.curveLinear,p=i.area().x(e=>s(e[r])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(g)(h);if(!p)return null;const y=e.fill||"#6366f1";return d.createElement("g",{key:"ann-"+t},d.createElement("path",{d:p,fill:y,fillOpacity:null!==(j=e.fillOpacity)&&void 0!==j?j:.15,stroke:"none"}),e.label&&h.length>0&&d.createElement("text",{x:s(h[h.length-1][r])+4,y:a(h[h.length-1][l])-4,fill:y,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(C=null===(S=n.scales)||void 0===S?void 0:S.x)&&void 0!==C?C:null===(E=n.scales)||void 0===E?void 0:E.time,s=null!==(_=null===(M=n.scales)||void 0===M?void 0:M.y)&&void 0!==_?_:null===(P=n.scales)||void 0===P?void 0:P.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,c=a.reduce((e,t)=>e+Math.pow(t-l,2),0)/a.length,u=Math.sqrt(c),h=null!==(L=e.threshold)&&void 0!==L?L:2,g=l-h*u,p=!1!==e.showBand,y=e.fill||"#6366f1",f=null!==(B=e.fillOpacity)&&void 0!==B?B:.1,m=e.anomalyColor||"#ef4444",v=null!==(T=e.anomalyRadius)&&void 0!==T?T:6,b=s(l+h*u),x=s(g),w=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return d.createElement("g",{key:"ann-"+t},p&&d.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),w.map((e,t)=>{const o=K(e,n),r=U(e,n);return null==o||null==r?null:d.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&d.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",s=null!==(H=null===(R=n.scales)||void 0===R?void 0:R.x)&&void 0!==H?H:null===(I=n.scales)||void 0===I?void 0:I.time,a=null!==(N=null===(D=n.scales)||void 0===D?void 0:D.y)&&void 0!==N?N:null===($=n.scales)||void 0===$?void 0:$.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 c;if("polynomial"===(e.method||"linear")){const t=h.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,g=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(g/Math.max(u-2,1)),y=l.reduce((e,t)=>e+t[0],0)/u,f=l.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),m=null!==(F=e.confidence)&&void 0!==F?F:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(z=e.steps)&&void 0!==z?z:5,x=l[u-1][0],w=(x-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=c(e),n=p*Math.sqrt(1+1/u+(f>0?Math.pow(e-y,2)/f:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,j=A.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),S=`${s(x)},${a(c(x))}`,C=e.strokeColor||"#6366f1";return d.createElement("g",{key:"ann-"+t},d.createElement("path",{d:O,fill:e.fill||"#6366f1",fillOpacity:null!==(W=e.fillOpacity)&&void 0!==W?W:.15,stroke:"none"}),d.createElement("polyline",{points:`${S} ${j}`,fill:"none",stroke:C,strokeWidth:null!==(q=e.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=e.strokeDasharray)&&void 0!==G?G:"6,3"}),e.label&&A.length>0&&d.createElement("text",{x:s(A[A.length-1].x)+4,y:a(A[A.length-1].yCenter)-4,fill:C,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=Q(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!Z(o,r,n))return null;const i=null!==(V=e.dx)&&void 0!==V?V:0,s=null!==(X=e.dy)&&void 0!==X?X:0,a=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,c=null!==(ne=e.content)&&void 0!==ne?ne:d.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return d.createElement("foreignObject",{key:"ann-"+t,x:o+i-a/2,y:r+s-l/2,width:a,height:l,style:{overflow:"visible",pointerEvents:"auto"}},d.createElement("div",{style:{width:a,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=Q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return d.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=null===(oe=n.scales)||void 0===oe?void 0:oe.o,i=null===(re=n.scales)||void 0===re?void 0:re.x,s=null===(ie=n.scales)||void 0===ie?void 0:ie.y,a=(null==r?void 0:r.bandwidth)?r:(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:null;if(!a)return null;const l=a(o);if(null==l)return null;const c=a.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",h=null!==(se=e.opacity)&&void 0!==se?se:.15,g=e.label;return(n.projection?"vertical"===n.projection:a===i)?d.createElement("g",{key:"ann-"+t},d.createElement("rect",{x:l,y:0,width:c,height:n.height||0,fill:u,fillOpacity:h}),g&&d.createElement("text",{x:l+c/2,y:12,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold"},g)):d.createElement("g",{key:"ann-"+t},d.createElement("rect",{x:0,y:l,width:n.width||0,height:c,fill:u,fillOpacity:h}),g&&d.createElement("text",{x:12,y:l+c/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold"},g))}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,o:g.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:s,height:a,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:F.current};return M.map((t,n)=>{if(_){const r=_(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[M,_,s,a,g,P,L,B]);return p||w||k||E||V&&V.length>0||x||R?d.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},d.createElement("title",null,"string"==typeof w?w:"Ordinal Chart"),d.createElement("desc",null,"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"),d.createElement("g",{transform:`translate(${u.left},${u.top})`},x&&g&&!H&&!T&&d.createElement("g",{className:"ordinal-grid"},$.map((e,t)=>d.createElement("line",{key:"grid-"+t,x1:I?e.pixel:0,y1:I?0:e.pixel,x2:I?e.pixel:s,y2:I?a:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),p&&g&&!H&&d.createElement("g",{className:"ordinal-axes"},I?d.createElement(d.Fragment,null,!T&&d.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>d.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},d.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),f&&d.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},f),!T&&d.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((e,t)=>d.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${a})`},d.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&d.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},m)):d.createElement(d.Fragment,null,!T&&d.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>d.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${a})`},d.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),f&&d.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!T&&d.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((e,t)=>d.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},d.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&d.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},m))),V,E,R),w&&d.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:c,legendIsolatedCategories:u,legendInteraction:h}=e;if(!t)return null;const g="top"===i||"bottom"===i;let p,y;return"left"===i?(p=4,y=r.top):"top"===i?(p=0,y=s?32:8):"bottom"===i?(p=0,y=o-r.bottom+50):(p=n-r.right+10,y=r.top),d.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=t)&&null!==f&&"gradient"in f?d.createElement(W,{config:t.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?d.createElement(q,{legendGroups:t.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:h}):t);var f}({legend:k,totalWidth:l,totalHeight:c,margin:u,legendPosition:C,title:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S})):null}function oe({width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,onBrush:c}){const u=e.useRef(null),h=e.useRef(null),g=e.useRef(c);g.current=c;const p=e.useRef(s);p.current=s;const y=e.useRef(!1),f=e.useRef(null),m="horizontal"===(null==s?void 0:s.projection),v=e.useRef(m);return v.current=m,e.useEffect(()=>{if(!u.current)return;const e=a.select(u.current).select(".brush-g"),o=m?l.brushX():l.brushY();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(y.current)return;const t=p.current;if(!t)return;if(!e.selection)return f.current=null,void g.current(null);const[n,o]=e.selection;let r;r=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};f.current=i,g.current(i)}),e.call(o),h.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),h.current=null}},[t,n,m]),e.useEffect(()=>{if(!s||!h.current||!f.current)return;if(!u.current)return;const e=f.current,t=a.select(u.current).select(".brush-g"),n=s.r(e.r[0]),o=s.r(e.r[1]);m?(y.current=!0,t.call(h.current.move,[n,o]),y.current=!1):(y.current=!0,t.call(h.current.move,[o,n]),y.current=!1)},[s,m]),d.createElement("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},d.createElement("g",{className:"brush-g",transform:`translate(${i.left},${i.top})`,style:{pointerEvents:"all"}}))}function re(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const ie="undefined"==typeof window||"undefined"==typeof document,se=d.createContext(null),ae={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function le(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const ce=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ue={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},de={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},he={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},ge={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},pe={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},ye={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},fe={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function me({scene:e,chartType:t,tableId:n,chartTitle:o}){var r;const[i,s]=d.useState(!1),a=d.useContext(se),l=null!==(r=null==a?void 0:a.visible)&&void 0!==r&&r,c=i||l,u=d.useRef(null),h=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t,g=d.useCallback(()=>{i||l||s(!0)},[i,l]),p=d.useCallback(e=>{var t;l||(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[l]);if(!e||0===e.length)return n?d.createElement("span",{id:n,tabIndex:-1,style:ae}):null;if(!c)return d.createElement("div",{id:n,tabIndex:-1,onFocus:g,style:ae,role:"region","aria-label":h},d.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",e.length," elements)"));const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,k,A,O,j;const S=[];if(!Array.isArray(e))return S;for(const C of e)if(C&&"object"==typeof C)try{switch(C.type){case"point":S.push({label:"Point",values:{x:C.x,y:C.y}});break;case"line":{const e=C.path,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=C.topPath,t=Array.isArray(C.datum)?C.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=C.datum&&"object"==typeof C.datum?C.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:C.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:C.x,y:C.y,value:C.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=C.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=C.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=C.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=C.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=C.cx)&&void 0!==g?g:C.x,y:null!==(p=C.cy)&&void 0!==p?p:C.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=C.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=C.cx)&&void 0!==m?m:C.x,y:null!==(v=C.cy)&&void 0!==v?v:C.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:C.x,open:C.open,high:C.high,low:C.low,close:C.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(A=null!==(w=null===(x=null===(b=C.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(k=C.datum)||void 0===k?void 0:k.name)&&void 0!==A?A:"",value:null!==(j=null===(O=C.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(e),f=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ce(e.min)} to ${ce(e.max)}, mean ${ce(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,f),v=y.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return d.createElement("div",{ref:u,id:n,tabIndex:-1,onBlur:p,style:ue,role:"region","aria-label":h},d.createElement("button",{type:"button",onClick:()=>{l&&a&&a.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:he},"×"),d.createElement("div",{role:"note",style:de},m),d.createElement("table",{role:"table","aria-label":"Sample data for "+t,style:ge},d.createElement("caption",{style:fe},"First ",v.length," of ",y.length," data points"),d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",{style:pe},"type"),x.map(e=>d.createElement("th",{key:e,style:pe},e)))),d.createElement("tbody",null,v.map((e,t)=>d.createElement("tr",{key:t},d.createElement("td",{style:ye},e.label),x.map(t=>{return d.createElement("td",{key:t,style:ye},null==(n=e.values[t])||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":ce(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"");var n}))))))}function ve({summary:e}){return e?d.createElement("div",{role:"note",style:ae},e):null}function be({tableId:e}){return d.createElement("a",{href:"#"+e,style:ae,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ae)}},"Skip to data table")}function xe({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 d.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:ae},t)}const we="var(--semiotic-focus, #005fcc)";function ke({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s}){if(!e||!t)return null;const a=t.x+n.left,l=t.y+n.top;let c;if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);c=d.createElement("rect",{x:a-e/2-3,y:l-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:we,strokeWidth:2,strokeDasharray:"4,2"})}else c=d.createElement("circle","wedge"===r?{cx:a,cy:l,r:12,fill:"none",stroke:we,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:l,r:8,fill:"none",stroke:we,strokeWidth:2,strokeDasharray:"4,2"});return d.createElement("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},c)}function Ae({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=d.useRef(null),[c,u]=d.useState(null);d.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect();u(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,s,n,o]);let h;return h=c?`translate(${c.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${c.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`,d.createElement("div",{ref:l,className:s,style:{position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"}},i)}function Oe(t){const n=e.createContext(null),o=je(t);return[function({children:o}){const r=e.useMemo(()=>je(t),[]);return d.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 je(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const Se={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}},Ce={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}},Ee={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"},[Me,_e]=Oe(e=>({theme:Se,setTheme(t){e(e=>{if("light"===t)return{theme:Se};if("dark"===t)return{theme:Ce};if("high-contrast"===t)return{theme:Ee};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ce:Se;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 Pe(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Le(e,t,n=.3){Pe(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 Be(e,t,n=.6){var o,r,i,s,a;if(!Pe(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 Te(e,t,n,o=.35){Pe(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const Re=(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?He(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))),Le(e,t),e.globalAlpha=1};function He(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 Ie=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Be(e,t),e.globalAlpha=1}}finally{e.restore()}}};function De(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 Ne=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"wedge"===e.type);for(const t of s)De(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&&(De(e,t),Te(e,t)),e.globalAlpha=1},$e=(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()}},Fe=(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 ze(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 We(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let qe=null;function Ge(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):(qe||(qe=document.createElement("canvas")),qe.width=e,qe.height=e,qe)}(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 Ve=new Map;function Xe(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Ve.get(n);if(void 0!==o)return o;const r=Ge({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ve.set(n,r),r}function Ye(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 Ke(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 Ue(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Qe=e=>[Fe,...e],Ze={bar:Qe([Re]),clusterbar:Qe([Re]),point:Qe([Ie]),swarm:Qe([Ie]),pie:[Ne],donut:[Ne],boxplot:Qe([(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()}},Ie]),violin:Qe([$e]),histogram:Qe([Re]),ridgeline:Qe([$e]),timeline:Qe([Re]),funnel:[Re,(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?ze(r):null!=i?`${ze(r)} (${We(i)})`:ze(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=ze(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":[Re,(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=Xe(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?Ue(r):"",a=Ke(o);e.font="bold 13px sans-serif";const l=i?e.measureText(s).width:0;e.font="11px sans-serif";const c=e.measureText(a).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,p=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),Ye(e,g,p,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Ye(e,g,p,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(s,h,p+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(a,h,p+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(a,h,p+3))}e.lineWidth=1}}],swimlane:Qe([Re])},Je={top:50,right:40,bottom:60,left:70},et={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function tt({hover:e}){var t,n,o,r,i,s;const a=e.data||{},l=e.stats,c=e.category;if(Array.isArray(a)){const e=c||(null===(t=a[0])||void 0===t?void 0:t.category)||"";if(l)return d.createElement("div",{className:"semiotic-tooltip",style:et},e&&d.createElement("div",{style:{fontWeight:"bold"}},e+""),d.createElement("div",null,"n = ",l.n),d.createElement("div",null,"Min: ",l.min.toLocaleString()),d.createElement("div",null,"Q1: ",l.q1.toLocaleString()),d.createElement("div",null,"Median: ",l.median.toLocaleString()),d.createElement("div",null,"Q3: ",l.q3.toLocaleString()),d.createElement("div",null,"Max: ",l.max.toLocaleString()),d.createElement("div",{style:{opacity:.8}},"Mean: ",l.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=a.length;return d.createElement("div",{className:"semiotic-tooltip",style:et},e&&d.createElement("div",{style:{fontWeight:"bold"}},e+""),d.createElement("div",null,n," items"))}if(null!=a.bin&&null!=a.count){const e=a.range||[];return d.createElement("div",{className:"semiotic-tooltip",style:et},a.category&&d.createElement("div",{style:{fontWeight:"bold"}},a.category+""),d.createElement("div",null,"Count: ",a.count),2===e.length&&d.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const u=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 d.createElement("div",{className:"semiotic-tooltip",style:et},e.map(([e,t])=>d.createElement("div",{key:e},d.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}const p=(u&&null!=a[u]?a[u]:null)||a.category||a.name||a.group||a.__rName||"",y=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(!p&&""===y){const e=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return d.createElement("div",{className:"semiotic-tooltip",style:et},e.map(([e,t])=>d.createElement("div",{key:e},d.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return d.createElement("div",{className:"semiotic-tooltip",style:et},p&&d.createElement("div",{style:{fontWeight:"bold"}},p+""),""!==y&&d.createElement("div",null,"number"==typeof y?y.toLocaleString():y+""))}const nt=e.forwardRef(function(t,n){var o,r,s,a,l,c,u,h,p,y;const{chartType:f,runtimeMode:m,data:v,oAccessor:b="category",rAccessor:x="value",colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:j,valueAccessor:S,categoryAccessor:C,projection:E="vertical",size:M=[600,400],responsiveWidth:P,responsiveHeight:N,margin:$,barPadding:F,innerRadius:z,normalize:W,startAngle:q,dynamicColumnWidth:G,bins:V,showOutliers:X,showIQR:Y,amplitude:K,connectorOpacity:U,showLabels:Q,connectorAccessor:Z,connectorStyle:J,rExtent:te,oExtent:se,extentPadding:ae=.05,oSort:ce,windowMode:ue="sliding",windowSize:de=200,pieceStyle:he,summaryStyle:ge,colorScheme:pe,barColors:ye,showAxes:fe=!0,showCategoryTicks:we,oLabel:Oe,rLabel:je,oFormat:Se,rFormat:Ce,enableHover:Ee=!0,hoverAnnotation:Me,tooltipContent:Pe,customHoverBehavior:Le,annotations:Be,svgAnnotationRules:Te,showGrid:Re=!1,legend:He,legendHoverBehavior:Ie,legendClickBehavior:De,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:Fe,backgroundGraphics:ze,foregroundGraphics:We,title:qe,className:Ge,background:Ve,centerContent:Xe,decay:Ye,pulse:Ke,transition:Ue,staleness:Qe,brush:et,onBrush:nt,accessibleTable:ot=!0,description:rt,summary:it}=t,st=function(){const[t,n]=e.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return e.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),t}(),at=e.useRef(st);at.current=st;const[lt,ct]=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]]]}(M,P,N),ut=e.useMemo(()=>Object.assign(Object.assign({},Je),$),[$]),dt=ct[0]-ut.left-ut.right,ht=ct[1]-ut.top-ut.bottom,gt="function"==typeof We?We({size:ct,margin:ut}):We,pt=e.useRef(null),yt=e.useRef(!0),ft=_e(e=>e.theme),mt=e.useRef(0),vt=e.useRef(null),bt=e.useRef(()=>{}),[xt,wt]=e.useState(null),[kt,At]=e.useState(null),[Ot,jt]=e.useState(0),[St,Ct]=e.useState(!1),Et=Ee||Me,Mt="streaming"===m,_t=e.useMemo(()=>({chartType:f,runtimeMode:Mt?"streaming":"bounded",windowSize:de,windowMode:ue,extentPadding:ae,projection:E,oAccessor:Mt?void 0:b,rAccessor:Mt?void 0:x,colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:Mt?j:void 0,valueAccessor:Mt?S||("string"==typeof x||"function"==typeof x?x:void 0):void 0,categoryAccessor:Mt?C||b:void 0,rExtent:te,oExtent:se,barPadding:F,innerRadius:z,normalize:W,startAngle:q,dynamicColumnWidth:G,bins:V,showOutliers:X,showIQR:Y,amplitude:K,connectorOpacity:U,showLabels:Q,connectorAccessor:Z,connectorStyle:J,oSort:ce,pieceStyle:he,summaryStyle:ge,colorScheme:pe,barColors:ye,decay:Ye,pulse:Ke,transition:Ue,staleness:Qe}),[f,de,ue,ae,E,b,x,w,k,A,O,j,S,C,te,se,F,z,W,q,G,V,X,Y,K,U,Q,Z,J,ce,he,ge,pe,ye,Ye,Ke,Ue,Qe,Mt]),Pt=e.useRef(null);Pt.current||(Pt.current=new _(_t));const Lt=e.useCallback(()=>{mt.current||(mt.current=requestAnimationFrame(()=>bt.current()))},[]);e.useEffect(()=>{var e;null===(e=Pt.current)||void 0===e||e.updateConfig(_t),yt.current=!0,Lt()},[_t,Lt]),e.useEffect(()=>{yt.current=!0,Lt()},[ft,Lt]);const Bt=e.useRef(null);Bt.current||(Bt.current=new g(e=>{const t=Pt.current;t&&t.ingest(e)&&(yt.current=!0,Lt())}));const Tt=e.useCallback(e=>{var t;null===(t=Bt.current)||void 0===t||t.push(e)},[]),Rt=e.useCallback(e=>{var t;null===(t=Bt.current)||void 0===t||t.pushMany(e)},[]),Ht=e.useCallback(()=>{var e,t;null===(e=Bt.current)||void 0===e||e.clear(),null===(t=Pt.current)||void 0===t||t.clear(),yt.current=!0,Lt()},[Lt]);e.useImperativeHandle(n,()=>({push:Tt,pushMany:Rt,clear:Ht,getData:()=>{var e,t,n;return null===(e=Bt.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}}),[Tt,Rt,Ht]),e.useEffect(()=>{var e;v&&(null===(e=Bt.current)||void 0===e||e.setBoundedData(v))},[v]);const It=e.useRef(()=>{}),Dt=e.useRef(()=>{});It.current=e=>{if(!Et)return;const t=pt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ut.left,r=e.clientY-n.top-ut.top;if(0>o||o>dt||0>r||r>ht)return void(vt.current&&(vt.current=null,wt(null),Le&&Le(null),Lt()));const i=Pt.current;if(!i||0===i.scene.length)return;const s="radial"===E,a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=L(i,t,n);break;case"point":e=B(i,t,n);break;case"wedge":e=T(i,t,n);break;case"boxplot":e=R(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-dt/2:o,s?r-ht/2:r);if(!a)return void(vt.current&&(vt.current=null,wt(null),Le&&Le(null),Lt()));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 b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});vt.current=c,wt(c),Le&&(Le(c),yt.current=!0),Lt()},Dt.current=()=>{vt.current&&(vt.current=null,wt(null),Le&&(Le(null),yt.current=!0),Lt())},e.useCallback(e=>It.current(e),[]);const Nt=e.useCallback(()=>Dt.current(),[]),$t=e.useRef(-1),Ft=e.useRef(null),zt=e.useRef(null),Wt=e.useCallback(e=>{const t=Pt.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(zt.current&&zt.current.version===n)o=zt.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(r=s.group)&&void 0!==r?r:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;i.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),zt.current={version:n,graph:o}}const r=$t.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),$t.current=0;const t=o.flat[0];Ft.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},D(t)),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});return vt.current=n,wt(n),Le&&Le(n),void Lt()}const i=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?I(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?I(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return $t.current=-1,Ft.current=null,vt.current=null,wt(null),Le&&Le(null),void Lt();$t.current=s;const a=o.flat[s];Ft.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},D(a)),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});vt.current=l,wt(l),Le&&Le(l),Lt()},[Le,Lt]),qt=e.useCallback(e=>{$t.current=-1,Ft.current=null,It.current(e)},[]);bt.current=()=>{var e,t;mt.current=0;const n=pt.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(at.current?i+1e6:i),a=!at.current&&s,l=yt.current;l&&!s&&(r.computeScene({width:dt,height:ht}),yt.current=!1),(l||a)&&n.setAttribute("aria-label",le(r.scene,f+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=ct[0]*c,d=ct[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=ct[0]+"px",n.style.height=ct[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,ct[0],ct[1]);const h=null!==(e=null==Qe?void 0:Qe.threshold)&&void 0!==e?e:5e3,g=Qe&&r.lastIngestTime>0&&i-r.lastIngestTime>h;g&&(o.globalAlpha=null!==(t=null==Qe?void 0:Qe.dimOpacity)&&void 0!==t?t:.5);const p=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",y=Ve||(p&&"transparent"!==p?p:null);y&&(o.fillStyle=y,o.fillRect(0,0,ct[0],ct[1]));const m="radial"===E;o.save(),o.beginPath(),o.rect(ut.left,ut.top,dt,ht),o.clip(),m?(o.save(),o.translate(ut.left+dt/2,ut.top+ht/2)):o.translate(ut.left,ut.top);const v=Ze[f]||[],b={width:dt,height:ht};for(const e of v)e(o,r.scene,r.scales,b);m&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(At(r.scales),jt(e=>e+1)),(null==Qe?void 0:Qe.showBadge)&&Ct(!!g),(a||r.hasActivePulses)&&(mt.current=requestAnimationFrame(()=>bt.current()))},e.useEffect(()=>(Lt(),()=>{mt.current&&(cancelAnimationFrame(mt.current),mt.current=0)}),[Lt]),e.useEffect(()=>{yt.current=!0,Lt()},[f,dt,ht,fe,Ve,Lt]),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,yt,Lt,St,Ct);const Gt=Et&&xt?Pe?Pe(xt):d.createElement(tt,{hover:xt}):null,Vt="radial"===E,Xt=Gt?d.createElement(Ae,{x:xt?Vt?xt.x+dt/2:xt.x:0,y:xt?Vt?xt.y+ht/2:xt.y:0,containerWidth:dt,containerHeight:ht,margin:ut,className:"stream-ordinal-tooltip"},Gt):null;if(ie){const e=Pt.current;e&&v&&(e.ingest({inserts:v,bounded:!0}),e.computeScene({width:dt,height:ht}));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"===E,a=s?ut.left+dt/2:ut.left,l=s?ut.top+ht/2:ut.top;return d.createElement("div",{className:"stream-ordinal-frame"+(Ge?" "+Ge:""),role:"img","aria-label":rt||("string"==typeof qe?qe:"Ordinal chart"),style:{position:"relative",width:ct[0],height:ct[1]}},d.createElement(ve,{summary:it}),d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:ct[0],height:ct[1],style:{position:"absolute",left:0,top:0}},ze&&d.createElement("g",{transform:`translate(${ut.left},${ut.top})`},ze),d.createElement("g",{transform:`translate(${a},${l})`},Ve&&d.createElement("rect",{x:0,y:0,width:dt,height:ht,fill:Ve}),t.map((e,t)=>function(e,t){var n,o,r,s,a;const l=e.category||e.group||"",c=n=>`ord-${e.type}-${l}-${t}-${n}`,u=`ord-${e.type}-${l}-${t}`;switch(e.type){case"rect":{const t=e;return d.createElement("rect",{key:u,x:t.x,y:t.y,width:t.w,height:t.h,fill:re(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}case"point":{const t=e;return d.createElement("circle",{key:u,cx:t.x,cy:t.y,r:t.r,fill:re(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 d.createElement("path",{key:u,d:n,transform:`translate(${t.cx},${t.cy})`,fill:re(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?d.createElement("g",{key:u},d.createElement("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),d.createElement("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:re(t.style.fill),fillOpacity:null!==(o=t.style.fillOpacity)&&void 0!==o?o:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),d.createElement("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),d.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}),d.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})):d.createElement("g",{key:u},d.createElement("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),d.createElement("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:re(t.style.fill),fillOpacity:null!==(r=t.style.fillOpacity)&&void 0!==r?r:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),d.createElement("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),d.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}),d.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=[d.createElement("path",{key:c("path"),d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:re(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(d.createElement("line",{key:c("iqr"),x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2}),d.createElement("circle",{key:c("med"),cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1})):n.push(d.createElement("line",{key:c("iqr"),x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2}),d.createElement("circle",{key:c("med"),cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1}))}return d.createElement("g",{key:u},n)}case"connector":return d.createElement("line",{key:u,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 d.createElement("polygon",{key:u,points:n,fill:re(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}default:return null}}(e,t)).filter(Boolean))),d.createElement(ne,{width:dt,height:ht,totalWidth:ct[0],totalHeight:ct[1],margin:ut,scales:n,showAxes:fe,showCategoryTicks:we,oLabel:Oe,rLabel:je,oFormat:Se,rFormat:Ce,showGrid:Re,title:qe,legend:He,legendHoverBehavior:Ie,legendClickBehavior:De,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:Fe,foregroundGraphics:gt,annotations:Be,svgAnnotationRules:Te,annotationFrame:0,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null==e?void 0:e.getData()}),Xe&&"radial"===E&&d.createElement("div",{style:{position:"absolute",left:ut.left+dt/2,top:ut.top+ht/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Xe))}const Yt="semiotic-table-"+d.useId();return d.createElement("div",{ref:lt,className:"stream-ordinal-frame"+(Ge?" "+Ge:""),role:"group","aria-label":rt||("string"==typeof qe?qe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:P?"100%":ct[0],height:N?"100%":ct[1],overflow:"visible"},onKeyDown:Wt},ot&&d.createElement(be,{tableId:Yt}),ot&&d.createElement(me,{scene:null!==(a=null===(s=Pt.current)||void 0===s?void 0:s.scene)&&void 0!==a?a:[],chartType:f+" chart",tableId:Yt,chartTitle:"string"==typeof qe?qe:void 0}),d.createElement(ve,{summary:it}),d.createElement("div",{role:"img","aria-label":rt||("string"==typeof qe?qe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Et?qt:void 0,onMouseLeave:Et?Nt:void 0},ze&&d.createElement("svg",{style:{position:"absolute",top:0,left:0,width:ct[0],height:ct[1],pointerEvents:"none"}},d.createElement("g",{transform:`translate(${ut.left},${ut.top})`},ze)),d.createElement(ee,{width:dt,height:ht,totalWidth:ct[0],totalHeight:ct[1],margin:ut,scales:kt,showAxes:fe,showGrid:Re,rFormat:Ce}),d.createElement("canvas",{ref:pt,"aria-label":le(null!==(c=null===(l=Pt.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],f+" chart"),style:{position:"absolute",top:0,left:0,width:ct[0],height:ct[1]}}),d.createElement(xe,{hoverPoint:xt}),d.createElement(ne,{width:dt,height:ht,totalWidth:ct[0],totalHeight:ct[1],margin:ut,scales:kt,showAxes:fe,showCategoryTicks:we,oLabel:Oe,rLabel:je,oFormat:Se,rFormat:Ce,showGrid:Re,title:qe,legend:He,legendHoverBehavior:Ie,legendClickBehavior:De,legendHighlightedCategory:Ne,legendIsolatedCategories:$e,legendPosition:Fe,foregroundGraphics:gt,annotations:Be,svgAnnotationRules:Te,annotationFrame:Ot,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null===(u=Pt.current)||void 0===u?void 0:u.getData(),underlayRendered:!0}),(et||nt)&&"radial"!==E&&d.createElement(oe,{width:dt,height:ht,totalWidth:ct[0],totalHeight:ct[1],margin:ut,scales:kt,onBrush:nt||(()=>{})}),Xe&&"radial"===E&&d.createElement("div",{style:{position:"absolute",left:ut.left+dt/2,top:ut.top+ht/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Xe),(null==Qe?void 0:Qe.showBadge)&&d.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:St?"#dc3545":"#28a745",color:"white"})},St?"STALE":"LIVE"),d.createElement(ke,{active:$t.current>=0,hoverPoint:xt,margin:ut,size:ct,shape:null===(h=Ft.current)||void 0===h?void 0:h.shape,width:null===(p=Ft.current)||void 0===p?void 0:p.w,height:null===(y=Ft.current)||void 0===y?void 0:y.h}),Xt))});nt.displayName="StreamOrdinalFrame";const ot=e.createContext(null);function rt(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 it(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[st,at]=Oe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=it(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=it(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}})}})),[lt,ct]=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}))}}));let ut={positions:new Map};const dt=new Set;function ht(){for(const e of dt)e()}function gt(e,t){const n=ut.positions.get(e);if(!n||n.sourceId!==t)return;const o=new Map(ut.positions);o.delete(e),ut={positions:o},ht()}function pt(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=at(e=>e.selections.get(r)),s=at(e=>e.setClause),a=at(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(rt(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 yt=e.createContext(!1);function ft({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):k[i%k.length];return{label:r+"",color:a}}),label:""}]}}function mt(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 vt(){var e;const t=_e(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 bt(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=x[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 xt(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])}d.createContext(void 0);const wt={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 kt(e,t,n){var o,r,i,s,a,l;const c=wt[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,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:At(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function At(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 Ot={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 jt(e,t){return"function"==typeof t?t(e):e[t]}function St(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 Ct(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=jt(e,n);s=St(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=jt(e,r);a.push({label:n,value:St(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=St(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=St(e[t[0]],o))}}const l=Object.assign(Object.assign({},Ot),r);return d.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},s&&d.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},s),a.map((e,t)=>d.createElement("div",{key:t,style:{marginTop:0===t&&s?"4px":0}},e.label&&d.createElement("span",null,e.label,": "),e.value)))}}function Et(e){if(!0===e)return Ct();if("function"==typeof e){const t=e;return e=>{const n=t(!e||"object"!=typeof e.data||null===e.data||"node"!==e.type&&"edge"!==e.type?e:e.data);return null==n?null:d.createElement("div",{className:"semiotic-tooltip",style:Ot},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Ct(e):Ct())}function Mt(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function _t(e,t){return"function"==typeof t?t(e):e[t]}function Pt({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=_t(a,e),c=_t(a,t),u=n?_t(a,n):void 0;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},d.createElement("div",{style:{fontWeight:"bold"}},Mt(l)),d.createElement("div",{style:{marginTop:4}},Mt(c)),null!=u&&d.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(h=n)?h:"value"),": ",Mt(u)));var h}}function Lt({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return d.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"}},d.createElement("div",{style:{textAlign:"center",maxWidth:400}},d.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),d.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&d.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 Bt extends d.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:d.createElement(Lt,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Tt(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let 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 Rt(e,t,n=3){let o,r=n+1;for(const n of t){const t=Tt(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Ht(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function It(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=Rt(e,t,3))&&void 0!==n?n:null)}function Dt({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=Ht(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=It(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"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},$t={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Ft={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},zt=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Wt=["vertical","horizontal"],qt={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),$t),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:zt},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),$t),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:zt},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),$t),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:zt},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),$t),{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),$t),{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),$t),{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),$t),{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({},Nt),$t),{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({},Nt),$t),{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),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},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),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Wt},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},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),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),Ft),{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({},Nt),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},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"}})},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"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),Ft),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Nt),Ft),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},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:Wt},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 Gt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Vt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Xt=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Yt=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Kt=new Set(["LineChart","AreaChart","StackedAreaChart"]),Ut=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Qt(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 Zt(e,t){const n=Qt(e),o=Qt(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Jt=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function en(e,t){const n=[],o=function(e,t){const n=[],o=qt[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(qt).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(!Gt(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=Rt(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=Dt({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=Ht(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=It(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 qt[e]?(function(e,t,n){const o=qt[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=qt[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){Vt.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){Xt.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=qt[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(!Yt.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(!Kt.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=qt[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(!Ut.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=Zt(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=Zt(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of Jt)"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 tn;const nn="undefined"!=typeof process&&"production"!==(null===(tn=process.env)||void 0===tn?void 0:tn.NODE_ENV);function on({componentName:e,width:t,height:n,chartProps:o,children:r}){return d.createElement(Bt,{fallback:r=>{let i="";if(nn&&o)try{const t=en(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return d.createElement(Lt,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const rn={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"},sn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function an(e,t,n,o){if(!nn)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 ln(t){const{data:n,rawData:o,colorBy:r,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:h=!1,onObservation:g,chartType:p,chartId:y,showLegend:f,userMargin:m,marginDefaults:v,onClick:b,loading:x,emptyContent:w,width:k,height:A}=t,{activeSelectionHook:S,customHoverBehavior:C,customClickBehavior:E,crosshairSourceId:M}=function({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:s,chartId:a,onClick:l}){const c=e.useId(),u=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(n,o),d=pt({name:(null==t?void 0:t.name)||"__unused__"}),h=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:s,clear:a}=pt({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==u?void 0:u.name)||"hover",fields:(null==u?void 0:u.fields)||o||[]}),g=ct(e=>e.pushObservation),p=t?{isActive:d.isActive,predicate:d.predicate}:null,y=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==u?void 0:u.mode)&&u.xField){const e=null==t?void 0:t[u.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=ut.positions.get(e);o&&o.xValue===t&&o.sourceId===n||(ut={positions:new Map(ut.positions).set(e,{xValue:t,sourceId:n})},ht())}(u.name||"hover",Number(e),c)}"x-position"!==(null==u?void 0:u.mode)&&h.onHover(t)}else"x-position"===(null==u?void 0:u.mode)&>(u.name||"hover",c),"x-position"!==(null==u?void 0:u.mode)&&h.onHover(null);if(i||g){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),g&&g(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),g&&g(e)}}},[n,h,u,c,i,s,a,g]),f=e.useCallback(e=>{var t,n,o,r;if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||g){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),g&&g(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),g&&g(e)}}},[l,i,g,s,a]);return e.useEffect(()=>{if("x-position"!==(null==u?void 0:u.mode))return;const e=u.name||"hover";return()=>{gt(e,c)}},[null==u?void 0:u.mode,null==u?void 0:u.name,c]),{activeSelectionHook:p,customHoverBehavior:y,customClickBehavior:f,crosshairSourceId:c}}({selection:l,linkedHover:c,fallbackFields:u,unwrapData:h,onObservation:g,chartType:p,chartId:y,onClick:b}),_=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(c,M),P=function(t,n,o){const r=e.useContext(ot),i=vt();return e.useMemo(()=>{var e;if(!n)return;const s=null!==(e=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==e?e:"category10";if(0!==t.length){if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const t=j(e.map(e=>({_cat:e})),"_cat",s);return e=>r[e]||t(e)}return j(e.map(e=>({_cat:e})),"_cat",s)}if(r&&Object.keys(r).length>0){const e=j(t,n,s);return t=>r[t]||e(t)}return j(t,n,s)}if(r&&Object.keys(r).length>0){const e=j([{_:"a"}],"_",s);return t=>r[t]||e(t)}},[t,n,o,r,i])}(n,r,i),L=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]),B=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,L),T=e.useMemo(()=>B.legendSelectionHook?B.legendSelectionHook:S,[B.legendSelectionHook,S]),{legend:R,margin:H,legendPosition:I}=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(yt),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return ft({data:t,colorBy:n,colorScale:o,getColor:O,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:P,showLegend:f,legendPosition:a,userMargin:m,defaults:v}),D=e.useMemo(()=>{const e={};return R&&(e.legend=R,e.legendPosition=I),s&&"none"!==s&&(e.legendHoverBehavior=B.onLegendHover,e.legendClickBehavior=B.onLegendClick,e.legendHighlightedCategory=B.highlightedCategory,e.legendIsolatedCategories=B.isolatedCategories),e},[R,I,s,B.onLegendHover,B.onLegendClick,B.highlightedCategory,B.isolatedCategories]),N=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 d.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)=>d.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},sn),{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})})))}(x,k,A),$=N?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?d.createElement("div",{style:Object.assign(Object.assign({},rn),{width:t,height:n})},o||"No data available"):null}(o,k,A,w);return{colorScale:P,allCategories:L,legendState:B,effectiveSelectionHook:T,activeSelectionHook:S,customHoverBehavior:C,customClickBehavior:E,legend:R,margin:H,legendPosition:I,earlyReturn:N||$||null,legendBehaviorProps:D,crosshairProps:_}}const cn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="vertical",valueFormat:h,colorBy:g,colorScheme:p,sort:y=!1,barPadding:f=40,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,chartId:j,loading:S,emptyContent:C,legendInteraction:E,legendPosition:M,color:_,showCategoryTicks:P,categoryFormat:L}=t,B=o.width,T=o.height,R=o.enableHover,H=o.showGrid,I=o.title,D=o.description,N=o.summary,$=o.accessibleTable,F=o.categoryLabel,z=o.valueLabel,W=i||[],q=ln({data:W,rawData:i,colorBy:g,colorScheme:p,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,onClick:A,chartType:"BarChart",chartId:j,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:S,emptyContent:C,width:B,height:T});if(q.earlyReturn)return q.earlyReturn;an("BarChart",W,"categoryAccessor",l),an("BarChart",W,"valueAccessor",c);const G=xt(W,y,c),V=vt(),X=e.useMemo(()=>new Map,[W]),Y=e.useMemo(()=>(e,t)=>{const n={};return n.fill=g?O(e,g,q.colorScale):bt(_,V,p,void 0,X),n},[g,q.colorScale,_,V,p,X]),K=e.useMemo(()=>mt(Y,q.effectiveSelectionHook,x),[Y,q.effectiveSelectionHook,x]),U=e.useMemo(()=>Pt({categoryAccessor:l,valueAccessor:c,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group"}),[l,c,g]),Q=Dt({componentName:"BarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(Q)return d.createElement(Lt,{componentName:"BarChart",message:Q,width:B,height:T});const Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:G}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:K,size:[B,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q.margin,barPadding:f,enableHover:R,showAxes:o.showAxes,oLabel:F,rLabel:z,rFormat:h}),L&&{oFormat:L}),{showGrid:H,showCategoryTicks:P,oSort:y}),q.legendBehaviorProps),I&&{title:I}),D&&{description:D}),N&&{summary:N}),void 0!==$&&{accessibleTable:$}),a&&{className:a}),{tooltipContent:!1===m?()=>null:Et(m)||U}),(w||k||A)&&{customHoverBehavior:q.customHoverBehavior}),(k||A)&&{customClickBehavior:q.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return d.createElement(on,{componentName:"BarChart",width:B,height:T},d.createElement(nt,Object.assign({ref:r},Z)))});function un({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]),p=e.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]),y=e.useMemo(()=>{if(!t||!n||!1===r)return;const e=a.current;if(0===e.length)return;const i=Array.isArray(o)?o:k,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 ft({data:e.map(e=>({[l]:e})),colorBy:l,colorScale:e=>s.get(e)||"#999",getColor:O})},[t,n,r,o,l]),f=e.useMemo(()=>{if(y)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[y,i]);return{wrapPush:h,wrapPushMany:g,resetCategories:p,streamingLegend:y,streamingMarginAdjust:f}}function dn({ref:t,frameRef:n,isPushMode:o,colorBy:r,colorScheme:i,showLegend:s,legendPosition:a,setup:l}){const c=un({isPushMode:o,colorBy:r,colorScheme:i,showLegend:s,legendPosition:a}),u=e.useCallback(c.wrapPush(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)}),[c.wrapPush]),d=e.useCallback(c.wrapPushMany(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)}),[c.wrapPushMany]);return e.useImperativeHandle(t,()=>({push:u,pushMany:d,clear:()=>{var e;c.resetCategories(),null===(e=n.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[u,d,c.resetCategories]),{effectiveLegendProps:e.useMemo(()=>c.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:c.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,c.streamingLegend,a]),effectiveMargin:e.useMemo(()=>{if(c.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(c.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,c.streamingMarginAdjust])}}cn.displayName="BarChart";const hn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",stackBy:c,valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:y,normalize:f=!1,barPadding:m=40,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:j,chartId:S,loading:C,emptyContent:E,legendInteraction:M,legendPosition:_,color:P,categoryFormat:L}=t,B=o.width,T=o.height,R=o.enableHover,H=o.showGrid,I=o.showLegend,D=o.title,N=o.description,$=o.summary,F=o.accessibleTable,z=o.categoryLabel,W=o.valueLabel,q=i||[],G=p||c,V=void 0===i,X=ln({data:q,rawData:i,colorBy:G,colorScheme:y,legendInteraction:M,legendPosition:_,selection:w,linkedHover:k,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:j,chartType:"StackedBarChart",chartId:S,showLegend:I,userMargin:s,marginDefaults:o.marginDefaults,loading:C,emptyContent:E,width:B,height:T});if(X.earlyReturn)return X.earlyReturn;const Y=vt(),K=e.useMemo(()=>new Map,[q]),U=e.useMemo(()=>(e,t)=>G?X.colorScale?{fill:O(e,G,X.colorScale)}:{}:{fill:bt(P,Y,y,t,K)},[G,X.colorScale,P,Y,y,K]),Q=e.useMemo(()=>mt(U,X.effectiveSelectionHook,w),[U,X.effectiveSelectionHook,w]),Z=e.useMemo(()=>Pt({categoryAccessor:c,valueAccessor:u,groupAccessor:l}),[c,l,u]),J=Dt({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{stackBy:c}}),{effectiveLegendProps:ee,effectiveMargin:te}=dn({ref:n,frameRef:r,isPushMode:V,colorBy:G,colorScheme:y,showLegend:I,legendPosition:_,setup:X}),ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:q}),{oAccessor:l,rAccessor:u,stackBy:c,normalize:f,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:Q,size:[B,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,barPadding:m,enableHover:R,showAxes:o.showAxes,oLabel:z,rLabel:W,rFormat:g}),L&&{oFormat:L}),{showGrid:H}),ee),D&&{title:D}),N&&{description:N}),$&&{summary:$}),void 0!==F&&{accessibleTable:F}),a&&{className:a}),{tooltipContent:!1===v?()=>null:Et(v)||Z}),(k||A||j)&&{customHoverBehavior:X.customHoverBehavior}),(A||j)&&{customClickBehavior:X.customClickBehavior}),b&&b.length>0&&{annotations:b}),x);return J?d.createElement(Lt,{componentName:"StackedBarChart",message:J,width:B,height:T}):d.createElement(on,{componentName:"StackedBarChart",width:B,height:T},d.createElement(nt,Object.assign({ref:r},ne)))});hn.displayName="StackedBarChart";const gn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",groupBy:c,valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:y,barPadding:f=60,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,chartId:j,loading:S,emptyContent:C,legendInteraction:E,legendPosition:M,color:_,categoryFormat:P}=t,L=o.width,B=o.height,T=o.enableHover,R=o.showGrid,H=o.showLegend,I=o.title,D=o.description,N=o.summary,$=o.accessibleTable,F=o.categoryLabel,z=o.valueLabel,W=i||[],q=p||c,G=void 0===i,V=ln({data:W,rawData:i,colorBy:q,colorScheme:y,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:k,onClick:A,chartType:"GroupedBarChart",chartId:j,showLegend:H,userMargin:s,marginDefaults:o.marginDefaults,loading:S,emptyContent:C,width:L,height:B});if(V.earlyReturn)return V.earlyReturn;const X=vt(),Y=e.useMemo(()=>new Map,[W]),K=e.useMemo(()=>(e,t)=>q?V.colorScale?{fill:O(e,q,V.colorScale)}:{}:{fill:bt(_,X,y,t,Y)},[q,V.colorScale,_,X,y,Y]),U=e.useMemo(()=>mt(K,V.effectiveSelectionHook,x),[K,V.effectiveSelectionHook,x]),Q=e.useMemo(()=>Pt({categoryAccessor:c,valueAccessor:u,groupAccessor:l}),[c,l,u]),Z=Dt({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{groupBy:c}}),{effectiveLegendProps:J,effectiveMargin:ee}=dn({ref:n,frameRef:r,isPushMode:G,colorBy:q,colorScheme:y,showLegend:H,legendPosition:M,setup:V}),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=i&&{data:W}),{oAccessor:l,rAccessor:u,groupBy:c,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:U,size:[L,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,barPadding:f,enableHover:T,showAxes:o.showAxes,oLabel:F,rLabel:z,rFormat:g}),P&&{oFormat:P}),{showGrid:R}),J),I&&{title:I}),D&&{description:D}),N&&{summary:N}),void 0!==$&&{accessibleTable:$}),a&&{className:a}),{tooltipContent:!1===m?()=>null:Et(m)||Q}),(w||k||A)&&{customHoverBehavior:V.customHoverBehavior}),(k||A)&&{customClickBehavior:V.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return Z?d.createElement(Lt,{componentName:"GroupedBarChart",message:Z,width:L,height:B}):d.createElement(on,{componentName:"GroupedBarChart",width:L,height:B},d.createElement(nt,Object.assign({ref:r},te)))});function pn({brushProp:t,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const i=(s="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(t){const{name:n,xField:o,yField:r}=t,{predicate:i,isActive:s,selectInterval:a,clear:l}=pt({name:n}),c=o&&r?"xyBrush":o?"xBrush":"yBrush",u=e.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,r,a,l]);return{brushInteraction:e.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof r?r:"value")}),l=e.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=e.useCallback(e=>{if(i){l.current.end(e?e.r:null)}null==n||n(e)},[n,i]),u=!!(t||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}gn.displayName="GroupedBarChart";const yn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",subcategoryAccessor:c,valueAccessor:u="value",orientation:h="horizontal",valueFormat:g,colorBy:p,colorScheme:y,barPadding:f=40,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:k={},selection:A,linkedHover:j,onObservation:S,onClick:C,chartId:E,loading:M,emptyContent:_,legendInteraction:P,legendPosition:L,color:B,categoryFormat:T}=t,R=o.width,H=o.height,I=o.enableHover,D=o.showGrid,N=o.showLegend,$=o.title,F=o.description,z=o.summary,W=o.accessibleTable,q=o.categoryLabel,G=o.valueLabel,V=i||[],X=p||c,Y=void 0===i,K=ln({data:V,rawData:i,colorBy:X,colorScheme:y,legendInteraction:P,legendPosition:L,selection:A,linkedHover:j,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:S,onClick:C,chartType:"SwimlaneChart",chartId:E,showLegend:N,userMargin:s,marginDefaults:o.marginDefaults,loading:M,emptyContent:_,width:R,height:H}),U=pn({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:u});if(K.earlyReturn)return K.earlyReturn;const Q=vt(),Z=e.useMemo(()=>new Map,[V]),J=e.useMemo(()=>(e,t)=>X?K.colorScale?{fill:O(e,X,K.colorScale)}:{}:{fill:bt(B,Q,y,t,Z)},[X,K.colorScale,B,Q,y,Z]),ee=e.useMemo(()=>mt(J,K.effectiveSelectionHook,A),[J,K.effectiveSelectionHook,A]),te=e.useMemo(()=>Pt({categoryAccessor:c,valueAccessor:u,groupAccessor:l}),[c,l,u]),ne=Dt({componentName:"SwimlaneChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u,subcategoryAccessor:c},requiredProps:{subcategoryAccessor:c}}),{effectiveLegendProps:oe,effectiveMargin:re}=dn({ref:n,frameRef:r,isPushMode:Y,colorBy:X,colorScheme:y,showLegend:N,legendPosition:L,setup:K}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=i&&{data:V}),{oAccessor:l,rAccessor:u,stackBy:c,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ee,size:[R,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re,barPadding:f,enableHover:I,showAxes:o.showAxes,oLabel:q,rLabel:G,rFormat:g}),T&&{oFormat:T}),{showGrid:D}),oe),$&&{title:$}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),a&&{className:a}),{tooltipContent:!1===m?()=>null:Et(m)||te}),(j||S||C)&&{customHoverBehavior:K.customHoverBehavior}),(S||C)&&{customClickBehavior:K.customClickBehavior}),v&&v.length>0&&{annotations:v}),U.brushStreamProps),k);return ne?d.createElement(Lt,{componentName:"SwimlaneChart",message:ne,width:R,height:H}):d.createElement(on,{componentName:"SwimlaneChart",width:R,height:H},d.createElement(nt,Object.assign({ref:r},ie)))});yn.displayName="SwimlaneChart";const fn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="vertical",valueFormat:h,colorBy:g,colorScheme:p,sizeBy:y,sizeRange:f=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:w,brush:k,onBrush:A,linkedBrush:j,frameProps:S={},selection:C,linkedHover:E,onObservation:M,onClick:_,chartId:P,loading:L,emptyContent:B,legendInteraction:T,legendPosition:R,color:H,showCategoryTicks:I,categoryFormat:D}=t,N=o.width,$=o.height,F=o.enableHover,z=o.showGrid,W=o.title,q=o.description,G=o.summary,V=o.accessibleTable,X=o.categoryLabel,Y=o.valueLabel,K=i||[],U=ln({data:K,rawData:i,colorBy:g,colorScheme:p,legendInteraction:T,legendPosition:R,selection:C,linkedHover:E,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:M,onClick:_,chartType:"SwarmPlot",chartId:P,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:L,emptyContent:B,width:N,height:$}),Q=pn({brushProp:k,onBrushProp:A,linkedBrush:j,valueAccessor:c});if(U.earlyReturn)return U.earlyReturn;const Z=e.useMemo(()=>{if(!y)return;const e=K.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[K,y]),J=vt(),ee=e.useMemo(()=>new Map,[K]),te=e.useMemo(()=>(e,t)=>{const n={fillOpacity:v};return n.fill=g?O(e,g,U.colorScale):bt(H,J,p,void 0,ee),n.r=y?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,y,f,Z):m,n},[g,U.colorScale,y,f,Z,m,v,H,J,p,ee]),ne=e.useMemo(()=>mt(te,U.effectiveSelectionHook,C),[te,U.effectiveSelectionHook,C]),oe=e.useMemo(()=>Pt({categoryAccessor:l,valueAccessor:c,groupAccessor:g||void 0}),[l,c,g]),re=Dt({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(re)return d.createElement(Lt,{componentName:"SwarmPlot",message:re,width:N,height:$});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=i&&{data:K}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ne,size:[N,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,barPadding:b,enableHover:F,showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:h}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:I}),U.legendBehaviorProps),W&&{title:W}),q&&{description:q}),G&&{summary:G}),void 0!==V&&{accessibleTable:V}),a&&{className:a}),{tooltipContent:!1===x?()=>null:Et(x)||oe}),(E||M||_)&&{customHoverBehavior:U.customHoverBehavior}),(M||_)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Q.brushStreamProps),S);return d.createElement(on,{componentName:"SwarmPlot",width:N,height:$},d.createElement(nt,Object.assign({ref:r},ie)))});function mn(e){return t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats||(t.data||t).stats;if(r&&null!=r.median)return d.createElement("div",{className:"semiotic-tooltip",style:Ot},o&&d.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r.n&&d.createElement("div",null,"n = ",r.n),null!=r.min&&d.createElement("div",null,"Min: ",r.min.toLocaleString()),null!=r.q1&&d.createElement("div",null,"Q1: ",r.q1.toLocaleString()),d.createElement("div",null,"Median: ",r.median.toLocaleString()),null!=r.q3&&d.createElement("div",null,"Q3: ",r.q3.toLocaleString()),null!=r.max&&d.createElement("div",null,"Max: ",r.max.toLocaleString()),null!=r.mean&&d.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==e?void 0:e.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},o&&d.createElement("div",{style:{fontWeight:"bold"}},o+""),i>0&&d.createElement("div",null,"n = ",i),null!=s&&d.createElement("div",null,"Median: ",s.toLocaleString()))}return d.createElement("div",{className:"semiotic-tooltip",style:Ot},d.createElement("div",{style:{fontWeight:"bold"}},o+""))}}fn.displayName="SwarmPlot";const vn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="vertical",valueFormat:h,colorBy:g,colorScheme:p,showOutliers:y=!0,categoryPadding:f=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,chartId:j,loading:S,emptyContent:C,legendInteraction:E,legendPosition:M,color:_,showCategoryTicks:P,categoryFormat:L}=t,B=o.width,T=o.height,R=o.enableHover,H=o.showGrid,I=o.title,D=o.description,N=o.summary,$=o.accessibleTable,F=o.categoryLabel,z=o.valueLabel,W=i||[],q=ln({data:W,rawData:i,colorBy:g,colorScheme:p,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,onClick:A,chartType:"BoxPlot",chartId:j,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:S,emptyContent:C,width:B,height:T});if(q.earlyReturn)return q.earlyReturn;const G=vt(),V=e.useMemo(()=>new Map,[W]),X=e.useMemo(()=>e=>{const t=g?O(e,g,q.colorScale):bt(_,G,p,void 0,V);return{fill:t,stroke:t,fillOpacity:.8}},[g,q.colorScale,_,G,p,V]),Y=e.useMemo(()=>mt(X,q.effectiveSelectionHook,x),[X,q.effectiveSelectionHook,x]),K=e.useMemo(()=>mn(),[]),U=Dt({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(U)return d.createElement(Lt,{componentName:"BoxPlot",message:U,width:B,height:T});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=i&&{data:W}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:Y,showOutliers:y,size:[B,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q.margin,barPadding:f,enableHover:R,showAxes:o.showAxes,oLabel:F,rLabel:z,rFormat:h}),L&&{oFormat:L}),{showGrid:H,showCategoryTicks:P}),q.legendBehaviorProps),I&&{title:I}),D&&{description:D}),N&&{summary:N}),void 0!==$&&{accessibleTable:$}),a&&{className:a}),{tooltipContent:!1===m?()=>null:Et(m)||K}),(w||k||A)&&{customHoverBehavior:q.customHoverBehavior}),(k||A)&&{customClickBehavior:q.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return d.createElement(on,{componentName:"BoxPlot",width:B,height:T},d.createElement(nt,Object.assign({ref:r},Q)))});vn.displayName="BoxPlot";const bn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:"horizontal"}),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:c="value",bins:u=25,relative:h=!1,valueFormat:g,colorBy:p,colorScheme:y,categoryPadding:f=20,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:k={},selection:A,linkedHover:j,onObservation:S,onClick:C,chartId:E,loading:M,emptyContent:_,legendInteraction:P,legendPosition:L,color:B,showCategoryTicks:T,categoryFormat:R}=t,H=o.width,I=o.height,D=o.enableHover,N=o.showGrid,$=o.title,F=o.description,z=o.summary,W=o.accessibleTable,q=o.categoryLabel,G=o.valueLabel,V=i||[],X=ln({data:V,rawData:i,colorBy:p,colorScheme:y,legendInteraction:P,legendPosition:L,selection:A,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:S,onClick:C,chartType:"Histogram",chartId:E,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:M,emptyContent:_,width:H,height:I}),Y=pn({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:c});if(X.earlyReturn)return X.earlyReturn;const K=e.useMemo(()=>{if(0===V.length)return;const e="function"==typeof c?c:e=>e[c];let t=1/0,n=-1/0;for(const o of V){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[V,c]),U=vt(),Q=e.useMemo(()=>new Map,[V]),Z=e.useMemo(()=>e=>{const t=p?O(e,p,X.colorScale):bt(B,U,y,void 0,Q);return{fill:t,stroke:t,fillOpacity:.8}},[p,X.colorScale,B,U,y,Q]),J=e.useMemo(()=>mt(Z,X.effectiveSelectionHook,A),[Z,X.effectiveSelectionHook,A]),ee=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},n&&d.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&d.createElement("div",null,"Count: ",o),r&&2===r.length&&d.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),te=Dt({componentName:"Histogram",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(te)return d.createElement(Lt,{componentName:"Histogram",message:te,width:H,height:I});const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=i&&{data:V}),{oAccessor:l,rAccessor:c,projection:"horizontal",summaryStyle:J,bins:u,normalize:h}),K&&{rExtent:K}),{size:[H,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X.margin,barPadding:f,enableHover:D,showAxes:o.showAxes,oLabel:q,rLabel:G,rFormat:g}),R&&{oFormat:R}),{showGrid:N,showCategoryTicks:T}),X.legendBehaviorProps),$&&{title:$}),F&&{description:F}),z&&{summary:z}),void 0!==W&&{accessibleTable:W}),a&&{className:a}),{tooltipContent:!1===m?()=>null:Et(m)||ee}),(j||S||C)&&{customHoverBehavior:X.customHoverBehavior}),(S||C)&&{customClickBehavior:X.customClickBehavior}),v&&v.length>0&&{annotations:v}),Y.brushStreamProps),k);return d.createElement(on,{componentName:"Histogram",width:H,height:I},d.createElement(nt,Object.assign({ref:r},ne)))});bn.displayName="Histogram";const xn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="vertical",bins:h=25,showIQR:g=!0,valueFormat:p,colorBy:y,colorScheme:f,categoryPadding:m=20,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:j,linkedHover:S,onObservation:C,onClick:E,chartId:M,loading:_,emptyContent:P,legendInteraction:L,legendPosition:B,color:T,showCategoryTicks:R,categoryFormat:H}=t,I=o.width,D=o.height,N=o.enableHover,$=o.showGrid,F=o.title,z=o.description,W=o.summary,q=o.accessibleTable,G=o.categoryLabel,V=o.valueLabel,X=i||[],Y=ln({data:X,rawData:i,colorBy:y,colorScheme:f,legendInteraction:L,legendPosition:B,selection:j,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:C,onClick:E,chartType:"ViolinPlot",chartId:M,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:_,emptyContent:P,width:I,height:D}),K=pn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:c});if(Y.earlyReturn)return Y.earlyReturn;const U=vt(),Q=e.useMemo(()=>new Map,[X]),Z=e.useMemo(()=>e=>{const t=y?O(e,y,Y.colorScale):bt(T,U,f,void 0,Q);return{fill:t,stroke:t,fillOpacity:.6}},[y,Y.colorScale,T,U,f,Q]),J=e.useMemo(()=>mt(Z,Y.effectiveSelectionHook,j),[Z,Y.effectiveSelectionHook,j]),ee=e.useMemo(()=>mn({valueAccessor:c}),[c]),te=Dt({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(te)return d.createElement(Lt,{componentName:"ViolinPlot",message:te,width:I,height:D});const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=i&&{data:X}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:J,bins:h,showIQR:g,size:[I,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y.margin,barPadding:m,enableHover:N,showAxes:o.showAxes,oLabel:G,rLabel:V,rFormat:p}),H&&{oFormat:H}),{showGrid:$,showCategoryTicks:R}),Y.legendBehaviorProps),F&&{title:F}),z&&{description:z}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),a&&{className:a}),{tooltipContent:!1===v?()=>null:Et(v)||ee}),(S||C||E)&&{customHoverBehavior:Y.customHoverBehavior}),(C||E)&&{customClickBehavior:Y.customClickBehavior}),b&&b.length>0&&{annotations:b}),K.brushStreamProps),A);return d.createElement(on,{componentName:"ViolinPlot",width:I,height:D},d.createElement(nt,Object.assign({ref:r},ne)))});xn.displayName="ViolinPlot";const wn=e.forwardRef(function(t,n){var o;const r=kt(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,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,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:c="category",valueAccessor:u="value",orientation:h="horizontal",valueFormat:g,colorBy:p,colorScheme:y,sort:f=!0,dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:j,onClick:S,chartId:C,loading:E,emptyContent:M,legendInteraction:_,legendPosition:P,color:L,categoryFormat:B}=t,T=r.width,R=r.height,H=r.enableHover,I=r.showGrid,D=r.title,N=r.description,$=r.summary,F=r.accessibleTable,z=r.categoryLabel,W=r.valueLabel,q=s||[],G=ln({data:q,rawData:s,colorBy:p,colorScheme:y,legendInteraction:_,legendPosition:P,selection:k,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:j,onClick:S,chartType:"DotPlot",chartId:C,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:E,emptyContent:M,width:T,height:R});if(G.earlyReturn)return G.earlyReturn;const V=xt(q,f,u),X=vt(),Y=e.useMemo(()=>new Map,[q]),K=e.useMemo(()=>(e,t)=>{const n={r:m,fillOpacity:.8};return n.fill=p?O(e,p,G.colorScale):bt(L,X,y,void 0,Y),n},[p,G.colorScale,m,L,X,y,Y]),U=e.useMemo(()=>mt(K,G.effectiveSelectionHook,k),[K,G.effectiveSelectionHook,k]),Q=e.useMemo(()=>Pt({categoryAccessor:c,valueAccessor:u}),[c,u]),Z=Dt({componentName:"DotPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(Z)return d.createElement(Lt,{componentName:"DotPlot",message:Z,width:T,height:R});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=s&&{data:V}),{oAccessor:c,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:U,size:[T,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,barPadding:v,enableHover:H,showAxes:r.showAxes,oLabel:z,rLabel:W,rFormat:g}),B&&{oFormat:B}),{showGrid:I,oSort:f}),G.legendBehaviorProps),D&&{title:D}),N&&{description:N}),$&&{summary:$}),void 0!==F&&{accessibleTable:F}),l&&{className:l}),{tooltipContent:!1===b?()=>null:Et(b)||Q}),(A||j||S)&&{customHoverBehavior:G.customHoverBehavior}),(j||S)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),w);return d.createElement(on,{componentName:"DotPlot",width:T,height:R},d.createElement(nt,Object.assign({ref:i},J)))});wn.displayName="DotPlot";const kn=e.forwardRef(function(t,n){var o,r;const i=kt(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,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),s=e.useRef(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:h="value",colorBy:g,colorScheme:p,startAngle:y=0,tooltip:f,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,onClick:k,chartId:A,loading:j,emptyContent:S,legendInteraction:C,legendPosition:E,color:M}=t,_=i.width,P=i.height,L=i.enableHover,B=i.showLegend,T=i.title,R=i.description,H=i.summary,I=i.accessibleTable,D=a||[],N=g||u,$=void 0===a,F=ln({data:D,rawData:a,colorBy:N,colorScheme:p,legendInteraction:C,legendPosition:E,selection:b,linkedHover:x,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:w,onClick:k,chartType:"PieChart",chartId:A,showLegend:B,userMargin:l,marginDefaults:i.marginDefaults,loading:j,emptyContent:S,width:_,height:P});if(F.earlyReturn)return F.earlyReturn;const z=vt(),W=e.useMemo(()=>new Map,[D]),q=e.useMemo(()=>(e,t)=>N?F.colorScale?{fill:O(e,N,F.colorScale)}:{}:{fill:bt(M,z,p,t,W)},[N,F.colorScale,M,z,p,W]),G=e.useMemo(()=>mt(q,F.effectiveSelectionHook,b),[q,F.effectiveSelectionHook,b]),V=e.useMemo(()=>Pt({categoryAccessor:u,valueAccessor:h,groupAccessor:g&&g!==u?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[u,h,g]),X=Dt({componentName:"PieChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h}}),{effectiveLegendProps:Y,effectiveMargin:K}=dn({ref:n,frameRef:s,isPushMode:$,colorBy:N,colorScheme:p,showLegend:B,legendPosition:E,setup:F}),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=a&&{data:D}),{oAccessor:u,rAccessor:h,projection:"radial",pieceStyle:G,startAngle:y,size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K,enableHover:L,showAxes:!1}),Y),T&&{title:T}),R&&{description:R}),H&&{summary:H}),void 0!==I&&{accessibleTable:I}),c&&{className:c}),{tooltipContent:!1===f?()=>null:Et(f)||V}),(x||w||k)&&{customHoverBehavior:F.customHoverBehavior}),(w||k)&&{customClickBehavior:F.customClickBehavior}),m&&m.length>0&&{annotations:m}),v);return X?d.createElement(Lt,{componentName:"PieChart",message:X,width:_,height:P}):d.createElement(on,{componentName:"PieChart",width:_,height:P},d.createElement(nt,Object.assign({ref:s},U)))});kn.displayName="PieChart";const An=e.forwardRef(function(t,n){var o,r;const i=kt(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,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks}),s=e.useRef(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:h="value",innerRadius:g=60,centerContent:p,colorBy:y,colorScheme:f,startAngle:m=0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:j,chartId:S,loading:C,emptyContent:E,legendInteraction:M,legendPosition:_,color:P}=t,L=i.width,B=i.height,T=i.enableHover,R=i.showLegend,H=i.title,I=i.description,D=i.summary,N=i.accessibleTable,$=a||[],F=y||u,z=void 0===a,W=ln({data:$,rawData:a,colorBy:F,colorScheme:f,legendInteraction:M,legendPosition:_,selection:w,linkedHover:k,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:A,onClick:j,chartType:"DonutChart",chartId:S,showLegend:R,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:E,width:L,height:B});if(W.earlyReturn)return W.earlyReturn;const q=vt(),G=e.useMemo(()=>new Map,[$]),V=e.useMemo(()=>(e,t)=>F?W.colorScale?{fill:O(e,F,W.colorScale)}:{}:{fill:bt(P,q,f,t,G)},[F,W.colorScale,P,q,f,G]),X=e.useMemo(()=>mt(V,W.effectiveSelectionHook,w),[V,W.effectiveSelectionHook,w]),Y=e.useMemo(()=>Pt({categoryAccessor:u,valueAccessor:h,groupAccessor:y&&y!==u?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[u,h,y]),K=Dt({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h}}),{effectiveLegendProps:U,effectiveMargin:Q}=dn({ref:n,frameRef:s,isPushMode:z,colorBy:F,colorScheme:f,showLegend:R,legendPosition:_,setup:W}),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:$}),{oAccessor:u,rAccessor:h,projection:"radial",pieceStyle:X,innerRadius:g,startAngle:m,centerContent:p,size:[L,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q,enableHover:T,showAxes:!1}),U),H&&{title:H}),I&&{description:I}),D&&{summary:D}),void 0!==N&&{accessibleTable:N}),c&&{className:c}),{tooltipContent:!1===v?()=>null:Et(v)||Y}),(k||A||j)&&{customHoverBehavior:W.customHoverBehavior}),(A||j)&&{customClickBehavior:W.customClickBehavior}),b&&b.length>0&&{annotations:b}),x);return K?d.createElement(Lt,{componentName:"DonutChart",message:K,width:L,height:B}):d.createElement(on,{componentName:"DonutChart",width:L,height:B},d.createElement(nt,Object.assign({ref:s},Z)))});An.displayName="DonutChart";const On=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:p,colorBy:y,colorScheme:f,categoryPadding:m=5,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:j,chartId:S,loading:C,emptyContent:E,legendInteraction:M,legendPosition:_,color:P,showCategoryTicks:L,categoryFormat:B}=t,T=o.width,R=o.height,H=o.enableHover,I=o.showGrid,D=o.title,N=o.description,$=o.summary,F=o.accessibleTable,z=o.categoryLabel,W=o.valueLabel,q=i||[],G=ln({data:q,rawData:i,colorBy:y,colorScheme:f,legendInteraction:M,legendPosition:_,selection:w,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:A,onClick:j,chartType:"RidgelinePlot",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:C,emptyContent:E,width:T,height:R});if(G.earlyReturn)return G.earlyReturn;const V=vt(),X=e.useMemo(()=>new Map,[q]),Y=e.useMemo(()=>e=>{const t=y?O(e,y,G.colorScale):bt(P,V,f,void 0,X);return{fill:t,stroke:t,fillOpacity:.5}},[y,G.colorScale,P,V,f,X]),K=e.useMemo(()=>mt(Y,G.effectiveSelectionHook,w),[Y,G.effectiveSelectionHook,w]),U=e.useMemo(()=>mn(),[]),Q=Dt({componentName:"RidgelinePlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(Q)return d.createElement(Lt,{componentName:"RidgelinePlot",message:Q,width:T,height:R});const Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=i&&{data:q}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:K,bins:h,size:[T,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,barPadding:m,enableHover:H,showAxes:o.showAxes,oLabel:z,rLabel:W,rFormat:p}),B&&{oFormat:B}),{showGrid:I,showCategoryTicks:L,oSort:!1,amplitude:g}),G.legendBehaviorProps),D&&{title:D}),N&&{description:N}),$&&{summary:$}),void 0!==F&&{accessibleTable:F}),a&&{className:a}),{tooltipContent:!1===v?()=>null:Et(v)||U}),(k||A||j)&&{customHoverBehavior:G.customHoverBehavior}),(A||j)&&{customClickBehavior:G.customClickBehavior}),b&&b.length>0&&{annotations:b}),x);return d.createElement(on,{componentName:"RidgelinePlot",width:T,height:R},d.createElement(nt,Object.assign({ref:r},Z)))});On.displayName="RidgelinePlot";const jn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:!1,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:!1}),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:c="value",categoryAccessor:u,colorBy:h,colorScheme:g,orientation:p="horizontal",connectorOpacity:y=.3,showLabels:f=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,chartId:j,loading:S,emptyContent:C,legendInteraction:E,legendPosition:M,color:_,categoryFormat:P}=t,L="vertical"===p,B=o.width,T=o.height,R=o.enableHover,H=o.title,I=o.description,D=o.summary,N=o.accessibleTable,$=i||[],F=h||u,z=!F,W=ln({data:$,rawData:i,colorBy:F,colorScheme:g,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:k,onClick:A,chartType:"FunnelChart",chartId:j,showLegend:o.showLegend,userMargin:s,marginDefaults:L?{top:H?60:40,right:20,bottom:60,left:60}:{top:H?40:10,right:10,bottom:10,left:10},loading:S,emptyContent:C,width:B,height:T});if(W.earlyReturn)return W.earlyReturn;an("FunnelChart",$,"stepAccessor",l),an("FunnelChart",$,"valueAccessor",c);const q=vt(),G=e.useMemo(()=>new Map,[$]),V=e.useMemo(()=>{if(z)return _||((null==q?void 0:q[0])?q[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[z,_,q,g]),X=e.useMemo(()=>(e,t)=>{const n={};return n.fill=V||(F?O(e,F,W.colorScale):bt(_,q,g,t,G)),n},[V,F,W.colorScale,_,q,g,G]),Y=e.useMemo(()=>mt(X,W.effectiveSelectionHook,x),[X,W.effectiveSelectionHook,x]),K=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)||"",c=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:"",u=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,p=null!==(s=null==a?void 0:a.__barFunnelCategory)&&void 0!==s?s:null==a?void 0:a.category,y=null==u||h?"":` (${.05>Math.abs(u-Math.round(u))?Math.round(u)+"%":u.toFixed(1)+"%"})`;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},l&&d.createElement("div",{style:{fontWeight:"bold"}},l+""),p&&p!==l&&d.createElement("div",{style:{marginTop:2,opacity:.8}},p+""),g&&d.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),d.createElement("div",{style:{marginTop:4}},c+"",y))},[]),U=Dt({componentName:"FunnelChart",data:i,accessors:{stepAccessor:l,valueAccessor:c}});if(U)return d.createElement(Lt,{componentName:"FunnelChart",message:U,width:B,height:T});const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:L?"bar-funnel":"funnel"},null!=i&&{data:$}),{oAccessor:l,rAccessor:c}),u&&{stackBy:u}),{projection:L?"vertical":"horizontal",barPadding:L?40:0,pieceStyle:Y,size:[B,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,enableHover:R,showAxes:L,showCategoryTicks:L}),P&&{oFormat:P}),{showGrid:L}),!L&&{connectorOpacity:y}),{showLabels:f}),W.legendBehaviorProps),H&&{title:H}),I&&{description:I}),D&&{summary:D}),void 0!==N&&{accessibleTable:N}),a&&{className:a}),{tooltipContent:!1===m?()=>null:!0===m||null==m?K:Et(m)||K}),(w||k||A)&&{customHoverBehavior:W.customHoverBehavior}),(k||A)&&{customClickBehavior:W.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return d.createElement(on,{componentName:"FunnelChart",width:B,height:T},d.createElement(nt,Object.assign({ref:r},Q)))});jn.displayName="FunnelChart";const Sn="__likert_neutral_neg",Cn="__likert_neutral_pos";function En(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Mn(e,t,n,o,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function _n(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:Sn,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:Cn,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function Pn(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===Sn?i=n:n.__likertLevel===Cn?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Ln=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="question",valueAccessor:c,levelAccessor:u,countAccessor:h="count",levels:g,orientation:p="horizontal",colorScheme:y,barPadding:f=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,chartId:O,valueFormat:j,loading:S,emptyContent:C,legendInteraction:E,legendPosition:M,categoryFormat:_}=t,P=o.width,L=o.height,B=o.enableHover,T=o.showGrid,R=o.showLegend,H=o.title,I=o.description,D=o.summary,N=o.accessibleTable,$=o.categoryLabel,F=o.valueLabel,z="horizontal"===p,W=void 0===i,q=!u,G=e.useMemo(()=>y&&Array.isArray(y)&&y.length>=g.length?y:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),s=[];for(let e=0;i>e;e++)s.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&s.push(o);for(let e=0;i>e;e++)s.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return s}(g.length),[y,g.length]),V=e.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],G[t]||"#888");return e},[g,G]),{processedData:X,reAggregate:Y,accumulatorRef:K}=function({data:t,levels:n,categoryAccessor:o,valueAccessor:r,levelAccessor:i,countAccessor:s,isDiverging:a,frameRef:l}){const c=!i,u=e.useMemo(()=>En(o,"question"),[o]),d=e.useMemo(()=>c?En(r,"score"):null,[c,r]),h=e.useMemo(()=>c?null:En(i,"level"),[c,i]),g=e.useMemo(()=>c?null:En(s,"count"),[c,s]),p=t||[],y=e.useRef([]),f=e.useMemo(()=>{if(0===p.length)return[];let e=Mn(p,n,u,d,h,g);return a&&(e=_n(e,n),e=Pn(e,n)),e},[p,n,u,d,h,g,a]),m=e.useCallback(e=>{var t,o;let r=Mn(e,n,u,d,h,g);a&&(r=_n(r,n),r=Pn(r,n)),null===(t=l.current)||void 0===t||t.clear(),r.length>0&&(null===(o=l.current)||void 0===o||o.pushMany(r))},[n,u,d,h,g,a,l]);return{processedData:f,reAggregate:m,accumulatorRef:y}}({data:i,levels:g,categoryAccessor:l,valueAccessor:c,levelAccessor:u,countAccessor:h,isDiverging:z,frameRef:r}),U="__likertLevelLabel",Q=un({isPushMode:W,colorBy:U,colorScheme:G,showLegend:R,legendPosition:M}),Z=e.useCallback(Q.wrapPush(e=>{K.current.push(e),Y(K.current)}),[Q.wrapPush,Y,K]),J=e.useCallback(Q.wrapPushMany(e=>{K.current.push(...e),Y(K.current)}),[Q.wrapPushMany,Y,K]);e.useImperativeHandle(n,()=>({push:Z,pushMany:J,clear:()=>{var e;K.current=[],Q.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,J,Q.resetCategories,K]);const ee=ln({data:X,rawData:i,colorBy:U,colorScheme:G,legendInteraction:E,legendPosition:M,selection:x,linkedHover:w,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:A,chartType:"LikertChart",chartId:O,showLegend:R,userMargin:s,marginDefaults:o.marginDefaults,loading:S,emptyContent:C,width:P,height:L});if(ee.earlyReturn)return ee.earlyReturn;const te=e.useMemo(()=>{const e=g.length;return e%2!=0&&V.get(g[Math.floor(e/2)])||"#888"},[g,V]),ne=e.useMemo(()=>e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(r===Sn||r===Cn)return{fill:te};const i=o||r;return i&&V.has(i)?{fill:V.get(i)}:{fill:"#888"}},[V,te]),oe=e.useMemo(()=>mt(ne,ee.effectiveSelectionHook,x),[ne,ee.effectiveSelectionHook,x]),re=e.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),ie=e.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===Sn||n===Cn?re:n,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=n===Sn||n===Cn?2*i:i,a=t.__likertCount||0;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},d.createElement("div",{style:{fontWeight:"bold"}},r),d.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[re]),se=e.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(c&&u)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(u&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==i&&0===i.length)return null;const e={categoryAccessor:l};return q?c&&(e.valueAccessor=c):(u&&(e.levelAccessor=u),h&&(e.countAccessor=h)),Dt({componentName:"LikertChart",data:i,accessors:e,requiredProps:{levels:g}})},[i,l,c,u,h,g,q]),ae=e.useMemo(()=>[{styleFn:e=>({fill:V.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,V]),le=e.useMemo(()=>!1!==R?Object.assign(Object.assign({},ee.legendBehaviorProps),{legend:{legendGroups:ae},legendPosition:M||ee.legendPosition||"bottom"}):ee.legendBehaviorProps,[ee.legendBehaviorProps,ee.legendPosition,M,R,ae]),ce=e.useMemo(()=>{const e=Object.assign({},ee.margin);if(W&&!1!==R){const t=M||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(Q.streamingMarginAdjust)for(const[t,n]of Object.entries(Q.streamingMarginAdjust))n>e[t]&&(e[t]=n);return z&&100>e.left&&(e.left=100),e},[ee.margin,Q.streamingMarginAdjust,z,W,R,M]),ue=e.useMemo(()=>j||(z?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[z,j]),de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:X}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:z?"horizontal":"vertical",pieceStyle:oe,size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,barPadding:f,enableHover:B,showAxes:o.showAxes,oLabel:$,rLabel:F||(z?void 0:"Percentage"),rFormat:ue}),_&&{oFormat:_}),{showGrid:T}),le),H&&{title:H}),I&&{description:I}),D&&{summary:D}),void 0!==N&&{accessibleTable:N}),a&&{className:a}),{tooltipContent:!1===m?()=>null:!0===m?ie:Et(m)||ie}),(w||k||A)&&{customHoverBehavior:ee.customHoverBehavior}),(k||A)&&{customClickBehavior:ee.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return se?d.createElement(Lt,{componentName:"LikertChart",message:se,width:P,height:L}):d.createElement(on,{componentName:"LikertChart",width:P,height:L},d.createElement(nt,Object.assign({ref:r},de)))});Ln.displayName="LikertChart",exports.BarChart=cn,exports.BoxPlot=vn,exports.DonutChart=An,exports.DotPlot=wn,exports.FunnelChart=jn,exports.GroupedBarChart=gn,exports.Histogram=bn,exports.LikertChart=Ln,exports.PieChart=kn,exports.RidgelinePlot=On,exports.StackedBarChart=hn,exports.StreamOrdinalFrame=nt,exports.SwarmPlot=fn,exports.SwimlaneChart=yn,exports.ViolinPlot=xn,exports.createHatchPattern=Ge;
|
|
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"),a=require("d3-selection"),l=require("d3-brush");function c(e){return e&&e.__esModule?e:{default:e}}function u(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 d=u(e),h=c(s);class g{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 p{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 y{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 f(e,t,n){return e+(t-e)*n}function m(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function v(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function b(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const x={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},w=n.schemeCategory10,k=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],A=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 O(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")||A.has(t)}(o)?n(o):o}const o=e[t];return n?n(o):w[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+""))%w.length]}function j(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=x[o]||x.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:w;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 M(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,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 C(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,p=[];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),p.push(t))}}else p.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 p){const c=t.get(i);if(!c)continue;let p=c.total;g&&n>0&&(p/=n);const y=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>p?r:o+p),n=0>p?l(r+p)-l(r):l(o)-l(o+p);u.push(S(e.x,t,e.width,Math.abs(n),y,f,i)),0>p?r+=p:o+=p}else if(h){const t=l(0>p?r+p:o),n=0>p?l(r)-l(r+p):l(o+p)-l(o);u.push(S(t,e.x,Math.abs(n),e.width,y,f,i)),0>p?r+=p:o+=p}}}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,p=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=p&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*y,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:g,y:p,r:d,style:u,datum:o})}}return l},pie:M,donut:M,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:p}=l,y=[],f="vertical"===p,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,p=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,k=null!==(s=t.find(e=>e>=x))&&void 0!==s?s:l,A=null!==(a=[...t].reverse().find(e=>w>=e))&&void 0!==a?a:c,O=h(e.pieceData[0],e.name),j=[];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;j.push({px:o,py:r,value:n,datum:t})}}if(y.push({type:"boxplot",x:f?e.middle:0,y:f?0:e.middle,projection:f?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(k),q1Pos:g(u),medianPos:g(p),q3Pos:g(v),maxPos:g(A),stats:{n:t.length,min:k,q1:u,median:p,q3:v,max:A,mean:t.reduce((e,t)=>e+t,0)/t.length},style:O,datum:e.pieceData,category:e.name,outliers:j}),m)for(const e of j)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:O.fill||"#999",opacity:.6},datum:e.datum})}return y},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=[],p="vertical"===h,y=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)/y||1,h=Array(y).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),y-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(p){b=`M ${e.middle} ${d(s)}`;for(let t=0;y>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=y-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;y>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=y-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:p}}const k=p?{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:k,iqrLine:w,stats:C(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,p=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=p&&isFinite(p)?p:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,y=Math.max(...i,1),f=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/y)*e.width*.9,s=l(n+t*r),a=l(n+(t+1)*r);c.push(S(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,f,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const p=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/p*f}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/p*f} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:C(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(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,p=[],y=n.width/2,f=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===m.length)return p;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let k=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>k&&(k=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>k&&(k=o)}if(0===k)return p;const A=new Map;for(const e of v){const t=w[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=w[0].stepTotal,j=x?.95*y:.9*n.width,M=t.scaleLinear().domain([0,k]).range([0,j]),C=null!==(r=e.config.connectorOpacity)&&void 0!==r?r:.3;let E=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+=M(o.total))}let r=y,i=y;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=M(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const w=g(c.pieces[0],l),k=null!==(a=A.get(l))&&void 0!==a?a:c.total,O=k>0?c.total/k*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=y,j.__funnelStepLabelY=d,j.__funnelRowWidth=e),j.__funnelValueLabelX=x+m/2,j.__funnelValueLabelY=d,j.__funnelBarW=m),p.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=M(e),a=y-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,k=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});f&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=y,k.__funnelStepLabelY=d,k.__funnelRowWidth=r,k.__funnelValueLabelX=y,k.__funnelValueLabelY=d,k.__funnelBarW=r),p.push(S(a,d,r,u,x,k,b)),h.set(l,{x:a,y:d,w:r,h:u})}if(e>0&&E.size>0){const e=x?v:[v[0]];for(const o of e){const e=E.get(o),r=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:C},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};p.push(s)}}E=h}return p},"bar-funnel":function(e,t){var n,o,r,i;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],p=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";p.has(e)||(p.add(e),g.push(e))}const y=g.length>1&&"_default"!==g[0],f=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=a(o);r.total+=i,r.pieces.push(o),n+=i}f.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=f[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=y?g.length:1,x=y?.15:0;for(let e=0;f.length>e;e++){const t=f[e],n=t.col,o=0===e,s=e>0?f[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],p=t.groups.get(h);if(!p)continue;const f=p.total,b=null!==(r=m.get(h))&&void 0!==r?r:f,x=b>0?f/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(i=null==w?void 0:w.total)&&void 0!==i?i:f,A=o?0:Math.max(0,k-f),O=n.x+e*a+l/2,j=v(f),M=v(0)-j,C=c(p.pieces[0],y?h:n.name),E=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:f,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name,__barFunnelLabelX:O+u/2,__barFunnelLabelY:v(f+A)});if(d.push(S(O,j,u,M,C,E,y?h:n.name)),A>0){const e=v(f+A),t=j-e,o=Object.assign({},C),r=Object.assign(Object.assign({},p.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:y?h:n.name});d.push(S(O,e,u,t,o,r,y?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=s(n,l);if(u){const r=a(t),i=a(t+o);c.push(S(r,e.x,i-r,e.width,d,n,l))}else{const r=a(t+o),i=a(t);c.push(S(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class _{constructor(e){this.rExtent=new y,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 p(e.windowSize),this.getO=b(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>v(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new y)):(this.getR=v(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=b(e.stackBy),this.getGroup=b(e.groupBy),this.getColor=b(e.colorAccessor),this.getConnector=b(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new p(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,r,i;const s=this.config.chartType,a=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let l=0,c=0;if("bar"===s&&this.getStack&&this.config.normalize)l=0,c=1;else if("bar"===s&&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>c&&(c=e);for(const e of n.values())l>e&&(l=e)}else if("bar"===s){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>c&&(c=e),l>e&&(l=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>c&&(c=e)}else if("clusterbar"===s||"bar-funnel"===s)for(const t of e){const e=this.getR(t);e>c&&(c=e),l>e&&(l=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(l=e),t!==-1/0&&(c=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(l=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(c=this.config.rExtent[1]));const u="bar"===s||"clusterbar"===s||"bar-funnel"===s||"swimlane"===s;if(u&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])&&(l>0&&(l=0),0>c&&(c=0)),"bar-funnel"!==s){const e=c-l,t=e>0?e*a:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||u&&!this.config.baselinePadding&&0===l||(l-=t),null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])||u&&!this.config.baselinePadding&&0===c||(c+=t)}return[l,c]}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:k,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 p=new Set,y=new Map;for(let e=0;this.scene.length>e;e++){const a=this.scene[e],l=this.getNodeKey(a,y);if(!l)continue;a._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===a.type?c?(p.add(l),a._targetOpacity=null!==(t=a.style.opacity)&&void 0!==t?t:1,c.x===a.x&&c.y===a.y||(a._targetX=a.x,a._targetY=a.y,a.x=c.x,a.y=c.y,g=!0)):(a._targetOpacity=null!==(n=a.style.opacity)&&void 0!==n?n:1,a.style=Object.assign(Object.assign({},a.style),{opacity:0}),g=!0):"rect"===a.type&&(c?(p.add(l),a._targetOpacity=null!==(o=a.style.opacity)&&void 0!==o?o:1,c.x===a.x&&c.y===a.y&&c.w===a.w&&c.h===a.h||(a._targetX=a.x,a._targetY=a.y,a._targetW=a.w,a._targetH=a.h,a.x=c.x,a.y=c.y,a.w=null!==(r=c.w)&&void 0!==r?r:a.w,a.h=null!==(i=c.h)&&void 0!==i?i:a.h,g=!0)):(a._targetOpacity=null!==(s=a.style.opacity)&&void 0!==s?s:1,a.style=Object.assign(Object.assign({},a.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)p.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(a=t.r)&&void 0!==a?a:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=f(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=f(o.x,e._targetX,i),e.y=f(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=f(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=f(n.x,e._targetX,i),e.y=f(n.y,e._targetY,i),void 0!==n.w&&(e.w=f(n.w,e._targetW,i),e.h=f(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)&&(m(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=b(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)=>!m(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>v(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new y)):(this.getR=v(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!m(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?b(this.config.stackBy):void 0),"groupBy"in e&&!m(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?b(this.config.groupBy):void 0),"colorAccessor"in e&&!m(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?b(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!m(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?b(this.config.connectorAccessor):void 0)}}function P(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function L(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 B(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i),a=function(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}(e.r,o);return s>a?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function H(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=P(Math.atan2(r,o)),a=P(e.startAngle),l=P(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 T(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 R(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}function I(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function N(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}const D={fill:e=>d.createElement("rect",{style:e,width:16,height:16}),line:e=>d.createElement("line",{style:e,x1:0,y1:0,x2:16,y2:16})};function F(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,D[n])(o(e,t)),r}function z(){return d.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function $(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function W({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-"+d.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(d.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))}))}return d.createElement("g",{"aria-label":i||"Gradient legend"},d.createElement("defs",null,d.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},c)),i&&d.createElement("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),d.createElement("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),d.createElement("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[0])),d.createElement("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[1])))}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(d.createElement("stop",{key:e,offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))}))}return d.createElement("g",{"aria-label":i||"Gradient legend"},i&&d.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},i),d.createElement("defs",null,d.createElement("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},c)),d.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),d.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[1])),d.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},a(r[0])))}function q(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical"}=e,[h,g]=d.useState(0),[p,y]=d.useState(0),f=d.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c})=>{let u=24;const h=[];return e.forEach((e,g)=>{u+=5,h.push(d.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:u,x2:t,y2:u})),u+=8,e.label&&(u+=16,h.push(d.createElement("text",{key:"legend-text-"+g,y:u,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label)),u+=8),h.push(d.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${u})`},((e,t,n,o,r,i,s,a,l,c)=>{const{type:u="fill",styleFn:h,items:g}=e,p=[];let y=0;const f=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r;return g.forEach((e,c)=>{const v=F(e,c,u,h),b=$(e,o,r),x=r&&r.size>0&&r.has(e.label);p.push(d.createElement("g",{key:"legend-item-"+c,transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:f?a===i&&c===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=(c+("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,c),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&&d.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&&d.createElement(z,null),d.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),y+=22}),p})(e,n,o,r,i,s,a,g,l,c))),u+=22*e.items.length+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:s}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let h=0;const g=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const y=((e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:g,items:p}=e,y=[];let f=0,m=0;const v=!(!t&&!n),b="isolate"===c||void 0===c&&null!=r;p.forEach((e,c)=>{const x=F(e,c,h,g),w=$(e,o,r),k=r&&r.size>0&&r.has(e.label),A=26+7*e.label.length;u&&u>0&&f>0&&f+A>u&&(m++,f=0),y.push(d.createElement("g",{key:"legend-item-"+c,transform:`translate(${f},${22*m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:v?a===i&&c===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?k||!1:void 0,"aria-current":v&&!b&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:v?n=>{var o;if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(c+("ArrowRight"===n.key?1:-1)+p.length)%p.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:v?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&d.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*e.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&d.createElement(z,null),d.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},e.label))),f+=A});let x=0,w=0;for(const e of p){const t=26+7*e.label.length;u&&u>0&&w>0&&w+t>u?(x=Math.max(x,w),w=t):w+=t}x=Math.max(x,w);const k=m+1;return{items:y,offset:x,totalRows:k,totalHeight:22*k}})(e,o,r,i,s,a,l,t,c,u,n);p+=y.offset+5,g.push(Object.assign(Object.assign({label:e.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),h+=p+12});let p=h>n?0:Math.max(0,(n-h)/2);const y=[];return g.forEach((n,o)=>{const r=e[o];r.label&&(y.push(d.createElement("text",{key:"legend-text-"+o,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},r.label)),p+=16),y.push(d.createElement("g",{key:"legend-group-"+o,className:"legend-item",transform:`translate(${p},0)`},n.items)),p+=n.offset+5,e[o+1]&&y.push(d.createElement("line",{key:"legend-top-line legend-symbol-"+o,stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8})),p+=12}),d.createElement("g",null,y)})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:s}),v=!(!n&&!o);return d.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"===u&&d.createElement("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},a),m)}function G(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 V(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 X(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:g,disable:p,events:y={},"data-testid":f}=e,m=new Set(Array.isArray(p)?p:[]);let v=o||0,b=r||0;null!=i&&(v=i-t),null!=s&&(b=s-n);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===v&&0===b)if(void 0!==c.width){v=c.width/2;const e=c.depth||30;b=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;v=e+(0>e?-5:5),b=c.height/2}return d.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":f},y),!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(d.createElement("line",{key:"connector-line",x1:a,y1:l,x2:e,y2:t,stroke:o||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-a);s.push(d.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||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return d.createElement("g",{className:"annotation-connector"},s)}(v,b,l,h,x,c),!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(d.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&s.push(d.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==t?void 0:t.custom)&&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(d.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-i,x2:o,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-i;s.push(d.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?s.push(d.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||s.push(d.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&s.push(d.createElement("path",{key:"bracket-path",d:V((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"}));break}}return d.createElement("g",{className:"annotation-subject"},s)}(x,c,h,t,n),!m.has("note")&&function(e,t,n,o){if(!e)return d.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return d.createElement("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===u?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>t?"end":"start";const p=16,y=i?c?[i]:G(i,l):[],f=r?c?[r]:G(r,l):[],m="leftRight"===u?"end"===g?-4:4:0;let v=0;const b=[],x=o||"var(--semiotic-text, #333)";y.length>0&&(b.push(d.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},y.map((e,t)=>d.createElement("tspan",{key:t,x:m,dy:0===t?0:p},e)))),v=y.length*p),f.length>0&&b.push(d.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},f.map((e,t)=>d.createElement("tspan",{key:t,x:m,dy:0===t?0:p},e))));let w=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){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),w=d.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+f.length)*p+(f.length>0?p:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),w=d.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+f.length-1)*p;let A=0;return"topBottom"===u?A=0>n?-(k+2):18:"leftRight"===u&&(A="middle"===h?-(k+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),d.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},d.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),w)}(a,v,b,h))}function Y(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 d.createElement(X,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},r,{type:i}))});return d.createElement("g",null,a)}const a=o.note||{title:"none",label:o.label};return d.createElement(X,Object.assign({"data-testid":"semiotic-annotation",key:`${a.label}-${a.title}-${o.i}`,events:s},o,{type:i}))}function K(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 U(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 Q(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=K(e,n),c=U(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 Z(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const J={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 ee(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:s,scales:a,showAxes:l,showGrid:c,rFormat:u}=t,h="radial"===(null==a?void 0:a.projection),g="horizontal"===(null==a?void 0:a.projection),p=e.useMemo(()=>!a||h?[]:a.r.ticks(5).map(e=>({value:e,pixel:a.r(e),label:(u||te)(e)})),[a,u,h]),y=c&&a&&!h,f=l&&a&&!h;return y||f?d.createElement("svg",{width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},d.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&d.createElement("g",{className:"ordinal-grid"},p.map((e,t)=>d.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&&d.createElement(d.Fragment,null,g?d.createElement(d.Fragment,null,d.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):d.createElement(d.Fragment,null,d.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function te(e){return Math.round(100*e)/100+""}function ne(t){var n,o;const{width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:g,showAxes:p,showCategoryTicks:y,oLabel:f,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:w,legend:k,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:C,annotations:E,svgAnnotationRules:_,xAccessor:P,yAccessor:L,annotationData:B,underlayRendered:H,children:T}=t,R="radial"===(null==g?void 0:g.projection),I="horizontal"===(null==g?void 0:g.projection),N=!1!==y,D=e.useMemo(()=>p&&N&&g&&!R?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[p,N,g,v,R]),F=e.useMemo(()=>p&&g&&!R?g.r.ticks(5).map(e=>({value:e,pixel:g.r(e),label:(b||te)(e)})):[],[p,g,b,R]),z=e.useRef(new Map),$=e.useRef(null!==(n=null==E?void 0:E.length)&&void 0!==n?n:0),G=null!==(o=null==E?void 0:E.length)&&void 0!==o?o:0;$.current!==G&&($.current=G,z.current=new Map);const V=e.useMemo(()=>{if(!E||0===E.length)return null;const e=function(e,t,n){var o,s,a,l,c,u,g,p,y,f,m,v,b,x,w,k,A,O,j,S,M,C,E,_,P,L,B,H,T,R,I,N,D,F,z,$,W,q,G,V,X,ee,te,ne,oe,re,ie,se;switch(e.type){case"label":{const o=Q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Z(r,i,n)?d.createElement(Y,{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=Q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return Z(r,i,n)?d.createElement(Y,{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=K(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;return s="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12,d.createElement("g",{key:"ann-"+t},d.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&&d.createElement("text",{x:o+4,y:s,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=U(e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(n.width||0)/2,a="middle"):(s=(n.width||0)-4,a="end"),d.createElement("g",{key:"ann-"+t},d.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&&d.createElement("text",{x:s,y:o-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:K(Object.assign(Object.assign({},e),{type:"point"}),n),y:U(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 d.createElement("g",{key:"ann-"+t},d.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&&d.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:K(Object.assign(Object.assign({},e),{type:"point"}),n),y:U(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,c=Math.min(...s)-r,u=Math.max(...s)+r;return d.createElement("g",{key:"ann-"+t},d.createElement("rect",{x:a,y:c,width:l-a,height:u-c,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&d.createElement("text",{x:(a+l)/2,y:c-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12},e.label))}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return d.createElement("g",{key:"ann-"+t},r.map((t,o)=>{const r=K(t,n),s=U(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 d.createElement("circle",Object.assign({key:"hl-"+o,cx:r,cy:s,r:a},l))}))}case"bracket":{const o=K(e,n),r=U(e,n);return d.createElement(Y,{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",p=n.yAccessor||"y",y=r.map(e=>[e[i],e[p]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.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!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!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,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(y,null!==(g=e.bandwidth)&&void 0!==g?g:.3):("polynomial"===v?h.default.polynomial(y,{order:e.order||2}):h.default.linear(y)).points;const x=b.map(([e,t])=>`${f(e)},${m(t)}`).join(" "),w=e.color||"#6366f1";return d.createElement("g",{key:"ann-"+t},d.createElement("polyline",{points:x,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&d.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!==(y=null===(p=n.scales)||void 0===p?void 0:p.y)&&void 0!==y?y: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 d.createElement("g",{key:"ann-"+t},d.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&&d.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!==(A=null===(k=n.scales)||void 0===k?void 0:k.y)&&void 0!==A?A:null===(O=n.scales)||void 0===O?void 0:O.value;if(!s||!a)return null;const l=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",u=e.filter,h=o.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=J[n.curve||"linear"]||i.curveLinear,p=i.area().x(e=>s(e[r])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(g)(h);if(!p)return null;const y=e.fill||"#6366f1";return d.createElement("g",{key:"ann-"+t},d.createElement("path",{d:p,fill:y,fillOpacity:null!==(j=e.fillOpacity)&&void 0!==j?j:.15,stroke:"none"}),e.label&&h.length>0&&d.createElement("text",{x:s(h[h.length-1][r])+4,y:a(h[h.length-1][l])-4,fill:y,fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=null!==(M=null===(S=n.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(C=n.scales)||void 0===C?void 0:C.time,s=null!==(_=null===(E=n.scales)||void 0===E?void 0:E.y)&&void 0!==_?_:null===(P=n.scales)||void 0===P?void 0:P.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,c=a.reduce((e,t)=>e+Math.pow(t-l,2),0)/a.length,u=Math.sqrt(c),h=null!==(L=e.threshold)&&void 0!==L?L:2,g=l-h*u,p=!1!==e.showBand,y=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*u),x=s(g),w=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return d.createElement("g",{key:"ann-"+t},p&&d.createElement("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),w.map((e,t)=>{const o=K(e,n),r=U(e,n);return null==o||null==r?null:d.createElement("circle",{key:"anomaly-"+t,cx:o,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),e.label&&d.createElement("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",s=null!==(R=null===(T=n.scales)||void 0===T?void 0:T.x)&&void 0!==R?R:null===(I=n.scales)||void 0===I?void 0:I.time,a=null!==(D=null===(N=n.scales)||void 0===N?void 0:N.y)&&void 0!==D?D:null===(F=n.scales)||void 0===F?void 0:F.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 c;if("polynomial"===(e.method||"linear")){const t=h.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,g=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(g/Math.max(u-2,1)),y=l.reduce((e,t)=>e+t[0],0)/u,f=l.reduce((e,t)=>e+Math.pow(t[0]-y,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!==($=e.steps)&&void 0!==$?$:5,x=l[u-1][0],w=(x-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=c(e),n=p*Math.sqrt(1+1/u+(f>0?Math.pow(e-y,2)/f:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,j=A.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),S=`${s(x)},${a(c(x))}`,M=e.strokeColor||"#6366f1";return d.createElement("g",{key:"ann-"+t},d.createElement("path",{d:O,fill:e.fill||"#6366f1",fillOpacity:null!==(W=e.fillOpacity)&&void 0!==W?W:.15,stroke:"none"}),d.createElement("polyline",{points:`${S} ${j}`,fill:"none",stroke:M,strokeWidth:null!==(q=e.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=e.strokeDasharray)&&void 0!==G?G:"6,3"}),e.label&&A.length>0&&d.createElement("text",{x:s(A[A.length-1].x)+4,y:a(A[A.length-1].yCenter)-4,fill:M,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=Q(e,t,n);if(!i)return null;o=i.x,r=i.y}if(null==o||null==r)return null;if(!Z(o,r,n))return null;const i=null!==(V=e.dx)&&void 0!==V?V:0,s=null!==(X=e.dy)&&void 0!==X?X:0,a=null!==(ee=e.width)&&void 0!==ee?ee:32,l=null!==(te=e.height)&&void 0!==te?te:32,c=null!==(ne=e.content)&&void 0!==ne?ne:d.createElement("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info"},"ℹ️");return d.createElement("foreignObject",{key:"ann-"+t,x:o+i-a/2,y:r+s-l/2,width:a,height:l,style:{overflow:"visible",pointerEvents:"auto"}},d.createElement("div",{style:{width:a,height:l,display:"flex",alignItems:"center",justifyContent:"center"}},c))}case"text":{const o=Q(e,t,n);if(!o)return null;const{x:r,y:i}=o;return d.createElement("text",{key:"ann-text-"+t,x:r+(e.dx||0),y:i+(e.dy||0),fill:e.color||"var(--semiotic-text, #333)",fontSize:e.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},e.label)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=null===(oe=n.scales)||void 0===oe?void 0:oe.o,i=null===(re=n.scales)||void 0===re?void 0:re.x,s=null===(ie=n.scales)||void 0===ie?void 0:ie.y,a=(null==r?void 0:r.bandwidth)?r:(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:null;if(!a)return null;const l=a(o);if(null==l)return null;const c=a.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",h=null!==(se=e.opacity)&&void 0!==se?se:.15,g=e.label;return(n.projection?"vertical"===n.projection:a===i)?d.createElement("g",{key:"ann-"+t},d.createElement("rect",{x:l,y:0,width:c,height:n.height||0,fill:u,fillOpacity:h}),g&&d.createElement("text",{x:l+c/2,y:12,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold"},g)):d.createElement("g",{key:"ann-"+t},d.createElement("rect",{x:0,y:l,width:n.width||0,height:c,fill:u,fillOpacity:h}),g&&d.createElement("text",{x:12,y:l+c/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold"},g))}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,o:g.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:s,height:a,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:z.current};return E.map((t,n)=>{if(_){const r=_(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[E,_,s,a,g,P,L,B]);return p||w||k||C||V&&V.length>0||x||T?d.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},d.createElement("title",null,"string"==typeof w?w:"Ordinal Chart"),d.createElement("desc",null,"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"),d.createElement("g",{transform:`translate(${u.left},${u.top})`},x&&g&&!R&&!H&&d.createElement("g",{className:"ordinal-grid"},F.map((e,t)=>d.createElement("line",{key:"grid-"+t,x1:I?e.pixel:0,y1:I?0:e.pixel,x2:I?e.pixel:s,y2:I?a:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),p&&g&&!R&&d.createElement("g",{className:"ordinal-axes"},I?d.createElement(d.Fragment,null,!H&&d.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((e,t)=>d.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},d.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?d.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label):d.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},d.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},e.label)))),f&&d.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},f),!H&&d.createElement("line",{x1:0,y1:a,x2:s,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!H&&(null==g?void 0:g.r)&&(()=>{const e=g.r(0);return e>1&&s-1>e?d.createElement("line",{x1:e,y1:0,x2:e,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),F.map((e,t)=>d.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${a})`},d.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&d.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},m)):d.createElement(d.Fragment,null,!H&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):a,t=0>e||e>a?a:e;return d.createElement("line",{x1:0,y1:t,x2:s,y2:t,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((e,t)=>d.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${a})`},d.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?d.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label):d.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},d.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},e.label)))),f&&d.createElement("text",{x:s/2,y:a+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!H&&d.createElement("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((e,t)=>d.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},d.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),d.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),m&&d.createElement("text",{x:15-u.left,y:a/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${a/2})`,style:{userSelect:"none"}},m))),V,C,T),w&&d.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:c,legendIsolatedCategories:u,legendInteraction:h}=e;if(!t)return null;const g="top"===i||"bottom"===i;let p,y;return"left"===i?(p=4,y=r.top):"top"===i?(p=0,y=s?32:8):"bottom"===i?(p=0,y=o-r.bottom+50):(p=n-r.right+10,y=r.top),d.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=t)&&null!==f&&"gradient"in f?d.createElement(W,{config:t.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(t)?d.createElement(q,{legendGroups:t.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:a,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:h}):t);var f}({legend:k,totalWidth:l,totalHeight:c,margin:u,legendPosition:M,title:w,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:j,legendIsolatedCategories:S})):null}function oe({width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,onBrush:c}){const u=e.useRef(null),h=e.useRef(null),g=e.useRef(c);g.current=c;const p=e.useRef(s);p.current=s;const y=e.useRef(!1),f=e.useRef(null),m="horizontal"===(null==s?void 0:s.projection),v=e.useRef(m);return v.current=m,e.useEffect(()=>{if(!u.current)return;const e=a.select(u.current).select(".brush-g"),o=m?l.brushX():l.brushY();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(y.current)return;const t=p.current;if(!t)return;if(!e.selection)return f.current=null,void g.current(null);const[n,o]=e.selection;let r;r=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};f.current=i,g.current(i)}),e.call(o),h.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),h.current=null}},[t,n,m]),e.useEffect(()=>{if(!s||!h.current||!f.current)return;if(!u.current)return;const e=f.current,t=a.select(u.current).select(".brush-g"),n=s.r(e.r[0]),o=s.r(e.r[1]);m?(y.current=!0,t.call(h.current.move,[n,o]),y.current=!1):(y.current=!0,t.call(h.current.move,[o,n]),y.current=!1)},[s,m]),d.createElement("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},d.createElement("g",{className:"brush-g",transform:`translate(${i.left},${i.top})`,style:{pointerEvents:"all"}}))}function re(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const ie="undefined"==typeof window||"undefined"==typeof document,se=d.createContext(null),ae={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function le(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const ce=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ue={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},de={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},he={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},ge={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},pe={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},ye={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},fe={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function me({scene:e,chartType:t,tableId:n,chartTitle:o}){var r;const[i,s]=d.useState(!1),a=d.useContext(se),l=null!==(r=null==a?void 0:a.visible)&&void 0!==r&&r,c=i||l,u=d.useRef(null),h=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t,g=d.useCallback(()=>{i||l||s(!0)},[i,l]),p=d.useCallback(e=>{var t;l||(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[l]);if(!e||0===e.length)return n?d.createElement("span",{id:n,tabIndex:-1,style:ae}):null;if(!c)return d.createElement("div",{id:n,tabIndex:-1,onFocus:g,style:ae,role:"region","aria-label":h},d.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",e.length," elements)"));const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,w,k,A,O,j;const S=[];if(!Array.isArray(e))return S;for(const M of e)if(M&&"object"==typeof M)try{switch(M.type){case"point":S.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&S.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=M.datum&&"object"==typeof M.datum?M.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;S.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":S.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":S.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=M.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=M.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=M.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":S.push({label:"Node",values:{id:null!==(h=null===(d=M.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=M.cx)&&void 0!==g?g:M.x,y:null!==(p=M.cy)&&void 0!==p?p:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(f=null===(y=M.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=M.cx)&&void 0!==m?m:M.x,y:null!==(v=M.cy)&&void 0!==v?v:M.y}});break;case"candlestick":S.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":S.push({label:"Region",values:{name:null!==(A=null!==(w=null===(x=null===(b=M.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==w?w:null===(k=M.datum)||void 0===k?void 0:k.name)&&void 0!==A?A:"",value:null!==(j=null===(O=M.datum)||void 0===O?void 0:O.value)&&void 0!==j?j:""}})}}catch(e){}return S}(e),f=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ce(e.min)} to ${ce(e.max)}, mean ${ce(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,f),v=y.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return d.createElement("div",{ref:u,id:n,tabIndex:-1,onBlur:p,style:ue,role:"region","aria-label":h},d.createElement("button",{type:"button",onClick:()=>{l&&a&&a.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:he},"×"),d.createElement("div",{role:"note",style:de},m),d.createElement("table",{role:"table","aria-label":"Sample data for "+t,style:ge},d.createElement("caption",{style:fe},"First ",v.length," of ",y.length," data points"),d.createElement("thead",null,d.createElement("tr",null,d.createElement("th",{style:pe},"type"),x.map(e=>d.createElement("th",{key:e,style:pe},e)))),d.createElement("tbody",null,v.map((e,t)=>d.createElement("tr",{key:t},d.createElement("td",{style:ye},e.label),x.map(t=>{return d.createElement("td",{key:t,style:ye},null==(n=e.values[t])||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":ce(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"");var n}))))))}function ve({summary:e}){return e?d.createElement("div",{role:"note",style:ae},e):null}function be({tableId:e}){return d.createElement("a",{href:"#"+e,style:ae,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ae)}},"Skip to data table")}function xe({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 d.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:ae},t)}const we="var(--semiotic-focus, #005fcc)";function ke({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s}){if(!e||!t)return null;const a=t.x+n.left,l=t.y+n.top;let c;if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);c=d.createElement("rect",{x:a-e/2-3,y:l-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:we,strokeWidth:2,strokeDasharray:"4,2"})}else c=d.createElement("circle","wedge"===r?{cx:a,cy:l,r:12,fill:"none",stroke:we,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:l,r:8,fill:"none",stroke:we,strokeWidth:2,strokeDasharray:"4,2"});return d.createElement("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},c)}function Ae({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=d.useRef(null),[c,u]=d.useState(null);d.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect();u(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,s,n,o]);let h;return h=c?`translate(${c.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${c.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`,d.createElement("div",{ref:l,className:s,style:{position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"}},i)}function Oe(t){const n=e.createContext(null),o=je(t);return[function({children:o}){const r=e.useMemo(()=>je(t),[]);return d.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 je(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const Se={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}},Me={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"},[Ee,_e]=Oe(e=>({theme:Se,setTheme(t){e(e=>{if("light"===t)return{theme:Se};if("dark"===t)return{theme:Me};if("high-contrast"===t)return{theme:Ce};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Me:Se;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 Pe(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Le(e,t,n=.3){Pe(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 Be(e,t,n=.6){var o,r,i,s,a;if(!Pe(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 He(e,t,n,o=.35){Pe(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}const Te=(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?Re(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))),Le(e,t),e.globalAlpha=1};function Re(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 Ie=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Be(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Ne(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 De=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"wedge"===e.type);for(const t of s)Ne(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&&(Ne(e,t),He(e,t)),e.globalAlpha=1},Fe=(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()}},ze=(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 $e(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 We(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let qe=null;function Ge(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):(qe||(qe=document.createElement("canvas")),qe.width=e,qe.height=e,qe)}(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 Ve=new Map;function Xe(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Ve.get(n);if(void 0!==o)return o;const r=Ge({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ve.set(n,r),r}function Ye(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 Ke(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 Ue(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Qe=e=>[ze,...e],Ze={bar:Qe([Te]),clusterbar:Qe([Te]),point:Qe([Ie]),swarm:Qe([Ie]),pie:[De],donut:[De],boxplot:Qe([(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()}},Ie]),violin:Qe([Fe]),histogram:Qe([Te]),ridgeline:Qe([Fe]),timeline:Qe([Te]),funnel:[Te,(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?$e(r):null!=i?`${$e(r)} (${We(i)})`:$e(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=$e(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":[Te,(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=Xe(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?Ue(r):"",a=Ke(o);e.font="bold 13px sans-serif";const l=i?e.measureText(s).width:0;e.font="11px sans-serif";const c=e.measureText(a).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,p=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),Ye(e,g,p,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Ye(e,g,p,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(s,h,p+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(a,h,p+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(a,h,p+3))}e.lineWidth=1}}],swimlane:Qe([Te])},Je={top:50,right:40,bottom:60,left:70},et={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function tt({hover:e}){var t,n,o,r,i,s;const a=e.data||{},l=e.stats,c=e.category;if(Array.isArray(a)){const e=c||(null===(t=a[0])||void 0===t?void 0:t.category)||"";if(l)return d.createElement("div",{className:"semiotic-tooltip",style:et},e&&d.createElement("div",{style:{fontWeight:"bold"}},e+""),d.createElement("div",null,"n = ",l.n),d.createElement("div",null,"Min: ",l.min.toLocaleString()),d.createElement("div",null,"Q1: ",l.q1.toLocaleString()),d.createElement("div",null,"Median: ",l.median.toLocaleString()),d.createElement("div",null,"Q3: ",l.q3.toLocaleString()),d.createElement("div",null,"Max: ",l.max.toLocaleString()),d.createElement("div",{style:{opacity:.8}},"Mean: ",l.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=a.length;return d.createElement("div",{className:"semiotic-tooltip",style:et},e&&d.createElement("div",{style:{fontWeight:"bold"}},e+""),d.createElement("div",null,n," items"))}if(null!=a.bin&&null!=a.count){const e=a.range||[];return d.createElement("div",{className:"semiotic-tooltip",style:et},a.category&&d.createElement("div",{style:{fontWeight:"bold"}},a.category+""),d.createElement("div",null,"Count: ",a.count),2===e.length&&d.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const u=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 d.createElement("div",{className:"semiotic-tooltip",style:et},e.map(([e,t])=>d.createElement("div",{key:e},d.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}const p=(u&&null!=a[u]?a[u]:null)||a.category||a.name||a.group||a.__rName||"",y=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(!p&&""===y){const e=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return d.createElement("div",{className:"semiotic-tooltip",style:et},e.map(([e,t])=>d.createElement("div",{key:e},d.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return d.createElement("div",{className:"semiotic-tooltip",style:et},p&&d.createElement("div",{style:{fontWeight:"bold"}},p+""),""!==y&&d.createElement("div",null,"number"==typeof y?y.toLocaleString():y+""))}const nt=e.forwardRef(function(t,n){var o,r,s,a,l,c,u,h,p,y;const{chartType:f,runtimeMode:m,data:v,oAccessor:b="category",rAccessor:x="value",colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:j,valueAccessor:S,categoryAccessor:M,projection:C="vertical",size:E=[600,400],responsiveWidth:P,responsiveHeight:D,margin:F,barPadding:z,baselinePadding:$,innerRadius:W,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Y,showOutliers:K,showIQR:U,amplitude:Q,connectorOpacity:Z,showLabels:J,connectorAccessor:te,connectorStyle:se,rExtent:ae,oExtent:ce,extentPadding:ue=.05,oSort:de,windowMode:he="sliding",windowSize:ge=200,pieceStyle:pe,summaryStyle:ye,colorScheme:fe,barColors:we,showAxes:Oe=!0,showCategoryTicks:je,oLabel:Se,rLabel:Me,oFormat:Ce,rFormat:Ee,enableHover:Pe=!0,hoverAnnotation:Le,tooltipContent:Be,customHoverBehavior:He,annotations:Te,svgAnnotationRules:Re,showGrid:Ie=!1,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:We,backgroundGraphics:qe,foregroundGraphics:Ge,title:Ve,className:Xe,background:Ye,centerContent:Ke,decay:Ue,pulse:Qe,transition:et,staleness:nt,brush:ot,onBrush:rt,accessibleTable:it=!0,description:st,summary:at}=t,lt=function(){const[t,n]=e.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return e.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>n(e.matches))},[]),t}(),ct=e.useRef(lt);ct.current=lt;const[ut,dt]=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]]]}(E,P,D),ht=e.useMemo(()=>Object.assign(Object.assign({},Je),F),[F]),gt=dt[0]-ht.left-ht.right,pt=dt[1]-ht.top-ht.bottom,yt="function"==typeof Ge?Ge({size:dt,margin:ht}):Ge,ft=e.useRef(null),mt=e.useRef(!0),vt=_e(e=>e.theme),bt=e.useRef(0),xt=e.useRef(null),wt=e.useRef(()=>{}),[kt,At]=e.useState(null),[Ot,jt]=e.useState(null),[St,Mt]=e.useState(0),[Ct,Et]=e.useState(!1),_t=Pe||Le,Pt="streaming"===m,Lt=e.useMemo(()=>({chartType:f,runtimeMode:Pt?"streaming":"bounded",windowSize:ge,windowMode:he,extentPadding:ue,projection:C,oAccessor:Pt?void 0:b,rAccessor:Pt?void 0:x,colorAccessor:w,stackBy:k,groupBy:A,multiAxis:O,timeAccessor:Pt?j:void 0,valueAccessor:Pt?S||("string"==typeof x||"function"==typeof x?x:void 0):void 0,categoryAccessor:Pt?M||b:void 0,rExtent:ae,oExtent:ce,barPadding:z,baselinePadding:$,innerRadius:W,normalize:q,startAngle:G,sweepAngle:V,dynamicColumnWidth:X,bins:Y,showOutliers:K,showIQR:U,amplitude:Q,connectorOpacity:Z,showLabels:J,connectorAccessor:te,connectorStyle:se,oSort:de,pieceStyle:pe,summaryStyle:ye,colorScheme:fe,barColors:we,decay:Ue,pulse:Qe,transition:et,staleness:nt}),[f,ge,he,ue,C,b,x,w,k,A,O,j,S,M,ae,ce,z,$,W,q,G,V,X,Y,K,U,Q,Z,J,te,se,de,pe,ye,fe,we,Ue,Qe,et,nt,Pt]),Bt=e.useRef(null);Bt.current||(Bt.current=new _(Lt));const Ht=e.useCallback(()=>{bt.current||(bt.current=requestAnimationFrame(()=>wt.current()))},[]);e.useEffect(()=>{var e;null===(e=Bt.current)||void 0===e||e.updateConfig(Lt),mt.current=!0,Ht()},[Lt,Ht]),e.useEffect(()=>{mt.current=!0,Ht()},[vt,Ht]);const Tt=e.useRef(null);Tt.current||(Tt.current=new g(e=>{const t=Bt.current;t&&t.ingest(e)&&(mt.current=!0,Ht())}));const Rt=e.useCallback(e=>{var t;null===(t=Tt.current)||void 0===t||t.push(e)},[]),It=e.useCallback(e=>{var t;null===(t=Tt.current)||void 0===t||t.pushMany(e)},[]),Nt=e.useCallback(()=>{var e,t;null===(e=Tt.current)||void 0===e||e.clear(),null===(t=Bt.current)||void 0===t||t.clear(),mt.current=!0,Ht()},[Ht]);e.useImperativeHandle(n,()=>({push:Rt,pushMany:It,clear:Nt,getData:()=>{var e,t,n;return null===(e=Tt.current)||void 0===e||e.flush(),null!==(n=null===(t=Bt.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Bt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Rt,It,Nt]),e.useEffect(()=>{var e;v&&(null===(e=Tt.current)||void 0===e||e.setBoundedData(v))},[v]);const Dt=e.useRef(()=>{}),Ft=e.useRef(()=>{});Dt.current=e=>{if(!_t)return;const t=ft.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ht.left,r=e.clientY-n.top-ht.top;if(0>o||o>gt||0>r||r>pt)return void(xt.current&&(xt.current=null,At(null),He&&He(null),Ht()));const i=Bt.current;if(!i||0===i.scene.length)return;const s="radial"===C,a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=L(i,t,n);break;case"point":e=B(i,t,n,o);break;case"wedge":e=H(i,t,n);break;case"boxplot":e=T(i,t,n);break;case"violin":e=R(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,s?o-gt/2:o,s?r-pt/2:r);if(!a)return void(xt.current&&(xt.current=null,At(null),He&&He(null),Ht()));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 b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});xt.current=c,At(c),He&&(He(c),mt.current=!0),Ht()},Ft.current=()=>{xt.current&&(xt.current=null,At(null),He&&(He(null),mt.current=!0),Ht())},e.useCallback(e=>Dt.current(e),[]);const zt=e.useCallback(()=>Ft.current(),[]),$t=e.useRef(-1),Wt=e.useRef(null),qt=e.useRef(null),Gt=e.useCallback(e=>{const t=Bt.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(qt.current&&qt.current.version===n)o=qt.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)if("rect"===s.type&&null!=s.x){const e=null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:e})}else if("point"===s.type)i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(r=s.group)&&void 0!==r?r:"_default"});else if("wedge"===s.type&&null!=s.cx){const e=((s.startAngle||0)+(s.endAngle||0))/2,t=((s.innerRadius||0)+(s.outerRadius||50))/2;i.push({x:s.cx+Math.cos(e)*t,y:s.cy+Math.sin(e)*t,datum:s.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),qt.current={version:n,graph:o}}const r=$t.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),$t.current=0;const t=o.flat[0];Wt.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},N(t)),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});return xt.current=n,At(n),He&&He(n),void Ht()}const i=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?I(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?I(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return $t.current=-1,Wt.current=null,xt.current=null,At(null),He&&He(null),void Ht();$t.current=s;const a=o.flat[s];Wt.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},N(a)),{__oAccessor:"string"==typeof b?b:void 0,__rAccessor:"string"==typeof x?x:void 0,__chartType:f});xt.current=l,At(l),He&&He(l),Ht()},[He,Ht]),Vt=e.useCallback(e=>{$t.current=-1,Wt.current=null,Dt.current(e)},[]);wt.current=()=>{var e,t;bt.current=0;const n=ft.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Bt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(ct.current?i+1e6:i),a=!ct.current&&s,l=mt.current;l&&!s&&(r.computeScene({width:gt,height:pt}),mt.current=!1),(l||a)&&n.setAttribute("aria-label",le(r.scene,f+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=dt[0]*c,d=dt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=dt[0]+"px",n.style.height=dt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,dt[0],dt[1]);const h=null!==(e=null==nt?void 0:nt.threshold)&&void 0!==e?e:5e3,g=nt&&r.lastIngestTime>0&&i-r.lastIngestTime>h;g&&(o.globalAlpha=null!==(t=null==nt?void 0:nt.dimOpacity)&&void 0!==t?t:.5);const p=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",y=Ye||(p&&"transparent"!==p?p:null);y&&(o.fillStyle=y,o.fillRect(0,0,dt[0],dt[1]));const m="radial"===C;o.save(),o.beginPath(),o.rect(ht.left,ht.top,gt,pt),o.clip(),m?(o.save(),o.translate(ht.left+gt/2,ht.top+pt/2)):o.translate(ht.left,ht.top);const v=Ze[f]||[],b={width:gt,height:pt};for(const e of v)e(o,r.scene,r.scales,b);m&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(jt(r.scales),Mt(e=>e+1)),(null==nt?void 0:nt.showBadge)&&Et(!!g),(a||r.hasActivePulses)&&(bt.current=requestAnimationFrame(()=>wt.current()))},e.useEffect(()=>(Ht(),()=>{bt.current&&(cancelAnimationFrame(bt.current),bt.current=0)}),[Ht]),e.useEffect(()=>{mt.current=!0,Ht()},[f,gt,pt,Oe,Ye,Ht]),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])}(nt,Bt,mt,Ht,Ct,Et);const Xt=_t&&kt?Be?Be(kt):d.createElement(tt,{hover:kt}):null,Yt="radial"===C,Kt=Xt?d.createElement(Ae,{x:kt?Yt?kt.x+gt/2:kt.x:0,y:kt?Yt?kt.y+pt/2:kt.y:0,containerWidth:gt,containerHeight:pt,margin:ht,className:"stream-ordinal-tooltip"},Xt):null;if(ie){const e=Bt.current;e&&v&&(e.ingest({inserts:v,bounded:!0}),e.computeScene({width:gt,height:pt}));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"===C,a=s?ht.left+gt/2:ht.left,l=s?ht.top+pt/2:ht.top;return d.createElement("div",{className:"stream-ordinal-frame"+(Xe?" "+Xe:""),role:"img","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),style:{position:"relative",width:dt[0],height:dt[1]}},d.createElement(ve,{summary:at}),d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:dt[0],height:dt[1],style:{position:"absolute",left:0,top:0}},qe&&d.createElement("g",{transform:`translate(${ht.left},${ht.top})`},qe),d.createElement("g",{transform:`translate(${a},${l})`},Ye&&d.createElement("rect",{x:0,y:0,width:gt,height:pt,fill:Ye}),t.map((e,t)=>function(e,t){var n,o,r,s,a;const l=e.category||e.group||"",c=n=>`ord-${e.type}-${l}-${t}-${n}`,u=`ord-${e.type}-${l}-${t}`;switch(e.type){case"rect":{const t=e;return d.createElement("rect",{key:u,x:t.x,y:t.y,width:t.w,height:t.h,fill:re(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}case"point":{const t=e;return d.createElement("circle",{key:u,cx:t.x,cy:t.y,r:t.r,fill:re(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 d.createElement("path",{key:u,d:n,transform:`translate(${t.cx},${t.cy})`,fill:re(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?d.createElement("g",{key:u},d.createElement("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),d.createElement("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:re(t.style.fill),fillOpacity:null!==(o=t.style.fillOpacity)&&void 0!==o?o:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),d.createElement("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),d.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}),d.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})):d.createElement("g",{key:u},d.createElement("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),d.createElement("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:re(t.style.fill),fillOpacity:null!==(r=t.style.fillOpacity)&&void 0!==r?r:.6,stroke:t.style.stroke||"#333",strokeWidth:1}),d.createElement("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),d.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}),d.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=[d.createElement("path",{key:c("path"),d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:re(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(d.createElement("line",{key:c("iqr"),x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2}),d.createElement("circle",{key:c("med"),cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1})):n.push(d.createElement("line",{key:c("iqr"),x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2}),d.createElement("circle",{key:c("med"),cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1}))}return d.createElement("g",{key:u},n)}case"connector":return d.createElement("line",{key:u,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 d.createElement("polygon",{key:u,points:n,fill:re(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})}default:return null}}(e,t)).filter(Boolean))),d.createElement(ne,{width:gt,height:pt,totalWidth:dt[0],totalHeight:dt[1],margin:ht,scales:n,showAxes:Oe,showCategoryTicks:je,oLabel:Se,rLabel:Me,oFormat:Ce,rFormat:Ee,showGrid:Ie,title:Ve,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:We,foregroundGraphics:yt,annotations:Te,svgAnnotationRules:Re,annotationFrame:0,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null==e?void 0:e.getData()}),Ke&&"radial"===C&&d.createElement("div",{style:{position:"absolute",left:ht.left+gt/2,top:ht.top+pt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ke))}const Ut="semiotic-table-"+d.useId();return d.createElement("div",{ref:ut,className:"stream-ordinal-frame"+(Xe?" "+Xe:""),role:"group","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:P?"100%":dt[0],height:D?"100%":dt[1],overflow:"visible"},onKeyDown:Gt},it&&d.createElement(be,{tableId:Ut}),it&&d.createElement(me,{scene:null!==(a=null===(s=Bt.current)||void 0===s?void 0:s.scene)&&void 0!==a?a:[],chartType:f+" chart",tableId:Ut,chartTitle:"string"==typeof Ve?Ve:void 0}),d.createElement(ve,{summary:at}),d.createElement("div",{role:"img","aria-label":st||("string"==typeof Ve?Ve:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:_t?Vt:void 0,onMouseLeave:_t?zt:void 0},qe&&d.createElement("svg",{style:{position:"absolute",top:0,left:0,width:dt[0],height:dt[1],pointerEvents:"none"}},d.createElement("g",{transform:`translate(${ht.left},${ht.top})`},qe)),d.createElement(ee,{width:gt,height:pt,totalWidth:dt[0],totalHeight:dt[1],margin:ht,scales:Ot,showAxes:Oe,showGrid:Ie,rFormat:Ee}),d.createElement("canvas",{ref:ft,"aria-label":le(null!==(c=null===(l=Bt.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],f+" chart"),style:{position:"absolute",top:0,left:0,width:dt[0],height:dt[1]}}),d.createElement(xe,{hoverPoint:kt}),d.createElement(ne,{width:gt,height:pt,totalWidth:dt[0],totalHeight:dt[1],margin:ht,scales:Ot,showAxes:Oe,showCategoryTicks:je,oLabel:Se,rLabel:Me,oFormat:Ce,rFormat:Ee,showGrid:Ie,title:Ve,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Fe,legendHighlightedCategory:ze,legendIsolatedCategories:$e,legendPosition:We,foregroundGraphics:yt,annotations:Te,svgAnnotationRules:Re,annotationFrame:St,xAccessor:"string"==typeof b?b:void 0,yAccessor:"string"==typeof x?x:void 0,annotationData:null===(u=Bt.current)||void 0===u?void 0:u.getData(),underlayRendered:!0}),(ot||rt)&&"radial"!==C&&d.createElement(oe,{width:gt,height:pt,totalWidth:dt[0],totalHeight:dt[1],margin:ht,scales:Ot,onBrush:rt||(()=>{})}),Ke&&"radial"===C&&d.createElement("div",{style:{position:"absolute",left:ht.left+gt/2,top:ht.top+pt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},Ke),(null==nt?void 0:nt.showBadge)&&d.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===nt.badgePosition?{top:4,left:4}:"bottom-left"===nt.badgePosition?{bottom:4,left:4}:"bottom-right"===nt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Ct?"#dc3545":"#28a745",color:"white"})},Ct?"STALE":"LIVE"),d.createElement(ke,{active:$t.current>=0,hoverPoint:kt,margin:ht,size:dt,shape:null===(h=Wt.current)||void 0===h?void 0:h.shape,width:null===(p=Wt.current)||void 0===p?void 0:p.w,height:null===(y=Wt.current)||void 0===y?void 0:y.h}),Kt))});nt.displayName="StreamOrdinalFrame";const ot=e.createContext(null);function rt(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 it(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[st,at]=Oe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=it(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=it(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}})}})),[lt,ct]=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}))}}));let ut={positions:new Map};const dt=new Set;function ht(){for(const e of dt)e()}function gt(e,t){const n=ut.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ut.positions);o.delete(e),ut={positions:o},ht()}function pt(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,i=at(e=>e.selections.get(r)),s=at(e=>e.setClause),a=at(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(rt(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 yt=e.createContext(!1);function ft({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):k[i%k.length];return{label:r+"",color:a}}),label:""}]}}function mt(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 vt(){var e;const t=_e(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 bt(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=x[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 xt(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])}d.createContext(void 0);const wt={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 kt(e,t,n){var o,r,i,s,a,l;const c=wt[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,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:At(c.marginDefaults,t.showCategoryTicks,t.orientation)}}function At(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 Ot={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 jt(e,t){return"function"==typeof t?t(e):e[t]}function St(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Mt(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=jt(e,n);s=St(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=jt(e,r);a.push({label:n,value:St(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=St(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=St(e[t[0]],o))}}const l=Object.assign(Object.assign({},Ot),r);return d.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},s&&d.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},s),a.map((e,t)=>d.createElement("div",{key:t,style:{marginTop:0===t&&s?"4px":0}},e.label&&d.createElement("span",null,e.label,": "),e.value)))}}function Ct(e){if(!0===e)return Mt();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:d.createElement("div",{className:"semiotic-tooltip",style:Ot},n)}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Mt(e):Mt())}function Et(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function _t(e,t){return"function"==typeof t?t(e):e[t]}function Pt({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=_t(a,e),c=_t(a,t),u=n?_t(a,n):void 0;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},d.createElement("div",{style:{fontWeight:"bold"}},Et(l)),d.createElement("div",{style:{marginTop:4}},Et(c)),null!=u&&d.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(h=n)?h:"value"),": ",Et(u)));var h}}function Lt({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return d.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"}},d.createElement("div",{style:{textAlign:"center",maxWidth:400}},d.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),d.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t),n&&d.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 Bt extends d.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:d.createElement(Lt,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Ht(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 Tt(e,t,n=3){let o,r=n+1;for(const n of t){const t=Ht(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function Rt(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function It(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=Tt(e,t,3))&&void 0!==n?n:null)}function Nt({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=Rt(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=It(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Dt={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Ft={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},zt={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},$t=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Wt=["vertical","horizontal"],qt={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),Ft),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:$t},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({},Dt),Ft),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:$t},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),Ft),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:$t},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({},Dt),Ft),{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({},Dt),Ft),{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({},Dt),Ft),{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({},Dt),Ft),{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({},Dt),Ft),{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({},Dt),Ft),{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({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Wt},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Wt},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Dt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Dt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Dt),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Dt),zt),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Dt),{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({},Dt),{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:Wt},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({},Dt),{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({},Dt),{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({},Dt),{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({},Dt),{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({},Dt),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Gt(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const Vt=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Xt=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Yt=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Kt=new Set(["LineChart","AreaChart","StackedAreaChart"]),Ut=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Qt(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 Zt(e,t){const n=Qt(e),o=Qt(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Jt=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function en(e,t){const n=[],o=function(e,t){const n=[],o=qt[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(qt).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(!Gt(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=Tt(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=Nt({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=Rt(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=It(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 qt[e]?(function(e,t,n){const o=qt[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=qt[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){Vt.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){Xt.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=qt[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(!Yt.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(!Kt.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=qt[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(!Ut.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=Zt(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=Zt(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of Jt)"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 tn;const nn="undefined"!=typeof process&&"production"!==(null===(tn=process.env)||void 0===tn?void 0:tn.NODE_ENV);function on({componentName:e,width:t,height:n,chartProps:o,children:r}){return d.createElement(Bt,{fallback:r=>{let i="";if(nn&&o)try{const t=en(e,o);t.ok||(i=t.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return d.createElement(Lt,{componentName:e,message:r.message,diagnosticHint:i,width:t,height:n})}},r)}const rn={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"},sn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function an(e,t,n,o){if(!nn)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 ln(t){const{data:n,rawData:o,colorBy:r,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:h=!1,onObservation:g,chartType:p,chartId:y,showLegend:f,userMargin:m,marginDefaults:v,onClick:b,hoverHighlight:x,loading:w,emptyContent:k,width:A,height:S}=t,M="string"==typeof t.colorBy?t.colorBy:void 0,{activeSelectionHook:C,hoverSelectionHook:E,customHoverBehavior:_,customClickBehavior:P,crosshairSourceId:L}=function({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:r=!1,onObservation:i,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=e.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(n,o),g=pt({name:(null==t?void 0:t.name)||"__unused__"}),p=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:i,selectPoints:s,clear:a}=pt({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==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),y=ct(e=>e.pushObservation),f=t?{isActive:g.isActive,predicate:g.predicate}:null,[m,v]=e.useState(null),b=u||o[0],x=e.useMemo(()=>{if(!c||null==m||!b)return null;const e=m,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,m,b]),w=e.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const e=null==t?void 0:t[h.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=ut.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(ut={positions:new Map(ut.positions).set(e,{xValue:t,sourceId:n})},ht())}(h.name||"hover",Number(e),d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&>(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(i||y){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),y&&y(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});i&&i(e),y&&y(e)}}},[n,p,h,d,i,s,a,y,c,b]),k=e.useCallback(e=>{var t,n,o,r;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[h.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=ut.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(ut.positions);return t.delete(e),ut={positions:t},ht(),!1}ut={positions:new Map(ut.positions).set(e,{xValue:t,sourceId:n,locked:!0})},ht()}(h.name||"hover",Number(n),d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||y){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(s),y&&y(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),y&&y(e)}}},[l,i,y,s,a,h,d]);return e.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const n=ut.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(ut.positions);o.delete(e),ut={positions:o},ht()}(e,d),gt(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:f,hoverSelectionHook:x,customHoverBehavior:w,customClickBehavior:k,crosshairSourceId:d}}({selection:l,linkedHover:c,fallbackFields:u,unwrapData:h,onObservation:g,chartType:p,chartId:y,onClick:b,hoverHighlight:x,colorByField:M}),B=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(c,L),H=function(t,n,o){const r=e.useContext(ot),i=vt();return e.useMemo(()=>{var e;if(!n)return;const s=null!==(e=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==e?e:"category10";if(0!==t.length){if("function"==typeof n){const e=Array.from(new Set(t.map(e=>n(e)+"")));if(r&&Object.keys(r).length>0){const t=j(e.map(e=>({_cat:e})),"_cat",s);return e=>r[e]||t(e)}return j(e.map(e=>({_cat:e})),"_cat",s)}if(r&&Object.keys(r).length>0){const e=j(t,n,s);return t=>r[t]||e(t)}return j(t,n,s)}if(r&&Object.keys(r).length>0){const e=j([{_:"a"}],"_",s);return t=>r[t]||e(t)}},[t,n,o,r,i])}(n,r,i),T=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]),R=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,T),I=e.useMemo(()=>E||(R.legendSelectionHook?R.legendSelectionHook:C),[E,R.legendSelectionHook,C]),{legend:N,margin:D,legendPosition:F}=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(yt),u=void 0!==r?r:!c&&!!n,d=e.useMemo(()=>{if(u&&n)return ft({data:t,colorBy:n,colorScale:o,getColor:O,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:H,showLegend:f,legendPosition:a,userMargin:m,defaults:v}),z=e.useMemo(()=>{const e={};return N&&(e.legend=N,e.legendPosition=F),s&&"none"!==s&&(e.legendHoverBehavior=R.onLegendHover,e.legendClickBehavior=R.onLegendClick,e.legendHighlightedCategory=R.highlightedCategory,e.legendIsolatedCategories=R.isolatedCategories),e},[N,F,s,R.onLegendHover,R.onLegendClick,R.highlightedCategory,R.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))),s=Math.floor((n-(o*(r+i)-i))/2);return d.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)=>d.createElement("div",{key:n,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},sn),{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})})))}(w,A,S),W=$?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?d.createElement("div",{style:Object.assign(Object.assign({},rn),{width:t,height:n})},o||"No data available"):null}(o,A,S,k);return{colorScale:H,allCategories:T,legendState:R,effectiveSelectionHook:I,activeSelectionHook:C,customHoverBehavior:_,customClickBehavior:P,legend:N,margin:D,legendPosition:F,earlyReturn:$||W||null,legendBehaviorProps:z,crosshairProps:B}}const cn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="vertical",valueFormat:h,colorBy:g,colorScheme:p,sort:y=!1,barPadding:f=40,baselinePadding:m=!1,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:j,hoverHighlight:S,chartId:M,loading:C,emptyContent:E,legendInteraction:_,legendPosition:P,color:L,showCategoryTicks:B,categoryFormat:H}=t,T=o.width,R=o.height,I=o.enableHover,N=o.showGrid,D=o.title,F=o.description,z=o.summary,$=o.accessibleTable,W=o.categoryLabel,q=o.valueLabel,G=i||[],V=ln({data:G,rawData:i,colorBy:g,colorScheme:p,legendInteraction:_,legendPosition:P,selection:w,linkedHover:k,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"BarChart",chartId:M,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:C,emptyContent:E,width:T,height:R});if(V.earlyReturn)return V.earlyReturn;an("BarChart",G,"categoryAccessor",l),an("BarChart",G,"valueAccessor",c);const X=xt(G,y,c),Y=vt(),K=e.useMemo(()=>new Map,[G]),U=e.useMemo(()=>(e,t)=>{const n={};return n.fill=g?O(e,g,V.colorScale):bt(L,Y,p,void 0,K),n},[g,V.colorScale,L,Y,p,K]),Q=e.useMemo(()=>mt(U,V.effectiveSelectionHook,w),[U,V.effectiveSelectionHook,w]),Z=e.useMemo(()=>Pt({categoryAccessor:l,valueAccessor:c,groupAccessor:g&&g!==l?g:void 0,groupLabel:"string"==typeof g?g:"group"}),[l,c,g]),J=Nt({componentName:"BarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(J)return d.createElement(Lt,{componentName:"BarChart",message:J,width:T,height:R});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:X}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:Q,size:[T,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V.margin,barPadding:f,baselinePadding:m,enableHover:I,showAxes:o.showAxes,oLabel:W,rLabel:q,rFormat:h}),H&&{oFormat:H}),{showGrid:N,showCategoryTicks:B,oSort:y}),V.legendBehaviorProps),D&&{title:D}),F&&{description:F}),z&&{summary:z}),void 0!==$&&{accessibleTable:$}),a&&{className:a}),{tooltipContent:!1===v?()=>null:Ct(v)||Z}),(k||A||j||S)&&{customHoverBehavior:V.customHoverBehavior}),(A||j||k)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),x);return d.createElement(on,{componentName:"BarChart",width:T,height:R},d.createElement(nt,Object.assign({ref:r},ee)))});function un({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]),p=e.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]),y=e.useMemo(()=>{if(!t||!n||!1===r)return;const e=a.current;if(0===e.length)return;const i=Array.isArray(o)?o:k,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 ft({data:e.map(e=>({[l]:e})),colorBy:l,colorScale:e=>s.get(e)||"#999",getColor:O})},[t,n,r,o,l]),f=e.useMemo(()=>{if(y)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[y,i]);return{wrapPush:h,wrapPushMany:g,resetCategories:p,streamingLegend:y,streamingMarginAdjust:f}}function dn({ref:t,frameRef:n,isPushMode:o,colorBy:r,colorScheme:i,showLegend:s,legendPosition:a,setup:l}){const c=un({isPushMode:o,colorBy:r,colorScheme:i,showLegend:s,legendPosition:a}),u=e.useCallback(c.wrapPush(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)}),[c.wrapPush]),d=e.useCallback(c.wrapPushMany(e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)}),[c.wrapPushMany]);return e.useImperativeHandle(t,()=>({push:u,pushMany:d,clear:()=>{var e;c.resetCategories(),null===(e=n.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[u,d,c.resetCategories]),{effectiveLegendProps:e.useMemo(()=>c.streamingLegend?Object.assign(Object.assign({},l.legendBehaviorProps),{legend:c.streamingLegend,legendPosition:a||l.legendPosition}):l.legendBehaviorProps,[l.legendBehaviorProps,l.legendPosition,c.streamingLegend,a]),effectiveMargin:e.useMemo(()=>{if(c.streamingMarginAdjust){const e=Object.assign({},l.margin);for(const[t,n]of Object.entries(c.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return l.margin},[l.margin,c.streamingMarginAdjust])}}cn.displayName="BarChart";const hn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",stackBy:c,valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:y,normalize:f=!1,barPadding:m=40,baselinePadding:v=!1,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:j,onClick:S,hoverHighlight:M,chartId:C,loading:E,emptyContent:_,legendInteraction:P,legendPosition:L,color:B,categoryFormat:H}=t,T=o.width,R=o.height,I=o.enableHover,N=o.showGrid,D=o.showLegend,F=o.title,z=o.description,$=o.summary,W=o.accessibleTable,q=o.categoryLabel,G=o.valueLabel,V=i||[],X=p||c,Y=void 0===i,K=ln({data:V,rawData:i,colorBy:X,colorScheme:y,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:M,chartType:"StackedBarChart",chartId:C,showLegend:D,userMargin:s,marginDefaults:o.marginDefaults,loading:E,emptyContent:_,width:T,height:R});if(K.earlyReturn)return K.earlyReturn;const U=vt(),Q=e.useMemo(()=>new Map,[V]),Z=e.useMemo(()=>(e,t)=>X?K.colorScale?{fill:O(e,X,K.colorScale)}:{}:{fill:bt(B,U,y,t,Q)},[X,K.colorScale,B,U,y,Q]),J=e.useMemo(()=>mt(Z,K.effectiveSelectionHook,k),[Z,K.effectiveSelectionHook,k]),ee=e.useMemo(()=>Pt({categoryAccessor:c,valueAccessor:u,groupAccessor:l}),[c,l,u]),te=Nt({componentName:"StackedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{stackBy:c}}),{effectiveLegendProps:ne,effectiveMargin:oe}=dn({ref:n,frameRef:r,isPushMode:Y,colorBy:X,colorScheme:y,showLegend:D,legendPosition:L,setup:K}),re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:V}),{oAccessor:l,rAccessor:u,stackBy:c,normalize:f,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:J,size:[T,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe,barPadding:m,baselinePadding:v,enableHover:I,showAxes:o.showAxes,oLabel:q,rLabel:G,rFormat:g}),H&&{oFormat:H}),{showGrid:N}),ne),F&&{title:F}),z&&{description:z}),$&&{summary:$}),void 0!==W&&{accessibleTable:W}),a&&{className:a}),{tooltipContent:!1===b?()=>null:Ct(b)||ee}),(A||j||S||M)&&{customHoverBehavior:K.customHoverBehavior}),(j||S||A)&&{customClickBehavior:K.customClickBehavior}),x&&x.length>0&&{annotations:x}),w);return te?d.createElement(Lt,{componentName:"StackedBarChart",message:te,width:T,height:R}):d.createElement(on,{componentName:"StackedBarChart",width:T,height:R},d.createElement(nt,Object.assign({ref:r},re)))});hn.displayName="StackedBarChart";const gn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",groupBy:c,valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:p,colorScheme:y,barPadding:f=60,baselinePadding:m=!1,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:j,hoverHighlight:S,chartId:M,loading:C,emptyContent:E,legendInteraction:_,legendPosition:P,color:L,categoryFormat:B}=t,H=o.width,T=o.height,R=o.enableHover,I=o.showGrid,N=o.showLegend,D=o.title,F=o.description,z=o.summary,$=o.accessibleTable,W=o.categoryLabel,q=o.valueLabel,G=i||[],V=p||c,X=void 0===i,Y=ln({data:G,rawData:i,colorBy:V,colorScheme:y,legendInteraction:_,legendPosition:P,selection:w,linkedHover:k,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"GroupedBarChart",chartId:M,showLegend:N,userMargin:s,marginDefaults:o.marginDefaults,loading:C,emptyContent:E,width:H,height:T});if(Y.earlyReturn)return Y.earlyReturn;const K=vt(),U=e.useMemo(()=>new Map,[G]),Q=e.useMemo(()=>(e,t)=>V?Y.colorScale?{fill:O(e,V,Y.colorScale)}:{}:{fill:bt(L,K,y,t,U)},[V,Y.colorScale,L,K,y,U]),Z=e.useMemo(()=>mt(Q,Y.effectiveSelectionHook,w),[Q,Y.effectiveSelectionHook,w]),J=e.useMemo(()=>Pt({categoryAccessor:c,valueAccessor:u,groupAccessor:l}),[c,l,u]),ee=Nt({componentName:"GroupedBarChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{groupBy:c}}),{effectiveLegendProps:te,effectiveMargin:ne}=dn({ref:n,frameRef:r,isPushMode:X,colorBy:V,colorScheme:y,showLegend:N,legendPosition:P,setup:Y}),oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=i&&{data:G}),{oAccessor:l,rAccessor:u,groupBy:c,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:Z,size:[H,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne,barPadding:f,baselinePadding:m,enableHover:R,showAxes:o.showAxes,oLabel:W,rLabel:q,rFormat:g}),B&&{oFormat:B}),{showGrid:I}),te),D&&{title:D}),F&&{description:F}),z&&{summary:z}),void 0!==$&&{accessibleTable:$}),a&&{className:a}),{tooltipContent:!1===v?()=>null:Ct(v)||J}),(k||A||j||S)&&{customHoverBehavior:Y.customHoverBehavior}),(A||j||k)&&{customClickBehavior:Y.customClickBehavior}),b&&b.length>0&&{annotations:b}),x);return ee?d.createElement(Lt,{componentName:"GroupedBarChart",message:ee,width:H,height:T}):d.createElement(on,{componentName:"GroupedBarChart",width:H,height:T},d.createElement(nt,Object.assign({ref:r},oe)))});function pn({brushProp:t,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const i=(s="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(t){const{name:n,xField:o,yField:r}=t,{predicate:i,isActive:s,selectInterval:a,clear:l}=pt({name:n}),c=o&&r?"xyBrush":o?"xBrush":"yBrush",u=e.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,r,a,l]);return{brushInteraction:e.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof r?r:"value")}),l=e.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=e.useCallback(e=>{if(i){l.current.end(e?e.r:null)}null==n||n(e)},[n,i]),u=!!(t||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}gn.displayName="GroupedBarChart";const yn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="category",subcategoryAccessor:c,valueAccessor:u="value",orientation:h="horizontal",valueFormat:g,colorBy:p,colorScheme:y,barPadding:f=40,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:k={},selection:A,linkedHover:j,onObservation:S,onClick:M,hoverHighlight:C,chartId:E,loading:_,emptyContent:P,legendInteraction:L,legendPosition:B,color:H,categoryFormat:T,showCategoryTicks:R}=t,I=o.width,N=o.height,D=o.enableHover,F=o.showGrid,z=o.showLegend,$=o.title,W=o.description,q=o.summary,G=o.accessibleTable,V=o.categoryLabel,X=o.valueLabel,Y=i||[],K=p||c,U=void 0===i,Q=ln({data:Y,rawData:i,colorBy:K,colorScheme:y,legendInteraction:L,legendPosition:B,selection:A,linkedHover:j,fallbackFields:K?["string"==typeof K?K:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:E,showLegend:z,userMargin:s,marginDefaults:o.marginDefaults,loading:_,emptyContent:P,width:I,height:N}),Z=pn({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:u});if(Q.earlyReturn)return Q.earlyReturn;const J=vt(),ee=e.useMemo(()=>new Map,[Y]),te=e.useMemo(()=>(e,t)=>K?Q.colorScale?{fill:O(e,K,Q.colorScale)}:{}:{fill:bt(H,J,y,t,ee)},[K,Q.colorScale,H,J,y,ee]),ne=e.useMemo(()=>mt(te,Q.effectiveSelectionHook,A),[te,Q.effectiveSelectionHook,A]),oe=e.useMemo(()=>Pt({categoryAccessor:c,valueAccessor:u,groupAccessor:l}),[c,l,u]),re=Nt({componentName:"SwimlaneChart",data:i,accessors:{categoryAccessor:l,valueAccessor:u,subcategoryAccessor:c},requiredProps:{subcategoryAccessor:c}}),{effectiveLegendProps:ie,effectiveMargin:se}=dn({ref:n,frameRef:r,isPushMode:U,colorBy:K,colorScheme:y,showLegend:z,legendPosition:B,setup:Q}),ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=i&&{data:Y}),{oAccessor:l,rAccessor:u,stackBy:c,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,barPadding:f,enableHover:D,showAxes:o.showAxes,oLabel:!1===R?void 0:V,rLabel:X,rFormat:g}),T&&{oFormat:T}),void 0!==R&&{showCategoryTicks:R}),{showGrid:F}),ie),$&&{title:$}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),a&&{className:a}),{tooltipContent:!1===m?()=>null:Ct(m)||oe}),(j||S||M||C)&&{customHoverBehavior:Q.customHoverBehavior}),(S||M||j)&&{customClickBehavior:Q.customClickBehavior}),v&&v.length>0&&{annotations:v}),Z.brushStreamProps),k);return re?d.createElement(Lt,{componentName:"SwimlaneChart",message:re,width:I,height:N}):d.createElement(on,{componentName:"SwimlaneChart",width:I,height:N},d.createElement(nt,Object.assign({ref:r},ae)))});yn.displayName="SwimlaneChart";const fn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="vertical",valueFormat:h,colorBy:g,colorScheme:p,sizeBy:y,sizeRange:f=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:w,brush:k,onBrush:A,linkedBrush:j,frameProps:S={},selection:M,linkedHover:C,onObservation:E,onClick:_,hoverHighlight:P,chartId:L,loading:B,emptyContent:H,legendInteraction:T,legendPosition:R,color:I,showCategoryTicks:N,categoryFormat:D}=t,F=o.width,z=o.height,$=o.enableHover,W=o.showGrid,q=o.title,G=o.description,V=o.summary,X=o.accessibleTable,Y=o.categoryLabel,K=o.valueLabel,U=i||[],Q=ln({data:U,rawData:i,colorBy:g,colorScheme:p,legendInteraction:T,legendPosition:R,selection:M,linkedHover:C,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:E,onClick:_,hoverHighlight:P,chartType:"SwarmPlot",chartId:L,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:B,emptyContent:H,width:F,height:z}),Z=pn({brushProp:k,onBrushProp:A,linkedBrush:j,valueAccessor:c});if(Q.earlyReturn)return Q.earlyReturn;const J=e.useMemo(()=>{if(!y)return;const e=U.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[U,y]),ee=vt(),te=e.useMemo(()=>new Map,[U]),ne=e.useMemo(()=>(e,t)=>{const n={fillOpacity:v};return n.fill=g?O(e,g,Q.colorScale):bt(I,ee,p,void 0,te),n.r=y?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,y,f,J):m,n},[g,Q.colorScale,y,f,J,m,v,I,ee,p,te]),oe=e.useMemo(()=>mt(ne,Q.effectiveSelectionHook,M),[ne,Q.effectiveSelectionHook,M]),re=e.useMemo(()=>Pt({categoryAccessor:l,valueAccessor:c,groupAccessor:g||void 0}),[l,c,g]),ie=Nt({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(ie)return d.createElement(Lt,{componentName:"SwarmPlot",message:ie,width:F,height:z});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=i&&{data:U}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[F,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Q.margin,barPadding:b,enableHover:$,showAxes:o.showAxes,oLabel:Y,rLabel:K,rFormat:h}),D&&{oFormat:D}),{showGrid:W,showCategoryTicks:N}),Q.legendBehaviorProps),q&&{title:q}),G&&{description:G}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),a&&{className:a}),{tooltipContent:!1===x?()=>null:Ct(x)||re}),(C||E||_||P)&&{customHoverBehavior:Q.customHoverBehavior}),(E||_||C)&&{customClickBehavior:Q.customClickBehavior}),w&&w.length>0&&{annotations:w}),Z.brushStreamProps),S);return d.createElement(on,{componentName:"SwarmPlot",width:F,height:z},d.createElement(nt,Object.assign({ref:r},se)))});function mn(e){return t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats||(t.data||t).stats;if(r&&null!=r.median)return d.createElement("div",{className:"semiotic-tooltip",style:Ot},o&&d.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r.n&&d.createElement("div",null,"n = ",r.n),null!=r.min&&d.createElement("div",null,"Min: ",r.min.toLocaleString()),null!=r.q1&&d.createElement("div",null,"Q1: ",r.q1.toLocaleString()),d.createElement("div",null,"Median: ",r.median.toLocaleString()),null!=r.q3&&d.createElement("div",null,"Q3: ",r.q3.toLocaleString()),null!=r.max&&d.createElement("div",null,"Max: ",r.max.toLocaleString()),null!=r.mean&&d.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==e?void 0:e.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},o&&d.createElement("div",{style:{fontWeight:"bold"}},o+""),i>0&&d.createElement("div",null,"n = ",i),null!=s&&d.createElement("div",null,"Median: ",s.toLocaleString()))}return d.createElement("div",{className:"semiotic-tooltip",style:Ot},d.createElement("div",{style:{fontWeight:"bold"}},o+""))}}fn.displayName="SwarmPlot";const vn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="vertical",valueFormat:h,colorBy:g,colorScheme:p,showOutliers:y=!0,categoryPadding:f=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:j,chartId:S,loading:M,emptyContent:C,legendInteraction:E,legendPosition:_,color:P,showCategoryTicks:L,categoryFormat:B}=t,H=o.width,T=o.height,R=o.enableHover,I=o.showGrid,N=o.title,D=o.description,F=o.summary,z=o.accessibleTable,$=o.categoryLabel,W=o.valueLabel,q=i||[],G=ln({data:q,rawData:i,colorBy:g,colorScheme:p,legendInteraction:E,legendPosition:_,selection:x,linkedHover:w,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:j,chartType:"BoxPlot",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:M,emptyContent:C,width:H,height:T});if(G.earlyReturn)return G.earlyReturn;const V=vt(),X=e.useMemo(()=>new Map,[q]),Y=e.useMemo(()=>e=>{const t=g?O(e,g,G.colorScale):bt(P,V,p,void 0,X);return{fill:t,stroke:t,fillOpacity:.8}},[g,G.colorScale,P,V,p,X]),K=e.useMemo(()=>mt(Y,G.effectiveSelectionHook,x),[Y,G.effectiveSelectionHook,x]),U=e.useMemo(()=>mn(),[]),Q=Nt({componentName:"BoxPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(Q)return d.createElement(Lt,{componentName:"BoxPlot",message:Q,width:H,height:T});const Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=i&&{data:q}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:K,showOutliers:y,size:[H,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,barPadding:f,enableHover:R,showAxes:o.showAxes,oLabel:$,rLabel:W,rFormat:h}),B&&{oFormat:B}),{showGrid:I,showCategoryTicks:L}),G.legendBehaviorProps),N&&{title:N}),D&&{description:D}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),a&&{className:a}),{tooltipContent:!1===m?()=>null:Ct(m)||U}),(w||k||A||j)&&{customHoverBehavior:G.customHoverBehavior}),(k||A||w)&&{customClickBehavior:G.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return d.createElement(on,{componentName:"BoxPlot",width:H,height:T},d.createElement(nt,Object.assign({ref:r},Z)))});vn.displayName="BoxPlot";const bn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:"horizontal"}),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:c="value",bins:u=25,relative:h=!1,valueFormat:g,colorBy:p,colorScheme:y,categoryPadding:f=20,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:k={},selection:A,linkedHover:j,onObservation:S,onClick:M,hoverHighlight:C,chartId:E,loading:_,emptyContent:P,legendInteraction:L,legendPosition:B,color:H,showCategoryTicks:T,categoryFormat:R}=t,I=o.width,N=o.height,D=o.enableHover,F=o.showGrid,z=o.title,$=o.description,W=o.summary,q=o.accessibleTable,G=o.categoryLabel,V=o.valueLabel,X=i||[],Y=ln({data:X,rawData:i,colorBy:p,colorScheme:y,legendInteraction:L,legendPosition:B,selection:A,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,chartType:"Histogram",chartId:E,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:_,emptyContent:P,width:I,height:N}),K=pn({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:c});if(Y.earlyReturn)return Y.earlyReturn;const U=e.useMemo(()=>{if(0===X.length)return;const e="function"==typeof c?c:e=>e[c];let t=1/0,n=-1/0;for(const o of X){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[X,c]),Q=vt(),Z=e.useMemo(()=>new Map,[X]),J=e.useMemo(()=>e=>{const t=p?O(e,p,Y.colorScale):bt(H,Q,y,void 0,Z);return{fill:t,stroke:t,fillOpacity:.8}},[p,Y.colorScale,H,Q,y,Z]),ee=e.useMemo(()=>mt(J,Y.effectiveSelectionHook,A),[J,Y.effectiveSelectionHook,A]),te=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},n&&d.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&d.createElement("div",null,"Count: ",o),r&&2===r.length&&d.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),ne=Nt({componentName:"Histogram",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(ne)return d.createElement(Lt,{componentName:"Histogram",message:ne,width:I,height:N});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=i&&{data:X}),{oAccessor:l,rAccessor:c,projection:"horizontal",summaryStyle:ee,bins:u,normalize:h}),U&&{rExtent:U}),{size:[I,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Y.margin,barPadding:f,enableHover:D,showAxes:o.showAxes,oLabel:G,rLabel:V,rFormat:g}),R&&{oFormat:R}),{showGrid:F,showCategoryTicks:T}),Y.legendBehaviorProps),z&&{title:z}),$&&{description:$}),W&&{summary:W}),void 0!==q&&{accessibleTable:q}),a&&{className:a}),{tooltipContent:!1===m?()=>null:Ct(m)||te}),(j||S||M||C)&&{customHoverBehavior:Y.customHoverBehavior}),(S||M||j)&&{customClickBehavior:Y.customClickBehavior}),v&&v.length>0&&{annotations:v}),K.brushStreamProps),k);return d.createElement(on,{componentName:"Histogram",width:I,height:N},d.createElement(nt,Object.assign({ref:r},oe)))});bn.displayName="Histogram";const xn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="vertical",bins:h=25,showIQR:g=!0,valueFormat:p,colorBy:y,colorScheme:f,categoryPadding:m=20,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:j,linkedHover:S,onObservation:M,onClick:C,hoverHighlight:E,chartId:_,loading:P,emptyContent:L,legendInteraction:B,legendPosition:H,color:T,showCategoryTicks:R,categoryFormat:I}=t,N=o.width,D=o.height,F=o.enableHover,z=o.showGrid,$=o.title,W=o.description,q=o.summary,G=o.accessibleTable,V=o.categoryLabel,X=o.valueLabel,Y=i||[],K=ln({data:Y,rawData:i,colorBy:y,colorScheme:f,legendInteraction:B,legendPosition:H,selection:j,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:E,chartType:"ViolinPlot",chartId:_,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:P,emptyContent:L,width:N,height:D}),U=pn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:c});if(K.earlyReturn)return K.earlyReturn;const Q=vt(),Z=e.useMemo(()=>new Map,[Y]),J=e.useMemo(()=>e=>{const t=y?O(e,y,K.colorScale):bt(T,Q,f,void 0,Z);return{fill:t,stroke:t,fillOpacity:.6}},[y,K.colorScale,T,Q,f,Z]),ee=e.useMemo(()=>mt(J,K.effectiveSelectionHook,j),[J,K.effectiveSelectionHook,j]),te=e.useMemo(()=>mn({valueAccessor:c}),[c]),ne=Nt({componentName:"ViolinPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(ne)return d.createElement(Lt,{componentName:"ViolinPlot",message:ne,width:N,height:D});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=i&&{data:Y}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:ee,bins:h,showIQR:g,size:[N,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:m,enableHover:F,showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:p}),I&&{oFormat:I}),{showGrid:z,showCategoryTicks:R}),K.legendBehaviorProps),$&&{title:$}),W&&{description:W}),q&&{summary:q}),void 0!==G&&{accessibleTable:G}),a&&{className:a}),{tooltipContent:!1===v?()=>null:Ct(v)||te}),(S||M||C||E)&&{customHoverBehavior:K.customHoverBehavior}),(M||C||S)&&{customClickBehavior:K.customClickBehavior}),b&&b.length>0&&{annotations:b}),U.brushStreamProps),A);return d.createElement(on,{componentName:"ViolinPlot",width:N,height:D},d.createElement(nt,Object.assign({ref:r},oe)))});xn.displayName="ViolinPlot";const wn=e.forwardRef(function(t,n){var o;const r=kt(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,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,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:c="category",valueAccessor:u="value",orientation:h="horizontal",valueFormat:g,colorBy:p,colorScheme:y,sort:f=!0,dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:j,onClick:S,hoverHighlight:M,chartId:C,loading:E,emptyContent:_,legendInteraction:P,legendPosition:L,color:B,categoryFormat:H}=t,T=r.width,R=r.height,I=r.enableHover,N=r.showGrid,D=r.title,F=r.description,z=r.summary,$=r.accessibleTable,W=r.categoryLabel,q=r.valueLabel,G=s||[],V=ln({data:G,rawData:s,colorBy:p,colorScheme:y,legendInteraction:P,legendPosition:L,selection:k,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:M,chartType:"DotPlot",chartId:C,showLegend:r.showLegend,userMargin:a,marginDefaults:r.marginDefaults,loading:E,emptyContent:_,width:T,height:R});if(V.earlyReturn)return V.earlyReturn;const X=xt(G,f,u),Y=vt(),K=e.useMemo(()=>new Map,[G]),U=e.useMemo(()=>(e,t)=>{const n={r:m,fillOpacity:.8};return n.fill=p?O(e,p,V.colorScale):bt(B,Y,y,void 0,K),n},[p,V.colorScale,m,B,Y,y,K]),Q=e.useMemo(()=>mt(U,V.effectiveSelectionHook,k),[U,V.effectiveSelectionHook,k]),Z=e.useMemo(()=>Pt({categoryAccessor:c,valueAccessor:u}),[c,u]),J=Nt({componentName:"DotPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(J)return d.createElement(Lt,{componentName:"DotPlot",message:J,width:T,height:R});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:Q,size:[T,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V.margin,barPadding:v,enableHover:I,showAxes:r.showAxes,oLabel:W,rLabel:q,rFormat:g}),H&&{oFormat:H}),{showGrid:N,oSort:f}),V.legendBehaviorProps),D&&{title:D}),F&&{description:F}),z&&{summary:z}),void 0!==$&&{accessibleTable:$}),l&&{className:l}),{tooltipContent:!1===b?()=>null:Ct(b)||Z}),(A||j||S||M)&&{customHoverBehavior:V.customHoverBehavior}),(j||S||A)&&{customClickBehavior:V.customClickBehavior}),x&&x.length>0&&{annotations:x}),w);return d.createElement(on,{componentName:"DotPlot",width:T,height:R},d.createElement(nt,Object.assign({ref:i},ee)))});wn.displayName="DotPlot";const kn=e.forwardRef(function(t,n){var o,r;const i=kt(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,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),s=e.useRef(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:h="value",colorBy:g,colorScheme:p,startAngle:y=0,tooltip:f,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:A,chartId:j,loading:S,emptyContent:M,legendInteraction:C,legendPosition:E,color:_}=t,P=i.width,L=i.height,B=i.enableHover,H=i.showLegend,T=i.title,R=i.description,I=i.summary,N=i.accessibleTable,D=a||[],F=g||u,z=void 0===a,$=ln({data:D,rawData:a,colorBy:F,colorScheme:p,legendInteraction:C,legendPosition:E,selection:b,linkedHover:x,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:A,chartType:"PieChart",chartId:j,showLegend:H,userMargin:l,marginDefaults:i.marginDefaults,loading:S,emptyContent:M,width:P,height:L});if($.earlyReturn)return $.earlyReturn;const W=vt(),q=e.useMemo(()=>new Map,[D]),G=e.useMemo(()=>(e,t)=>F?$.colorScale?{fill:O(e,F,$.colorScale)}:{}:{fill:bt(_,W,p,t,q)},[F,$.colorScale,_,W,p,q]),V=e.useMemo(()=>mt(G,$.effectiveSelectionHook,b),[G,$.effectiveSelectionHook,b]),X=e.useMemo(()=>Pt({categoryAccessor:u,valueAccessor:h,groupAccessor:g&&g!==u?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[u,h,g]),Y=Nt({componentName:"PieChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h}}),{effectiveLegendProps:K,effectiveMargin:U}=dn({ref:n,frameRef:s,isPushMode:z,colorBy:F,colorScheme:p,showLegend:H,legendPosition:E,setup:$}),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=a&&{data:D}),{oAccessor:u,rAccessor:h,projection:"radial",pieceStyle:V,startAngle:y,size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,enableHover:B,showAxes:!1}),K),T&&{title:T}),R&&{description:R}),I&&{summary:I}),void 0!==N&&{accessibleTable:N}),c&&{className:c}),{tooltipContent:!1===f?()=>null:Ct(f)||X}),(x||w||k||A)&&{customHoverBehavior:$.customHoverBehavior}),(w||k||x)&&{customClickBehavior:$.customClickBehavior}),m&&m.length>0&&{annotations:m}),v);return Y?d.createElement(Lt,{componentName:"PieChart",message:Y,width:P,height:L}):d.createElement(on,{componentName:"PieChart",width:P,height:L},d.createElement(nt,Object.assign({ref:s},Q)))});kn.displayName="PieChart";const An=e.forwardRef(function(t,n){var o,r;const i=kt(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,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks}),s=e.useRef(null),{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:h="value",innerRadius:g=60,centerContent:p,colorBy:y,colorScheme:f,startAngle:m=0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:j,hoverHighlight:S,chartId:M,loading:C,emptyContent:E,legendInteraction:_,legendPosition:P,color:L}=t,B=i.width,H=i.height,T=i.enableHover,R=i.showLegend,I=i.title,N=i.description,D=i.summary,F=i.accessibleTable,z=a||[],$=y||u,W=void 0===a,q=ln({data:z,rawData:a,colorBy:$,colorScheme:f,legendInteraction:_,legendPosition:P,selection:w,linkedHover:k,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"DonutChart",chartId:M,showLegend:R,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:E,width:B,height:H});if(q.earlyReturn)return q.earlyReturn;const G=vt(),V=e.useMemo(()=>new Map,[z]),X=e.useMemo(()=>(e,t)=>$?q.colorScale?{fill:O(e,$,q.colorScale)}:{}:{fill:bt(L,G,f,t,V)},[$,q.colorScale,L,G,f,V]),Y=e.useMemo(()=>mt(X,q.effectiveSelectionHook,w),[X,q.effectiveSelectionHook,w]),K=e.useMemo(()=>Pt({categoryAccessor:u,valueAccessor:h,groupAccessor:y&&y!==u?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[u,h,y]),U=Nt({componentName:"DonutChart",data:a,accessors:{categoryAccessor:u,valueAccessor:h}}),{effectiveLegendProps:Q,effectiveMargin:Z}=dn({ref:n,frameRef:s,isPushMode:W,colorBy:$,colorScheme:f,showLegend:R,legendPosition:P,setup:q}),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:z}),{oAccessor:u,rAccessor:h,projection:"radial",pieceStyle:Y,innerRadius:g,startAngle:m,centerContent:p,size:[B,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,enableHover:T,showAxes:!1}),Q),I&&{title:I}),N&&{description:N}),D&&{summary:D}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),{tooltipContent:!1===v?()=>null:Ct(v)||K}),(k||A||j||S)&&{customHoverBehavior:q.customHoverBehavior}),(A||j||k)&&{customClickBehavior:q.customClickBehavior}),b&&b.length>0&&{annotations:b}),x);return U?d.createElement(Lt,{componentName:"DonutChart",message:U,width:B,height:H}):d.createElement(on,{componentName:"DonutChart",width:B,height:H},d.createElement(nt,Object.assign({ref:s},J)))});An.displayName="DonutChart";const On=e.forwardRef(function(t,n){var o,r,i;const s=kt(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:300,height:null!==(r=t.height)&&void 0!==r?r:250,enableHover:null===(i=t.enableHover)||void 0===i||i,showLegend:!1,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary}),a=e.useRef(null),{value:l,min:c=0,max:u=100,thresholds:h,color:g,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:y=.3,showNeedle:f=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:v,valueFormat:b,showScaleLabels:x=!0,sweep:w=240,fillZones:k=!0,tooltip:A,annotations:O,frameProps:j={},className:S}=t,M=s.width,C=s.height,E=s.title,_=s.description,P=s.summary,L=s.accessibleTable,B=Math.max(c,Math.min(u,l)),H=u-c||1,T=(B-c)/H,{gaugeData:R,pieceStyle:I,gaugeAnnotations:N}=e.useMemo(()=>{const e=[],t=new Map,n=[];let o=h&&h.length>0?[...h].sort((e,t)=>e.value-t.value):[{value:u,color:g||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(c,Math.min(u,e.value))})),u>o[o.length-1].value&&o.push({value:u,color:o[o.length-1].color});let r=c;for(let n=0;o.length>n;n++){const i=o[n],s=(i.value-r)/H;if(k){const o=(r-c)/H,a=Math.max(0,Math.min(T,(i.value-c)/H)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:i.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:p,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:i.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:i.color})}r=i.value}if(x&&h&&h.length>0)for(const e of h)e.value>c&&u>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:p},gaugeAnnotations:n}},[l,c,u,h,g,p,T,H,x,k]),D=w*Math.PI/180,F=180+(360-w)/2,z=-Math.PI/2+F*Math.PI/180,$=[[Math.cos(z),Math.sin(z)],[Math.cos(z+D),Math.sin(z+D)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-z)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>D+.001||$.push([Math.cos(e),Math.sin(e)]);const W=Math.min(...$.map(e=>e[0])),q=Math.max(...$.map(e=>e[0])),G=Math.min(...$.map(e=>e[1])),V=Math.max(...$.map(e=>e[1])),X=(G+V)/2,Y=(W+q)/2,K=Math.max(10,Math.min((M-20)/(q-W),(C-20)/(V-G))-4),U=Math.max(10,K*(1-y)),Q=M/2-Y*K,Z=C/2-X*K,J=2*(K+4),ee=e.useMemo(()=>{if(null!=v)return"function"==typeof v?v(B,c,u):v;const e=b?b(B):Math.round(B)+"";return d.createElement("div",{style:{textAlign:"center",lineHeight:1.2}},d.createElement("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"}},e),x&&d.createElement("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"}},c," – ",u))},[v,B,c,u,b,x,K]),te=e.useMemo(()=>{if(!f)return null;const e=-Math.PI/2+F*Math.PI/180+T*D,t=U-8;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[f,T,F,D,U,m]),ne=e.useMemo(()=>(e,t,n)=>{if("gauge-needle"===e.type)return d.createElement("g",{key:"gauge-needle-"+t,transform:`translate(${(n.width||M)/2},${(n.height||C)/2})`},d.createElement("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:2.5,strokeLinecap:"round"}),d.createElement("circle",{cx:0,cy:0,r:5,fill:e.color}));if("gauge-label"===e.type){const o=-Math.PI/2+F*Math.PI/180+(e.value-c)/H*D,r=U-14,i=(n.height||C)/2;return d.createElement("text",{key:"gauge-label-"+t,x:(n.width||M)/2+Math.cos(o)*r,y:i+Math.sin(o)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label)}return null},[M,C,c,H,F,D,U]),oe=e.useMemo(()=>{const e=[...N,...O||[]];return te&&e.push(te),e},[N,O,te]),re=e.useMemo(()=>e=>{var t;const n=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t[0])||(null==e?void 0:e.data)||e,o=null==n?void 0:n._isFill;return d.createElement("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"}},d.createElement("div",{style:{fontWeight:600}},(null==n?void 0:n._zone)||""),d.createElement("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"}},o?"Current: "+Math.round(B):"Remaining"))},[B]);if(0===R.length)return d.createElement(Lt,{componentName:"GaugeChart",message:"No data to display",width:M,height:C});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:R,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:I,innerRadius:U,startAngle:F,sweepAngle:w,centerContent:ee,size:[M,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:{top:Z-J/2,bottom:C-Z-J/2,left:Q-J/2,right:M-Q-J/2},enableHover:s.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===A?()=>null:Ct(A)||re,svgAnnotationRules:ne},oe.length>0&&{annotations:oe}),E&&{title:E}),_&&{description:_}),P&&{summary:P}),void 0!==L&&{accessibleTable:L}),S&&{className:S}),j);return d.createElement(on,{componentName:"GaugeChart",width:M,height:C},d.createElement(nt,Object.assign({ref:a},ie)))});On.displayName="GaugeChart";const jn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),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:c="value",orientation:u="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:p,colorBy:y,colorScheme:f,categoryPadding:m=5,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:j,hoverHighlight:S,chartId:M,loading:C,emptyContent:E,legendInteraction:_,legendPosition:P,color:L,showCategoryTicks:B,categoryFormat:H}=t,T=o.width,R=o.height,I=o.enableHover,N=o.showGrid,D=o.title,F=o.description,z=o.summary,$=o.accessibleTable,W=o.categoryLabel,q=o.valueLabel,G=i||[],V=ln({data:G,rawData:i,colorBy:y,colorScheme:f,legendInteraction:_,legendPosition:P,selection:w,linkedHover:k,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"RidgelinePlot",chartId:M,showLegend:o.showLegend,userMargin:s,marginDefaults:o.marginDefaults,loading:C,emptyContent:E,width:T,height:R});if(V.earlyReturn)return V.earlyReturn;const X=vt(),Y=e.useMemo(()=>new Map,[G]),K=e.useMemo(()=>e=>{const t=y?O(e,y,V.colorScale):bt(L,X,f,void 0,Y);return{fill:t,stroke:t,fillOpacity:.5}},[y,V.colorScale,L,X,f,Y]),U=e.useMemo(()=>mt(K,V.effectiveSelectionHook,w),[K,V.effectiveSelectionHook,w]),Q=e.useMemo(()=>mn(),[]),Z=Nt({componentName:"RidgelinePlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(Z)return d.createElement(Lt,{componentName:"RidgelinePlot",message:Z,width:T,height:R});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=i&&{data:G}),{oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:U,bins:h,size:[T,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:V.margin,barPadding:m,enableHover:I,showAxes:o.showAxes,oLabel:W,rLabel:q,rFormat:p}),H&&{oFormat:H}),{showGrid:N,showCategoryTicks:B,oSort:!1,amplitude:g}),V.legendBehaviorProps),D&&{title:D}),F&&{description:F}),z&&{summary:z}),void 0!==$&&{accessibleTable:$}),a&&{className:a}),{tooltipContent:!1===v?()=>null:Ct(v)||Q}),(k||A||j||S)&&{customHoverBehavior:V.customHoverBehavior}),(A||j||k)&&{customClickBehavior:V.customClickBehavior}),b&&b.length>0&&{annotations:b}),x);return d.createElement(on,{componentName:"RidgelinePlot",width:T,height:R},d.createElement(nt,Object.assign({ref:r},J)))});jn.displayName="RidgelinePlot";const Sn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:!1,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:!1}),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:c="value",categoryAccessor:u,colorBy:h,colorScheme:g,orientation:p="horizontal",connectorOpacity:y=.3,showLabels:f=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:j,chartId:S,loading:M,emptyContent:C,legendInteraction:E,legendPosition:_,color:P,categoryFormat:L}=t,B="vertical"===p,H=o.width,T=o.height,R=o.enableHover,I=o.title,N=o.description,D=o.summary,F=o.accessibleTable,z=i||[],$=h||u,W=!$,q=ln({data:z,rawData:i,colorBy:$,colorScheme:g,legendInteraction:E,legendPosition:_,selection:x,linkedHover:w,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:j,chartType:"FunnelChart",chartId:S,showLegend:o.showLegend,userMargin:s,marginDefaults:B?{top:I?60:40,right:20,bottom:60,left:60}:{top:I?40:10,right:10,bottom:10,left:10},loading:M,emptyContent:C,width:H,height:T});if(q.earlyReturn)return q.earlyReturn;an("FunnelChart",z,"stepAccessor",l),an("FunnelChart",z,"valueAccessor",c);const G=vt(),V=e.useMemo(()=>new Map,[z]),X=e.useMemo(()=>{if(W)return P||((null==G?void 0:G[0])?G[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[W,P,G,g]),Y=e.useMemo(()=>(e,t)=>{const n={};return n.fill=X||($?O(e,$,q.colorScale):bt(P,G,g,t,V)),n},[X,$,q.colorScale,P,G,g,V]),K=e.useMemo(()=>mt(Y,q.effectiveSelectionHook,x),[Y,q.effectiveSelectionHook,x]),U=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)||"",c=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:"",u=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,p=null!==(s=null==a?void 0:a.__barFunnelCategory)&&void 0!==s?s:null==a?void 0:a.category,y=null==u||h?"":` (${.05>Math.abs(u-Math.round(u))?Math.round(u)+"%":u.toFixed(1)+"%"})`;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},l&&d.createElement("div",{style:{fontWeight:"bold"}},l+""),p&&p!==l&&d.createElement("div",{style:{marginTop:2,opacity:.8}},p+""),g&&d.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),d.createElement("div",{style:{marginTop:4}},c+"",y))},[]),Q=Nt({componentName:"FunnelChart",data:i,accessors:{stepAccessor:l,valueAccessor:c}});if(Q)return d.createElement(Lt,{componentName:"FunnelChart",message:Q,width:H,height:T});const Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=i&&{data:z}),{oAccessor:l,rAccessor:c}),u&&{stackBy:u}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:K,size:[H,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:q.margin,enableHover:R,showAxes:B,showCategoryTicks:B}),L&&{oFormat:L}),{showGrid:B}),!B&&{connectorOpacity:y}),{showLabels:f}),q.legendBehaviorProps),I&&{title:I}),N&&{description:N}),D&&{summary:D}),void 0!==F&&{accessibleTable:F}),a&&{className:a}),{tooltipContent:!1===m?()=>null:!0===m||null==m?U:Ct(m)||U}),(w||k||A||j)&&{customHoverBehavior:q.customHoverBehavior}),(k||A||w)&&{customClickBehavior:q.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return d.createElement(on,{componentName:"FunnelChart",width:H,height:T},d.createElement(nt,Object.assign({ref:r},Z)))});Sn.displayName="FunnelChart";const Mn="__likert_neutral_neg",Cn="__likert_neutral_pos";function En(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function _n(e,t,n,o,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function Pn(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:Mn,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:Cn,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function Ln(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===Mn?i=n:n.__likertLevel===Cn?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Bn=e.forwardRef(function(t,n){const o=kt(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),r=e.useRef(null),{data:i,margin:s,className:a,categoryAccessor:l="question",valueAccessor:c,levelAccessor:u,countAccessor:h="count",levels:g,orientation:p="horizontal",colorScheme:y,barPadding:f=20,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,onClick:A,hoverHighlight:O,chartId:j,valueFormat:S,loading:M,emptyContent:C,legendInteraction:E,legendPosition:_,categoryFormat:P}=t,L=o.width,B=o.height,H=o.enableHover,T=o.showGrid,R=o.showLegend,I=o.title,N=o.description,D=o.summary,F=o.accessibleTable,z=o.categoryLabel,$=o.valueLabel,W="horizontal"===p,q=void 0===i,G=!u,V=e.useMemo(()=>y&&Array.isArray(y)&&y.length>=g.length?y:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),s=[];for(let e=0;i>e;e++)s.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&s.push(o);for(let e=0;i>e;e++)s.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return s}(g.length),[y,g.length]),X=e.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],V[t]||"#888");return e},[g,V]),{processedData:Y,reAggregate:K,accumulatorRef:U}=function({data:t,levels:n,categoryAccessor:o,valueAccessor:r,levelAccessor:i,countAccessor:s,isDiverging:a,frameRef:l}){const c=!i,u=e.useMemo(()=>En(o,"question"),[o]),d=e.useMemo(()=>c?En(r,"score"):null,[c,r]),h=e.useMemo(()=>c?null:En(i,"level"),[c,i]),g=e.useMemo(()=>c?null:En(s,"count"),[c,s]),p=t||[],y=e.useRef([]),f=e.useMemo(()=>{if(0===p.length)return[];let e=_n(p,n,u,d,h,g);return a&&(e=Pn(e,n),e=Ln(e,n)),e},[p,n,u,d,h,g,a]),m=e.useCallback(e=>{var t,o;let r=_n(e,n,u,d,h,g);a&&(r=Pn(r,n),r=Ln(r,n)),null===(t=l.current)||void 0===t||t.clear(),r.length>0&&(null===(o=l.current)||void 0===o||o.pushMany(r))},[n,u,d,h,g,a,l]);return{processedData:f,reAggregate:m,accumulatorRef:y}}({data:i,levels:g,categoryAccessor:l,valueAccessor:c,levelAccessor:u,countAccessor:h,isDiverging:W,frameRef:r}),Q="__likertLevelLabel",Z=un({isPushMode:q,colorBy:Q,colorScheme:V,showLegend:R,legendPosition:_}),J=e.useCallback(Z.wrapPush(e=>{U.current.push(e),K(U.current)}),[Z.wrapPush,K,U]),ee=e.useCallback(Z.wrapPushMany(e=>{U.current.push(...e),K(U.current)}),[Z.wrapPushMany,K,U]);e.useImperativeHandle(n,()=>({push:J,pushMany:ee,clear:()=>{var e;U.current=[],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:[]}}),[J,ee,Z.resetCategories,U]);const te=ln({data:Y,rawData:i,colorBy:Q,colorScheme:V,legendInteraction:E,legendPosition:_,selection:x,linkedHover:w,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:A,hoverHighlight:O,chartType:"LikertChart",chartId:j,showLegend:R,userMargin:s,marginDefaults:o.marginDefaults,loading:M,emptyContent:C,width:L,height:B});if(te.earlyReturn)return te.earlyReturn;const ne=e.useMemo(()=>{const e=g.length;return e%2!=0&&X.get(g[Math.floor(e/2)])||"#888"},[g,X]),oe=e.useMemo(()=>e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(r===Mn||r===Cn)return{fill:ne};const i=o||r;return i&&X.has(i)?{fill:X.get(i)}:{fill:"#888"}},[X,ne]),re=e.useMemo(()=>mt(oe,te.effectiveSelectionHook,x),[oe,te.effectiveSelectionHook,x]),ie=e.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),se=e.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===Mn||n===Cn?ie:n,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=n===Mn||n===Cn?2*i:i,a=t.__likertCount||0;return d.createElement("div",{className:"semiotic-tooltip",style:Ot},d.createElement("div",{style:{fontWeight:"bold"}},r),d.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[ie]),ae=e.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(c&&u)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(u&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==i&&0===i.length)return null;const e={categoryAccessor:l};return G?c&&(e.valueAccessor=c):(u&&(e.levelAccessor=u),h&&(e.countAccessor=h)),Nt({componentName:"LikertChart",data:i,accessors:e,requiredProps:{levels:g}})},[i,l,c,u,h,g,G]),le=e.useMemo(()=>[{styleFn:e=>({fill:X.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,X]),ce=e.useMemo(()=>!1!==R?Object.assign(Object.assign({},te.legendBehaviorProps),{legend:{legendGroups:le},legendPosition:_||te.legendPosition||"bottom"}):te.legendBehaviorProps,[te.legendBehaviorProps,te.legendPosition,_,R,le]),ue=e.useMemo(()=>{const e=Object.assign({},te.margin);if(q&&!1!==R){const t=_||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(Z.streamingMarginAdjust)for(const[t,n]of Object.entries(Z.streamingMarginAdjust))n>e[t]&&(e[t]=n);return W&&100>e.left&&(e.left=100),e},[te.margin,Z.streamingMarginAdjust,W,q,R,_]),de=e.useMemo(()=>S||(W?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[W,S]),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=i&&{data:Y}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:W?"horizontal":"vertical",pieceStyle:re,size:[L,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue,barPadding:f,enableHover:H,showAxes:o.showAxes,oLabel:z,rLabel:$||(W?void 0:"Percentage"),rFormat:de}),P&&{oFormat:P}),{showGrid:T}),ce),I&&{title:I}),N&&{description:N}),D&&{summary:D}),void 0!==F&&{accessibleTable:F}),a&&{className:a}),{tooltipContent:!1===m?()=>null:!0===m?se:Ct(m)||se}),(w||k||A||O)&&{customHoverBehavior:te.customHoverBehavior}),(k||A||w)&&{customClickBehavior:te.customClickBehavior}),v&&v.length>0&&{annotations:v}),b);return ae?d.createElement(Lt,{componentName:"LikertChart",message:ae,width:L,height:B}):d.createElement(on,{componentName:"LikertChart",width:L,height:B},d.createElement(nt,Object.assign({ref:r},he)))});Bn.displayName="LikertChart",exports.BarChart=cn,exports.BoxPlot=vn,exports.DonutChart=An,exports.DotPlot=wn,exports.FunnelChart=Sn,exports.GaugeChart=On,exports.GroupedBarChart=gn,exports.Histogram=bn,exports.LikertChart=Bn,exports.PieChart=kn,exports.RidgelinePlot=jn,exports.StackedBarChart=hn,exports.StreamOrdinalFrame=nt,exports.SwarmPlot=fn,exports.SwimlaneChart=yn,exports.ViolinPlot=xn,exports.createHatchPattern=Ge;
|