semiotic 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/ai/schema.json +1 -1
  2. package/dist/components/charts/ordinal/BarChart.d.ts +2 -0
  3. package/dist/components/charts/ordinal/BoxPlot.d.ts +2 -0
  4. package/dist/components/charts/ordinal/DotPlot.d.ts +2 -0
  5. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +2 -0
  6. package/dist/components/charts/ordinal/Histogram.d.ts +2 -0
  7. package/dist/components/charts/ordinal/LikertChart.d.ts +2 -0
  8. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
  9. package/dist/components/charts/ordinal/StackedBarChart.d.ts +2 -0
  10. package/dist/components/charts/ordinal/SwarmPlot.d.ts +2 -0
  11. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -0
  12. package/dist/components/charts/ordinal/ViolinPlot.d.ts +2 -0
  13. package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +24 -0
  14. package/dist/components/charts/xy/AreaChart.d.ts +14 -0
  15. package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
  16. package/dist/components/charts/xy/CandlestickChart.d.ts +4 -0
  17. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +4 -0
  18. package/dist/components/charts/xy/Heatmap.d.ts +4 -0
  19. package/dist/components/charts/xy/LineChart.d.ts +12 -0
  20. package/dist/components/charts/xy/MinimapChart.d.ts +7 -0
  21. package/dist/components/charts/xy/Scatterplot.d.ts +4 -0
  22. package/dist/components/charts/xy/StackedAreaChart.d.ts +12 -0
  23. package/dist/ordinal.min.js +1 -1
  24. package/dist/ordinal.module.min.js +1 -1
  25. package/dist/realtime.min.js +1 -1
  26. package/dist/realtime.module.min.js +1 -1
  27. package/dist/semiotic-ai.min.js +1 -1
  28. package/dist/semiotic-ai.module.min.js +1 -1
  29. package/dist/semiotic.min.js +1 -1
  30. package/dist/semiotic.module.min.js +1 -1
  31. package/dist/server.min.js +1 -1
  32. package/dist/server.module.min.js +1 -1
  33. package/dist/xy.min.js +1 -1
  34. package/dist/xy.module.min.js +1 -1
  35. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),t=require("react"),o=require("d3-scale"),n=require("d3-quadtree"),i=require("d3-array"),r=require("d3-hierarchy"),s=require("d3-shape"),a=require("regression"),l=require("d3-selection"),c=require("d3-brush");function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const o in e)if("default"!==o){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}return t.default=e,Object.freeze(t)}const h=d(t),g=u(a),f=Object.freeze([]);function p(e){if(!e)return f;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class m{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n: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(e=p(e),this.lastBoundedData===e)return;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 o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=p(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}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){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class y{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.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 o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}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 v{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(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 o of e){const e=t?t(o):o;Number.isFinite(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 b(e,t,o){return e+(t-e)*o}function x(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function w(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function k(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function j(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function A(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function O(e){const t=e.map(j),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return A(e,o,n)}if(e>=1){const[e,n,i]=t[o];return A(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return A(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const S=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],M=O(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),_=O(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),C=O(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),P=O(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),L=O(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);O(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const T=O(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),R=O(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);O(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),O(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),O(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),O(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const H=O(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),B=O(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),I=O(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),F=O(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),W=O(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),D=O(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),$=O(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),z={category10:S,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:M,reds:_,greens:C,oranges:P,purples:L,viridis:T,plasma:R},N=S,E=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],q=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function G(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||q.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):N[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%N.length]}function V(e,t,n="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return o.scaleOrdinal().domain(i).range(n).unknown("#999");const s=z[n]||z.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const o=Number(t);o>e&&(e=o)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:N;return o.scaleOrdinal().domain(i).range(e).unknown("#999")}}function X(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function Y(e,t){const{columns:o,config:n,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o},n.cornerRadius&&{cornerRadius:n.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function Q(e){var t,o,n;const r=e.length,s=e[0],a=e[r-1];return{n:r,min:s,q1:null!==(t=i.quantile(e,.25))&&void 0!==t?t:s,median:null!==(o=i.quantile(e,.5))&&void 0!==o?o:(s+a)/2,q3:null!==(n=i.quantile(e,.75))&&void 0!==n?n:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}function K(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}const Z={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,m=a.normalize,y=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),y.push(t))}}else y.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(m)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of y){const s=t.get(r);if(!s)continue;let a=s.total;m&&o>0&&(a/=o);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:n+a),o=0>a?d(i+a)-d(i):d(n)-d(n+a);g.push(X(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=d(0>a?i+a:n),o=0>a?d(i)-d(i+a):d(n+a)-d(n);g.push(X(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(X(r,Math.min(a,d),n,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(X(Math.min(a,d),r,Math.abs(d-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=a.length>0,p=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),u=f&&a[i]||c,y=l(t,e.name),v=y.r||5;let b,x;if(g){const t=m+(e.pctStart+e.pct/2)*p,o=u(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:y,datum:t})}return d},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),u=r(n,e.name),d=u.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:n})}}return l},pie:Y,donut:Y,boxplot:function(e,t){var o,n,r,s,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:f,projection:p}=c,m=[],y="vertical"===p,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],p=null!==(o=i.quantile(c,.25))&&void 0!==o?o:u,b=null!==(n=i.quantile(c,.5))&&void 0!==n?n:(u+d)/2,x=null!==(r=i.quantile(c,.75))&&void 0!==r?r:d,w=x-p,k=p-1.5*w,j=x+1.5*w,A=null!==(s=c.find(e=>e>=k))&&void 0!==s?s:u,O=null!==(a=[...c].reverse().find(e=>j>=e))&&void 0!==a?a:d,S=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const o=h(e);if(k>o||o>j){const n=y?t.middle:f(o),i=y?f(o):t.middle;M.push({px:n,py:i,value:o,datum:e})}}if(m.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:f(A),q1Pos:f(p),medianPos:f(b),q3Pos:f(x),maxPos:f(O),stats:{n:c.length,min:A,q1:p,median:b,q3:x,max:O,mean:c.reduce((e,t)=>e+t,0)/c.length},style:S,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)m.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:S.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return m},violin:function(e,t){var o,n,r;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,g=[],f="vertical"===h,p=l.bins||20,m=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),p-1)]++;const y=Math.max(...h,1),v=e.width/2*.9;let b="";if(f){b=`M ${e.middle} ${d(s)}`;for(let t=0;p>t;t++){const o=d(s+(t+.5)*l);b+=` L ${e.middle+h[t]/y*v} ${o}`}b+=` L ${e.middle} ${d(a)}`;for(let t=p-1;t>=0;t--){const o=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/y*v} ${o}`}b+=" Z"}else{b=`M ${d(s)} ${e.middle}`;for(let t=0;p>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/y*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=p-1;t>=0;t--)b+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/y*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(m&&t.length>=4){const l=null!==(o=i.quantile(t,.25))&&void 0!==o?o:s,c=null!==(n=i.quantile(t,.5))&&void 0!==n?n:(s+a)/2,u=null!==(r=i.quantile(t,.75))&&void 0!==r?r:a;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:f}}const k=f?{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:Q(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],u=r.bins||25,d=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/u||1,r=Array(u).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),m=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const n=(d?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(X(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,m,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){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 n=t[0],i=t[t.length-1],r=(i-n)/d||1,c=Array(d).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),d-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),m=e.width*g;let y="";if(h){const t=e.x+e.width;y=`M ${l(n)} ${t}`;for(let e=0;d>e;e++)y+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*m}`;y+=` L ${l(i)} ${t} Z`}else{const t=e.x;y=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*r);y+=` L ${t+c[e]/f*m} ${o}`}y+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};u.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:v,stats:Q(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,u=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(X(o,e.x,i-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(X(e.x,o,e.width,i-o,u,t,e.name))}}return l},funnel:function(e,t){var n,i,r,s,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:f}=e,p=[],m=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],k=[];let j=0;for(const e of v){const t=new Map;let o=0;for(const n of e.pieceData){const e=g?g(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(n);i.total+=r,i.pieces.push(n),o+=r}k.push({col:e,groups:t,stepTotal:o}),w||o>j&&(j=o)}if(w)for(const e of k){let t=0,o=0;for(let n=0;b.length>n;n++){const i=e.groups.get(b[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>j&&(j=n)}if(0===j)return p;const A=new Map;for(const e of b){const t=k[0].groups.get(e);A.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=k[0].stepTotal,S=w?.95*m:.9*t.width,M=o.scaleLinear().domain([0,j]).range([0,S]),_=null!==(i=e.config.connectorOpacity)&&void 0!==i?i:.3;let C=new Map;for(let t=0;k.length>t;t++){const o=k[t],n=o.col,i=0===t,d=n.width,h=.55*d,g=n.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const n=o.groups.get(t);n&&(e+=M(n.total))}let t=m,r=m;for(let s=0;b.length>s;s++){const l=b[s],c=o.groups.get(l);if(!c)continue;const u=M(c.total),d=s%2==0,x=d?t:r-u;d?t+=u:r-=u;const w=f(c.pieces[0],l),k=null!==(a=A.get(l))&&void 0!==a?a:c.total,j=k>0?c.total/k*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:j,__funnelStep:n.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});y&&(0===s&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=m,O.__funnelStepLabelY=g,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+u/2,O.__funnelValueLabelY=g,O.__funnelBarW=u),p.push(X(x,g,u,h,w,O,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=o.stepTotal,t=M(e),a=m-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=o.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:n.pieceData[0],d=c?l:n.name,x=f(u,d),w=O>0?e/O*100:0,k=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:i,category:c?l:n.name});y&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=m,k.__funnelStepLabelY=g,k.__funnelRowWidth=t,k.__funnelValueLabelX=m,k.__funnelValueLabelY=g,k.__funnelBarW=t),p.push(X(a,g,t,h,x,k,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&C.size>0){const t=w?b:[b[0]];for(const i of t){const t=C.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return f(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:_},datum:null!==(u=null===(c=o.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:n.pieceData[0],category:"_default"===i?n.name:i};p.push(a)}}C=v}return p},"bar-funnel":function(e,t){var o,n,i,r;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=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],m=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}m.push({col:e,groups:t,stepTotal:o})}const y=new Map;for(const e of g){const t=null===(o=m[0])||void 0===o?void 0:o.groups.get(e);y.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;m.length>e;e++){const t=m[e],o=t.col,n=0===e,s=e>0?m[e-1]:null,a=o.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const m=f.total,b=null!==(i=y.get(h))&&void 0!==i?i:m,x=b>0?m/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:m,j=n?0:Math.max(0,k-m),A=o.x+e*a+l/2,O=v(m),S=v(0)-O,M=c(f.pieces[0],p?h:o.name),_=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:m,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:j,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(m+j)});if(d.push(X(A,O,u,S,M,_,p?h:o.name)),j>0){const e=v(m+j),t=O-e,n=Object.assign({},M),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:j,__barFunnelPercent:b>0?j/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});d.push(X(A,e,u,t,n,i,p?h:o.name))}}}return d},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=d?X(s,o.x,a,o.width,n,null,"__track__"):X(o.x,s,o.width,a,n,null,"__track__");u.push(i)}}for(const e of Object.values(i)){let t=0;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(d){const r=l(t),s=l(t+n);f=X(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=X(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=n}}return u}};class U{constructor(e){this.rExtent=new v,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.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new y(e.windowSize),this.getO=k(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>w(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new v)):(this.getR=w(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=k(e.stackBy),this.getGroup=k(e.groupBy),this.getColor=k(e.colorAccessor),this.getConnector=k(e.connectorAccessor),this.getDataId=k(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new y(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const i=n.toArray(),r=t.projection||"vertical",s=t.oExtent||this.resolveCategories(i),a=this.computeValueDomain(i,s),l="horizontal"===r,c="radial"===r,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let d,h;if(c){d=o.scaleBand().domain(s).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,i=t.innerRadius||0;h=o.scaleLinear().domain(a).range([i,n])}else l?(d=o.scaleBand().domain(s).range([0,e.height]).padding(u),h=o.scaleLinear().domain(a).range([0,e.width])):(d=o.scaleBand().domain(s).range([0,e.width]).padding(u),h=o.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((i,r)=>{var s;const a=this.rExtents[r];a.dirty&&a.recalculate(n,i);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=t.extentPadding)&&void 0!==s?s:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?o.scaleLinear().domain([c,u]).range([0,e.width]):o.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=i;this.rAccessors.length>1&&(g=i.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(g,s,d,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,o,n,i){var r;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"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==n){u=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of u)u.set(t,o/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;u?(c=h,g=u.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:d},d+=i}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){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=Z[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(o)||u.set(o,[]),u.get(o).push({x:n,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=function(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=z[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}(r.colorScheme,r.themeCategorical,E),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:K(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}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 o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||E,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?function(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,U.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._pointQuadtree=n.quadtree().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const n=u.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._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(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,m,y,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const j=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(j.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),k=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)d?(j.add(u),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(d)j.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,k=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),k=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!j.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(m=t.innerRadius)&&void 0!==m?m:0,outerRadius:null!==(y=t.outerRadius)&&void 0!==y?y:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(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 n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=b(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=b(n.x,e._targetX,s),e.y=b(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=b(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=b(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=b(o.x,e._targetX,s),e.y=b(o.y,e._targetY,s),void 0!==o.w&&(e.w=b(o.w,e._targetW,s),e.h=b(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:b(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=b(o.startAngle,e._targetStartAngle,s),e.endAngle=b(o.endAngle,e._targetEndAngle,s))}}}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&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!x(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!x(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!x(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(x(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=k(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!x(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>w(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new v)):(this.getR=w(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!x(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?k(this.config.stackBy):void 0),"groupBy"in e&&!x(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?k(this.config.groupBy):void 0),"colorAccessor"in e&&!x(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?k(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!x(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?k(this.config.connectorAccessor):void 0)}}function J(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:h.createElement(h.Fragment,null,...t)}function ee(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function te(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function oe(e,t,o){const n=function(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function ne(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>ee(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function ie(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=te(Math.atan2(i,n)),a=te(e.startAngle),l=te(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 re(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>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 i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function se(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function ae(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function le(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}U.QUADTREE_THRESHOLD=500;const ce={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function ue(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,ce[o])(n(e,t)),i}function de(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function he(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ge=(t,o,n,i,r,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,f=[];let p=0;const m=!(!o&&!n),y="isolate"===u||void 0===u&&null!=r;return g.forEach((t,u)=>{const v=ue(t,u,d,h),b=he(t,i,r),x=r&&r.size>0&&r.has(t.label);f.push(e.jsxs("g",{transform:`translate(0,${p})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?l===s&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&y?x||!1:void 0,"aria-current":m&&!y&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:m?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{c(l,u),n&&n(t);const o=e.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(de,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),p+=22}),f};function fe({config:t,orientation:o="vertical",width:n=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+h.useId();if("horizontal"===o){const t=12,o=Math.min(n,200),a=Math.max(0,(n-o)/2),u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[0]+o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:o,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+o,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[1]-o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function pe(t){const{legendGroups:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[g,f]=h.useState(0),[p,m]=h.useState(0),y=h.useCallback((e,t)=>{f(e),m(t)},[]),v="vertical"===d?(({legendGroups:t,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.jsx("line",{stroke:"gray",x1:0,y1:d,x2:o,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e.jsx("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),d+=8),h.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${d})`,children:ge(t,n,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:o||[],width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:a}):(({legendGroups:t,height:o,width:n,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,o)=>{let f=0;t.label&&(f+=16);const p=((t,o,n,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let m=0,y=0;const v=!(!o&&!n),b="isolate"===u||void 0===u&&null!=r;f.forEach((t,u)=>{const x=ue(t,u,h,g),w=he(t,i,r),k=r&&r.size>0&&r.has(t.label),j=26+7*t.label.length;d&&d>0&&m>0&&m+j>d&&(y++,m=0),p.push(e.jsxs("g",{transform:`translate(${m},${22*y})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?k||!1:void 0,"aria-current":v&&!b&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:v?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+f.length)%f.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{c(l,u),n&&n(t);const o=e.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"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&e.jsx(de,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),m+=j});let x=0,w=0;for(const e of f){const t=26+7*e.label.length;d&&d>0&&w>0&&w+t>d?(x=Math.max(x,w),w=t):w+=t}x=Math.max(x,w);const k=y+1;return{items:p,offset:x,totalRows:k,totalHeight:22*k}})(t,i,r,s,a,l,c,o,u,d,n);f+=p.offset+5,g.push(Object.assign(Object.assign({label:t.label},p),{offset:f,totalRows:p.totalRows,totalHeight:p.totalHeight})),h+=f+12});let f=h>n?0:Math.max(0,(n-h)/2);const p=[];return g.forEach((n,i)=>{const r=t[i];r.label&&(p.push(e.jsx("text",{transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),f+=16),p.push(e.jsx("g",{className:"legend-item",transform:`translate(${f},0)`,children:n.items},"legend-group-"+i)),f+=n.offset+5,t[i+1]&&p.push(e.jsx("line",{stroke:"gray",x1:f,y1:-8,x2:f,y2:(n.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),f+=12}),e.jsx("g",{children:p})})({legendGroups:o||[],title:l,height:u,width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:a}),b=!(!n&&!i);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),v]})}function me(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ye(t){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!o)return null;const g="top"===s||"bottom"===s;let f,p;return"left"===s?(f=4,p=r.top):"top"===s?(f=0,p=a?32:8):"bottom"===s?(f=0,p=i-r.bottom+50):(f=n-r.right+10,p=r.top),e.jsx("g",{transform:`translate(${f}, ${p})`,children:(m=o,"object"==typeof m&&null!==m&&"gradient"in m?e.jsx(fe,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):me(o)?e.jsx(pe,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):o)});var m}function ve(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function be(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function xe(t,o,n,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(o)>Math.abs(n)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>o?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>o?"end":"start";const f=16,p=s?u?[s]:ve(s,c):[],m=r?u?[r]:ve(r,c):[],y="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:p.map((t,o)=>e.jsx("tspan",{x:y,dy:0===o?0:f,children:t},o))},"annotation-note-title")),v=p.length*f),m.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:m.map((t,o)=>e.jsx("tspan",{x:y,dy:0===o?0:f,children:t},o))},"annotation-note-label"));let w=null;if((s||r)&&(0!==o||0!==n))if("topBottom"===d){const t=Math.min(c,120);let o=0,n=t;"end"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),w=e.jsx("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+m.length)*f+(m.length>0?f:0);let o=0,n=t;"bottom"===h?(o=-t,n=0):"middle"===h&&(o=-t/2,n=t/2),w=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+m.length-1)*f;let j=0;return"topBottom"===d?j=0>n?-(k+2):18:"leftRight"===d&&(j="middle"===h?-(k+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${o},${n})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),w]})}function we(t,o,n,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(t>0||i>0)&&a.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(e.jsx("line",{x1:(o.x1||0)-t,y1:i,x2:(o.x2||0)-t,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(e.jsx("line",{x1:(o.x1||0)-t,y1:0,x2:(o.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(e.jsx("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==t&&a.push(e.jsx("path",{d:be((null==o?void 0:o.type)||"curly",t,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function ke(t,o,n,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,n=s.height||0;if(e>0||n>0){const i=e/2,r=n/2,s=t-i,a=o-r;if(0!==s||0!==a){const t=Math.abs(s),o=Math.abs(a),u=e/2,d=n/2,h=t*d>o*u?u/t:d/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==o)){const n=Math.atan2(o,t);l=Math.cos(n)*e,c=Math.sin(n)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(o-c,2))>.5&&(a.push(e.jsx("line",{x1:l,y1:c,x2:t,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:a})}function je(t){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":m}=t,y=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-o),null!=a&&(b=a-n);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":m},p,{children:[!y.has("connector")&&ke(v,b,c,h,x,u),!y.has("subject")&&we(x,u,h,o,n),!y.has("note")&&xe(l,v,b,h)]}))}function Ae(t){var o,n;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:t,ny:a});return e.jsx(je,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(je,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Oe(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Se(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Me(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r: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)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Oe(e,o),c=Se(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function _e(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Ce={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};function Pe(o){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=o,{rTickValues:h}=o,g="radial"===(null==l?void 0:l.projection),f="horizontal"===(null==l?void 0:l.projection),p=t.useMemo(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||Le)(e)})),[l,d,g,h]),m=u&&l&&!g,y=c&&l&&!g;return m||y?e.jsx("svg",{width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&e.jsx("g",{className:"ordinal-grid",children:p.map((t,o)=>e.jsx("line",{x1:f?t.pixel:0,y1:f?0:t.pixel,x2:f?t.pixel:n,y2:f?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),y&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,f?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Le(e){return Math.round(100*e)/100+""}function Te(o){var n,i;const{width:a,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:f,showCategoryTicks:p,oLabel:m,rLabel:y,oFormat:v,rFormat:b,showGrid:x,title:w,legend:k,legendHoverBehavior:j,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:_,annotations:C,svgAnnotationRules:P,xAccessor:L,yAccessor:T,annotationData:R,underlayRendered:H,children:B}=o,I="radial"===(null==h?void 0:h.projection),F="horizontal"===(null==h?void 0:h.projection),W=!1!==p,D=t.useMemo(()=>f&&W&&h&&!I?h.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=h.o(e))&&void 0!==o?o:0)+h.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,W,h,v,I]),$=o.rTickValues,z=o.tickLabelEdgeAlign,N=t.useMemo(()=>f&&h&&!I?($||h.r.ticks(5)).map(e=>({value:e,pixel:h.r(e),label:(b||Le)(e)})):[],[f,h,b,I,$]),E=t.useRef(new Map),q=t.useRef(null!==(n=null==C?void 0:C.length)&&void 0!==n?n:0),G=null!==(i=null==C?void 0:C.length)&&void 0!==i?i:0;q.current!==G&&(q.current=G,E.current=new Map);const V=t.useMemo(()=>{if(!C||0===C.length)return null;const t=function(t,o,n){var i,a,l,c,u,d,h,f,p,m,y,v,b,x,w,k,j,A,O,S,M,_,C,P,L,T,R,H,B,I,F,W,D,$,z,N,E,q,G,V,X,Y,Q,K,Z,U,J,ee;switch(t.type){case"label":{const i=Me(t,o,n);if(!i)return null;const{x:r,y:s}=i;return _e(r,s,n)?e.jsx(Ae,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+o):null}case"callout":{const i=Me(t,o,n);if(!i)return null;const{x:r,y:s}=i;return _e(r,s,n)?e.jsx(Ae,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+o):null}case"x-threshold":{const i=Oe(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(n.height||0)-4:"center"===s?(n.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:n.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"y-threshold":{const i=Se(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(n.width||0)/2,l="middle"):(a=(n.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:n.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),n),y:Se(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=r.packEnclose(i),a=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),n),y:Se(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),l=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"highlight":{const i=n.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((o,i)=>{const r=Oe(o,n),a=Se(o,n);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(o):t.r||6,c="function"==typeof t.style?t.style(o):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+o)}case"bracket":{const i=Oe(t,n),r=Se(t,n);return e.jsx(Ae,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+o)}case"trend":{const r=n.data||[];if(2>r.length)return null;const s=n.xAccessor||"x",f=n.yAccessor||"y",p=r.map(e=>[e[s],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const m=null!==(a=null===(i=n.scales)||void 0===i?void 0:i.x)&&void 0!==a?a:null===(l=n.scales)||void 0===l?void 0:l.time,y=null!==(u=null===(c=n.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=n.scales)||void 0===d?void 0:d.value;if(!m||!y)return null;const v=t.method||"linear";let b;b="loess"===v?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===v?g.default.polynomial(p,{order:t.order||2}):g.default.linear(p)).points;const x=b.map(([e,t])=>`${m(e)},${y(t)}`).join(" "),w=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:w,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:m(b[b.length-1][0])+4,y:y(b[b.length-1][1])-4,fill:w,fontSize:11,children:t.label})]},"ann-"+o)}case"band":{const i=null!==(p=null===(f=n.scales)||void 0===f?void 0:f.y)&&void 0!==p?p:null===(m=n.scales)||void 0===m?void 0:m.value,r=null!==(y=null==i?void 0:i(t.y0))&&void 0!==y?y:0,s=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:n.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:n.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+o)}case"envelope":{const i=n.data||[];if(2>i.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(b=n.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(w=n.scales)||void 0===w?void 0:w.time,l=null!==(j=null===(k=n.scales)||void 0===k?void 0:k.y)&&void 0!==j?j:null===(A=n.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=Ce[n.curve||"linear"]||s.curveLinear,f=s.area().x(e=>a(e[r])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:p,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:a(h[h.length-1][r])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"anomaly-band":{const i=n.data||[];if(2>i.length)return null;const r=n.yAccessor||"y",s=null!==(M=null===(S=n.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(_=n.scales)||void 0===_?void 0:_.time,a=null!==(P=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(L=n.scales)||void 0===L?void 0:L.value;if(!s||!a)return null;const l=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(T=t.threshold)&&void 0!==T?T:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",m=null!==(R=t.fillOpacity)&&void 0!==R?R:.1,y=t.anomalyColor||"#ef4444",v=null!==(H=t.anomalyRadius)&&void 0!==H?H:6,b=a(c+h*d),x=a(g),w=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[f&&e.jsx("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:m}),w.map((t,o)=>{const i=Oe(t,n),r=Se(t,n);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+o)}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"forecast":{const i=n.data||[];if(3>i.length)return null;const r=n.xAccessor||"x",s=n.yAccessor||"y",a=null!==(I=null===(B=n.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(F=n.scales)||void 0===F?void 0:F.time,l=null!==(D=null===(W=n.scales)||void 0===W?void 0:W.y)&&void 0!==D?D:null===($=n.scales)||void 0===$?void 0:$.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=g.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=c.length;let t=0,o=0,n=0,i=0;for(const[e,r]of c)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),p=c.reduce((e,t)=>e+t[0],0)/d,m=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),y=null!==(z=t.confidence)&&void 0!==z?z:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(N=t.steps)&&void 0!==N?N:5,x=c[d-1][0],w=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const j=[];for(const e of k){const t=u(e),o=f*Math.sqrt(1+1/d+(m>0?Math.pow(e-p,2)/m:0))*v;j.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const A=`M${j.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:a(j[j.length-1].x)+4,y:l(j[j.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+o)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Me(t,o,n);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!_e(i,r,n))return null;const s=null!==(V=t.dx)&&void 0!==V?V:0,a=null!==(X=t.dy)&&void 0!==X?X:0,l=null!==(Y=t.width)&&void 0!==Y?Y:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(K=t.content)&&void 0!==K?K:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const i=Me(t,o,n);if(!i)return null;const{x:r,y:s}=i;return e.jsx("text",{x:r+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+o)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=null===(Z=n.scales)||void 0===Z?void 0:Z.o,s=null===(U=n.scales)||void 0===U?void 0:U.x,a=null===(J=n.scales)||void 0===J?void 0:J.y,l=(null==r?void 0:r.bandwidth)?r:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(i);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,g=t.label;return e.jsxs("g",(n.projection?"vertical"===n.projection:l===s)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:n.height||0,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e.jsx("rect",{x:0,y:c,width:n.width||0,height:u,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+o)}default:return null}},o="horizontal"===(null==h?void 0:h.projection),n=(null==h?void 0:h.o)?e=>{var t;return(null!==(t=h.o(e))&&void 0!==t?t:0)+h.o.bandwidth()/2}:null,i={scales:h?{x:o?h.r:n||h.r,y:o&&n||h.r,time:h.r,value:h.r,o:h.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:a,height:l,data:R,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:E.current};return C.map((e,o)=>{if(P){const n=P(e,o,i);return null!=n?n:t(e,o,i)}return t(e,o,i)}).filter(Boolean)},[C,P,a,l,h,L,T,R]);return f||w||k||_||V&&V.length>0||x||B?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof w?w:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[x&&h&&!I&&!H&&e.jsx("g",{className:"ordinal-grid",children:N.map((t,o)=>e.jsx("line",{x1:F?t.pixel:0,y1:F?0:t.pixel,x2:F?t.pixel:a,y2:F?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&h&&!I&&e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,F?{children:[!H&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((t,o)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+o)),m&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:m}),!H&&e.jsx("line",{x1:0,y1:l,x2:a,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!H&&(null==h?void 0:h.r)&&(()=>{const t=h.r(0);return t>1&&a-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),N.map((t,o)=>{const n=z?0===o?"start":o===N.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:n,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+o)}),y&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y})]}:{children:[!H&&(()=>{const t=(null==h?void 0:h.r)?h.r(0):l,o=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:o,x2:a,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((t,o)=>e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+o)),m&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m}),!H&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((t,o)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+o)),y&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:y})]})}),V,_,B]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),ye({legend:k,totalWidth:c,totalHeight:u,margin:d,legendPosition:M,title:w,legendHoverBehavior:j,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S})]}):null}function Re({width:o,height:n,totalWidth:i,totalHeight:r,margin:s,scales:a,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(u);g.current=u;const f=t.useRef(a);f.current=a;const p=t.useRef(!1),m=t.useRef(null),y="horizontal"===(null==a?void 0:a.projection),v=t.useRef(y);return v.current=y,t.useEffect(()=>{if(!d.current)return;const e=l.select(d.current).select(".brush-g"),t=y?c.brushX():c.brushY();return t.extent([[0,0],[o,n]]),t.on("brush end",e=>{if(p.current)return;const t=f.current;if(!t)return;if(!e.selection)return m.current=null,void g.current(null);const[o,n]=e.selection;let i;i=v.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};m.current=r,g.current(r)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[o,n,y]),t.useEffect(()=>{if(!a||!h.current||!m.current)return;if(!d.current)return;const e=m.current,t=l.select(d.current).select(".brush-g"),o=a.r(e.r[0]),n=a.r(e.r[1]);y?(p.current=!0,t.call(h.current.move,[o,n]),p.current=!1):(p.current=!0,t.call(h.current.move,[n,o]),p.current=!1)},[a,y]),e.jsx("svg",{ref:d,width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}})})}const He={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Be(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Ie="undefined"==typeof window||"undefined"==typeof document,Fe="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,We=()=>()=>{},De=()=>!1,$e=()=>!0;function ze(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function Ne(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function Ee(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const qe=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ge=new WeakMap;let Ve=0,Xe=!1,Ye=null,Qe=null,Ke=null;function Ze(e,t){var o,n;if(!t)return t;const i=qe.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(Xe)return;if("undefined"==typeof window||"undefined"==typeof document)return;Xe=!0;const e=()=>{Ve++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ye=new MutationObserver(e),Ye.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Qe=window.matchMedia("(prefers-color-scheme: dark)"),Ke=e,"function"==typeof Qe.addEventListener?Qe.addEventListener("change",Ke):"function"==typeof Qe.addListener&&Qe.addListener(Ke)}catch(e){}}();let s=Ge.get(r);s&&s.version===Ve||(s={version:Ve,map:new Map},Ge.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}const Ue=h.createContext(null),Je={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function et(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e)o[t.type]=(o[t.type]||0)+1;const n=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}const tt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ot={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},nt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},it={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)"},rt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},st={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)"},at={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},lt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function ct({scene:t,chartType:o,tableId:n,chartTitle:i}){var r;const[s,a]=h.useState(!1),l=h.useContext(Ue),c=null!==(r=null==l?void 0:l.visible)&&void 0!==r&&r,u=s||c,d=h.useRef(null),g=i?"Data summary for "+i:n?`Data summary for ${o} ${n}`:"Data summary for "+o,f=h.useCallback(()=>{s||c||a(!0)},[s,c]),p=h.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return n?e.jsx("span",{id:n,tabIndex:-1,style:Je}):null;if(!u)return e.jsx("div",{id:n,tabIndex:-1,onFocus:f,style:Je,role:"region","aria-label":g,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const m=function(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,m,y,v,b,x,w,k,j,A,O;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 o=0;e.length>o&&t.length>o;o++){const t=e[o];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 o=0;e.length>o&&t.length>o;o++){const t=e[o];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:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,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===(r=M.datum)||void 0===r?void 0:r.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!==(f=M.cy)&&void 0!==f?f:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(m=null===(p=M.datum)||void 0===p?void 0:p.id)&&void 0!==m?m:"",x:null!==(y=M.cx)&&void 0!==y?y: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!==(j=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!==j?j:"",value:null!==(O=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return S}(t),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(m),v=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${tt(e.min)} to ${tt(e.max)}, mean ${tt(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(m.length,y),b=m.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const w=Array.from(x);return e.jsxs("div",{ref:d,id:n,tabIndex:-1,onBlur:p,style:ot,role:"region","aria-label":g,children:[e.jsx("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:it,children:"×"}),e.jsx("div",{role:"note",style:nt,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+o,style:rt,children:[e.jsxs("caption",{style:lt,children:["First ",b.length," of ",m.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:st,children:"type"}),w.map(t=>e.jsx("th",{style:st,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:at,children:t.label}),w.map(o=>{return e.jsx("td",{style:at,children:(n=t.values[o],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":tt(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},o);var n})]},o))})]})]})}function ut({summary:t}){return t?e.jsx("div",{role:"note",style:Je,children:t}):null}function dt({tableId:t}){return e.jsx("a",{href:"#"+t,style:Je,onClick:e=>{e.preventDefault();const o=document.getElementById(t);o&&requestAnimationFrame(()=>o.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,Je)},children:"Skip to data table"})}function ht({hoverPoint:t}){let o="";if(t){const e=t.data||t;o="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Je,children:o})}const gt="var(--semiotic-focus, #005fcc)";function ft({active:t,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!t||!o)return null;const l=o.x+n.left,c=o.y+n.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:gt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:gt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:gt,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function pt({x:t,y:o,containerWidth:n,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=h.useRef(null),[u,d]=h.useState(null);h.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,n,i]);let g;return g=u?`translate(${u.width+12>n-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>i-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*i>o?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:a,style:{position:"absolute",left:r.left+t,top:r.top+o,transform:g,pointerEvents:"none",zIndex:l,width:"max-content"},children:s})}function mt(o){let n=null;const i=()=>(n||(n=t.createContext(null)),n),r=yt(o);return[function({children:n,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>yt(o,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:n})},e=>{var o;const n=i(),s=null!==(o=t.useContext(n))&&void 0!==o?o:r,a=t.useRef(e);a.current=e;const l=t.useCallback(()=>a.current(s.getState()),[s]),c=t.useCallback(()=>a.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,l,c)}]}function yt(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function vt(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function bt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:xt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const xt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],wt={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},kt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},jt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:xt,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function At(e,t){if("light"===t)return wt;if("dark"===t)return kt;if("high-contrast"===t)return jt;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?kt:wt;return bt(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 bt(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[Ot,St]=mt(e=>({theme:wt,setTheme(t){e(e=>({theme:At(e.theme,t)}))}}));const Mt="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function _t(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Ct(e){const o=function(){const[e,o]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return o(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=>o(e.matches))},[]),e}(),n=t.useRef(o);n.current=o;const[i,r]=function(e,o,n){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!o&&!n)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;s(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return t.observe(e),()=>t.disconnect()},[o,n]),[i,[o&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=_t(e.foregroundGraphics,r,s),u=_t(e.backgroundGraphics,r,s),d=St(e=>e.theme),{transition:g,introEnabled:f}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+h.useId(),m=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{m.current||(m.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),w=t.useRef(null),k=t.useRef(0),j=t.useCallback(()=>{k.current=0;const e=w.current;w.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{w.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(j))},[j]),O=t.useCallback(()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return Mt(()=>{S&&(Ve++,S.current=!0,v())},[d,v,S]),{reducedMotion:o,reducedMotionRef:n,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:g,introEnabled:f,tableId:p,rafRef:m,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function Pt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Lt(e,t,o=.3){Pt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Tt(e,t,o=.6){var n,i,r,s,a;if(!Pt(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r: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*o,e.stroke()}function Rt(e,t,o,n=.35){Pt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ht(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function Bt(e,t,o){return null==t?o:"string"!=typeof t?t:Ze(e,t)||o}function It(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,i,r,s),[h,g,f]=Ht(e,o);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function Ft(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const Wt=(e,t,o,n)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Dt(e,t);else if(t.roundedTop&&t.roundedTop>0){const o=Bt(e,t.style.fill,Ze(e,"var(--semiotic-primary, #007bff)")),n=Ft(t),i=t.fillGradient&&"string"==typeof o?It(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Bt(e,t.style.fill,Ze(e,"var(--semiotic-primary, #007bff)")),n=Ft(t),i=t.fillGradient&&"string"==typeof o?It(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Lt(e,t),e.globalAlpha=1}};function Dt(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}const $t=(e,t,o,n)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=Bt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Bt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Tt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function zt(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Nt(e,t){const o=s.arc().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!o)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}const Et=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=o*n,e.fillStyle=("string"==typeof t.style.fill?Ze(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Nt(e,t)):(zt(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(zt(e,t),Rt(e,t)),e.globalAlpha=1}},qt=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=Ze(e,"var(--semiotic-primary, #007bff)"),a=Ze(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?Ze(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?Ze(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),n?(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(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Gt=(e,t,o,n)=>{var i,r;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 o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?Ze(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Vt=(e,t,o,n)=>{var i,r,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 o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=Ze(e,o.style.stroke)||("string"==typeof o.style.fill?Ze(e,o.style.fill):o.style.fill)||Ze(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},Xt=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[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=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Yt(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 Qt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Kt=null;function Zt(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Kt||(Kt=document.createElement("canvas")),Kt.width=e,Kt.height=e,Kt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,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+=r)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+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Ut=new Map;function Jt(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=Ut.get(o);if(void 0!==n)return n;const i=Zt({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ut.set(o,i),i}function eo(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function to(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 oo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const no=e=>[Vt,...e],io={bar:no([Wt]),clusterbar:no([Wt]),point:no([$t]),swarm:no([$t]),pie:[Et],donut:[Et],boxplot:no([qt,$t]),violin:no([Gt]),histogram:no([Wt]),ridgeline:no([Gt]),timeline:no([Wt]),funnel:[Wt,Xt,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?Yt(i):null!=r?`${Yt(i)} (${Qt(r)})`:Yt(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=Yt(i),e.measureText(c).width+16>n)continue}const u=o.__funnelValueLabelX,d=(null!==(a=o.__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":[Wt,(e,t,o,n)=>{var i,r;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 o=("string"==typeof t.style.fill?t.style.fill:null)||Ze(e,"var(--semiotic-border, #999)"),n=Jt(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=Ht(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,Ze(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,u=r?oo(i):"",d=to(n);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,m=o.__barFunnelLabelX,y=m-f/2,v=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),eo(e,y,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),eo(e,y,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,m,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,m,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,m,v+3))}e.lineWidth=1}],swimlane:no([Wt]),custom:no([Wt,$t,Et,qt,Gt,Xt])},ro={top:50,right:40,bottom:60,left:70},so={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 ao({hover:t}){var o,n,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(o=l[0])||void 0===o?void 0:o.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:so,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const n=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:so,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[n," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:so,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:so,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(a=null!==(s=null!==(r=null!==(i=null!==(n=l.__aggregateValue)&&void 0!==n?n:h&&null!=l[h]?l[h]:null)&&void 0!==i?i:l.value)&&void 0!==r?r:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:so,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:so,children:[f&&e.jsx("div",{style:{fontWeight:"bold"},children:f+""}),""!==p&&e.jsx("div",{children:"number"==typeof p?p.toLocaleString():p+""})]})}const lo=t.forwardRef(function(o,n){var i,r,a,l,c,u,d,g,f,y,v;const{chartType:b,runtimeMode:x,data:w,oAccessor:k="category",rAccessor:j="value",colorAccessor:A,stackBy:O,groupBy:S,multiAxis:M,timeAccessor:_,valueAccessor:C,categoryAccessor:P,projection:L="vertical",size:T=[600,400],responsiveWidth:R,responsiveHeight:H,margin:B,barPadding:I,roundedTop:F,gradientFill:W,trackFill:D,baselinePadding:$,innerRadius:z,cornerRadius:N,normalize:E,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:K,connectorOpacity:Z,showLabels:te,connectorAccessor:ce,connectorStyle:ue,dataIdAccessor:de,rExtent:he,oExtent:ge,extentPadding:fe=.05,oSort:pe,windowMode:me="sliding",windowSize:ye=200,pieceStyle:ve,summaryStyle:be,colorScheme:xe,barColors:we,showAxes:ke=!0,showCategoryTicks:je,categoryLabel:Ae,valueLabel:Oe,categoryFormat:Se,valueFormat:Me,oLabel:_e,rLabel:Ce,oFormat:Le,rFormat:qe,rTickValues:Ge,tickLabelEdgeAlign:Ve,enableHover:Xe=!0,hoverAnnotation:Ye,tooltipContent:Qe,customHoverBehavior:Ke,annotations:Ue,svgAnnotationRules:Je,showGrid:tt=!1,legend:ot,legendHoverBehavior:nt,legendClickBehavior:it,legendHighlightedCategory:rt,legendIsolatedCategories:st,legendPosition:at,legendCategoryAccessor:lt,onCategoriesChange:gt,backgroundGraphics:mt,foregroundGraphics:yt,title:bt,className:xt,background:wt,centerContent:kt,decay:jt,pulse:At,transition:Ot,animate:St,staleness:Mt,brush:_t,onBrush:Pt,accessibleTable:Lt=!0,description:Tt,summary:Rt,customLayout:Ht,layoutConfig:Bt}=o,It=t.useRef(!0),Ft=Ct({sizeProp:T,responsiveWidth:R,responsiveHeight:H,userMargin:B,marginDefault:ro,foregroundGraphics:yt,backgroundGraphics:mt,animate:St,transitionProp:Ot,themeDirtyRef:It}),{reducedMotionRef:Wt,responsiveRef:Dt,size:$t,margin:zt,adjustedWidth:Nt,adjustedHeight:Et,resolvedForeground:qt,resolvedBackground:Gt,currentTheme:Vt,transition:Xt,introEnabled:Yt,tableId:Qt,rafRef:Kt,renderFnRef:Zt,scheduleRender:Ut}=Ft,Jt=function(){const[e,o]=t.useState(!1);return Fe(()=>{o(!0)},[]),e}(),eo=function(){const e=t.useSyncExternalStore(We,De,$e);return t.useRef(e).current}(),to=t.useMemo(()=>p(w),[w]),oo=null!=Ae?Ae:_e,no=null!=Oe?Oe:Ce,so=null!=Se?Se:Le,lo=null!=Me?Me:qe,co=t.useRef(null),uo=t.useRef(null),ho=t.useRef([]),go=t.useRef(lt),fo=t.useRef(gt);go.current=lt,fo.current=gt;const[po,mo]=t.useState(null),[yo,vo]=t.useState(null),[bo,xo]=t.useState(0),[wo,ko]=t.useState(!1),[jo,Ao]=t.useState(null),Oo=t.useCallback(()=>{var e,t;Ao(null!==(t=null===(e=Po.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),So=Xe||Ye,Mo="streaming"===x,_o=t.useMemo(()=>{var e,t,o;return{chartType:b,runtimeMode:Mo?"streaming":"bounded",windowSize:ye,windowMode:me,extentPadding:fe,projection:L,oAccessor:Mo?void 0:k,rAccessor:Mo?void 0:j,colorAccessor:A,stackBy:O,groupBy:S,multiAxis:M,timeAccessor:Mo?_:void 0,valueAccessor:Mo?C||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:Mo?P||k:void 0,rExtent:he,oExtent:ge,barPadding:I,roundedTop:F,gradientFill:W,trackFill:D,baselinePadding:$,innerRadius:z,cornerRadius:N,normalize:E,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:K,connectorOpacity:Z,showLabels:te,connectorAccessor:ce,connectorStyle:ue,dataIdAccessor:de,oSort:pe,pieceStyle:ve,summaryStyle:be,colorScheme:xe,themeCategorical:null===(e=null==Vt?void 0:Vt.colors)||void 0===e?void 0:e.categorical,themeSemantic:vt(Vt),themeSequential:null===(t=null==Vt?void 0:Vt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Vt?void 0:Vt.colors)||void 0===o?void 0:o.diverging,barColors:we,decay:jt,pulse:At,transition:Xt,introAnimation:Yt,staleness:Mt,customLayout:Ht,layoutConfig:Bt,layoutMargin:zt}},[b,ye,me,fe,L,k,j,A,O,S,M,_,C,P,he,ge,I,F,W,D,$,z,N,E,q,G,V,X,Y,Q,K,Z,te,ce,ue,de,pe,ve,be,xe,we,jt,At,null==Xt?void 0:Xt.duration,null==Xt?void 0:Xt.easing,Yt,Mt,Mo,Vt,Ht,Bt,zt]),Co=function(e){const o=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ne(e,t);if(!Ee(e)||!Ee(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!Ne(o,i))return!1}else{if(!Ee(o)||!Ee(i))return!1;if(!ze(o,i))return!1}}return!0}(o.current,e)||(o.current=e),o.current}(_o),Po=t.useRef(null);Po.current||(Po.current=new U(Co));const Lo=t.useCallback(()=>{var e,t;const o=go.current,n=fo.current;if(!n||!o)return;const i=function(e,t){if(!t)return[];const o=new Set,n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";o.has(r)||(o.add(r),n.push(r))}return n}(null!==(t=null===(e=Po.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(i,ho.current)||(ho.current=i,n(i))},[]);t.useEffect(()=>{var e;null===(e=Po.current)||void 0===e||e.updateConfig(Co),It.current=!0,Ut()},[Co,Ut]);const To=t.useRef(null);To.current||(To.current=new m(e=>{const t=Po.current;t&&t.ingest(e)&&(It.current=!0,Ut())}));const Ro=t.useCallback(e=>{var t;null===(t=To.current)||void 0===t||t.push(e)},[]),Ho=t.useCallback(e=>{var t;null===(t=To.current)||void 0===t||t.pushMany(e)},[]),Bo=t.useCallback(()=>{var e,t;null===(e=To.current)||void 0===e||e.clear(),null===(t=Po.current)||void 0===t||t.clear(),It.current=!0,Ut()},[Ut]),Io=t.useCallback(e=>{var t,o;null===(t=To.current)||void 0===t||t.clearLastData(),null===(o=To.current)||void 0===o||o.setReplacementData(e)},[]);t.useImperativeHandle(n,()=>({push:Ro,pushMany:Ho,replace:Io,remove:e=>{var t,o,n,i;null===(t=To.current)||void 0===t||t.flush();const r=null!==(n=null===(o=Po.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=uo.current)||void 0===i?void 0:i.data;!!uo.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(uo.current=null,mo(null)),It.current=!0,Ut()}return r},update:(e,t)=>{var o,n,i;null===(o=To.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Po.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(It.current=!0,Ut()),r},clear:Bo,getData:()=>{var e,t,o;return null===(e=To.current)||void 0===e||e.flush(),null!==(o=null===(t=Po.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Po.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Ro,Ho,Io,Bo,Ut]),t.useEffect(()=>{var e;w&&(null===(e=To.current)||void 0===e||e.setBoundedData(to))},[w,to]);const{hoverHandlerRef:Fo,hoverLeaveRef:Wo,onPointerMove:Do,onPointerLeave:$o}=Ft;Fo.current=e=>{if(!So)return;const t=co.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-zt.left,i=e.clientY-o.top-zt.top;if(0>n||n>Nt||0>i||i>Et)return void(uo.current&&(uo.current=null,mo(null),Ke&&Ke(null),Ut()));const r=Po.current;if(!r||0===r.scene.length)return;const s="radial"===L,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=function(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-o,a=Math.sqrt(r*r+s*s);ee(e.r,n)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,o,n,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=oe(r,t,o);break;case"point":if(i)break;e=ne(r,t,o,n);break;case"wedge":e=ie(r,t,o);break;case"boxplot":e=re(r,t,o);break;case"violin":e=se(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-Nt/2:n,s?i-Et/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(uo.current&&(uo.current=null,mo(null),Ke&&Ke(null),Ut()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b}),Object.assign({data:c,x:u,y:d,__semioticHoverData:!0},h));var c,u,d,h;uo.current=l,mo(l),Ke&&(Ke(l),It.current=!0),Ut()},Wo.current=()=>{uo.current&&(uo.current=null,mo(null),Ke&&(Ke(null),It.current=!0),Ut())};const zo=t.useRef(-1),No=t.useRef(null),Eo=t.useRef(null),qo=t.useCallback(e=>{const t=Po.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Eo.current&&Eo.current.version===o)n=Eo.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.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;n=function(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.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 i=Array.from(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}(e),Eo.current={version:o,graph:n}}const i=zo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),zo.current=0;const t=n.flat[0];No.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},le(t)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b});return uo.current=o,mo(o),Ke&&Ke(o),void Ut()}const r=function(e,t){var o,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}(n,i),s=function(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?ae(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?ae(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return zo.current=-1,No.current=null,uo.current=null,mo(null),Ke&&Ke(null),void Ut();zo.current=s;const a=n.flat[s];No.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},le(a)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b});uo.current=l,mo(l),Ke&&Ke(l),Ut()},[Ke,Ut]),Go=t.useCallback(e=>{zo.current=-1,No.current=null,Do(e)},[Do]);Zt.current=()=>{var e,t;Kt.current=0;const o=co.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=Po.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Wt.current?r+1e6:r),a=!Wt.current&&s,l=It.current;l&&!s&&(i.computeScene({width:Nt,height:Et}),Lo(),Oo(),It.current=!1),(l||a)&&o.setAttribute("aria-label",et(i.scene,b+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=$t[0]*c,d=$t[1]*c;o.width===u&&o.height===d||(o.width=u,o.height=d,o.style.width=$t[0]+"px",o.style.height=$t[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,$t[0],$t[1]);const h=null!==(e=null==Mt?void 0:Mt.threshold)&&void 0!==e?e:5e3,g=Mt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==Mt?void 0:Mt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==wt&&!mt){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=wt||(e&&"transparent"!==e?e:null),i=t?Ze(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,$t[0],$t[1]))}const f="radial"===L;n.save(),n.beginPath(),n.rect(zt.left,zt.top,Nt,Et),n.clip(),f?(n.save(),n.translate(zt.left+Nt/2,zt.top+Et/2)):n.translate(zt.left,zt.top);const p=Ht?io.custom:io[b]||[],m={width:Nt,height:Et};for(const e of p)e(n,i.scene,i.scales,m);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(vo(i.scales),xo(e=>e+1)),(null==Mt?void 0:Mt.showBadge)&&ko(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Kt.current=requestAnimationFrame(()=>Zt.current()))},function(e){const{hydrated:o,wasHydratingFromSSR:n,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;Fe(()=>{var e,t;o&&n&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[o,n]);const l=t.useRef(a);l.current=a,t.useEffect(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}({hydrated:Jt,wasHydratingFromSSR:eo,storeRef:Po,dirtyRef:It,renderFnRef:Zt,cleanup:()=>{var e;return null===(e=To.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{It.current=!0,Ut()},[b,Nt,Et,ke,wt,Ut]),function(e,o,n,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=o.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(Mt,Po,It,Ut,wo,ko);const Vo=So&&po?Qe?Qe(po):e.jsx(ao,{hover:po}):null,Xo="radial"===L,Yo=Vo?e.jsx(pt,{x:po?Xo?po.x+Nt/2:po.x:0,y:po?Xo?po.y+Et/2:po.y:0,containerWidth:Nt,containerHeight:Et,margin:zt,className:"stream-ordinal-tooltip",children:Vo}):null;if(Ie||!Jt&&eo){const t=Po.current;t&&w&&(t.ingest({inserts:to,bounded:!0}),t.computeScene({width:Nt,height:Et}));const o=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],n=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===L,c=l?zt.left+Nt/2:zt.left,u=l?zt.top+Et/2:zt.top;return e.jsxs("div",{ref:Dt,className:"stream-ordinal-frame"+(xt?" "+xt:""),role:"img","aria-label":Tt||("string"==typeof bt?bt:"Ordinal chart"),style:{position:"relative",width:R?"100%":$t[0],height:H?"100%":$t[1]},children:[e.jsx(ut,{summary:Rt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:$t[0],height:$t[1],style:{position:"absolute",left:0,top:0},children:[Gt&&e.jsx("g",{transform:`translate(${zt.left},${zt.top})`,children:Gt}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[wt&&e.jsx("rect",{x:0,y:0,width:Nt,height:Et,fill:wt}),o.map((t,o)=>function(t,o){var n,i,r,a,l;const c=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",u=e=>`ord-${t.type}-${c}-${o}-${e}`,d=`ord-${t.type}-${c}-${o}`;switch(t.type){case"rect":{const o=t,n=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(d)+"-grad",i=function(t,o){const n=t.fillGradient;if(!n)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in n){const t=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let o=0;t.length>o;o++)l.push(e.jsx("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=Be(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(o,n),r=i?`url(#${n})`:Be(o.style.fill);if(o.roundedTop&&o.roundedTop>0){const t=Math.min(o.roundedTop,o.w/2,o.h/2),{x:n,y:s,w:a,h:l}=o;let c;switch(o.roundedEdge){case"right":c=`M${n},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n},${s+l} Z`;break;case"left":c=`M${n+a},${s} L${n+t},${s} A${t},${t} 0 0 0 ${n},${s+t} L${n},${s+l-t} A${t},${t} 0 0 0 ${n+t},${s+l} L${n+a},${s+l} Z`;break;case"bottom":c=`M${n},${s} L${n+a},${s} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n+t},${s+l} A${t},${t} 0 0 1 ${n},${s+l-t} Z`;break;default:c=`M${n},${s+l} L${n},${s+t} A${t},${t} 0 0 1 ${n+t},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l} Z`}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},d)}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},d)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:Be(o.style.fill),opacity:null!==(n=o.style.opacity)&&void 0!==n?n:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},d)}case"wedge":{const o=t,n=s.arc().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&n.cornerRadius(o.cornerRadius);const i=n(He)||"";return e.jsx("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:Be(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},d)}case"boxplot":{const o=t,n=o.columnWidth/2;return e.jsxs("g","vertical"===o.projection?{children:[e.jsx("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:o.x-n,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Be(o.style.fill),fillOpacity:null!==(i=o.style.fillOpacity)&&void 0!==i?i:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-n,y1:o.medianPos,x2:o.x+n,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.x-.5*n,y1:o.minPos,x2:o.x+.5*n,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-.5*n,y1:o.maxPos,x2:o.x+.5*n,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-n,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Be(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.medianPos,y1:o.y-n,x2:o.medianPos,y2:o.y+n,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.minPos,y1:o.y-.5*n,x2:o.minPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.maxPos,y1:o.y-.5*n,x2:o.maxPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1})]},d)}case"violin":{const o=t,n=[e.jsx("path",{d:o.pathString,transform:o.translateX||o.translateY?`translate(${o.translateX},${o.translateY})`:void 0,fill:Be(o.style.fill),fillOpacity:null!==(a=o.style.fillOpacity)&&void 0!==a?a:.6,stroke:o.style.stroke||"#333",strokeWidth:o.style.strokeWidth||1},u("path"))];if(o.iqrLine&&o.bounds){const t=o.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?n.push(e.jsx("line",{x1:i,y1:o.iqrLine.q1Pos,x2:i,y2:o.iqrLine.q3Pos,stroke:o.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:i,cy:o.iqrLine.medianPos,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},u("med"))):n.push(e.jsx("line",{x1:o.iqrLine.q1Pos,y1:r,x2:o.iqrLine.q3Pos,y2:r,stroke:o.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:o.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},u("med")))}return e.jsx("g",{children:n},d)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(l=t.style.opacity)&&void 0!==l?l:.5},d);case"trapezoid":{const o=t,n=o.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:n,fill:Be(o.style.fill,"#999"),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},d)}default:return null}}(t,o)).filter(Boolean)]})]}),e.jsx(Te,{width:Nt,height:Et,totalWidth:$t[0],totalHeight:$t[1],margin:zt,scales:n,showAxes:ke,showCategoryTicks:je,oLabel:oo,rLabel:no,oFormat:so,rFormat:lo,rTickValues:Ge,tickLabelEdgeAlign:Ve,showGrid:tt,title:bt,legend:ot,legendHoverBehavior:nt,legendClickBehavior:it,legendHighlightedCategory:rt,legendIsolatedCategories:st,legendPosition:at,foregroundGraphics:J(qt,null===(a=Po.current)||void 0===a?void 0:a.customLayoutOverlays),annotations:Ue,svgAnnotationRules:Je,annotationFrame:0,xAccessor:"string"==typeof k?k:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==t?void 0:t.getData()}),kt&&"radial"===L&&e.jsx("div",{style:{position:"absolute",left:zt.left+Nt/2,top:zt.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:kt})]})}return e.jsxs("div",{ref:Dt,className:"stream-ordinal-frame"+(xt?" "+xt:""),role:"group","aria-label":Tt||("string"==typeof bt?bt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:R?"100%":$t[0],height:H?"100%":$t[1],overflow:"visible"},onKeyDown:qo,children:[Lt&&e.jsx(dt,{tableId:Qt}),Lt&&e.jsx(ct,{scene:null!==(c=null===(l=Po.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:b+" chart",tableId:Qt,chartTitle:"string"==typeof bt?bt:void 0}),e.jsx(ut,{summary:Rt}),e.jsxs("div",{role:"img","aria-label":Tt||("string"==typeof bt?bt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:So?Go:void 0,onMouseLeave:So?$o:void 0,children:[Gt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:$t[0],height:$t[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${zt.left},${zt.top})`,children:Gt})}),e.jsx(Pe,{width:Nt,height:Et,totalWidth:$t[0],totalHeight:$t[1],margin:zt,scales:yo,showAxes:ke,showGrid:tt,rFormat:lo,rTickValues:Ge}),e.jsx("canvas",{ref:co,"aria-label":et(null!==(d=null===(u=Po.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:$t[0],height:$t[1]}}),e.jsx(ht,{hoverPoint:po}),e.jsx(Te,{width:Nt,height:Et,totalWidth:$t[0],totalHeight:$t[1],margin:zt,scales:yo,showAxes:ke,showCategoryTicks:je,oLabel:oo,rLabel:no,oFormat:so,rFormat:lo,showGrid:tt,title:bt,legend:ot,legendHoverBehavior:nt,legendClickBehavior:it,legendHighlightedCategory:rt,legendIsolatedCategories:st,legendPosition:at,foregroundGraphics:J(qt,jo),annotations:Ue,svgAnnotationRules:Je,annotationFrame:bo,xAccessor:"string"==typeof k?k:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(g=Po.current)||void 0===g?void 0:g.getData(),underlayRendered:!0}),(_t||Pt)&&"radial"!==L&&e.jsx(Re,{width:Nt,height:Et,totalWidth:$t[0],totalHeight:$t[1],margin:zt,scales:yo,onBrush:Pt||(()=>{})}),kt&&"radial"===L&&e.jsx("div",{style:{position:"absolute",left:zt.left+Nt/2,top:zt.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:kt}),(null==Mt?void 0:Mt.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Mt.badgePosition?{top:4,left:4}:"bottom-left"===Mt.badgePosition?{bottom:4,left:4}:"bottom-right"===Mt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:wo?"#dc3545":"#28a745",color:"white"}),children:wo?"STALE":"LIVE"}),e.jsx(ft,{active:zo.current>=0,hoverPoint:po,margin:zt,size:$t,shape:null===(f=No.current)||void 0===f?void 0:f.shape,width:null===(y=No.current)||void 0===y?void 0:y.w,height:null===(v=No.current)||void 0===v?void 0:v.h}),Yo]})]})});lo.displayName="StreamOrdinalFrame";const co={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 uo(e,t){return"function"==typeof t?t(e):e[t]}function ho(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 go(t={}){const{fields:o,title:n,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(n){const e=uo(t,n);a=ho(e,i)}if(o&&o.length>0)o.forEach(e=>{let o,n,r;"string"==typeof e?(o=e,n=e,r=i):(o=e.label,n=e.accessor||e.key||"",r=e.format||i);const s=uo(t,n);l.push({label:o,value:ho(s,r)})});else if(!n){const e=["value","y","name","id","label"];for(const o of e)if(void 0!==t[o]){a=ho(t[o],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=ho(t[e[0]],i))}}const c=Object.assign(Object.assign({},co),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,o)=>e.jsxs("div",{style:{marginTop:0===o&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},o))]})}}function fo(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(n=t.data)&&void 0!==n?n:{}:t,r=o(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:co,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?go(t):go())}}function po(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s}=e,a={};return t&&(a.title=t),o&&(a.description=o),n&&(a.summary=n),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),a}function mo(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function yo(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:fo(t)||o}}const vo=t.createContext(null);function bo(){return t.useContext(vo)}function xo(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function wo(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}const[ko,jo]=mt(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=wo(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=wo(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Ao,Oo]=mt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let So={positions:new Map};const Mo=new Set;function _o(){for(const e of Mo)e()}function Co(e,t){const o=So.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(So.positions);n.delete(e),So={positions:n},_o()}function Po(e){const o=t.useId(),n=e.clientId||o,{name:i}=e,r=jo(e=>e.selections.get(i)),s=jo(e=>e.setClause),a=jo(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(xo(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(i,{clientId:n,type:"point",fields:t})},[n,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(i,{clientId:n,type:"interval",fields:t})},[n,i,s]),clear:t.useCallback(()=>{a(i,n)},[a,i,n]),clientId:n}}function Lo(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const To=t.createContext(!1),Ro=t.createContext(null),Ho="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Bo(e){const o=t.useContext(Ro),n=t.useId(),i=function(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}(e),r=t.useRef([]);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(r.current,i)||(r.current=i);const s=r.current;Ho(()=>{if(o)return()=>o.unregisterCategories(n)},[o,n]),Ho(()=>{o&&o.registerCategories(n,s)},[o,n,s])}function Io({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?n(s,t,o):o?o(i):E[r%E.length];return{label:i+"",color:a}}),label:""}]}}function Fo(e,t,o){return t?n=>{var i;const r=Object.assign({},e(n));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(r,o.selectedStyle);else{const e=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(r,o.unselectedStyle)}return r}:e}function Wo(){return St(e=>e.theme)}function Do(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function $o(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function zo(){var e;const t=Wo(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function No(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=z[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:"#007bff"}function Eo(e,o,n){return t.useMemo(()=>{if(!o||"auto"===o||"function"==typeof o)return e;const t=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return t.sort("asc"===o?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,o,n])}h.createContext(void 0);const qo={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 Go(e,t,o){var n,i,r,s,a,l,c;const u=qo[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?u.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?u.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Vo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Vo(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function Xo(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}function Yo(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Qo(e,t){if(!t)return Yo(e);try{const o=t(e);return null==o?Yo(e):o}catch(t){return Yo(e)}}function Ko(e,t){return"function"==typeof t?t(e):e[t]}function Zo({categoryAccessor:t,valueAccessor:o,groupAccessor:n,groupLabel:i,pieData:r=!1,valueFormat:s}){return a=>{var l;const c=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=Ko(c,t),d=Ko(c,o),h=n?Ko(c,n):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[e.jsx("div",{style:{fontWeight:"bold"},children:Yo(u)}),e.jsx("div",{style:{marginTop:4},children:Qo(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||(g=n,"string"==typeof g?g:"value"),": ",Yo(h)]})]});var g}}function Uo({componentName:t,message:o,diagnosticHint:n,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),n&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}class Jo extends h.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,o=this.state.error;return"function"==typeof t?t(o):void 0!==t?t:e.jsx(Uo,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var en;const tn="undefined"!=typeof process&&"production"!==(null===(en=process.env)||void 0===en?void 0:en.NODE_ENV);function on({componentName:t,width:o,height:n,children:i}){return e.jsx(Jo,{fallback:i=>e.jsx(Uo,{componentName:t,message:i.message,width:o,height:n}),children:i})}const nn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},rn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function sn(e,t,o,n){if(!tn)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function an(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function ln(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=an(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function cn({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)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(o){const n=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=ln(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function un(o){const{data:n,rawData:i,colorBy:r,colorScheme:s,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:f,chartId:m,showLegend:y,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,loading:k,emptyContent:j,width:A,height:O}=o,S=void 0===i,M=t.useMemo(()=>p(n),[n]),[_,C]=t.useState([]),P=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),L="string"==typeof o.colorBy?o.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:R,customHoverBehavior:H,customClickBehavior:B,crosshairSourceId:I}=function({selection:e,linkedHover:o,fallbackFields:n=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.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}(o,n),g=Po({name:(null==e?void 0:e.name)||"__unused__"}),f=function(e){const o=e.name||"hover",{fields:n}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=Po({name:o});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&s(t)},[n,s,a,o]),predicate:i,isActive:r}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||n||[]}),p=Oo(e=>e.pushObservation),m=e?{isActive:g.isActive,predicate:g.predicate}:null,[y,v]=t.useState(null),b=u||n[0],x=t.useMemo(()=>{if(!c||null==y||!b)return null;const e=y,t=b;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[c,y,b]),w=t.useCallback(e=>{var t,n;if(o)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const o=Do(e,t,h.xField);null!=o&&function(e,t,o){const n=So.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(So={positions:new Map(So.positions).set(e,{xValue:t,sourceId:o})},_o())}(h.name||"hover",o,d)}"x-position"!==(null==h?void 0:h.mode)&&f.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Co(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&f.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[b];v(null!=o?o+"":null)}else v(null);if(r||p){const o={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=$o(e),s=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});r&&r(e),p&&p(e)}}},[o,f,h,d,r,s,a,p,c,b]),k=t.useCallback(e=>{var t,o,n,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=Do(e,t,h.xField);null!=o&&function(e,t,o){const n=So.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(So.positions);return t.delete(e),So={positions:t},_o(),!1}So={positions:new Map(So.positions).set(e,{xValue:t,sourceId:o,locked:!0})},_o()}(h.name||"hover",o,d)}if(e&&l){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),l(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(r||p){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const o=$o(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),p&&p(e)}}},[l,r,p,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const o=So.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(So.positions);n.delete(e),So={positions:n},_o()}(e,d),Co(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:m,hoverSelectionHook:x,customHoverBehavior:w,customClickBehavior:k,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:f,chartId:m,onClick:x,hoverHighlight:w,colorByField:L}),F=function(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}(u,I),W=function(e,o,n){const i=bo(),r=zo();return t.useMemo(()=>{var t;if(!o)return;const s=null!==(t=null!=n?n:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof o){const t=Array.from(new Set(e.map(e=>o(e)+"")));if(i&&Object.keys(i).length>0){const e=V(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return V(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=V(e,o,s);return e=>i[e]||t(e)}return V(e,o,s)}if(i&&Object.keys(i).length>0){const e=V([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,o,n,i,r])}(M,r,s),D=t.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of M){const o="function"==typeof r?r(t):t[r];null!=o&&e.add(o+"")}return Array.from(e)},[M,r]),$=t.useMemo(()=>S&&_.length>0?_:D,[S,_,D]),z=function(e,o,n){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=t.useMemo(()=>{if(!e||"none"===e||!o)return null;const t="string"==typeof o?o:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof o?o(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=t?e[t]:"function"==typeof o?o(e):null;return s.has(n)}}:null},[e,o,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,r,$),N=t.useMemo(()=>R||(z.legendSelectionHook?z.legendSelectionHook:T),[R,z.legendSelectionHook,T]),q=function(e){const o=St(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,n;if(void 0!==e||void 0!==o)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:o})},[e,o])}(c),X=zo(),Y=bo(),Q=t.useMemo(()=>{if(W)return W;if(!r||0===$.length)return;const e=Array.isArray(s)&&s.length>0||"string"==typeof s&&s.length>0?s:X&&X.length>0?X:E,t="__streamCat",o=V($.map(e=>({[t]:e})),t,e);return e=>(null==Y?void 0:Y[e])||o(e)||"#999"},[W,r,$,s,X,Y]),{legend:K,margin:Z,legendPosition:U}=function({data:e,colorBy:o,colorScale:n,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(To),u=null!==t.useContext(Ro),d=void 0!==i?i:!c&&!!o,h=!!o&&(d||u),g=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const n of e){const e="function"==typeof o?o(n):n[o];null!=e&&t.add(e+"")}return Array.from(t)},[l,o,e,h]);Bo(u&&o?g:[]);const f=t.useMemo(()=>{if(!d||!o)return;const t=Io({data:e,colorBy:o,colorScale:n,getColor:G,categories:g});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,o,e,n,g]),p=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return f&&("right"===r&&110>t.right?t.right=110:"left"===r&&110>t.left?t.left=110:"top"===r&&50>t.top?t.top=50:"bottom"===r&&80>t.bottom&&(t.bottom=80)),t},[a,s,f,r]);return{legend:f,margin:p,legendPosition:r}}({data:M,colorBy:r,colorScale:Q,showLegend:y,legendPosition:l,userMargin:v,defaults:b,categories:$}),J=t.useMemo(()=>{const e={};return K&&(e.legend=K,e.legendPosition=U),a&&"none"!==a&&(e.legendHoverBehavior=z.onLegendHover,e.legendClickBehavior=z.onLegendClick,e.legendHighlightedCategory=z.highlightedCategory,e.legendIsolatedCategories=z.isolatedCategories),S&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=P),e},[K,U,a,z.onLegendHover,z.onLegendClick,z.highlightedCategory,z.isolatedCategories,S,r,P]),ee=Array.isArray(i)?p(i):i,te=function(t,o,n){if(!t)return null;const i=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(r+s)-s))/2);return e.jsx("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,n)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},rn),{position:"absolute",top:a+n*(r+s),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})},n))})}(k,A,O),oe=te?null:function(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},nn),{width:o,height:n}),children:i||"No data available"}):null}(ee,A,O,j);return{data:M,colorScale:W,allCategories:$,legendState:z,effectiveSelectionHook:N,activeSelectionHook:T,customHoverBehavior:H,customClickBehavior:B,legend:K,margin:Z,legendPosition:U,earlyReturn:te||oe||null,legendBehaviorProps:J,crosshairProps:F,resolvedSelection:q}}function dn({ref:e,frameRef:o,setup:n}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[o]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}const hn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sort:m=!1,barPadding:y=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,frameProps:j={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:H,stroke:B,strokeWidth:I,opacity:F,showCategoryTicks:W,categoryFormat:D,dataIdAccessor:$}=o,{width:z,height:N,enableHover:E,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=i,J=t.useMemo(()=>p(s),[s]),ee=un({data:J,rawData:s,colorBy:g,colorScheme:f,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:_,chartType:"BarChart",chartId:C,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:z,height:N}),{effectiveLegendProps:te,effectiveMargin:oe}=dn({ref:n,frameRef:r,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;sn("BarChart",J,"categoryAccessor",c),sn("BarChart",J,"valueAccessor",u);const ne=Eo(J,m,u),ie=zo(),re=t.useMemo(()=>new Map,[J]),se=t.useMemo(()=>(e,t)=>{const o={};return o.fill=g?G(e,g,ee.colorScale):No(H,ie,f,void 0,re),o},[g,ee.colorScale,H,ie,f,re]),ae=t.useMemo(()=>{const e=null==j?void 0:j.pieceStyle;return Xo(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},se(t,o)),e(t,o)||{}):se,{stroke:B,strokeWidth:I,opacity:F})},[se,j,B,I,F]),le=t.useMemo(()=>Fo(ae,ee.effectiveSelectionHook,ee.resolvedSelection),[ae,ee.effectiveSelectionHook,ee.resolvedSelection]),ce=t.useMemo(()=>Zo({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),ue=cn({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(Uo,{componentName:"BarChart",message:ue,width:z,height:N});const 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({chartType:"bar"},null!=s&&{data:ne}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[z,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,barPadding:y}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),$&&{dataIdAccessor:$}),{baselinePadding:x,enableHover:E,showAxes:i.showAxes,oLabel:Z,rLabel:U,rFormat:h}),D&&{oFormat:D}),{showGrid:q,showCategoryTicks:W,oSort:m}),te),po({title:X,description:Y,summary:Q,accessibleTable:K,className:l,animate:o.animate})),yo({tooltip:w,defaultTooltipContent:ce})),mo({linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"BarChart",width:z,height:N,children:e.jsx(lo,Object.assign({ref:r},de))})});hn.displayName="BarChart";const gn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:m,normalize:y=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:j,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:R,legendPosition:H,color:B,stroke:I,strokeWidth:F,opacity:W,categoryFormat:D}=o,{width:$,height:z,enableHover:N,showGrid:E,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,U=t.useMemo(()=>p(s),[s]),J=f||u,ee=un({data:U,rawData:s,colorBy:J,colorScheme:m,legendInteraction:R,legendPosition:H,selection:O,linkedHover:S,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:$,height:z});if(ee.earlyReturn)return ee.earlyReturn;const te=zo(),oe=t.useMemo(()=>new Map,[U]),ne=t.useMemo(()=>(e,t)=>J?ee.colorScale?{fill:G(e,J,ee.colorScale)}:{}:{fill:No(B,te,m,t,oe)},[J,ee.colorScale,B,te,m,oe]),ie=t.useMemo(()=>{const e=null==A?void 0:A.pieceStyle;return Xo(e&&"function"==typeof e?(t,o)=>{const n=ne(t,o),i=e(t,o)||{};return Object.assign(Object.assign({},n),i)}:ne,{stroke:I,strokeWidth:F,opacity:W})},[ne,A,I,F,W]),re=t.useMemo(()=>Fo(ie,ee.effectiveSelectionHook,ee.resolvedSelection),[ie,ee.effectiveSelectionHook,ee.resolvedSelection]),se=t.useMemo(()=>Zo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ae=cn({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=dn({ref:n,frameRef:r,setup:ee}),ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:U}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:v,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:re,size:[$,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:N}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z,rFormat:g}),D&&{oFormat:D}),{showGrid:E}),le),po({title:V,description:X,summary:Y,accessibleTable:Q,className:l,animate:o.animate})),yo({tooltip:k,defaultTooltipContent:se})),mo({linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),j&&j.length>0&&{annotations:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ae?e.jsx(Uo,{componentName:"StackedBarChart",message:ae,width:$,height:z}):e.jsx(on,{componentName:"StackedBarChart",width:$,height:z,children:e.jsx(lo,Object.assign({ref:r},ue))})});gn.displayName="StackedBarChart";const fn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:m,sort:y=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,frameProps:j={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:H,stroke:B,strokeWidth:I,opacity:F,categoryFormat:W}=o,{width:D,height:$,enableHover:z,showGrid:N,showLegend:E,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=i,Z=t.useMemo(()=>p(s),[s]),U=f||u,J=un({data:Z,rawData:s,colorBy:U,colorScheme:m,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:_,chartType:"GroupedBarChart",chartId:C,showLegend:E,userMargin:a,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:D,height:$});if(J.earlyReturn)return J.earlyReturn;const ee=zo(),te=t.useMemo(()=>new Map,[Z]),oe=j.pieceStyle,ne=t.useMemo(()=>(e,t)=>{const o=U?J.colorScale?{fill:G(e,U,J.colorScale)}:{}:{fill:No(H,ee,m,t,te)};if(oe){const n=oe(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[U,J.colorScale,H,ee,m,te,oe]),ie=t.useMemo(()=>Xo(ne,{stroke:B,strokeWidth:I,opacity:F}),[ne,B,I,F]),re=t.useMemo(()=>Fo(ie,J.effectiveSelectionHook,J.resolvedSelection),[ie,J.effectiveSelectionHook,J.resolvedSelection]),se=t.useMemo(()=>Zo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ae=cn({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=dn({ref:n,frameRef:r,setup:J}),ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:Z}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:re,size:[D,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ce,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K,rFormat:g}),W&&{oFormat:W}),{showGrid:N}),le),po({title:q,description:V,summary:X,accessibleTable:Y,className:l,animate:o.animate})),yo({tooltip:w,defaultTooltipContent:se})),mo({linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return ae?e.jsx(Uo,{componentName:"GroupedBarChart",message:ae,width:D,height:$}):e.jsx(on,{componentName:"GroupedBarChart",width:D,height:$,children:e.jsx(lo,Object.assign({ref:r},ue))})});function pn({brushProp:e,onBrushProp:o,linkedBrush:n,valueAccessor:i}){const r=(s="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(e){const{name:o,xField:n,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=Po({name:o}),c=n&&i?"xyBrush":n?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Lo(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Lo(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof i?i:"value")}),l=t.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=t.useCallback(e=>{if(r){l.current.end(e?e.r:null)}null==o||o(e)},[o,r]),u=!!(e||n||o);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}fn.displayName="GroupedBarChart";const mn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:m,barPadding:y,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:j={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:H,stroke:B,strokeWidth:I,opacity:F,categoryFormat:W,rTickValues:D,tickLabelEdgeAlign:$,showCategoryTicks:z,gradientFill:N,trackFill:E}=o,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=i,oe=t.useMemo(()=>p(s),[s]),ne=f||u,ie=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==o.mode)return 40;const e=new Set(oe.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?V:q)-2*t)/(t-1))):1},[y,o.mode,oe,c,h,q,V]),re=un({data:oe,rawData:s,colorBy:ne,colorScheme:m,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:_,chartType:"SwimlaneChart",chartId:C,showLegend:Q,userMargin:a,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:q,height:V}),se=pn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:d});if(re.earlyReturn)return re.earlyReturn;const ae=zo(),le=t.useMemo(()=>new Map,[oe]),ce=j.pieceStyle,ue=t.useMemo(()=>(e,t)=>{const o=ne?re.colorScale?{fill:G(e,ne,re.colorScale)}:{}:{fill:No(H,ae,m,t,le)};if(ce){const n=ce(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ne,re.colorScale,H,ae,m,le,ce]),de=t.useMemo(()=>Xo(ue,{stroke:B,strokeWidth:I,opacity:F}),[ue,B,I,F]),he=t.useMemo(()=>Fo(de,re.effectiveSelectionHook,re.resolvedSelection),[de,re.effectiveSelectionHook,re.resolvedSelection]),ge=t.useMemo(()=>Zo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),fe=cn({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:pe,effectiveMargin:me}=dn({ref:n,frameRef:r,setup:re}),ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:oe}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:he,size:[q,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:me,barPadding:ie,enableHover:X}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===z?void 0:ee,rLabel:te,rFormat:g}),D&&{rTickValues:D}),null!=$&&{tickLabelEdgeAlign:$}),W&&{oFormat:W}),void 0!==z&&{showCategoryTicks:z}),{showGrid:Y}),pe),po({title:K,description:Z,summary:U,accessibleTable:J,className:l,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:ge})),mo({linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),b&&b.length>0&&{annotations:b}),N&&{gradientFill:!0===N?{topOpacity:.8,bottomOpacity:.05}:N}),null!=E&&{trackFill:E}),se.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return fe?e.jsx(Uo,{componentName:"SwimlaneChart",message:fe,width:q,height:V}):e.jsx(on,{componentName:"SwimlaneChart",width:q,height:V,children:e.jsx(lo,Object.assign({ref:r},ye))})});function yn(e,o){const{variant:n,frameRef:i,overrides:r,deps:s}=o;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}const o=t;return{push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.push(t(e));return s},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(n,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}mn.displayName="SwimlaneChart";const vn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sizeBy:m,sizeRange:y=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,brush:j,onBrush:A,linkedBrush:O,frameProps:S={},selection:M,linkedHover:_,onObservation:C,onClick:P,hoverHighlight:L,chartId:T,loading:R,emptyContent:H,legendInteraction:B,legendPosition:I,color:F,stroke:W,strokeWidth:D,opacity:$,showCategoryTicks:z,categoryFormat:N}=o,{width:E,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:K,summary:Z,accessibleTable:U,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>p(s),[s]),oe=un({data:te,rawData:s,colorBy:g,colorScheme:f,legendInteraction:B,legendPosition:I,selection:M,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:L,chartType:"SwarmPlot",chartId:T,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:R,emptyContent:H,width:E,height:q}),ne=pn({brushProp:j,onBrushProp:A,linkedBrush:O,valueAccessor:u});if(oe.earlyReturn)return oe.earlyReturn;const ie=t.useMemo(()=>{if(!m)return;const e=te.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[te,m]),re=zo(),se=t.useMemo(()=>new Map,[te]),ae=S.pieceStyle,le=t.useMemo(()=>(e,t)=>{const o={fillOpacity:b};if(o.fill=g?G(e,g,oe.colorScale):No(F,re,f,void 0,se),o.r=m?function(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,m,y,ie):v,ae){const n=ae(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[g,oe.colorScale,m,y,ie,v,b,F,re,f,se,ae]),ce=t.useMemo(()=>Xo(le,{stroke:W,strokeWidth:D,opacity:$}),[le,W,D,$]),ue=t.useMemo(()=>Fo(ce,oe.effectiveSelectionHook,oe.resolvedSelection),[ce,oe.effectiveSelectionHook,oe.resolvedSelection]),de=t.useMemo(()=>Zo({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),he=cn({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(he)return e.jsx(Uo,{componentName:"SwarmPlot",message:he,width:E,height:q});const ge=Object.assign(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!=s&&{data:te}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ue,size:[E,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe.margin,barPadding:x,enableHover:V}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),N&&{oFormat:N}),{showGrid:X,showCategoryTicks:z}),oe.legendBehaviorProps),po({title:Q,description:K,summary:Z,accessibleTable:U,className:l,animate:o.animate})),yo({tooltip:w,defaultTooltipContent:de})),mo({linkedHover:_,onObservation:C,onClick:P,hoverHighlight:L,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),k&&k.length>0&&{annotations:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"SwarmPlot",width:E,height:q,children:e.jsx(lo,Object.assign({ref:r},ge))})});function bn(t){return o=>{var n;const i=o.category||o.data&&(null===(n=o.data[0])||void 0===n?void 0:n.category)||"",r=o.stats||(o.data||o).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),null!=r.n&&e.jsxs("div",{children:["n = ",r.n]}),null!=r.min&&e.jsxs("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&e.jsxs("div",{children:["Q1: ",r.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&e.jsxs("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&e.jsxs("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const n=t.valueAccessor,r=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=r.length,a=s>0?s%2!=0?r[Math.floor(s/2)]:(r[s/2-1]+r[s/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),s>0&&e.jsxs("div",{children:["n = ",s]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:co,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}vn.displayName="SwarmPlot";const xn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,showOutliers:m=!0,categoryPadding:y=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:R,opacity:H,showCategoryTicks:B,categoryFormat:I}=o,{width:F,height:W,enableHover:D,showGrid:$,showLegend:z,title:N,description:E,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Y}=i,Q=t.useMemo(()=>p(s),[s]),K=un({data:Q,rawData:s,colorBy:g,colorScheme:f,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"BoxPlot",chartId:S,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:F,height:W});if(K.earlyReturn)return K.earlyReturn;const Z=zo(),U=t.useMemo(()=>new Map,[Q]),J=t.useMemo(()=>e=>{const t=g?G(e,g,K.colorScale):No(L,Z,f,void 0,U);return{fill:t,stroke:t,fillOpacity:.8}},[g,K.colorScale,L,Z,f,U]),ee=t.useMemo(()=>Xo(J,{stroke:T,strokeWidth:R,opacity:H}),[J,T,R,H]),te=t.useMemo(()=>Fo(ee,K.effectiveSelectionHook,K.resolvedSelection),[ee,K.effectiveSelectionHook,K.resolvedSelection]),oe=t.useMemo(()=>bn(),[]),ne=cn({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(Uo,{componentName:"BoxPlot",message:ne,width:F,height:W});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({chartType:"boxplot"},null!=s&&{data:Q}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,showOutliers:m,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,barPadding:y,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:Y,rFormat:h}),I&&{oFormat:I}),{showGrid:$,showCategoryTicks:B}),K.legendBehaviorProps),po({title:N,description:E,summary:q,accessibleTable:V,className:l,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:oe})),mo({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"BoxPlot",width:F,height:W,children:e.jsx(lo,Object.assign({ref:r},ie))})});xn.displayName="BoxPlot";const wn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:f,colorScheme:m,categoryPadding:y=20,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:j={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:H,stroke:B,strokeWidth:I,opacity:F,showCategoryTicks:W,categoryFormat:D}=o,{width:$,height:z,enableHover:N,showGrid:E,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,U=t.useMemo(()=>p(s),[s]),J=un({data:U,rawData:s,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:_,chartType:"Histogram",chartId:C,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:$,height:z}),ee=pn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:u});if(J.earlyReturn)return J.earlyReturn;const te=t.useMemo(()=>{if(0===U.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,o=-1/0;for(const n of U){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[U,u]),oe=zo(),ne=t.useMemo(()=>new Map,[U]),ie=t.useMemo(()=>e=>{const t=f?G(e,f,J.colorScale):No(H,oe,m,void 0,ne);return{fill:t,stroke:t,fillOpacity:.8}},[f,J.colorScale,H,oe,m,ne]),re=t.useMemo(()=>Xo(ie,{stroke:B,strokeWidth:I,opacity:F}),[ie,B,I,F]),se=t.useMemo(()=>Fo(re,J.effectiveSelectionHook,J.resolvedSelection),[re,J.effectiveSelectionHook,J.resolvedSelection]),ae=t.useMemo(()=>t=>{const o=t.data||t,n=o.category||t.category||"",i=o.count,r=o.range;return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[n&&e.jsx("div",{style:{fontWeight:"bold"},children:n+""}),null!=i&&e.jsxs("div",{children:["Count: ",i]}),r&&2===r.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]),le=cn({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(le)return e.jsx(Uo,{componentName:"Histogram",message:le,width:$,height:z});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:U}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:se,bins:d,normalize:h}),te&&{rExtent:te}),{size:[$,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,barPadding:y,enableHover:N}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z,rFormat:g}),D&&{oFormat:D}),{showGrid:E,showCategoryTicks:W}),J.legendBehaviorProps),po({title:V,description:X,summary:Y,accessibleTable:Q,className:l,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:ae})),mo({linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),b&&b.length>0&&{annotations:b}),ee.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"Histogram",width:$,height:z,children:e.jsx(lo,Object.assign({ref:r},ce))})});wn.displayName="Histogram";const kn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:f,colorBy:m,colorScheme:y,categoryPadding:v=20,tooltip:b,annotations:x,brush:w,onBrush:k,linkedBrush:j,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:R,legendPosition:H,color:B,stroke:I,strokeWidth:F,opacity:W,showCategoryTicks:D,categoryFormat:$}=o,{width:z,height:N,enableHover:E,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=i,J=t.useMemo(()=>p(s),[s]),ee=un({data:J,rawData:s,colorBy:m,colorScheme:y,legendInteraction:R,legendPosition:H,selection:O,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"ViolinPlot",chartId:P,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:z,height:N}),te=pn({brushProp:w,onBrushProp:k,linkedBrush:j,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const oe=zo(),ne=t.useMemo(()=>new Map,[J]),ie=t.useMemo(()=>e=>{const t=m?G(e,m,ee.colorScale):No(B,oe,y,void 0,ne);return{fill:t,stroke:t,fillOpacity:.6}},[m,ee.colorScale,B,oe,y,ne]),re=t.useMemo(()=>Xo(ie,{stroke:I,strokeWidth:F,opacity:W}),[ie,I,F,W]),se=t.useMemo(()=>Fo(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ae=t.useMemo(()=>bn({valueAccessor:u}),[u]),le=cn({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(le)return e.jsx(Uo,{componentName:"ViolinPlot",message:le,width:z,height:N});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:se,bins:h,showIQR:g,size:[z,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee.margin,barPadding:v,enableHover:E}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:U,rFormat:f}),$&&{oFormat:$}),{showGrid:q,showCategoryTicks:D}),ee.legendBehaviorProps),po({title:X,description:Y,summary:Q,accessibleTable:K,className:l,animate:o.animate})),yo({tooltip:b,defaultTooltipContent:ae})),mo({linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),x&&x.length>0&&{annotations:x}),te.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"ViolinPlot",width:z,height:N,children:e.jsx(lo,Object.assign({ref:r},ce))})});kn.displayName="ViolinPlot";const jn=t.forwardRef(function(o,n){var i;const r=Go(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),s=t.useRef(null);yn(n,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:m,sort:y="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,frameProps:k={},selection:j,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:R,stroke:H,strokeWidth:B,opacity:I,categoryFormat:F}=o,{width:W,height:D,enableHover:$,showGrid:z,showLegend:N,title:E,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=r,K=t.useMemo(()=>p(a),[a]),Z=un({data:K,rawData:a,colorBy:f,colorScheme:m,legendInteraction:L,legendPosition:T,selection:j,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:M,chartType:"DotPlot",chartId:_,showLegend:N,userMargin:l,marginDefaults:r.marginDefaults,loading:C,emptyContent:P,width:W,height:D});if(Z.earlyReturn)return Z.earlyReturn;const U=Eo(K,y,d),J=zo(),ee=t.useMemo(()=>new Map,[K]),te=k.pieceStyle,oe=t.useMemo(()=>(e,t)=>{const o={r:v,fillOpacity:.8};if(o.fill=f?G(e,f,Z.colorScale):No(R,J,m,void 0,ee),te){const n=te(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[f,Z.colorScale,v,R,J,m,ee,te]),ne=t.useMemo(()=>Xo(oe,{stroke:H,strokeWidth:B,opacity:I}),[oe,H,B,I]),ie=t.useMemo(()=>Fo(ne,Z.effectiveSelectionHook,Z.resolvedSelection),[ne,Z.effectiveSelectionHook,Z.resolvedSelection]),re=t.useMemo(()=>Zo({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),se=cn({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(se)return e.jsx(Uo,{componentName:"DotPlot",message:se,width:W,height:D});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=a&&{data:U}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:b,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Y,rLabel:Q,rFormat:g}),F&&{oFormat:F}),{showGrid:z,oSort:y}),Z.legendBehaviorProps),po({title:E,description:q,summary:V,accessibleTable:X,className:c,animate:o.animate})),yo({tooltip:x,defaultTooltipContent:re})),mo({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"DotPlot",width:W,height:D,children:e.jsx(lo,Object.assign({ref:s},ae))})});jn.displayName="DotPlot";const An=t.forwardRef(function(o,n){var i,r;const s=Go(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(r=o.height)&&void 0!==r?r:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:f,startAngle:m=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:R,opacity:H}=o,{width:B,height:I,enableHover:F,showLegend:W,title:D,description:$,summary:z,accessibleTable:N}=s,E=t.useMemo(()=>p(l),[l]),q=g||d,V=un({data:E,rawData:l,colorBy:q,colorScheme:f,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"PieChart",chartId:S,showLegend:W,userMargin:c,marginDefaults:s.marginDefaults,loading:M,emptyContent:_,width:B,height:I});if(V.earlyReturn)return V.earlyReturn;const X=zo(),Y=t.useMemo(()=>new Map,[E]),Q=t.useMemo(()=>(e,t)=>q?V.colorScale?{fill:G(e,q,V.colorScale)}:{}:{fill:No(L,X,f,t,Y)},[q,V.colorScale,L,X,f,Y]),K=t.useMemo(()=>{const e=null==x?void 0:x.pieceStyle;return Xo(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},Q(t,o)),e(t,o)||{}):Q,{stroke:T,strokeWidth:R,opacity:H})},[Q,x,T,R,H]),Z=t.useMemo(()=>Fo(K,V.effectiveSelectionHook,V.resolvedSelection),[K,V.effectiveSelectionHook,V.resolvedSelection]),U=t.useMemo(()=>Zo({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),J=cn({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:ee,effectiveMargin:te}=dn({ref:n,frameRef:a,setup:V}),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({chartType:"pie"},null!=l&&{data:E}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:Z,startAngle:m}),null!=y&&{cornerRadius:y}),{size:[B,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),ee),po({title:D,description:$,summary:z,accessibleTable:N,className:u,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:U})),mo({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?e.jsx(Uo,{componentName:"PieChart",message:J,width:B,height:I}):e.jsx(on,{componentName:"PieChart",width:B,height:I,children:e.jsx(lo,Object.assign({ref:a},oe))})});An.displayName="PieChart";const On=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks},{width:400,height:400}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:f,startAngle:m=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:R,opacity:H}=o,{width:B,height:I,enableHover:F,showLegend:W,title:D,description:$,summary:z,accessibleTable:N}=i,E=t.useMemo(()=>p(s),[s]),q=g||c,V=un({data:E,rawData:s,colorBy:q,colorScheme:f,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"DonutChart",chartId:S,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:B,height:I});if(V.earlyReturn)return V.earlyReturn;const X=null!=d?d:Math.max(2,.15*Math.min(B,I)),Y=zo(),Q=t.useMemo(()=>new Map,[E]),K=x.pieceStyle,Z=t.useMemo(()=>(e,t)=>{let o;if(o=q?V.colorScale?{fill:G(e,q,V.colorScale)}:{}:{fill:No(L,Y,f,t,Q)},K){const n=K(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[q,V.colorScale,L,Y,f,Q,K]),U=t.useMemo(()=>Xo(Z,{stroke:T,strokeWidth:R,opacity:H}),[Z,T,R,H]),J=t.useMemo(()=>Fo(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),ee=t.useMemo(()=>Zo({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),te=cn({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:oe,effectiveMargin:ne}=dn({ref:n,frameRef:r,setup:V}),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({chartType:"donut"},null!=s&&{data:E}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:m}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[B,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),oe),po({title:D,description:$,summary:z,accessibleTable:N,className:l,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:ee})),mo({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?e.jsx(Uo,{componentName:"DonutChart",message:te,width:B,height:I}):e.jsx(on,{componentName:"DonutChart",width:B,height:I,children:e.jsx(lo,Object.assign({ref:r},ie))})});On.displayName="DonutChart";const Sn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),r=t.useRef(null),s="context"===o.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,color:h,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:p=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:y,valueFormat:v,showScaleLabels:b=!a,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:j,frameProps:A={},className:O,stroke:S,strokeWidth:M,opacity:_}=o,{width:C,height:P,title:L,description:T,summary:R,accessibleTable:H}=i,B=Math.max(c,Math.min(u,l)),I=u-c||1,F=(B-c)/I,{gaugeData:W,pieceStyle:D,gaugeAnnotations:$}=t.useMemo(()=>{const e=[],t=new Map,o=[];let n=d&&d.length>0?[...d].sort((e,t)=>e.value-t.value):[{value:u,color:h||"var(--semiotic-primary, #007bff)"}];n=n.map(e=>Object.assign(Object.assign({},e),{value:Math.max(c,Math.min(u,e.value))})),u>n[n.length-1].value&&n.push({value:u,color:n[n.length-1].color});let i=c;for(let o=0;n.length>o;o++){const r=n[o],s=(r.value-i)/I;if(w){const n=(i-c)/I,a=Math.max(0,Math.min(F,(r.value-c)/I)-n),l=s-a;if(a>0){const n="fill-"+o;e.push({category:n,value:a,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}if(l>0){const n="bg-"+o;e.push({category:n,value:l,_zone:r.label||"Zone "+(o+1),_isFill:!1}),t.set(n,{fill:g,opacity:.4})}}else{const n="zone-"+o;e.push({category:n,value:s,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}i=r.value}if(b&&d&&d.length>0)for(const e of d)e.value>c&&u>e.value&&o.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,o)=>t.get(o||e.category)||{fill:g},gaugeAnnotations:o}},[l,c,u,d,h,g,F,I,b,w]),z=t.useMemo(()=>Xo(D,{stroke:S,strokeWidth:M,opacity:_}),[D,S,M,_]),N=x*Math.PI/180,E=180+(360-x)/2,q=Math.min(10,Math.max(1,Math.min(C,P)/12)),G=-Math.PI/2+E*Math.PI/180,V=[[Math.cos(G),Math.sin(G)],[Math.cos(G+N),Math.sin(G+N)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-G)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>N+.001||V.push([Math.cos(e),Math.sin(e)]);const X=Math.min(...V.map(e=>e[0])),Y=Math.max(...V.map(e=>e[0])),Q=Math.min(...V.map(e=>e[1])),K=Math.max(...V.map(e=>e[1])),Z=(Q+K)/2,U=(X+Y)/2,J=Math.max(4,Math.min((C-2*q)/(Y-X),(P-2*q)/(K-Q))-2),ee=Math.max(0,Math.min(J-1.5,J*(1-f))),te=C/2-U*J,oe=P/2-Z*J,ne=2*(J+4),ie=t.useMemo(()=>{if(a&&null==y)return null;if(null!=y)return"function"==typeof y?y(B,c,u):y;const t=v?v(B):Math.round(B)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),b&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[y,B,c,u,v,b,J,a]),re=t.useMemo(()=>s&&null==y?{type:"gauge-value",text:v?v(B):Math.round(B)+""}:null,[s,y,B,v]),se=t.useMemo(()=>{if(!p)return null;const e=-Math.PI/2+E*Math.PI/180+F*N,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[p,F,E,N,ee,m]),ae=t.useMemo(()=>(t,o,n)=>{if("gauge-needle"===t.type){const i=(n.width||C)/2,r=(n.height||P)/2,s=Math.max(1,J-ee),a=Math.max(1,Math.min(2.5,.4*s)),l=Math.max(1,Math.min(5,.6*s));return e.jsxs("g",{transform:`translate(${i},${r})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+o)}if("gauge-label"===t.type){const i=-Math.PI/2+E*Math.PI/180+(t.value-c)/I*N,r=ee-14,s=(n.height||P)/2;return e.jsx("text",{x:(n.width||C)/2+Math.cos(i)*r,y:s+Math.sin(i)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label},"gauge-label-"+o)}return"gauge-value"===t.type?e.jsx("text",{x:(n.width||C)/2,y:(n.height||P)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+o):null},[C,P,c,I,E,N,ee,J]),le=t.useMemo(()=>{const e=[...$,...j||[]];return se&&e.push(se),re&&e.push(re),e},[$,j,se,re]),ce=t.useMemo(()=>t=>{var o;const n=(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o[0])||(null==t?void 0:t.data)||t,i=null==n?void 0:n._isFill;return e.jsxs("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))"},children:[e.jsx("div",{style:{fontWeight:600},children:(null==n?void 0:n._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(B):"Remaining"})]})},[B]);if(0===W.length)return e.jsx(Uo,{componentName:"GaugeChart",message:"No data to display",width:C,height:P});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:z,innerRadius:ee,startAngle:E,sweepAngle:x,centerContent:ie,size:[C,P],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:oe-ne/2,bottom:P-oe-ne/2,left:te-ne/2,right:C-te-ne/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:fo(k)||ce,svgAnnotationRules:ae},le.length>0&&{annotations:le}),L&&{title:L}),T&&{description:T}),R&&{summary:R}),void 0!==H&&{accessibleTable:H}),O&&{className:O}),null!=o.animate&&{animate:o.animate}),A);return e.jsx(on,{componentName:"GaugeChart",width:C,height:P,children:e.jsx(lo,Object.assign({ref:r},ue))})});Sn.displayName="GaugeChart";const Mn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:f,colorBy:m,colorScheme:y,categoryPadding:v=5,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,chartId:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:H,opacity:B,showCategoryTicks:I,categoryFormat:F}=o,{width:W,height:D,enableHover:$,showGrid:z,showLegend:N,title:E,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=i,K=t.useMemo(()=>p(s),[s]),Z=un({data:K,rawData:s,colorBy:m,colorScheme:y,legendInteraction:P,legendPosition:L,selection:k,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"RidgelinePlot",chartId:M,showLegend:N,userMargin:a,marginDefaults:i.marginDefaults,loading:_,emptyContent:C,width:W,height:D});if(Z.earlyReturn)return Z.earlyReturn;const U=zo(),J=t.useMemo(()=>new Map,[K]),ee=t.useMemo(()=>e=>{const t=m?G(e,m,Z.colorScale):No(T,U,y,void 0,J);return{fill:t,stroke:t,fillOpacity:.5}},[m,Z.colorScale,T,U,y,J]),te=t.useMemo(()=>Xo(ee,{stroke:R,strokeWidth:H,opacity:B}),[ee,R,H,B]),oe=t.useMemo(()=>Fo(te,Z.effectiveSelectionHook,Z.resolvedSelection),[te,Z.effectiveSelectionHook,Z.resolvedSelection]),ne=t.useMemo(()=>bn(),[]),ie=cn({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(Uo,{componentName:"RidgelinePlot",message:ie,width:W,height:D});const 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({chartType:"ridgeline"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:oe,bins:h,size:[W,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:v,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q,rFormat:f}),F&&{oFormat:F}),{showGrid:z,showCategoryTicks:I,oSort:!1,amplitude:g}),Z.legendBehaviorProps),po({title:E,description:q,summary:V,accessibleTable:X,className:l,animate:o.animate})),yo({tooltip:b,defaultTooltipContent:ne})),mo({linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"RidgelinePlot",width:W,height:D,children:e.jsx(lo,Object.assign({ref:r},re))})});Mn.displayName="RidgelinePlot";const _n=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:y=!0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:R,opacity:H,categoryFormat:B}=o,I="vertical"===f,{width:F,height:W,enableHover:D,showLegend:$,title:z,description:N,summary:E,accessibleTable:q}=i,V=I?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>p(s),[s]),Y=h||d,Q=!Y,K=un({data:X,rawData:s,colorBy:Y,colorScheme:g,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"FunnelChart",chartId:S,showLegend:$,userMargin:a,marginDefaults:V,loading:M,emptyContent:_,width:F,height:W});if(K.earlyReturn)return K.earlyReturn;sn("FunnelChart",X,"stepAccessor",c),sn("FunnelChart",X,"valueAccessor",u);const Z=zo(),U=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(Q)return L||((null==Z?void 0:Z[0])?Z[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[Q,L,Z,g]),ee=x.pieceStyle,te=t.useMemo(()=>(e,t)=>{const o={};if(o.fill=J||(Y?G(e,Y,K.colorScale):No(L,Z,g,t,U)),ee){const n=ee(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[J,Y,K.colorScale,L,Z,g,U,ee]),oe=t.useMemo(()=>Xo(te,{stroke:T,strokeWidth:R,opacity:H}),[te,T,R,H]),ne=t.useMemo(()=>Fo(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),ie=t.useMemo(()=>t=>{var o,n,i,r,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(i=null!==(n=null!==(o=null==l?void 0:l.__funnelValue)&&void 0!==o?o:null==l?void 0:l.__barFunnelValue)&&void 0!==n?n:null==l?void 0:l.value)&&void 0!==i?i:"",d=null!==(r=null==l?void 0:l.__funnelPercent)&&void 0!==r?r:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),f&&f!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:f+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",p]})]})},[]),re=cn({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(re)return e.jsx(Uo,{componentName:"FunnelChart",message:re,width:F,height:W});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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:I?"bar-funnel":"funnel"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:I?"vertical":"horizontal",barPadding:I?40:0,pieceStyle:ne,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:I,showCategoryTicks:I}),B&&{oFormat:B}),{showGrid:I}),!I&&{connectorOpacity:m}),{showLabels:y}),K.legendBehaviorProps),z&&{title:z}),N&&{description:N}),E&&{summary:E}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===v?()=>null:!0===v||null==v?ie:fo(v)||ie}),(k||j||A||O)&&{customHoverBehavior:K.customHoverBehavior}),(j||A||k)&&{customClickBehavior:K.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"FunnelChart",width:F,height:W,children:e.jsx(lo,Object.assign({ref:r},se))})});_n.displayName="FunnelChart";const Cn={RdBu:H,PiYG:B,PRGn:I,BrBG:F,RdYlBu:W,RdYlGn:D,Spectral:$},Pn="__likert_neutral_neg",Ln="__likert_neutral_pos";function Tn(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Rn(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(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 o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function Hn(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Pn,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Ln,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Bn(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Pn?r=o:o.__likertLevel===Ln?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const In=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:g="count",levels:f,orientation:p="horizontal",colorScheme:m,barPadding:y=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,valueFormat:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,categoryFormat:T,stroke:R,strokeWidth:H,opacity:B}=o,{width:I,height:F,enableHover:W,showGrid:D,showLegend:$,title:z,description:N,summary:q,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=i,K="horizontal"===p,Z=void 0===s,U=!d,J=function(){var e;const t=Wo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ee=t.useMemo(()=>m&&Array.isArray(m)&&m.length>=f.length?m:function(e,t){if(0>=e)return[];if(t){const o=Cn[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(f.length,J),[m,f.length,J]),te=t.useMemo(()=>{const e=new Map;for(let t=0;f.length>t;t++)e.set(f[t],ee[t]||"#888");return e},[f,ee]),{processedData:oe,reAggregate:ne,accumulatorRef:ie}=function({data:e,levels:o,categoryAccessor:n,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>Tn(n,"question"),[n]),d=t.useMemo(()=>c?Tn(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:Tn(r,"level"),[c,r]),g=t.useMemo(()=>c?null:Tn(s,"count"),[c,s]),f=e||[],p=t.useRef([]),m=t.useMemo(()=>{if(0===f.length)return[];let e=Rn(f,o,u,d,h,g);return a&&(e=Hn(e,o),e=Bn(e,o)),e},[f,o,u,d,h,g,a]),y=t.useCallback(e=>{var t;let n=Rn(e,o,u,d,h,g);a&&(n=Hn(n,o),n=Bn(n,o)),null===(t=l.current)||void 0===t||t.replace(n)},[o,u,d,h,g,a,l]);return{processedData:m,reAggregate:y,accumulatorRef:p}}({data:s,levels:f,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:g,isDiverging:K,frameRef:r}),re="__likertLevelLabel",se=function({isPushMode:e,colorBy:o,colorScheme:n,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=bo(),d=zo(),h=t.useCallback(e=>{const t=e[o];return null!=t?t+"":null},[o]),g=t.useCallback(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=h(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),n=!0)}n&&c(e=>e+1)},[e,o,h]),f=t.useCallback(t=>{if(!e||!o)return;const n=Array.from(new Set(t.map(String))),i=a.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(s.current=new Set(n),a.current=n,c(e=>e+1))},[e,o]),p=t.useCallback(e=>t=>{g([t]),e(t)},[g]),m=t.useCallback(e=>t=>{g(t),e(t)},[g]),y=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);Bo(e&&o?a.current:[]);const v=t.useMemo(()=>{if(!e||!o||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:d&&d.length>0?d:E,s=o,l=t.map(e=>({[s]:e})),c=V(l,s,r);return Io({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:G})},[e,o,i,n,u,d,l]),b=t.useMemo(()=>{if(v)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[v,r]);return{wrapPush:p,wrapPushMany:m,resetCategories:y,categories:a.current,categoryDomainProps:e&&o?{legendCategoryAccessor:o,onCategoriesChange:f}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:Z,colorBy:re,colorScheme:ee,showLegend:$,legendPosition:L}),ae=t.useCallback(se.wrapPush(e=>{ie.current.push(e),ne(ie.current)}),[se.wrapPush,ne,ie]),le=t.useCallback(se.wrapPushMany(e=>{ie.current.push(...e),ne(ie.current)}),[se.wrapPushMany,ne,ie]);t.useImperativeHandle(n,()=>({push:ae,pushMany:le,remove:e=>{var t,o;return null!==(o=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=r.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;ie.current=[],se.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:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ae,le,se.resetCategories,ie]);const ce=un({data:oe,rawData:s,colorBy:re,colorScheme:ee,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"LikertChart",chartId:S,showLegend:$,userMargin:a,marginDefaults:i.marginDefaults,loading:_,emptyContent:C,width:I,height:F});if(ce.earlyReturn)return ce.earlyReturn;const ue=t.useMemo(()=>{const e=f.length;return e%2!=0&&te.get(f[Math.floor(e/2)])||"#888"},[f,te]),de=x.pieceStyle,he=t.useMemo(()=>(e,t)=>{var o,n;const i=e.__likertLevelLabel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);let s;if(r===Pn||r===Ln)s={fill:ue};else{const e=i||r;s=e&&te.has(e)?{fill:te.get(e)}:{fill:"#888"}}if(de){const o=de(e,t);o.stroke&&(s.stroke=o.stroke),null!=o.strokeWidth&&(s.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(s.strokeOpacity=o.strokeOpacity)}return s},[te,ue,de]),ge=t.useMemo(()=>Xo(he,{stroke:R,strokeWidth:H,opacity:B}),[he,R,H,B]),fe=t.useMemo(()=>Fo(ge,ce.effectiveSelectionHook,ce.resolvedSelection),[ge,ce.effectiveSelectionHook,ce.resolvedSelection]),pe=t.useMemo(()=>{const e=f.length;return e%2!=0?f[Math.floor(e/2)]:""},[f]),me=t.useMemo(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===Pn||o===Ln?pe:o,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=o===Pn||o===Ln?2*r:r,a=t.__likertCount||0;return h.createElement("div",{className:"semiotic-tooltip",style:co},h.createElement("div",{style:{fontWeight:"bold"}},i),h.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[pe]),ye=t.useMemo(()=>{if(!f||2>f.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!g)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return U?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),g&&(e.countAccessor=g)),cn({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:f}})},[s,c,u,d,g,f,U]),ve=t.useMemo(()=>[{styleFn:e=>({fill:te.get(e.label)||"#888"}),items:f.map(e=>({label:e})),label:""}],[f,te]),be=t.useMemo(()=>!1!==$?Object.assign(Object.assign({},ce.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:L||ce.legendPosition||"bottom"}):ce.legendBehaviorProps,[ce.legendBehaviorProps,ce.legendPosition,L,$,ve]),xe=t.useMemo(()=>{const e=Object.assign({},ce.margin);if(Z&&!1!==$){const t=L||"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(se.streamingMarginAdjust)for(const[t,o]of Object.entries(se.streamingMarginAdjust))o>e[t]&&(e[t]=o);return K&&100>e.left&&(e.left=100),e},[ce.margin,se.streamingMarginAdjust,K,Z,$,L]),we=t.useMemo(()=>M||(K?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[K,M]),ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=s&&{data:oe}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:K?"horizontal":"vertical",pieceStyle:fe,size:[I,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:xe,barPadding:y,enableHover:W}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q||(K?void 0:"Percentage"),rFormat:we}),T&&{oFormat:T}),{showGrid:D}),be),z&&{title:z}),N&&{description:N}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===v?()=>null:!0===v?me:fo(v)||me}),(k||j||A||O)&&{customHoverBehavior:ce.customHoverBehavior}),(j||A||k)&&{customClickBehavior:ce.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return ye?e.jsx(Uo,{componentName:"LikertChart",message:ye,width:I,height:F}):e.jsx(on,{componentName:"LikertChart",width:I,height:F,children:e.jsx(lo,Object.assign({ref:r},ke))})});In.displayName="LikertChart";const Fn=t.forwardRef(function(o,n){const{data:i,layout:r,layoutConfig:s,categoryAccessor:a="category",valueAccessor:l="value",oExtent:c,rExtent:u,projection:d="vertical",margin:h,className:g,colorScheme:f,showAxes:p=!1,annotations:m,onObservation:y,onClick:v,selection:b,linkedHover:x,chartId:w,loading:k,emptyContent:j,frameProps:A={}}=o,{frameRef:O,resolved:S,safeData:M,setup:_,earlyReturn:C}=function(e){var o;const n=function(e){const o=t.useRef(null);return yn(e.imperativeRef,{variant:e.imperativeVariant,frameRef:o}),{frameRef:o,resolved:Go(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:r}=n,s=un({data:null!==(o=e.data)&&void 0!==o?o:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:i.showLegend,userMargin:r,marginDefaults:i.marginDefaults,loading:e.loading,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},n),{safeData:s.data,setup:s,earlyReturn:s.earlyReturn})}({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:i,colorScheme:f,selection:b,linkedHover:x,onObservation:y,onClick:v,chartId:w,loading:k,emptyContent:j,margin:h,width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,mode:o.mode});if(C)return C;const{width:P,height:L,enableHover:T,showGrid:R,title:H,description:B,summary:I,accessibleTable:F}=S,W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:M}),{customLayout:r,layoutConfig:s,oAccessor:a,rAccessor:l,oExtent:c,rExtent:u,projection:d,colorScheme:f,size:[P,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:_.margin,enableHover:T,showAxes:p,showGrid:R,annotations:m}),po({title:H,description:B,summary:I,accessibleTable:F,className:g,animate:o.animate})),mo({linkedHover:x,onObservation:y,onClick:v,hoverHighlight:!1,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior})),A);return e.jsx(on,{componentName:"OrdinalCustomChart",width:P,height:L,children:e.jsx(lo,Object.assign({ref:O},W))})});Fn.displayName="OrdinalCustomChart",exports.BarChart=hn,exports.BoxPlot=xn,exports.DonutChart=On,exports.DotPlot=jn,exports.FunnelChart=_n,exports.GaugeChart=Sn,exports.GroupedBarChart=fn,exports.Histogram=wn,exports.LikertChart=In,exports.OrdinalCustomChart=Fn,exports.PieChart=An,exports.RidgelinePlot=Mn,exports.StackedBarChart=gn,exports.StreamOrdinalFrame=lo,exports.SwarmPlot=vn,exports.SwimlaneChart=mn,exports.ViolinPlot=kn,exports.createHatchPattern=Zt;
2
+ "use strict";const e=require("react/jsx-runtime"),t=require("react"),o=require("d3-scale"),n=require("d3-quadtree"),i=require("d3-array"),r=require("d3-hierarchy"),s=require("d3-shape"),a=require("regression"),l=require("d3-selection"),c=require("d3-brush");function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const o in e)if("default"!==o){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}return t.default=e,Object.freeze(t)}const h=d(t),g=u(a),f=Object.freeze([]);function p(e){if(!e)return f;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class m{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n: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(e=p(e),this.lastBoundedData===e)return;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 o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=p(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}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){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class y{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),o=[];for(;t.length>e;)o.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 o}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}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 v{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(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 o of e){const e=t?t(o):o;Number.isFinite(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 b(e,t,o){return e+(t-e)*o}function x(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function w(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function k(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function j(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function A(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function O(e){const t=e.map(j),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return A(e,o,n)}if(e>=1){const[e,n,i]=t[o];return A(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return A(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const S=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],M=O(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),_=O(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),C=O(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),P=O(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),L=O(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);O(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const T=O(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),R=O(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);O(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),O(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),O(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),O(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const H=O(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),B=O(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),I=O(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),F=O(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),W=O(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),D=O(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),$=O(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),z={category10:S,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:M,reds:_,greens:C,oranges:P,purples:L,viridis:T,plasma:R},N=S,E=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],q=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function G(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||q.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):N[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%N.length]}function V(e,t,n="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return o.scaleOrdinal().domain(i).range(n).unknown("#999");const s=z[n]||z.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const o=Number(t);o>e&&(e=o)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:N;return o.scaleOrdinal().domain(i).range(e).unknown("#999")}}function X(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function Y(e,t){const{columns:o,config:n,resolvePieceStyle:i}=e,r=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,u=i(e.pieceData[0],e.name);r.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o},n.cornerRadius&&{cornerRadius:n.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return r}function Q(e){var t,o,n;const r=e.length,s=e[0],a=e[r-1];return{n:r,min:s,q1:null!==(t=i.quantile(e,.25))&&void 0!==t?t:s,median:null!==(o=i.quantile(e,.5))&&void 0!==o?o:(s+a)/2,q3:null!==(n=i.quantile(e,.75))&&void 0!==n?n:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}function K(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}const Z={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,m=a.normalize,y=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),y.push(t))}}else y.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(m)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of y){const s=t.get(r);if(!s)continue;let a=s.total;m&&o>0&&(a/=o);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:n+a),o=0>a?d(i+a)-d(i):d(n)-d(n+a);g.push(X(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=d(0>a?i+a:n),o=0>a?d(i)-d(i+a):d(n+a)-d(n);g.push(X(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(X(r,Math.min(a,d),n,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(X(Math.min(a,d),r,Math.abs(d-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=a.length>0,p=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),u=f&&a[i]||c,y=l(t,e.name),v=y.r||5;let b,x;if(g){const t=m+(e.pctStart+e.pct/2)*p,o=u(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:y,datum:t})}return d},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=i(n),u=r(n,e.name),d=u.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:n})}}return l},pie:Y,donut:Y,boxplot:function(e,t){var o,n,r,s,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:f,projection:p}=c,m=[],y="vertical"===p,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],p=null!==(o=i.quantile(c,.25))&&void 0!==o?o:u,b=null!==(n=i.quantile(c,.5))&&void 0!==n?n:(u+d)/2,x=null!==(r=i.quantile(c,.75))&&void 0!==r?r:d,w=x-p,k=p-1.5*w,j=x+1.5*w,A=null!==(s=c.find(e=>e>=k))&&void 0!==s?s:u,O=null!==(a=[...c].reverse().find(e=>j>=e))&&void 0!==a?a:d,S=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const o=h(e);if(k>o||o>j){const n=y?t.middle:f(o),i=y?f(o):t.middle;M.push({px:n,py:i,value:o,datum:e})}}if(m.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:f(A),q1Pos:f(p),medianPos:f(b),q3Pos:f(x),maxPos:f(O),stats:{n:c.length,min:A,q1:p,median:b,q3:x,max:O,mean:c.reduce((e,t)=>e+t,0)/c.length},style:S,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)m.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:S.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return m},violin:function(e,t){var o,n,r;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,g=[],f="vertical"===h,p=l.bins||20,m=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),p-1)]++;const y=Math.max(...h,1),v=e.width/2*.9;let b="";if(f){b=`M ${e.middle} ${d(s)}`;for(let t=0;p>t;t++){const o=d(s+(t+.5)*l);b+=` L ${e.middle+h[t]/y*v} ${o}`}b+=` L ${e.middle} ${d(a)}`;for(let t=p-1;t>=0;t--){const o=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/y*v} ${o}`}b+=" Z"}else{b=`M ${d(s)} ${e.middle}`;for(let t=0;p>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/y*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=p-1;t>=0;t--)b+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/y*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(m&&t.length>=4){const l=null!==(o=i.quantile(t,.25))&&void 0!==o?o:s,c=null!==(n=i.quantile(t,.5))&&void 0!==n?n:(s+a)/2,u=null!==(r=i.quantile(t,.75))&&void 0!==r?r:a;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:f}}const k=f?{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:Q(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],u=r.bins||25,d=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/u||1,r=Array(u).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),m=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const n=(d?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(X(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,m,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){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 n=t[0],i=t[t.length-1],r=(i-n)/d||1,c=Array(d).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),d-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),m=e.width*g;let y="";if(h){const t=e.x+e.width;y=`M ${l(n)} ${t}`;for(let e=0;d>e;e++)y+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*m}`;y+=` L ${l(i)} ${t} Z`}else{const t=e.x;y=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*r);y+=` L ${t+c[e]/f*m} ${o}`}y+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};u.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:v,stats:Q(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=i(t);if(!o)continue;const[n,a]=o,u=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(X(o,e.x,i-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(X(e.x,o,e.width,i-o,u,t,e.name))}}return l},funnel:function(e,t){var n,i,r,s,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:f}=e,p=[],m=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],k=[];let j=0;for(const e of v){const t=new Map;let o=0;for(const n of e.pieceData){const e=g?g(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(n);i.total+=r,i.pieces.push(n),o+=r}k.push({col:e,groups:t,stepTotal:o}),w||o>j&&(j=o)}if(w)for(const e of k){let t=0,o=0;for(let n=0;b.length>n;n++){const i=e.groups.get(b[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>j&&(j=n)}if(0===j)return p;const A=new Map;for(const e of b){const t=k[0].groups.get(e);A.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=k[0].stepTotal,S=w?.95*m:.9*t.width,M=o.scaleLinear().domain([0,j]).range([0,S]),_=null!==(i=e.config.connectorOpacity)&&void 0!==i?i:.3;let C=new Map;for(let t=0;k.length>t;t++){const o=k[t],n=o.col,i=0===t,d=n.width,h=.55*d,g=n.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const n=o.groups.get(t);n&&(e+=M(n.total))}let t=m,r=m;for(let s=0;b.length>s;s++){const l=b[s],c=o.groups.get(l);if(!c)continue;const u=M(c.total),d=s%2==0,x=d?t:r-u;d?t+=u:r-=u;const w=f(c.pieces[0],l),k=null!==(a=A.get(l))&&void 0!==a?a:c.total,j=k>0?c.total/k*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:j,__funnelStep:n.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});y&&(0===s&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=m,O.__funnelStepLabelY=g,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+u/2,O.__funnelValueLabelY=g,O.__funnelBarW=u),p.push(X(x,g,u,h,w,O,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=o.stepTotal,t=M(e),a=m-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=o.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:n.pieceData[0],d=c?l:n.name,x=f(u,d),w=O>0?e/O*100:0,k=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:i,category:c?l:n.name});y&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=m,k.__funnelStepLabelY=g,k.__funnelRowWidth=t,k.__funnelValueLabelX=m,k.__funnelValueLabelY=g,k.__funnelBarW=t),p.push(X(a,g,t,h,x,k,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&C.size>0){const t=w?b:[b[0]];for(const i of t){const t=C.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return f(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:_},datum:null!==(u=null===(c=o.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:n.pieceData[0],category:"_default"===i?n.name:i};p.push(a)}}C=v}return p},"bar-funnel":function(e,t){var o,n,i,r;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=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],m=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}m.push({col:e,groups:t,stepTotal:o})}const y=new Map;for(const e of g){const t=null===(o=m[0])||void 0===o?void 0:o.groups.get(e);y.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;m.length>e;e++){const t=m[e],o=t.col,n=0===e,s=e>0?m[e-1]:null,a=o.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const m=f.total,b=null!==(i=y.get(h))&&void 0!==i?i:m,x=b>0?m/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:m,j=n?0:Math.max(0,k-m),A=o.x+e*a+l/2,O=v(m),S=v(0)-O,M=c(f.pieces[0],p?h:o.name),_=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:m,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:j,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(m+j)});if(d.push(X(A,O,u,S,M,_,p?h:o.name)),j>0){const e=v(m+j),t=O-e,n=Object.assign({},M),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:j,__barFunnelPercent:b>0?j/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});d.push(X(A,e,u,t,n,i,p?h:o.name))}}}return d},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=d?X(s,o.x,a,o.width,n,null,"__track__"):X(o.x,s,o.width,a,n,null,"__track__");u.push(i)}}for(const e of Object.values(i)){let t=0;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(d){const r=l(t),s=l(t+n);f=X(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=X(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=n}}return u}};class U{constructor(e){this.rExtent=new v,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.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new y(e.windowSize),this.getO=k(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>w(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new v)):(this.getR=w(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=k(e.stackBy),this.getGroup=k(e.groupBy),this.getColor=k(e.colorAccessor),this.getConnector=k(e.connectorAccessor),this.getDataId=k(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new y(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const i=n.toArray(),r=t.projection||"vertical",s=t.oExtent||this.resolveCategories(i),a=this.computeValueDomain(i,s),l="horizontal"===r,c="radial"===r,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let d,h;if(c){d=o.scaleBand().domain(s).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,i=t.innerRadius||0;h=o.scaleLinear().domain(a).range([i,n])}else l?(d=o.scaleBand().domain(s).range([0,e.height]).padding(u),h=o.scaleLinear().domain(a).range([0,e.width])):(d=o.scaleBand().domain(s).range([0,e.width]).padding(u),h=o.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((i,r)=>{var s;const a=this.rExtents[r];a.dirty&&a.recalculate(n,i);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=t.extentPadding)&&void 0!==s?s:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?o.scaleLinear().domain([c,u]).range([0,e.width]):o.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=i;this.rAccessors.length>1&&(g=i.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(g,s,d,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,o,n,i){var r;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"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==n){u=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(o,n),e+=n}const r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of u)u.set(t,o/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?n/l:0;let c,g;u?(c=h,g=u.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:d},d+=i}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){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=Z[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(o)||u.set(o,[]),u.get(o).push({x:n,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=function(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=z[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}(r.colorScheme,r.themeCategorical,E),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:K(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}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 o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||E,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?function(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,U.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._pointQuadtree=n.quadtree().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const n=u.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._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(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,m,y,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const j=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(j.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),k=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)d?(j.add(u),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(d)j.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,k=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),k=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!j.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(m=t.innerRadius)&&void 0!==m?m:0,outerRadius:null!==(y=t.outerRadius)&&void 0!==y?y:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(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 n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=b(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=b(n.x,e._targetX,s),e.y=b(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=b(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=b(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=b(o.x,e._targetX,s),e.y=b(o.y,e._targetY,s),void 0!==o.w&&(e.w=b(o.w,e._targetW,s),e.h=b(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:b(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=b(o.startAngle,e._targetStartAngle,s),e.endAngle=b(o.endAngle,e._targetEndAngle,s))}}}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&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!x(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!x(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!x(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(x(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=k(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!x(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>w(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new v)):(this.getR=w(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!x(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?k(this.config.stackBy):void 0),"groupBy"in e&&!x(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?k(this.config.groupBy):void 0),"colorAccessor"in e&&!x(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?k(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!x(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?k(this.config.connectorAccessor):void 0)}}function J(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:h.createElement(h.Fragment,null,...t)}function ee(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function te(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function oe(e,t,o){const n=function(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function ne(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>ee(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function ie(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=te(Math.atan2(i,n)),a=te(e.startAngle),l=te(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 re(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>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 i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function se(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function ae(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function le(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}U.QUADTREE_THRESHOLD=500;const ce={fill:t=>e.jsx("rect",{style:t,width:16,height:16}),line:t=>e.jsx("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function ue(e,t,o,n){let i;return i="function"==typeof o?o(e):(0,ce[o])(n(e,t)),i}function de(){return e.jsx("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function he(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ge=(t,o,n,i,r,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,f=[];let p=0;const m=!(!o&&!n),y="isolate"===u||void 0===u&&null!=r;return g.forEach((t,u)=>{const v=ue(t,u,d,h),b=he(t,i,r),x=r&&r.size>0&&r.has(t.label);f.push(e.jsxs("g",{transform:`translate(0,${p})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?l===s&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&y?x||!1:void 0,"aria-current":m&&!y&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:m?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{c(l,u),n&&n(t);const o=e.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.jsx(de,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),p+=22}),f};function fe({config:t,orientation:o="vertical",width:n=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+h.useId();if("horizontal"===o){const t=12,o=Math.min(n,200),a=Math.max(0,(n-o)/2),u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[0]+o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:o,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+o,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[1]-o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function pe(t){const{legendGroups:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[g,f]=h.useState(0),[p,m]=h.useState(0),y=h.useCallback((e,t)=>{f(e),m(t)},[]),v="vertical"===d?(({legendGroups:t,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.jsx("line",{stroke:"gray",x1:0,y1:d,x2:o,y2:d},"legend-top-line legend-symbol-"+g)),d+=8,t.label&&(d+=16,h.push(e.jsx("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),d+=8),h.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${d})`,children:ge(t,n,i,r,s,a,l,g,c,u)},"legend-group-"+g)),d+=22*t.items.length+8}),h})({legendGroups:o||[],width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:a}):(({legendGroups:t,height:o,width:n,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,o)=>{let f=0;t.label&&(f+=16);const p=((t,o,n,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let m=0,y=0;const v=!(!o&&!n),b="isolate"===u||void 0===u&&null!=r;f.forEach((t,u)=>{const x=ue(t,u,h,g),w=he(t,i,r),k=r&&r.size>0&&r.has(t.label),j=26+7*t.label.length;d&&d>0&&m>0&&m+j>d&&(y++,m=0),p.push(e.jsxs("g",{transform:`translate(${m},${22*y})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?k||!1:void 0,"aria-current":v&&!b&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:v?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+f.length)%f.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{c(l,u),n&&n(t);const o=e.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"},children:[v&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,k&&e.jsx(de,{}),e.jsx("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),m+=j});let x=0,w=0;for(const e of f){const t=26+7*e.label.length;d&&d>0&&w>0&&w+t>d?(x=Math.max(x,w),w=t):w+=t}x=Math.max(x,w);const k=y+1;return{items:p,offset:x,totalRows:k,totalHeight:22*k}})(t,i,r,s,a,l,c,o,u,d,n);f+=p.offset+5,g.push(Object.assign(Object.assign({label:t.label},p),{offset:f,totalRows:p.totalRows,totalHeight:p.totalHeight})),h+=f+12});let f=h>n?0:Math.max(0,(n-h)/2);const p=[];return g.forEach((n,i)=>{const r=t[i];r.label&&(p.push(e.jsx("text",{transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),f+=16),p.push(e.jsx("g",{className:"legend-item",transform:`translate(${f},0)`,children:n.items},"legend-group-"+i)),f+=n.offset+5,t[i+1]&&p.push(e.jsx("line",{stroke:"gray",x1:f,y1:-8,x2:f,y2:(n.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),f+=12}),e.jsx("g",{children:p})})({legendGroups:o||[],title:l,height:u,width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:a}),b=!(!n&&!i);return e.jsxs("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),v]})}function me(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ye(t){const{legend:o,totalWidth:n,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!o)return null;const g="top"===s||"bottom"===s;let f,p;return"left"===s?(f=4,p=r.top):"top"===s?(f=0,p=a?32:8):"bottom"===s?(f=0,p=i-r.bottom+50):(f=n-r.right+10,p=r.top),e.jsx("g",{transform:`translate(${f}, ${p})`,children:(m=o,"object"==typeof m&&null!==m&&"gradient"in m?e.jsx(fe,{config:o.gradient,orientation:g?"horizontal":"vertical",width:g?n:100}):me(o)?e.jsx(pe,{legendGroups:o.legendGroups,title:"",width:g?n:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):o)});var m}function ve(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function be(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function xe(t,o,n,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(o)>Math.abs(n)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>o?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>o?"end":"start";const f=16,p=s?u?[s]:ve(s,c):[],m=r?u?[r]:ve(r,c):[],y="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:p.map((t,o)=>e.jsx("tspan",{x:y,dy:0===o?0:f,children:t},o))},"annotation-note-title")),v=p.length*f),m.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:m.map((t,o)=>e.jsx("tspan",{x:y,dy:0===o?0:f,children:t},o))},"annotation-note-label"));let w=null;if((s||r)&&(0!==o||0!==n))if("topBottom"===d){const t=Math.min(c,120);let o=0,n=t;"end"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),w=e.jsx("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+m.length)*f+(m.length>0?f:0);let o=0,n=t;"bottom"===h?(o=-t,n=0):"middle"===h&&(o=-t/2,n=t/2),w=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+m.length-1)*f;let j=0;return"topBottom"===d?j=0>n?-(k+2):18:"leftRight"===d&&(j="middle"===h?-(k+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${o},${n})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),w]})}function we(t,o,n,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(t>0||i>0)&&a.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(e.jsx("line",{x1:(o.x1||0)-t,y1:i,x2:(o.x2||0)-t,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(e.jsx("line",{x1:(o.x1||0)-t,y1:0,x2:(o.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(e.jsx("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==t&&a.push(e.jsx("path",{d:be((null==o?void 0:o.type)||"curly",t,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function ke(t,o,n,i,r,s){const a=[];let l=0,c=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,n=s.height||0;if(e>0||n>0){const i=e/2,r=n/2,s=t-i,a=o-r;if(0!==s||0!==a){const t=Math.abs(s),o=Math.abs(a),u=e/2,d=n/2,h=t*d>o*u?u/t:d/o;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(l=e/2,c=o):void 0!==t&&(l=o,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==o)){const n=Math.atan2(o,t);l=Math.cos(n)*e,c=Math.sin(n)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(o-c,2))>.5&&(a.push(e.jsx("line",{x1:l,y1:c,x2:t,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==n?void 0:n.end))){const n=10,r=16/180*Math.PI,s=Math.atan2(o-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+n*Math.cos(s+r)},${c+n*Math.sin(s+r)}L${l+n*Math.cos(s-r)},${c+n*Math.sin(s-r)}Z`,fill:i||"var(--semiotic-text-secondary, currentColor)",stroke:"none"},"connector-arrow"))}return e.jsx("g",{className:"annotation-connector",children:a})}function je(t){const{x:o=0,y:n=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":m}=t,y=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-o),null!=a&&(b=a-n);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${o},${n})`,"data-testid":m},p,{children:[!y.has("connector")&&ke(v,b,c,h,x,u),!y.has("subject")&&we(x,u,h,o,n),!y.has("note")&&xe(l,v,b,h)]}))}function Ae(t){var o,n;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:t,ny:a});return e.jsx(je,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(je,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Oe(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Se(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Me(e,t,o){var n,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let i=o.pointNodes.length-1;i>=0;i--){const r=o.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(n=o.stickyPositionCache)||void 0===n||n.set(t,e),e}}const r=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r: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)}}(o);return r&&(null===(i=o.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Oe(e,o),c=Se(e,o)),null!=l&&null!=c)return null===(r=o.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=o.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function _e(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const Ce={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};function Pe(o){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=o,{rTickValues:h}=o,g="radial"===(null==l?void 0:l.projection),f="horizontal"===(null==l?void 0:l.projection),p=t.useMemo(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||Le)(e)})),[l,d,g,h]),m=u&&l&&!g,y=c&&l&&!g;return m||y?e.jsx("svg",{width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&e.jsx("g",{className:"ordinal-grid",children:p.map((t,o)=>e.jsx("line",{x1:f?t.pixel:0,y1:f?0:t.pixel,x2:f?t.pixel:n,y2:f?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),y&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,f?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Le(e){return Math.round(100*e)/100+""}function Te(o){var n,i;const{width:a,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:f,showCategoryTicks:p,oLabel:m,rLabel:y,oFormat:v,rFormat:b,showGrid:x,title:w,legend:k,legendHoverBehavior:j,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S,legendPosition:M="right",foregroundGraphics:_,annotations:C,svgAnnotationRules:P,xAccessor:L,yAccessor:T,annotationData:R,underlayRendered:H,children:B}=o,I="radial"===(null==h?void 0:h.projection),F="horizontal"===(null==h?void 0:h.projection),W=!1!==p,D=t.useMemo(()=>f&&W&&h&&!I?h.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=h.o(e))&&void 0!==o?o:0)+h.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,W,h,v,I]),$=o.rTickValues,z=o.tickLabelEdgeAlign,N=t.useMemo(()=>f&&h&&!I?($||h.r.ticks(5)).map(e=>({value:e,pixel:h.r(e),label:(b||Le)(e)})):[],[f,h,b,I,$]),E=t.useRef(new Map),q=t.useRef(null!==(n=null==C?void 0:C.length)&&void 0!==n?n:0),G=null!==(i=null==C?void 0:C.length)&&void 0!==i?i:0;q.current!==G&&(q.current=G,E.current=new Map);const V=t.useMemo(()=>{if(!C||0===C.length)return null;const t=function(t,o,n){var i,a,l,c,u,d,h,f,p,m,y,v,b,x,w,k,j,A,O,S,M,_,C,P,L,T,R,H,B,I,F,W,D,$,z,N,E,q,G,V,X,Y,Q,K,Z,U,J,ee;switch(t.type){case"label":{const i=Me(t,o,n);if(!i)return null;const{x:r,y:s}=i;return _e(r,s,n)?e.jsx(Ae,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+o):null}case"callout":{const i=Me(t,o,n);if(!i)return null;const{x:r,y:s}=i;return _e(r,s,n)?e.jsx(Ae,{noteData:{x:r,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}},"ann-"+o):null}case"x-threshold":{const i=Oe(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(n.height||0)-4:"center"===s?(n.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:n.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"y-threshold":{const i=Se(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(n.width||0)/2,l="middle"):(a=(n.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:n.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),n),y:Se(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=r.packEnclose(i),a=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),n),y:Se(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),l=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"highlight":{const i=n.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((o,i)=>{const r=Oe(o,n),a=Se(o,n);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(o):t.r||6,c="function"==typeof t.style?t.style(o):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+o)}case"bracket":{const i=Oe(t,n),r=Se(t,n);return e.jsx(Ae,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+o)}case"trend":{const r=n.data||[];if(2>r.length)return null;const s=n.xAccessor||"x",f=n.yAccessor||"y",p=r.map(e=>[e[s],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const m=null!==(a=null===(i=n.scales)||void 0===i?void 0:i.x)&&void 0!==a?a:null===(l=n.scales)||void 0===l?void 0:l.time,y=null!==(u=null===(c=n.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=n.scales)||void 0===d?void 0:d.value;if(!m||!y)return null;const v=t.method||"linear";let b;b="loess"===v?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===v?g.default.polynomial(p,{order:t.order||2}):g.default.linear(p)).points;const x=b.map(([e,t])=>`${m(e)},${y(t)}`).join(" "),w=t.color||"#6366f1";return e.jsxs("g",{children:[e.jsx("polyline",{points:x,fill:"none",stroke:w,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:m(b[b.length-1][0])+4,y:y(b[b.length-1][1])-4,fill:w,fontSize:11,children:t.label})]},"ann-"+o)}case"band":{const i=null!==(p=null===(f=n.scales)||void 0===f?void 0:f.y)&&void 0!==p?p:null===(m=n.scales)||void 0===m?void 0:m.value,r=null!==(y=null==i?void 0:i(t.y0))&&void 0!==y?y:0,s=null!==(v=null==i?void 0:i(t.y1))&&void 0!==v?v:n.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:n.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+o)}case"envelope":{const i=n.data||[];if(2>i.length)return null;const r=n.xAccessor||"x",a=null!==(x=null===(b=n.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(w=n.scales)||void 0===w?void 0:w.time,l=null!==(j=null===(k=n.scales)||void 0===k?void 0:k.y)&&void 0!==j?j:null===(A=n.scales)||void 0===A?void 0:A.value;if(!a||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=Ce[n.curve||"linear"]||s.curveLinear,f=s.area().x(e=>a(e[r])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:p,fillOpacity:null!==(O=t.fillOpacity)&&void 0!==O?O:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:a(h[h.length-1][r])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"anomaly-band":{const i=n.data||[];if(2>i.length)return null;const r=n.yAccessor||"y",s=null!==(M=null===(S=n.scales)||void 0===S?void 0:S.x)&&void 0!==M?M:null===(_=n.scales)||void 0===_?void 0:_.time,a=null!==(P=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==P?P:null===(L=n.scales)||void 0===L?void 0:L.value;if(!s||!a)return null;const l=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(T=t.threshold)&&void 0!==T?T:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",m=null!==(R=t.fillOpacity)&&void 0!==R?R:.1,y=t.anomalyColor||"#ef4444",v=null!==(H=t.anomalyRadius)&&void 0!==H?H:6,b=a(c+h*d),x=a(g),w=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[f&&e.jsx("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:m}),w.map((t,o)=>{const i=Oe(t,n),r=Se(t,n);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+o)}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"forecast":{const i=n.data||[];if(3>i.length)return null;const r=n.xAccessor||"x",s=n.yAccessor||"y",a=null!==(I=null===(B=n.scales)||void 0===B?void 0:B.x)&&void 0!==I?I:null===(F=n.scales)||void 0===F?void 0:F.time,l=null!==(D=null===(W=n.scales)||void 0===W?void 0:W.y)&&void 0!==D?D:null===($=n.scales)||void 0===$?void 0:$.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=g.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=c.length;let t=0,o=0,n=0,i=0;for(const[e,r]of c)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),p=c.reduce((e,t)=>e+t[0],0)/d,m=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),y=null!==(z=t.confidence)&&void 0!==z?z:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(N=t.steps)&&void 0!==N?N:5,x=c[d-1][0],w=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const j=[];for(const e of k){const t=u(e),o=f*Math.sqrt(1+1/d+(m>0?Math.pow(e-p,2)/m:0))*v;j.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const A=`M${j.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(E=t.fillOpacity)&&void 0!==E?E:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(G=t.strokeDasharray)&&void 0!==G?G:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:a(j[j.length-1].x)+4,y:l(j[j.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+o)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Me(t,o,n);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!_e(i,r,n))return null;const s=null!==(V=t.dx)&&void 0!==V?V:0,a=null!==(X=t.dy)&&void 0!==X?X:0,l=null!==(Y=t.width)&&void 0!==Y?Y:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(K=t.content)&&void 0!==K?K:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const i=Me(t,o,n);if(!i)return null;const{x:r,y:s}=i;return e.jsx("text",{x:r+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label},"ann-text-"+o)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=null===(Z=n.scales)||void 0===Z?void 0:Z.o,s=null===(U=n.scales)||void 0===U?void 0:U.x,a=null===(J=n.scales)||void 0===J?void 0:J.y,l=(null==r?void 0:r.bandwidth)?r:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(i);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,g=t.label;return e.jsxs("g",(n.projection?"vertical"===n.projection:l===s)?{children:[e.jsx("rect",{x:c,y:0,width:u,height:n.height||0,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e.jsx("rect",{x:0,y:c,width:n.width||0,height:u,fill:d,fillOpacity:h}),g&&e.jsx("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+o)}default:return null}},o="horizontal"===(null==h?void 0:h.projection),n=(null==h?void 0:h.o)?e=>{var t;return(null!==(t=h.o(e))&&void 0!==t?t:0)+h.o.bandwidth()/2}:null,i={scales:h?{x:o?h.r:n||h.r,y:o&&n||h.r,time:h.r,value:h.r,o:h.o}:null,timeAxis:"x",xAccessor:L,yAccessor:T,width:a,height:l,data:R,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:E.current};return C.map((e,o)=>{if(P){const n=P(e,o,i);return null!=n?n:t(e,o,i)}return t(e,o,i)}).filter(Boolean)},[C,P,a,l,h,L,T,R]);return f||w||k||_||V&&V.length>0||x||B?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof w?w:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof w?w+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[x&&h&&!I&&!H&&e.jsx("g",{className:"ordinal-grid",children:N.map((t,o)=>e.jsx("line",{x1:F?t.pixel:0,y1:F?0:t.pixel,x2:F?t.pixel:a,y2:F?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),f&&h&&!I&&e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,F?{children:[!H&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((t,o)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+o)),m&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:m}),!H&&e.jsx("line",{x1:0,y1:l,x2:a,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!H&&(null==h?void 0:h.r)&&(()=>{const t=h.r(0);return t>1&&a-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),N.map((t,o)=>{const n=z?0===o?"start":o===N.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:n,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+o)}),y&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:y})]}:{children:[!H&&(()=>{const t=(null==h?void 0:h.r)?h.r(0):l,o=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:o,x2:a,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((t,o)=>e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"},children:t.label})})]},"cat-"+o)),m&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:m}),!H&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((t,o)=>e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label})]},"val-"+o)),y&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,style:{userSelect:"none"},children:y})]})}),V,_,B]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:"string"==typeof w?w:null}),ye({legend:k,totalWidth:c,totalHeight:u,margin:d,legendPosition:M,title:w,legendHoverBehavior:j,legendClickBehavior:A,legendHighlightedCategory:O,legendIsolatedCategories:S})]}):null}function Re({width:o,height:n,totalWidth:i,totalHeight:r,margin:s,scales:a,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(u);g.current=u;const f=t.useRef(a);f.current=a;const p=t.useRef(!1),m=t.useRef(null),y="horizontal"===(null==a?void 0:a.projection),v=t.useRef(y);return v.current=y,t.useEffect(()=>{if(!d.current)return;const e=l.select(d.current).select(".brush-g"),t=y?c.brushX():c.brushY();return t.extent([[0,0],[o,n]]),t.on("brush end",e=>{if(p.current)return;const t=f.current;if(!t)return;if(!e.selection)return m.current=null,void g.current(null);const[o,n]=e.selection;let i;i=v.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};m.current=r,g.current(r)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[o,n,y]),t.useEffect(()=>{if(!a||!h.current||!m.current)return;if(!d.current)return;const e=m.current,t=l.select(d.current).select(".brush-g"),o=a.r(e.r[0]),n=a.r(e.r[1]);y?(p.current=!0,t.call(h.current.move,[o,n]),p.current=!1):(p.current=!0,t.call(h.current.move,[n,o]),p.current=!1)},[a,y]),e.jsx("svg",{ref:d,width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}})})}const He={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Be(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Ie="undefined"==typeof window||"undefined"==typeof document,Fe="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,We=()=>()=>{},De=()=>!1,$e=()=>!0;function ze(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function Ne(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function Ee(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const qe=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ge=new WeakMap;let Ve=0,Xe=!1,Ye=null,Qe=null,Ke=null;function Ze(e,t){var o,n;if(!t)return t;const i=qe.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(Xe)return;if("undefined"==typeof window||"undefined"==typeof document)return;Xe=!0;const e=()=>{Ve++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ye=new MutationObserver(e),Ye.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Qe=window.matchMedia("(prefers-color-scheme: dark)"),Ke=e,"function"==typeof Qe.addEventListener?Qe.addEventListener("change",Ke):"function"==typeof Qe.addListener&&Qe.addListener(Ke)}catch(e){}}();let s=Ge.get(r);s&&s.version===Ve||(s={version:Ve,map:new Map},Ge.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}const Ue=h.createContext(null),Je={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function et(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e)o[t.type]=(o[t.type]||0)+1;const n=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}const tt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ot={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},nt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},it={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)"},rt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},st={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)"},at={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},lt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function ct({scene:t,chartType:o,tableId:n,chartTitle:i}){var r;const[s,a]=h.useState(!1),l=h.useContext(Ue),c=null!==(r=null==l?void 0:l.visible)&&void 0!==r&&r,u=s||c,d=h.useRef(null),g=i?"Data summary for "+i:n?`Data summary for ${o} ${n}`:"Data summary for "+o,f=h.useCallback(()=>{s||c||a(!0)},[s,c]),p=h.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return n?e.jsx("span",{id:n,tabIndex:-1,style:Je}):null;if(!u)return e.jsx("div",{id:n,tabIndex:-1,onFocus:f,style:Je,role:"region","aria-label":g,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const m=function(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,m,y,v,b,x,w,k,j,A,O;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 o=0;e.length>o&&t.length>o;o++){const t=e[o];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 o=0;e.length>o&&t.length>o;o++){const t=e[o];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:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;S.push({label:"Bar",values:{category:r,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===(r=M.datum)||void 0===r?void 0:r.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!==(f=M.cy)&&void 0!==f?f:M.y}});break;case"arc":S.push({label:"Arc",values:{id:null!==(m=null===(p=M.datum)||void 0===p?void 0:p.id)&&void 0!==m?m:"",x:null!==(y=M.cx)&&void 0!==y?y: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!==(j=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!==j?j:"",value:null!==(O=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==O?O:""}})}}catch(e){}return S}(t),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(m),v=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${tt(e.min)} to ${tt(e.max)}, mean ${tt(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(m.length,y),b=m.slice(0,5),x=new Set;for(const e of b)for(const t of Object.keys(e.values))x.add(t);const w=Array.from(x);return e.jsxs("div",{ref:d,id:n,tabIndex:-1,onBlur:p,style:ot,role:"region","aria-label":g,children:[e.jsx("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:it,children:"×"}),e.jsx("div",{role:"note",style:nt,children:v}),e.jsxs("table",{role:"table","aria-label":"Sample data for "+o,style:rt,children:[e.jsxs("caption",{style:lt,children:["First ",b.length," of ",m.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:st,children:"type"}),w.map(t=>e.jsx("th",{style:st,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:at,children:t.label}),w.map(o=>{return e.jsx("td",{style:at,children:(n=t.values[o],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":tt(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},o);var n})]},o))})]})]})}function ut({summary:t}){return t?e.jsx("div",{role:"note",style:Je,children:t}):null}function dt({tableId:t}){return e.jsx("a",{href:"#"+t,style:Je,onClick:e=>{e.preventDefault();const o=document.getElementById(t);o&&requestAnimationFrame(()=>o.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,Je)},children:"Skip to data table"})}function ht({hoverPoint:t}){let o="";if(t){const e=t.data||t;o="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Je,children:o})}const gt="var(--semiotic-focus, #005fcc)";function ft({active:t,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!t||!o)return null;const l=o.x+n.left,c=o.y+n.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:gt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:gt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:gt,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function pt({x:t,y:o,containerWidth:n,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=h.useRef(null),[u,d]=h.useState(null);h.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,n,i]);let g;return g=u?`translate(${u.width+12>n-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>i-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*i>o?"4px":"calc(-100% - 4px)"})`,e.jsx("div",{ref:c,className:a,style:{position:"absolute",left:r.left+t,top:r.top+o,transform:g,pointerEvents:"none",zIndex:l,width:"max-content"},children:s})}function mt(o){let n=null;const i=()=>(n||(n=t.createContext(null)),n),r=yt(o);return[function({children:n,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>yt(o,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:n})},e=>{var o;const n=i(),s=null!==(o=t.useContext(n))&&void 0!==o?o:r,a=t.useRef(e);a.current=e;const l=t.useCallback(()=>a.current(s.getState()),[s]),c=t.useCallback(()=>a.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,l,c)}]}function yt(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function vt(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function bt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:xt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const xt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],wt={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},kt={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},jt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:xt,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function At(e,t){if("light"===t)return wt;if("dark"===t)return kt;if("high-contrast"===t)return jt;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?kt:wt;return bt(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 bt(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[Ot,St]=mt(e=>({theme:wt,setTheme(t){e(e=>({theme:At(e.theme,t)}))}}));const Mt="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function _t(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Ct(e){const o=function(){const[e,o]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return o(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=>o(e.matches))},[]),e}(),n=t.useRef(o);n.current=o;const[i,r]=function(e,o,n){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!o&&!n)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;s(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return t.observe(e),()=>t.disconnect()},[o,n]),[i,[o&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=_t(e.foregroundGraphics,r,s),u=_t(e.backgroundGraphics,r,s),d=St(e=>e.theme),{transition:g,introEnabled:f}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+h.useId(),m=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{m.current||(m.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),w=t.useRef(null),k=t.useRef(0),j=t.useCallback(()=>{k.current=0;const e=w.current;w.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{w.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(j))},[j]),O=t.useCallback(()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return Mt(()=>{S&&(Ve++,S.current=!0,v())},[d,v,S]),{reducedMotion:o,reducedMotionRef:n,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:g,introEnabled:f,tableId:p,rafRef:m,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function Pt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Lt(e,t,o=.3){Pt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Tt(e,t,o=.6){var n,i,r,s,a;if(!Pt(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r: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*o,e.stroke()}function Rt(e,t,o,n=.35){Pt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ht(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function Bt(e,t,o){return null==t?o:"string"!=typeof t?t:Ze(e,t)||o}function It(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,i,r,s),[h,g,f]=Ht(e,o);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function Ft(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const Wt=(e,t,o,n)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Dt(e,t);else if(t.roundedTop&&t.roundedTop>0){const o=Bt(e,t.style.fill,Ze(e,"var(--semiotic-primary, #007bff)")),n=Ft(t),i=t.fillGradient&&"string"==typeof o?It(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Bt(e,t.style.fill,Ze(e,"var(--semiotic-primary, #007bff)")),n=Ft(t),i=t.fillGradient&&"string"==typeof o?It(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Lt(e,t),e.globalAlpha=1}};function Dt(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}const $t=(e,t,o,n)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=Bt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Bt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Tt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function zt(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Nt(e,t){const o=s.arc().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!o)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}const Et=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;e.globalAlpha=o*n,e.fillStyle=("string"==typeof t.style.fill?Ze(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Nt(e,t)):(zt(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(zt(e,t),Rt(e,t)),e.globalAlpha=1}},qt=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=Ze(e,"var(--semiotic-primary, #007bff)"),a=Ze(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?Ze(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?Ze(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),n?(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(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Gt=(e,t,o,n)=>{var i,r;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 o=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?Ze(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Vt=(e,t,o,n)=>{var i,r,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 o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=Ze(e,o.style.stroke)||("string"==typeof o.style.fill?Ze(e,o.style.fill):o.style.fill)||Ze(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},Xt=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[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=Ze(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Yt(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 Qt(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Kt=null;function Zt(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Kt||(Kt=document.createElement("canvas")),Kt.width=e,Kt.height=e,Kt)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,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+=r)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+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Ut=new Map;function Jt(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=Ut.get(o);if(void 0!==n)return n;const i=Zt({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Ut.set(o,i),i}function eo(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function to(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 oo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const no=e=>[Vt,...e],io={bar:no([Wt]),clusterbar:no([Wt]),point:no([$t]),swarm:no([$t]),pie:[Et],donut:[Et],boxplot:no([qt,$t]),violin:no([Gt]),histogram:no([Wt]),ridgeline:no([Gt]),timeline:no([Wt]),funnel:[Wt,Xt,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?Yt(i):null!=r?`${Yt(i)} (${Qt(r)})`:Yt(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=Yt(i),e.measureText(c).width+16>n)continue}const u=o.__funnelValueLabelX,d=(null!==(a=o.__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":[Wt,(e,t,o,n)=>{var i,r;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 o=("string"==typeof t.style.fill?t.style.fill:null)||Ze(e,"var(--semiotic-border, #999)"),n=Jt(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=Ht(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,Ze(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,u=r?oo(i):"",d=to(n);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,m=o.__barFunnelLabelX,y=m-f/2,v=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),eo(e,y,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),eo(e,y,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,m,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,m,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,m,v+3))}e.lineWidth=1}],swimlane:no([Wt]),custom:no([Wt,$t,Et,qt,Gt,Xt])},ro={top:50,right:40,bottom:60,left:70},so={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 ao({hover:t}){var o,n,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(o=l[0])||void 0===o?void 0:o.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:so,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const n=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:so,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[n," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:so,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:so,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(a=null!==(s=null!==(r=null!==(i=null!==(n=l.__aggregateValue)&&void 0!==n?n:h&&null!=l[h]?l[h]:null)&&void 0!==i?i:l.value)&&void 0!==r?r:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:so,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:so,children:[f&&e.jsx("div",{style:{fontWeight:"bold"},children:f+""}),""!==p&&e.jsx("div",{children:"number"==typeof p?p.toLocaleString():p+""})]})}const lo=t.forwardRef(function(o,n){var i,r,a,l,c,u,d,g,f,y,v;const{chartType:b,runtimeMode:x,data:w,oAccessor:k="category",rAccessor:j="value",colorAccessor:A,stackBy:O,groupBy:S,multiAxis:M,timeAccessor:_,valueAccessor:C,categoryAccessor:P,projection:L="vertical",size:T=[600,400],responsiveWidth:R,responsiveHeight:H,margin:B,barPadding:I,roundedTop:F,gradientFill:W,trackFill:D,baselinePadding:$,innerRadius:z,cornerRadius:N,normalize:E,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:K,connectorOpacity:Z,showLabels:te,connectorAccessor:ce,connectorStyle:ue,dataIdAccessor:de,rExtent:he,oExtent:ge,extentPadding:fe=.05,oSort:pe,windowMode:me="sliding",windowSize:ye=200,pieceStyle:ve,summaryStyle:be,colorScheme:xe,barColors:we,showAxes:ke=!0,showCategoryTicks:je,categoryLabel:Ae,valueLabel:Oe,categoryFormat:Se,valueFormat:Me,oLabel:_e,rLabel:Ce,oFormat:Le,rFormat:qe,rTickValues:Ge,tickLabelEdgeAlign:Ve,enableHover:Xe=!0,hoverAnnotation:Ye,tooltipContent:Qe,customHoverBehavior:Ke,annotations:Ue,svgAnnotationRules:Je,showGrid:tt=!1,legend:ot,legendHoverBehavior:nt,legendClickBehavior:it,legendHighlightedCategory:rt,legendIsolatedCategories:st,legendPosition:at,legendCategoryAccessor:lt,onCategoriesChange:gt,backgroundGraphics:mt,foregroundGraphics:yt,title:bt,className:xt,background:wt,centerContent:kt,decay:jt,pulse:At,transition:Ot,animate:St,staleness:Mt,brush:_t,onBrush:Pt,accessibleTable:Lt=!0,description:Tt,summary:Rt,customLayout:Ht,layoutConfig:Bt}=o,It=t.useRef(!0),Ft=Ct({sizeProp:T,responsiveWidth:R,responsiveHeight:H,userMargin:B,marginDefault:ro,foregroundGraphics:yt,backgroundGraphics:mt,animate:St,transitionProp:Ot,themeDirtyRef:It}),{reducedMotionRef:Wt,responsiveRef:Dt,size:$t,margin:zt,adjustedWidth:Nt,adjustedHeight:Et,resolvedForeground:qt,resolvedBackground:Gt,currentTheme:Vt,transition:Xt,introEnabled:Yt,tableId:Qt,rafRef:Kt,renderFnRef:Zt,scheduleRender:Ut}=Ft,Jt=function(){const[e,o]=t.useState(!1);return Fe(()=>{o(!0)},[]),e}(),eo=function(){const e=t.useSyncExternalStore(We,De,$e);return t.useRef(e).current}(),to=t.useMemo(()=>p(w),[w]),oo=null!=Ae?Ae:_e,no=null!=Oe?Oe:Ce,so=null!=Se?Se:Le,lo=null!=Me?Me:qe,co=t.useRef(null),uo=t.useRef(null),ho=t.useRef([]),go=t.useRef(lt),fo=t.useRef(gt);go.current=lt,fo.current=gt;const[po,mo]=t.useState(null),[yo,vo]=t.useState(null),[bo,xo]=t.useState(0),[wo,ko]=t.useState(!1),[jo,Ao]=t.useState(null),Oo=t.useCallback(()=>{var e,t;Ao(null!==(t=null===(e=Po.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),So=Xe||Ye,Mo="streaming"===x,_o=t.useMemo(()=>{var e,t,o;return{chartType:b,runtimeMode:Mo?"streaming":"bounded",windowSize:ye,windowMode:me,extentPadding:fe,projection:L,oAccessor:Mo?void 0:k,rAccessor:Mo?void 0:j,colorAccessor:A,stackBy:O,groupBy:S,multiAxis:M,timeAccessor:Mo?_:void 0,valueAccessor:Mo?C||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:Mo?P||k:void 0,rExtent:he,oExtent:ge,barPadding:I,roundedTop:F,gradientFill:W,trackFill:D,baselinePadding:$,innerRadius:z,cornerRadius:N,normalize:E,startAngle:q,sweepAngle:G,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:K,connectorOpacity:Z,showLabels:te,connectorAccessor:ce,connectorStyle:ue,dataIdAccessor:de,oSort:pe,pieceStyle:ve,summaryStyle:be,colorScheme:xe,themeCategorical:null===(e=null==Vt?void 0:Vt.colors)||void 0===e?void 0:e.categorical,themeSemantic:vt(Vt),themeSequential:null===(t=null==Vt?void 0:Vt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Vt?void 0:Vt.colors)||void 0===o?void 0:o.diverging,barColors:we,decay:jt,pulse:At,transition:Xt,introAnimation:Yt,staleness:Mt,customLayout:Ht,layoutConfig:Bt,layoutMargin:zt}},[b,ye,me,fe,L,k,j,A,O,S,M,_,C,P,he,ge,I,F,W,D,$,z,N,E,q,G,V,X,Y,Q,K,Z,te,ce,ue,de,pe,ve,be,xe,we,jt,At,null==Xt?void 0:Xt.duration,null==Xt?void 0:Xt.easing,Yt,Mt,Mo,Vt,Ht,Bt,zt]),Co=function(e){const o=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ne(e,t);if(!Ee(e)||!Ee(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!Ne(o,i))return!1}else{if(!Ee(o)||!Ee(i))return!1;if(!ze(o,i))return!1}}return!0}(o.current,e)||(o.current=e),o.current}(_o),Po=t.useRef(null);Po.current||(Po.current=new U(Co));const Lo=t.useCallback(()=>{var e,t;const o=go.current,n=fo.current;if(!n||!o)return;const i=function(e,t){if(!t)return[];const o=new Set,n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";o.has(r)||(o.add(r),n.push(r))}return n}(null!==(t=null===(e=Po.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(i,ho.current)||(ho.current=i,n(i))},[]);t.useEffect(()=>{var e;null===(e=Po.current)||void 0===e||e.updateConfig(Co),It.current=!0,Ut()},[Co,Ut]);const To=t.useRef(null);To.current||(To.current=new m(e=>{const t=Po.current;t&&t.ingest(e)&&(It.current=!0,Ut())}));const Ro=t.useCallback(e=>{var t;null===(t=To.current)||void 0===t||t.push(e)},[]),Ho=t.useCallback(e=>{var t;null===(t=To.current)||void 0===t||t.pushMany(e)},[]),Bo=t.useCallback(()=>{var e,t;null===(e=To.current)||void 0===e||e.clear(),null===(t=Po.current)||void 0===t||t.clear(),It.current=!0,Ut()},[Ut]),Io=t.useCallback(e=>{var t,o;null===(t=To.current)||void 0===t||t.clearLastData(),null===(o=To.current)||void 0===o||o.setReplacementData(e)},[]);t.useImperativeHandle(n,()=>({push:Ro,pushMany:Ho,replace:Io,remove:e=>{var t,o,n,i;null===(t=To.current)||void 0===t||t.flush();const r=null!==(n=null===(o=Po.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=uo.current)||void 0===i?void 0:i.data;!!uo.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(uo.current=null,mo(null)),It.current=!0,Ut()}return r},update:(e,t)=>{var o,n,i;null===(o=To.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Po.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(It.current=!0,Ut()),r},clear:Bo,getData:()=>{var e,t,o;return null===(e=To.current)||void 0===e||e.flush(),null!==(o=null===(t=Po.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Po.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Ro,Ho,Io,Bo,Ut]),t.useEffect(()=>{var e;w&&(null===(e=To.current)||void 0===e||e.setBoundedData(to))},[w,to]);const{hoverHandlerRef:Fo,hoverLeaveRef:Wo,onPointerMove:Do,onPointerLeave:$o}=Ft;Fo.current=e=>{if(!So)return;const t=co.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-zt.left,i=e.clientY-o.top-zt.top;if(0>n||n>Nt||0>i||i>Et)return void(uo.current&&(uo.current=null,mo(null),Ke&&Ke(null),Ut()));const r=Po.current;if(!r||0===r.scene.length)return;const s="radial"===L,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=function(e,t,o,n,i){const r=Math.max(n,i+5,12),s=t-r,a=t+r,l=o-r,c=o+r;let u=null,d=1/0;return e.visit((e,i,r,h,g)=>{if(i>a||s>h||r>c||l>g)return!0;if(!e.length){let i=e;do{const e=i.data,r=e.x-t,s=e.y-o,a=Math.sqrt(r*r+s*s);ee(e.r,n)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,o,n,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=oe(r,t,o);break;case"point":if(i)break;e=ne(r,t,o,n);break;case"wedge":e=ie(r,t,o);break;case"boxplot":e=re(r,t,o);break;case"violin":e=se(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-Nt/2:n,s?i-Et/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(uo.current&&(uo.current=null,mo(null),Ke&&Ke(null),Ut()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b}),Object.assign({data:c,x:u,y:d,__semioticHoverData:!0},h));var c,u,d,h;uo.current=l,mo(l),Ke&&(Ke(l),It.current=!0),Ut()},Wo.current=()=>{uo.current&&(uo.current=null,mo(null),Ke&&(Ke(null),It.current=!0),Ut())};const zo=t.useRef(-1),No=t.useRef(null),Eo=t.useRef(null),qo=t.useCallback(e=>{const t=Po.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Eo.current&&Eo.current.version===o)n=Eo.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.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;n=function(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.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 i=Array.from(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}(e),Eo.current={version:o,graph:n}}const i=zo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),zo.current=0;const t=n.flat[0];No.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},le(t)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b});return uo.current=o,mo(o),Ke&&Ke(o),void Ut()}const r=function(e,t){var o,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}(n,i),s=function(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?ae(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?ae(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return zo.current=-1,No.current=null,uo.current=null,mo(null),Ke&&Ke(null),void Ut();zo.current=s;const a=n.flat[s];No.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},le(a)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b});uo.current=l,mo(l),Ke&&Ke(l),Ut()},[Ke,Ut]),Go=t.useCallback(e=>{zo.current=-1,No.current=null,Do(e)},[Do]);Zt.current=()=>{var e,t;Kt.current=0;const o=co.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=Po.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Wt.current?r+1e6:r),a=!Wt.current&&s,l=It.current;l&&!s&&(i.computeScene({width:Nt,height:Et}),Lo(),Oo(),It.current=!1),(l||a)&&o.setAttribute("aria-label",et(i.scene,b+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=$t[0]*c,d=$t[1]*c;o.width===u&&o.height===d||(o.width=u,o.height=d,o.style.width=$t[0]+"px",o.style.height=$t[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,$t[0],$t[1]);const h=null!==(e=null==Mt?void 0:Mt.threshold)&&void 0!==e?e:5e3,g=Mt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==Mt?void 0:Mt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==wt&&!mt){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=wt||(e&&"transparent"!==e?e:null),i=t?Ze(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,$t[0],$t[1]))}const f="radial"===L;n.save(),n.beginPath(),n.rect(zt.left,zt.top,Nt,Et),n.clip(),f?(n.save(),n.translate(zt.left+Nt/2,zt.top+Et/2)):n.translate(zt.left,zt.top);const p=Ht?io.custom:io[b]||[],m={width:Nt,height:Et};for(const e of p)e(n,i.scene,i.scales,m);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(vo(i.scales),xo(e=>e+1)),(null==Mt?void 0:Mt.showBadge)&&ko(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Kt.current=requestAnimationFrame(()=>Zt.current()))},function(e){const{hydrated:o,wasHydratingFromSSR:n,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;Fe(()=>{var e,t;o&&n&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[o,n]);const l=t.useRef(a);l.current=a,t.useEffect(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}({hydrated:Jt,wasHydratingFromSSR:eo,storeRef:Po,dirtyRef:It,renderFnRef:Zt,cleanup:()=>{var e;return null===(e=To.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{It.current=!0,Ut()},[b,Nt,Et,ke,wt,Ut]),function(e,o,n,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=o.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(Mt,Po,It,Ut,wo,ko);const Vo=So&&po?Qe?Qe(po):e.jsx(ao,{hover:po}):null,Xo="radial"===L,Yo=Vo?e.jsx(pt,{x:po?Xo?po.x+Nt/2:po.x:0,y:po?Xo?po.y+Et/2:po.y:0,containerWidth:Nt,containerHeight:Et,margin:zt,className:"stream-ordinal-tooltip",children:Vo}):null;if(Ie||!Jt&&eo){const t=Po.current;t&&w&&(t.ingest({inserts:to,bounded:!0}),t.computeScene({width:Nt,height:Et}));const o=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],n=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===L,c=l?zt.left+Nt/2:zt.left,u=l?zt.top+Et/2:zt.top;return e.jsxs("div",{ref:Dt,className:"stream-ordinal-frame"+(xt?" "+xt:""),role:"img","aria-label":Tt||("string"==typeof bt?bt:"Ordinal chart"),style:{position:"relative",width:R?"100%":$t[0],height:H?"100%":$t[1]},children:[e.jsx(ut,{summary:Rt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:$t[0],height:$t[1],style:{position:"absolute",left:0,top:0},children:[Gt&&e.jsx("g",{transform:`translate(${zt.left},${zt.top})`,children:Gt}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[wt&&e.jsx("rect",{x:0,y:0,width:Nt,height:Et,fill:wt}),o.map((t,o)=>function(t,o){var n,i,r,a,l;const c=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",u=e=>`ord-${t.type}-${c}-${o}-${e}`,d=`ord-${t.type}-${c}-${o}`;switch(t.type){case"rect":{const o=t,n=function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(d)+"-grad",i=function(t,o){const n=t.fillGradient;if(!n)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in n){const t=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let o=0;t.length>o;o++)l.push(e.jsx("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=Be(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(o,n),r=i?`url(#${n})`:Be(o.style.fill);if(o.roundedTop&&o.roundedTop>0){const t=Math.min(o.roundedTop,o.w/2,o.h/2),{x:n,y:s,w:a,h:l}=o;let c;switch(o.roundedEdge){case"right":c=`M${n},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n},${s+l} Z`;break;case"left":c=`M${n+a},${s} L${n+t},${s} A${t},${t} 0 0 0 ${n},${s+t} L${n},${s+l-t} A${t},${t} 0 0 0 ${n+t},${s+l} L${n+a},${s+l} Z`;break;case"bottom":c=`M${n},${s} L${n+a},${s} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n+t},${s+l} A${t},${t} 0 0 1 ${n},${s+l-t} Z`;break;default:c=`M${n},${s+l} L${n},${s+t} A${t},${t} 0 0 1 ${n+t},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l} Z`}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},d)}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},d)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:Be(o.style.fill),opacity:null!==(n=o.style.opacity)&&void 0!==n?n:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},d)}case"wedge":{const o=t,n=s.arc().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&n.cornerRadius(o.cornerRadius);const i=n(He)||"";return e.jsx("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:Be(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},d)}case"boxplot":{const o=t,n=o.columnWidth/2;return e.jsxs("g","vertical"===o.projection?{children:[e.jsx("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:o.x-n,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Be(o.style.fill),fillOpacity:null!==(i=o.style.fillOpacity)&&void 0!==i?i:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-n,y1:o.medianPos,x2:o.x+n,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.x-.5*n,y1:o.minPos,x2:o.x+.5*n,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-.5*n,y1:o.maxPos,x2:o.x+.5*n,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-n,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Be(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.medianPos,y1:o.y-n,x2:o.medianPos,y2:o.y+n,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.minPos,y1:o.y-.5*n,x2:o.minPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.maxPos,y1:o.y-.5*n,x2:o.maxPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1})]},d)}case"violin":{const o=t,n=[e.jsx("path",{d:o.pathString,transform:o.translateX||o.translateY?`translate(${o.translateX},${o.translateY})`:void 0,fill:Be(o.style.fill),fillOpacity:null!==(a=o.style.fillOpacity)&&void 0!==a?a:.6,stroke:o.style.stroke||"#333",strokeWidth:o.style.strokeWidth||1},u("path"))];if(o.iqrLine&&o.bounds){const t=o.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?n.push(e.jsx("line",{x1:i,y1:o.iqrLine.q1Pos,x2:i,y2:o.iqrLine.q3Pos,stroke:o.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:i,cy:o.iqrLine.medianPos,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},u("med"))):n.push(e.jsx("line",{x1:o.iqrLine.q1Pos,y1:r,x2:o.iqrLine.q3Pos,y2:r,stroke:o.style.stroke||"#333",strokeWidth:2},u("iqr")),e.jsx("circle",{cx:o.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},u("med")))}return e.jsx("g",{children:n},d)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(l=t.style.opacity)&&void 0!==l?l:.5},d);case"trapezoid":{const o=t,n=o.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:n,fill:Be(o.style.fill,"#999"),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},d)}default:return null}}(t,o)).filter(Boolean)]})]}),e.jsx(Te,{width:Nt,height:Et,totalWidth:$t[0],totalHeight:$t[1],margin:zt,scales:n,showAxes:ke,showCategoryTicks:je,oLabel:oo,rLabel:no,oFormat:so,rFormat:lo,rTickValues:Ge,tickLabelEdgeAlign:Ve,showGrid:tt,title:bt,legend:ot,legendHoverBehavior:nt,legendClickBehavior:it,legendHighlightedCategory:rt,legendIsolatedCategories:st,legendPosition:at,foregroundGraphics:J(qt,null===(a=Po.current)||void 0===a?void 0:a.customLayoutOverlays),annotations:Ue,svgAnnotationRules:Je,annotationFrame:0,xAccessor:"string"==typeof k?k:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null==t?void 0:t.getData()}),kt&&"radial"===L&&e.jsx("div",{style:{position:"absolute",left:zt.left+Nt/2,top:zt.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:kt})]})}return e.jsxs("div",{ref:Dt,className:"stream-ordinal-frame"+(xt?" "+xt:""),role:"group","aria-label":Tt||("string"==typeof bt?bt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:R?"100%":$t[0],height:H?"100%":$t[1],overflow:"visible"},onKeyDown:qo,children:[Lt&&e.jsx(dt,{tableId:Qt}),Lt&&e.jsx(ct,{scene:null!==(c=null===(l=Po.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:b+" chart",tableId:Qt,chartTitle:"string"==typeof bt?bt:void 0}),e.jsx(ut,{summary:Rt}),e.jsxs("div",{role:"img","aria-label":Tt||("string"==typeof bt?bt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:So?Go:void 0,onMouseLeave:So?$o:void 0,children:[Gt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:$t[0],height:$t[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${zt.left},${zt.top})`,children:Gt})}),e.jsx(Pe,{width:Nt,height:Et,totalWidth:$t[0],totalHeight:$t[1],margin:zt,scales:yo,showAxes:ke,showGrid:tt,rFormat:lo,rTickValues:Ge}),e.jsx("canvas",{ref:co,"aria-label":et(null!==(d=null===(u=Po.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:$t[0],height:$t[1]}}),e.jsx(ht,{hoverPoint:po}),e.jsx(Te,{width:Nt,height:Et,totalWidth:$t[0],totalHeight:$t[1],margin:zt,scales:yo,showAxes:ke,showCategoryTicks:je,oLabel:oo,rLabel:no,oFormat:so,rFormat:lo,showGrid:tt,title:bt,legend:ot,legendHoverBehavior:nt,legendClickBehavior:it,legendHighlightedCategory:rt,legendIsolatedCategories:st,legendPosition:at,foregroundGraphics:J(qt,jo),annotations:Ue,svgAnnotationRules:Je,annotationFrame:bo,xAccessor:"string"==typeof k?k:void 0,yAccessor:"string"==typeof j?j:void 0,annotationData:null===(g=Po.current)||void 0===g?void 0:g.getData(),underlayRendered:!0}),(_t||Pt)&&"radial"!==L&&e.jsx(Re,{width:Nt,height:Et,totalWidth:$t[0],totalHeight:$t[1],margin:zt,scales:yo,onBrush:Pt||(()=>{})}),kt&&"radial"===L&&e.jsx("div",{style:{position:"absolute",left:zt.left+Nt/2,top:zt.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:kt}),(null==Mt?void 0:Mt.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Mt.badgePosition?{top:4,left:4}:"bottom-left"===Mt.badgePosition?{bottom:4,left:4}:"bottom-right"===Mt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:wo?"#dc3545":"#28a745",color:"white"}),children:wo?"STALE":"LIVE"}),e.jsx(ft,{active:zo.current>=0,hoverPoint:po,margin:zt,size:$t,shape:null===(f=No.current)||void 0===f?void 0:f.shape,width:null===(y=No.current)||void 0===y?void 0:y.w,height:null===(v=No.current)||void 0===v?void 0:v.h}),Yo]})]})});lo.displayName="StreamOrdinalFrame";const co={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 uo(e,t){return"function"==typeof t?t(e):e[t]}function ho(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 go(t={}){const{fields:o,title:n,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(n){const e=uo(t,n);a=ho(e,i)}if(o&&o.length>0)o.forEach(e=>{let o,n,r;"string"==typeof e?(o=e,n=e,r=i):(o=e.label,n=e.accessor||e.key||"",r=e.format||i);const s=uo(t,n);l.push({label:o,value:ho(s,r)})});else if(!n){const e=["value","y","name","id","label"];for(const o of e)if(void 0!==t[o]){a=ho(t[o],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=ho(t[e[0]],i))}}const c=Object.assign(Object.assign({},co),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,o)=>e.jsxs("div",{style:{marginTop:0===o&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},o))]})}}function fo(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(n=t.data)&&void 0!==n?n:{}:t,r=o(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:co,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?go(t):go())}}function po(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s}=e,a={};return t&&(a.title=t),o&&(a.description=o),n&&(a.summary=n),void 0!==i&&(a.accessibleTable=i),r&&(a.className=r),null!=s&&(a.animate=s),a}function mo(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function yo(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:fo(t)||o}}const vo=t.createContext(null);function bo(){return t.useContext(vo)}function xo(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function wo(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}const[ko,jo]=mt(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=wo(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=wo(n,t);return n.set(t,Object.assign(Object.assign({},i),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[Ao,Oo]=mt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let So={positions:new Map};const Mo=new Set;function _o(){for(const e of Mo)e()}function Co(e,t){const o=So.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(So.positions);n.delete(e),So={positions:n},_o()}function Po(e){const o=t.useId(),n=e.clientId||o,{name:i}=e,r=jo(e=>e.selections.get(i)),s=jo(e=>e.setClause),a=jo(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(xo(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(i,{clientId:n,type:"point",fields:t})},[n,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(i,{clientId:n,type:"interval",fields:t})},[n,i,s]),clear:t.useCallback(()=>{a(i,n)},[a,i,n]),clientId:n}}function Lo(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const To=t.createContext(!1),Ro=t.createContext(null),Ho="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Bo(e){const o=t.useContext(Ro),n=t.useId(),i=function(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}(e),r=t.useRef([]);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(r.current,i)||(r.current=i);const s=r.current;Ho(()=>{if(o)return()=>o.unregisterCategories(n)},[o,n]),Ho(()=>{o&&o.registerCategories(n,s)},[o,n,s])}function Io({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?n(s,t,o):o?o(i):E[r%E.length];return{label:i+"",color:a}}),label:""}]}}function Fo(e,t,o){return t?n=>{var i;const r=Object.assign({},e(n));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(r,o.selectedStyle);else{const e=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(r,o.unselectedStyle)}return r}:e}function Wo(){return St(e=>e.theme)}function Do(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function $o(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function zo(){var e;const t=Wo(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function No(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=z[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:"#007bff"}function Eo(e,o,n){return t.useMemo(()=>{if(!o||"auto"===o||"function"==typeof o)return e;const t=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return t.sort("asc"===o?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,o,n])}h.createContext(void 0);const qo={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 Go(e,t,o){var n,i,r,s,a,l,c;const u=qo[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?u.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?u.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Vo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Vo(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function Xo(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}function Yo(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Qo(e,t){if(!t)return Yo(e);try{const o=t(e);return null==o?Yo(e):o}catch(t){return Yo(e)}}function Ko(e,t){return"function"==typeof t?t(e):e[t]}function Zo({categoryAccessor:t,valueAccessor:o,groupAccessor:n,groupLabel:i,pieData:r=!1,valueFormat:s}){return a=>{var l;const c=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=Ko(c,t),d=Ko(c,o),h=n?Ko(c,n):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[e.jsx("div",{style:{fontWeight:"bold"},children:Yo(u)}),e.jsx("div",{style:{marginTop:4},children:Qo(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||(g=n,"string"==typeof g?g:"value"),": ",Yo(h)]})]});var g}}function Uo({componentName:t,message:o,diagnosticHint:n,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),n&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}class Jo extends h.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,o=this.state.error;return"function"==typeof t?t(o):void 0!==t?t:e.jsx(Uo,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var en;const tn="undefined"!=typeof process&&"production"!==(null===(en=process.env)||void 0===en?void 0:en.NODE_ENV);function on({componentName:t,width:o,height:n,children:i}){return e.jsx(Jo,{fallback:i=>e.jsx(Uo,{componentName:t,message:i.message,width:o,height:n}),children:i})}const nn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #999)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},rn={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function sn(e,t,o,n){if(!tn)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function an(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function ln(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=an(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function cn({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)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(o){const n=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=ln(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function un(o){const{data:n,rawData:i,colorBy:r,colorScheme:s,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:f,chartId:m,showLegend:y,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,loading:k,emptyContent:j,width:A,height:O}=o,S=void 0===i,M=t.useMemo(()=>p(n),[n]),[_,C]=t.useState([]),P=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),L="string"==typeof o.colorBy?o.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:R,customHoverBehavior:H,customClickBehavior:B,crosshairSourceId:I}=function({selection:e,linkedHover:o,fallbackFields:n=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.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}(o,n),g=Po({name:(null==e?void 0:e.name)||"__unused__"}),f=function(e){const o=e.name||"hover",{fields:n}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=Po({name:o});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&s(t)},[n,s,a,o]),predicate:i,isActive:r}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||n||[]}),p=Oo(e=>e.pushObservation),m=e?{isActive:g.isActive,predicate:g.predicate}:null,[y,v]=t.useState(null),b=u||n[0],x=t.useMemo(()=>{if(!c||null==y||!b)return null;const e=y,t=b;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[c,y,b]),w=t.useCallback(e=>{var t,n;if(o)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const o=Do(e,t,h.xField);null!=o&&function(e,t,o){const n=So.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(So={positions:new Map(So.positions).set(e,{xValue:t,sourceId:o})},_o())}(h.name||"hover",o,d)}"x-position"!==(null==h?void 0:h.mode)&&f.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Co(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&f.onHover(null);if(c&&b)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[b];v(null!=o?o+"":null)}else v(null);if(r||p){const o={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=$o(e),s=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});r&&r(e),p&&p(e)}}},[o,f,h,d,r,s,a,p,c,b]),k=t.useCallback(e=>{var t,o,n,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=Do(e,t,h.xField);null!=o&&function(e,t,o){const n=So.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(So.positions);return t.delete(e),So={positions:t},_o(),!1}So={positions:new Map(So.positions).set(e,{xValue:t,sourceId:o,locked:!0})},_o()}(h.name||"hover",o,d)}if(e&&l){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),l(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(r||p){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const o=$o(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),p&&p(e)}}},[l,r,p,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const o=So.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(So.positions);n.delete(e),So={positions:n},_o()}(e,d),Co(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:m,hoverSelectionHook:x,customHoverBehavior:w,customClickBehavior:k,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:f,chartId:m,onClick:x,hoverHighlight:w,colorByField:L}),F=function(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}(u,I),W=function(e,o,n){const i=bo(),r=zo();return t.useMemo(()=>{var t;if(!o)return;const s=null!==(t=null!=n?n:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof o){const t=Array.from(new Set(e.map(e=>o(e)+"")));if(i&&Object.keys(i).length>0){const e=V(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return V(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=V(e,o,s);return e=>i[e]||t(e)}return V(e,o,s)}if(i&&Object.keys(i).length>0){const e=V([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,o,n,i,r])}(M,r,s),D=t.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of M){const o="function"==typeof r?r(t):t[r];null!=o&&e.add(o+"")}return Array.from(e)},[M,r]),$=t.useMemo(()=>S&&_.length>0?_:D,[S,_,D]),z=function(e,o,n){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=t.useMemo(()=>{if(!e||"none"===e||!o)return null;const t="string"==typeof o?o:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof o?o(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=t?e[t]:"function"==typeof o?o(e):null;return s.has(n)}}:null},[e,o,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,r,$),N=t.useMemo(()=>R||(z.legendSelectionHook?z.legendSelectionHook:T),[R,z.legendSelectionHook,T]),q=function(e){const o=St(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,n;if(void 0!==e||void 0!==o)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:o})},[e,o])}(c),X=zo(),Y=bo(),Q=t.useMemo(()=>{if(W)return W;if(!r||0===$.length)return;const e=Array.isArray(s)&&s.length>0||"string"==typeof s&&s.length>0?s:X&&X.length>0?X:E,t="__streamCat",o=V($.map(e=>({[t]:e})),t,e);return e=>(null==Y?void 0:Y[e])||o(e)||"#999"},[W,r,$,s,X,Y]),{legend:K,margin:Z,legendPosition:U}=function({data:e,colorBy:o,colorScale:n,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(To),u=null!==t.useContext(Ro),d=void 0!==i?i:!c&&!!o,h=!!o&&(d||u),g=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const n of e){const e="function"==typeof o?o(n):n[o];null!=e&&t.add(e+"")}return Array.from(t)},[l,o,e,h]);Bo(u&&o?g:[]);const f=t.useMemo(()=>{if(!d||!o)return;const t=Io({data:e,colorBy:o,colorScale:n,getColor:G,categories:g});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,o,e,n,g]),p=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=Object.assign(Object.assign({},a),e);return f&&("right"===r&&110>t.right?t.right=110:"left"===r&&110>t.left?t.left=110:"top"===r&&50>t.top?t.top=50:"bottom"===r&&80>t.bottom&&(t.bottom=80)),t},[a,s,f,r]);return{legend:f,margin:p,legendPosition:r}}({data:M,colorBy:r,colorScale:Q,showLegend:y,legendPosition:l,userMargin:v,defaults:b,categories:$}),J=t.useMemo(()=>{const e={};return K&&(e.legend=K,e.legendPosition=U),a&&"none"!==a&&(e.legendHoverBehavior=z.onLegendHover,e.legendClickBehavior=z.onLegendClick,e.legendHighlightedCategory=z.highlightedCategory,e.legendIsolatedCategories=z.isolatedCategories),S&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=P),e},[K,U,a,z.onLegendHover,z.onLegendClick,z.highlightedCategory,z.isolatedCategories,S,r,P]),ee=Array.isArray(i)?p(i):i,te=function(t,o,n){if(!t)return null;const i=Math.min(5,Math.floor(n/40)),r=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(r+s)-s))/2);return e.jsx("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,n)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},rn),{position:"absolute",top:a+n*(r+s),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:r,opacity:.5+n%2*.2})},n))})}(k,A,O),oe=te?null:function(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},nn),{width:o,height:n}),children:i||"No data available"}):null}(ee,A,O,j);return{data:M,colorScale:W,allCategories:$,legendState:z,effectiveSelectionHook:N,activeSelectionHook:T,customHoverBehavior:H,customClickBehavior:B,legend:K,margin:Z,legendPosition:U,earlyReturn:te||oe||null,legendBehaviorProps:J,crosshairProps:F,resolvedSelection:q}}function dn({ref:e,frameRef:o,setup:n}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[o]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}const hn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sort:m=!1,barPadding:y=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:j,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:R,legendPosition:H,color:B,stroke:I,strokeWidth:F,opacity:W,showCategoryTicks:D,categoryFormat:$,dataIdAccessor:z}=o,{width:N,height:E,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=i,ee=t.useMemo(()=>p(s),[s]),te=un({data:ee,rawData:s,colorBy:g,colorScheme:f,legendInteraction:R,legendPosition:H,selection:O,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"BarChart",chartId:P,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:N,height:E}),{effectiveLegendProps:oe,effectiveMargin:ne}=dn({ref:n,frameRef:r,setup:te});if(te.earlyReturn)return te.earlyReturn;sn("BarChart",ee,"categoryAccessor",c),sn("BarChart",ee,"valueAccessor",u);const ie=Eo(ee,m,u),re=zo(),se=t.useMemo(()=>new Map,[ee]),ae=t.useMemo(()=>(e,t)=>{const o={};return o.fill=g?G(e,g,te.colorScale):No(B,re,f,void 0,se),o},[g,te.colorScale,B,re,f,se]),le=t.useMemo(()=>{const e=null==A?void 0:A.pieceStyle;return Xo(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},ae(t,o)),e(t,o)||{}):ae,{stroke:I,strokeWidth:F,opacity:W})},[ae,A,I,F,W]),ce=t.useMemo(()=>Fo(le,te.effectiveSelectionHook,te.resolvedSelection),[le,te.effectiveSelectionHook,te.resolvedSelection]),ue=t.useMemo(()=>Zo({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),de=cn({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(de)return e.jsx(Uo,{componentName:"BarChart",message:de,width:N,height:E});const 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!=s&&{data:ie}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ce,size:[N,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne,barPadding:y}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:q,showAxes:i.showAxes,oLabel:U,rLabel:J,rFormat:h}),$&&{oFormat:$}),{showGrid:V,showCategoryTicks:D,oSort:m}),oe),po({title:Y,description:Q,summary:K,accessibleTable:Z,className:l,animate:o.animate})),yo({tooltip:w,defaultTooltipContent:ue})),mo({linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&k.length>0&&{annotations:k}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"BarChart",width:N,height:E,children:e.jsx(lo,Object.assign({ref:r},he))})});hn.displayName="BarChart";const gn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:m,normalize:y=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:j,valueExtent:A,frameProps:O={},selection:S,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:R,legendInteraction:H,legendPosition:B,color:I,stroke:F,strokeWidth:W,opacity:D,categoryFormat:$}=o,{width:z,height:N,enableHover:E,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=i,J=t.useMemo(()=>p(s),[s]),ee=f||u,te=un({data:J,rawData:s,colorBy:ee,colorScheme:m,legendInteraction:H,legendPosition:B,selection:S,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:T,emptyContent:R,width:z,height:N});if(te.earlyReturn)return te.earlyReturn;const oe=zo(),ne=t.useMemo(()=>new Map,[J]),ie=t.useMemo(()=>(e,t)=>ee?te.colorScale?{fill:G(e,ee,te.colorScale)}:{}:{fill:No(I,oe,m,t,ne)},[ee,te.colorScale,I,oe,m,ne]),re=t.useMemo(()=>{const e=null==O?void 0:O.pieceStyle;return Xo(e&&"function"==typeof e?(t,o)=>{const n=ie(t,o),i=e(t,o)||{};return Object.assign(Object.assign({},n),i)}:ie,{stroke:F,strokeWidth:W,opacity:D})},[ie,O,F,W,D]),se=t.useMemo(()=>Fo(re,te.effectiveSelectionHook,te.resolvedSelection),[re,te.effectiveSelectionHook,te.resolvedSelection]),ae=t.useMemo(()=>Zo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),le=cn({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ce,effectiveMargin:ue}=dn({ref:n,frameRef:r,setup:te}),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!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:v,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:se,size:[z,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:E}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:U,rFormat:g}),$&&{oFormat:$}),{showGrid:q}),ce),po({title:X,description:Y,summary:Q,accessibleTable:K,className:l,animate:o.animate})),yo({tooltip:k,defaultTooltipContent:ae})),mo({linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),j&&j.length>0&&{annotations:j}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return le?e.jsx(Uo,{componentName:"StackedBarChart",message:le,width:z,height:N}):e.jsx(on,{componentName:"StackedBarChart",width:z,height:N,children:e.jsx(lo,Object.assign({ref:r},de))})});gn.displayName="StackedBarChart";const fn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:m,sort:y=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:j,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:R,legendPosition:H,color:B,stroke:I,strokeWidth:F,opacity:W,categoryFormat:D}=o,{width:$,height:z,enableHover:N,showGrid:E,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,U=t.useMemo(()=>p(s),[s]),J=f||u,ee=un({data:U,rawData:s,colorBy:J,colorScheme:m,legendInteraction:R,legendPosition:H,selection:O,linkedHover:S,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"GroupedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:$,height:z});if(ee.earlyReturn)return ee.earlyReturn;const te=zo(),oe=t.useMemo(()=>new Map,[U]),ne=A.pieceStyle,ie=t.useMemo(()=>(e,t)=>{const o=J?ee.colorScale?{fill:G(e,J,ee.colorScale)}:{}:{fill:No(B,te,m,t,oe)};if(ne){const n=ne(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[J,ee.colorScale,B,te,m,oe,ne]),re=t.useMemo(()=>Xo(ie,{stroke:I,strokeWidth:F,opacity:W}),[ie,I,F,W]),se=t.useMemo(()=>Fo(re,ee.effectiveSelectionHook,ee.resolvedSelection),[re,ee.effectiveSelectionHook,ee.resolvedSelection]),ae=t.useMemo(()=>Zo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),le=cn({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:ce,effectiveMargin:ue}=dn({ref:n,frameRef:r,setup:ee}),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:"clusterbar"},null!=s&&{data:U}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:se,size:[$,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:N}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z,rFormat:g}),D&&{oFormat:D}),{showGrid:E}),ce),po({title:V,description:X,summary:Y,accessibleTable:Q,className:l,animate:o.animate})),yo({tooltip:w,defaultTooltipContent:ae})),mo({linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&k.length>0&&{annotations:k}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return le?e.jsx(Uo,{componentName:"GroupedBarChart",message:le,width:$,height:z}):e.jsx(on,{componentName:"GroupedBarChart",width:$,height:z,children:e.jsx(lo,Object.assign({ref:r},de))})});function pn({brushProp:e,onBrushProp:o,linkedBrush:n,valueAccessor:i}){const r=(s="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(e){const{name:o,xField:n,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=Po({name:o}),c=n&&i?"xyBrush":n?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Lo(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Lo(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof i?i:"value")}),l=t.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=t.useCallback(e=>{if(r){l.current.end(e?e.r:null)}null==o||o(e)},[o,r]),u=!!(e||n||o);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}fn.displayName="GroupedBarChart";const mn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:m,barPadding:y,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:j={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:H,stroke:B,strokeWidth:I,opacity:F,categoryFormat:W,rTickValues:D,tickLabelEdgeAlign:$,showCategoryTicks:z,gradientFill:N,trackFill:E,valueExtent:q}=o,{width:V,height:X,enableHover:Y,showGrid:Q,showLegend:K,title:Z,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=i,ne=t.useMemo(()=>p(s),[s]),ie=f||u,re=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==o.mode)return 40;const e=new Set(ne.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?X:V)-2*t)/(t-1))):1},[y,o.mode,ne,c,h,V,X]),se=un({data:ne,rawData:s,colorBy:ie,colorScheme:m,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:ie?["string"==typeof ie?ie:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:_,chartType:"SwimlaneChart",chartId:C,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:P,emptyContent:L,width:V,height:X}),ae=pn({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:d});if(se.earlyReturn)return se.earlyReturn;const le=zo(),ce=t.useMemo(()=>new Map,[ne]),ue=j.pieceStyle,de=t.useMemo(()=>(e,t)=>{const o=ie?se.colorScale?{fill:G(e,ie,se.colorScale)}:{}:{fill:No(H,le,m,t,ce)};if(ue){const n=ue(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[ie,se.colorScale,H,le,m,ce,ue]),he=t.useMemo(()=>Xo(de,{stroke:B,strokeWidth:I,opacity:F}),[de,B,I,F]),ge=t.useMemo(()=>Fo(he,se.effectiveSelectionHook,se.resolvedSelection),[he,se.effectiveSelectionHook,se.resolvedSelection]),fe=t.useMemo(()=>Zo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),pe=cn({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:me,effectiveMargin:ye}=dn({ref:n,frameRef:r,setup:se}),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=s&&{data:ne}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ge,size:[V,X],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ye,barPadding:re,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===z?void 0:te,rLabel:oe,rFormat:g}),D&&{rTickValues:D}),null!=$&&{tickLabelEdgeAlign:$}),W&&{oFormat:W}),void 0!==z&&{showCategoryTicks:z}),{showGrid:Q}),me),po({title:Z,description:U,summary:J,accessibleTable:ee,className:l,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:fe})),mo({linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),b&&b.length>0&&{annotations:b}),N&&{gradientFill:!0===N?{topOpacity:.8,bottomOpacity:.05}:N}),null!=E&&{trackFill:E}),q&&{rExtent:q}),ae.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return pe?e.jsx(Uo,{componentName:"SwimlaneChart",message:pe,width:V,height:X}):e.jsx(on,{componentName:"SwimlaneChart",width:V,height:X,children:e.jsx(lo,Object.assign({ref:r},ve))})});function yn(e,o){const{variant:n,frameRef:i,overrides:r,deps:s}=o;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}const o=t;return{push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removePoint(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.push(t(e));return s},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}}(n,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}mn.displayName="SwimlaneChart";const vn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sizeBy:m,sizeRange:y=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:j,brush:A,onBrush:O,linkedBrush:S,frameProps:M={},selection:_,linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,chartId:R,loading:H,emptyContent:B,legendInteraction:I,legendPosition:F,color:W,stroke:D,strokeWidth:$,opacity:z,showCategoryTicks:N,categoryFormat:E}=o,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=i,oe=t.useMemo(()=>p(s),[s]),ne=un({data:oe,rawData:s,colorBy:g,colorScheme:f,legendInteraction:I,legendPosition:F,selection:_,linkedHover:C,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:R,showLegend:Q,userMargin:a,marginDefaults:i.marginDefaults,loading:H,emptyContent:B,width:q,height:V}),ie=pn({brushProp:A,onBrushProp:O,linkedBrush:S,valueAccessor:u});if(ne.earlyReturn)return ne.earlyReturn;const re=t.useMemo(()=>{if(!m)return;const e=oe.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[oe,m]),se=zo(),ae=t.useMemo(()=>new Map,[oe]),le=M.pieceStyle,ce=t.useMemo(()=>(e,t)=>{const o={fillOpacity:b};if(o.fill=g?G(e,g,ne.colorScale):No(W,se,f,void 0,ae),o.r=m?function(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;return s===r?(a+l)/2:a+(i-r)/(s-r)*(l-a)}(e,m,y,re):v,le){const n=le(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[g,ne.colorScale,m,y,re,v,b,W,se,f,ae,le]),ue=t.useMemo(()=>Xo(ce,{stroke:D,strokeWidth:$,opacity:z}),[ce,D,$,z]),de=t.useMemo(()=>Fo(ue,ne.effectiveSelectionHook,ne.resolvedSelection),[ue,ne.effectiveSelectionHook,ne.resolvedSelection]),he=t.useMemo(()=>Zo({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),ge=cn({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ge)return e.jsx(Uo,{componentName:"SwarmPlot",message:ge,width:q,height:V});const fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:oe}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:de,size:[q,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne.margin,barPadding:x,enableHover:X}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:ee,rLabel:te,rFormat:h}),E&&{oFormat:E}),{showGrid:Y,showCategoryTicks:N}),ne.legendBehaviorProps),po({title:K,description:Z,summary:U,accessibleTable:J,className:l,animate:o.animate})),yo({tooltip:w,defaultTooltipContent:he})),mo({linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),k&&k.length>0&&{annotations:k}),j&&{rExtent:j}),ie.brushStreamProps),Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"SwarmPlot",width:q,height:V,children:e.jsx(lo,Object.assign({ref:r},fe))})});function bn(t){return o=>{var n;const i=o.category||o.data&&(null===(n=o.data[0])||void 0===n?void 0:n.category)||"",r=o.stats||(o.data||o).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),null!=r.n&&e.jsxs("div",{children:["n = ",r.n]}),null!=r.min&&e.jsxs("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&e.jsxs("div",{children:["Q1: ",r.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&e.jsxs("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&e.jsxs("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const n=t.valueAccessor,r=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=r.length,a=s>0?s%2!=0?r[Math.floor(s/2)]:(r[s/2-1]+r[s/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),s>0&&e.jsxs("div",{children:["n = ",s]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:co,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}vn.displayName="SwarmPlot";const xn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,showOutliers:m=!0,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,chartId:M,loading:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:H,opacity:B,showCategoryTicks:I,categoryFormat:F}=o,{width:W,height:D,enableHover:$,showGrid:z,showLegend:N,title:E,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=i,K=t.useMemo(()=>p(s),[s]),Z=un({data:K,rawData:s,colorBy:g,colorScheme:f,legendInteraction:P,legendPosition:L,selection:k,linkedHover:j,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"BoxPlot",chartId:M,showLegend:N,userMargin:a,marginDefaults:i.marginDefaults,loading:_,emptyContent:C,width:W,height:D});if(Z.earlyReturn)return Z.earlyReturn;const U=zo(),J=t.useMemo(()=>new Map,[K]),ee=t.useMemo(()=>e=>{const t=g?G(e,g,Z.colorScale):No(T,U,f,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[g,Z.colorScale,T,U,f,J]),te=t.useMemo(()=>Xo(ee,{stroke:R,strokeWidth:H,opacity:B}),[ee,R,H,B]),oe=t.useMemo(()=>Fo(te,Z.effectiveSelectionHook,Z.resolvedSelection),[te,Z.effectiveSelectionHook,Z.resolvedSelection]),ne=t.useMemo(()=>bn(),[]),ie=cn({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ie)return e.jsx(Uo,{componentName:"BoxPlot",message:ie,width:W,height:D});const 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({chartType:"boxplot"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:oe,showOutliers:m,size:[W,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:y,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q,rFormat:h}),F&&{oFormat:F}),{showGrid:z,showCategoryTicks:I}),Z.legendBehaviorProps),po({title:E,description:q,summary:V,accessibleTable:X,className:l,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:ne})),mo({linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"BoxPlot",width:W,height:D,children:e.jsx(lo,Object.assign({ref:r},re))})});xn.displayName="BoxPlot";const wn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:f,colorScheme:m,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:k,linkedBrush:j,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,emptyContent:T,legendInteraction:R,legendPosition:H,color:B,stroke:I,strokeWidth:F,opacity:W,showCategoryTicks:D,categoryFormat:$}=o,{width:z,height:N,enableHover:E,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:U}=i,J=t.useMemo(()=>p(s),[s]),ee=un({data:J,rawData:s,colorBy:f,colorScheme:m,legendInteraction:R,legendPosition:H,selection:O,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"Histogram",chartId:P,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:L,emptyContent:T,width:z,height:N}),te=pn({brushProp:w,onBrushProp:k,linkedBrush:j,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const oe=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,o=-1/0;for(const n of J){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[J,u]),ne=zo(),ie=t.useMemo(()=>new Map,[J]),re=t.useMemo(()=>e=>{const t=f?G(e,f,ee.colorScale):No(B,ne,m,void 0,ie);return{fill:t,stroke:t,fillOpacity:.8}},[f,ee.colorScale,B,ne,m,ie]),se=t.useMemo(()=>Xo(re,{stroke:I,strokeWidth:F,opacity:W}),[re,I,F,W]),ae=t.useMemo(()=>Fo(se,ee.effectiveSelectionHook,ee.resolvedSelection),[se,ee.effectiveSelectionHook,ee.resolvedSelection]),le=t.useMemo(()=>t=>{const o=t.data||t,n=o.category||t.category||"",i=o.count,r=o.range;return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[n&&e.jsx("div",{style:{fontWeight:"bold"},children:n+""}),null!=i&&e.jsxs("div",{children:["Count: ",i]}),r&&2===r.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]),ce=cn({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ce)return e.jsx(Uo,{componentName:"Histogram",message:ce,width:z,height:N});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:ae,bins:d,normalize:h}),x?{rExtent:x}:oe&&{rExtent:oe}),{size:[z,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:E}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:U,rFormat:g}),$&&{oFormat:$}),{showGrid:q,showCategoryTicks:D}),ee.legendBehaviorProps),po({title:X,description:Y,summary:Q,accessibleTable:K,className:l,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:le})),mo({linkedHover:S,onObservation:M,onClick:_,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),b&&b.length>0&&{annotations:b}),te.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"Histogram",width:z,height:N,children:e.jsx(lo,Object.assign({ref:r},ue))})});wn.displayName="Histogram";const kn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:f,colorBy:m,colorScheme:y,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:j,linkedBrush:A,frameProps:O={},selection:S,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:T,emptyContent:R,legendInteraction:H,legendPosition:B,color:I,stroke:F,strokeWidth:W,opacity:D,showCategoryTicks:$,categoryFormat:z}=o,{width:N,height:E,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=i,ee=t.useMemo(()=>p(s),[s]),te=un({data:ee,rawData:s,colorBy:m,colorScheme:y,legendInteraction:H,legendPosition:B,selection:S,linkedHover:M,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:T,emptyContent:R,width:N,height:E}),oe=pn({brushProp:k,onBrushProp:j,linkedBrush:A,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const ne=zo(),ie=t.useMemo(()=>new Map,[ee]),re=t.useMemo(()=>e=>{const t=m?G(e,m,te.colorScale):No(I,ne,y,void 0,ie);return{fill:t,stroke:t,fillOpacity:.6}},[m,te.colorScale,I,ne,y,ie]),se=t.useMemo(()=>Xo(re,{stroke:F,strokeWidth:W,opacity:D}),[re,F,W,D]),ae=t.useMemo(()=>Fo(se,te.effectiveSelectionHook,te.resolvedSelection),[se,te.effectiveSelectionHook,te.resolvedSelection]),le=t.useMemo(()=>bn({valueAccessor:u}),[u]),ce=cn({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ce)return e.jsx(Uo,{componentName:"ViolinPlot",message:ce,width:N,height:E});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ae,bins:h,showIQR:g,size:[N,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te.margin,barPadding:v,enableHover:q}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:J,rFormat:f}),z&&{oFormat:z}),{showGrid:V,showCategoryTicks:$}),te.legendBehaviorProps),po({title:Y,description:Q,summary:K,accessibleTable:Z,className:l,animate:o.animate})),yo({tooltip:b,defaultTooltipContent:le})),mo({linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),oe.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"ViolinPlot",width:N,height:E,children:e.jsx(lo,Object.assign({ref:r},ue))})});kn.displayName="ViolinPlot";const jn=t.forwardRef(function(o,n){var i;const r=Go(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),s=t.useRef(null);yn(n,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:m,sort:y="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,valueExtent:k,frameProps:j={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,chartId:C,loading:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:H,stroke:B,strokeWidth:I,opacity:F,categoryFormat:W}=o,{width:D,height:$,enableHover:z,showGrid:N,showLegend:E,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=r,Z=t.useMemo(()=>p(a),[a]),U=un({data:Z,rawData:a,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:R,selection:A,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:_,chartType:"DotPlot",chartId:C,showLegend:E,userMargin:l,marginDefaults:r.marginDefaults,loading:P,emptyContent:L,width:D,height:$});if(U.earlyReturn)return U.earlyReturn;const J=Eo(Z,y,d),ee=zo(),te=t.useMemo(()=>new Map,[Z]),oe=j.pieceStyle,ne=t.useMemo(()=>(e,t)=>{const o={r:v,fillOpacity:.8};if(o.fill=f?G(e,f,U.colorScale):No(H,ee,m,void 0,te),oe){const n=oe(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[f,U.colorScale,v,H,ee,m,te,oe]),ie=t.useMemo(()=>Xo(ne,{stroke:B,strokeWidth:I,opacity:F}),[ne,B,I,F]),re=t.useMemo(()=>Fo(ie,U.effectiveSelectionHook,U.resolvedSelection),[ie,U.effectiveSelectionHook,U.resolvedSelection]),se=t.useMemo(()=>Zo({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),ae=cn({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(ae)return e.jsx(Uo,{componentName:"DotPlot",message:ae,width:D,height:$});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=a&&{data:J}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:re,size:[D,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:b,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:K,rFormat:g}),W&&{oFormat:W}),{showGrid:N,oSort:y}),U.legendBehaviorProps),po({title:q,description:V,summary:X,accessibleTable:Y,className:c,animate:o.animate})),yo({tooltip:x,defaultTooltipContent:se})),mo({linkedHover:O,onObservation:S,onClick:M,hoverHighlight:_,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),w&&w.length>0&&{annotations:w}),k&&{rExtent:k}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"DotPlot",width:D,height:$,children:e.jsx(lo,Object.assign({ref:s},le))})});jn.displayName="DotPlot";const An=t.forwardRef(function(o,n){var i,r;const s=Go(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(r=o.height)&&void 0!==r?r:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:f,startAngle:m=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:R,opacity:H}=o,{width:B,height:I,enableHover:F,showLegend:W,title:D,description:$,summary:z,accessibleTable:N}=s,E=t.useMemo(()=>p(l),[l]),q=g||d,V=un({data:E,rawData:l,colorBy:q,colorScheme:f,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"PieChart",chartId:S,showLegend:W,userMargin:c,marginDefaults:s.marginDefaults,loading:M,emptyContent:_,width:B,height:I});if(V.earlyReturn)return V.earlyReturn;const X=zo(),Y=t.useMemo(()=>new Map,[E]),Q=t.useMemo(()=>(e,t)=>q?V.colorScale?{fill:G(e,q,V.colorScale)}:{}:{fill:No(L,X,f,t,Y)},[q,V.colorScale,L,X,f,Y]),K=t.useMemo(()=>{const e=null==x?void 0:x.pieceStyle;return Xo(e&&"function"==typeof e?(t,o)=>Object.assign(Object.assign({},Q(t,o)),e(t,o)||{}):Q,{stroke:T,strokeWidth:R,opacity:H})},[Q,x,T,R,H]),Z=t.useMemo(()=>Fo(K,V.effectiveSelectionHook,V.resolvedSelection),[K,V.effectiveSelectionHook,V.resolvedSelection]),U=t.useMemo(()=>Zo({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),J=cn({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:ee,effectiveMargin:te}=dn({ref:n,frameRef:a,setup:V}),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({chartType:"pie"},null!=l&&{data:E}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:Z,startAngle:m}),null!=y&&{cornerRadius:y}),{size:[B,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),ee),po({title:D,description:$,summary:z,accessibleTable:N,className:u,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:U})),mo({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?e.jsx(Uo,{componentName:"PieChart",message:J,width:B,height:I}):e.jsx(on,{componentName:"PieChart",width:B,height:I,children:e.jsx(lo,Object.assign({ref:a},oe))})});An.displayName="PieChart";const On=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks},{width:400,height:400}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:f,startAngle:m=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:R,opacity:H}=o,{width:B,height:I,enableHover:F,showLegend:W,title:D,description:$,summary:z,accessibleTable:N}=i,E=t.useMemo(()=>p(s),[s]),q=g||c,V=un({data:E,rawData:s,colorBy:q,colorScheme:f,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"DonutChart",chartId:S,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:M,emptyContent:_,width:B,height:I});if(V.earlyReturn)return V.earlyReturn;const X=null!=d?d:Math.max(2,.15*Math.min(B,I)),Y=zo(),Q=t.useMemo(()=>new Map,[E]),K=x.pieceStyle,Z=t.useMemo(()=>(e,t)=>{let o;if(o=q?V.colorScale?{fill:G(e,q,V.colorScale)}:{}:{fill:No(L,Y,f,t,Q)},K){const n=K(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[q,V.colorScale,L,Y,f,Q,K]),U=t.useMemo(()=>Xo(Z,{stroke:T,strokeWidth:R,opacity:H}),[Z,T,R,H]),J=t.useMemo(()=>Fo(U,V.effectiveSelectionHook,V.resolvedSelection),[U,V.effectiveSelectionHook,V.resolvedSelection]),ee=t.useMemo(()=>Zo({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),te=cn({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:oe,effectiveMargin:ne}=dn({ref:n,frameRef:r,setup:V}),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({chartType:"donut"},null!=s&&{data:E}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:J,innerRadius:X,startAngle:m}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[B,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),oe),po({title:D,description:$,summary:z,accessibleTable:N,className:l,animate:o.animate})),yo({tooltip:v,defaultTooltipContent:ee})),mo({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return te?e.jsx(Uo,{componentName:"DonutChart",message:te,width:B,height:I}):e.jsx(on,{componentName:"DonutChart",width:B,height:I,children:e.jsx(lo,Object.assign({ref:r},ie))})});On.displayName="DonutChart";const Sn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),r=t.useRef(null),s="context"===o.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,color:h,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,showNeedle:p=!0,needleColor:m="var(--semiotic-text, #333)",centerContent:y,valueFormat:v,showScaleLabels:b=!a,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:j,frameProps:A={},className:O,stroke:S,strokeWidth:M,opacity:_}=o,{width:C,height:P,title:L,description:T,summary:R,accessibleTable:H}=i,B=Math.max(c,Math.min(u,l)),I=u-c||1,F=(B-c)/I,{gaugeData:W,pieceStyle:D,gaugeAnnotations:$}=t.useMemo(()=>{const e=[],t=new Map,o=[];let n=d&&d.length>0?[...d].sort((e,t)=>e.value-t.value):[{value:u,color:h||"var(--semiotic-primary, #007bff)"}];n=n.map(e=>Object.assign(Object.assign({},e),{value:Math.max(c,Math.min(u,e.value))})),u>n[n.length-1].value&&n.push({value:u,color:n[n.length-1].color});let i=c;for(let o=0;n.length>o;o++){const r=n[o],s=(r.value-i)/I;if(w){const n=(i-c)/I,a=Math.max(0,Math.min(F,(r.value-c)/I)-n),l=s-a;if(a>0){const n="fill-"+o;e.push({category:n,value:a,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}if(l>0){const n="bg-"+o;e.push({category:n,value:l,_zone:r.label||"Zone "+(o+1),_isFill:!1}),t.set(n,{fill:g,opacity:.4})}}else{const n="zone-"+o;e.push({category:n,value:s,_zone:r.label||"Zone "+(o+1),_isFill:!0}),t.set(n,{fill:r.color})}i=r.value}if(b&&d&&d.length>0)for(const e of d)e.value>c&&u>e.value&&o.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,o)=>t.get(o||e.category)||{fill:g},gaugeAnnotations:o}},[l,c,u,d,h,g,F,I,b,w]),z=t.useMemo(()=>Xo(D,{stroke:S,strokeWidth:M,opacity:_}),[D,S,M,_]),N=x*Math.PI/180,E=180+(360-x)/2,q=Math.min(10,Math.max(1,Math.min(C,P)/12)),G=-Math.PI/2+E*Math.PI/180,V=[[Math.cos(G),Math.sin(G)],[Math.cos(G+N),Math.sin(G+N)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-G)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>N+.001||V.push([Math.cos(e),Math.sin(e)]);const X=Math.min(...V.map(e=>e[0])),Y=Math.max(...V.map(e=>e[0])),Q=Math.min(...V.map(e=>e[1])),K=Math.max(...V.map(e=>e[1])),Z=(Q+K)/2,U=(X+Y)/2,J=Math.max(4,Math.min((C-2*q)/(Y-X),(P-2*q)/(K-Q))-2),ee=Math.max(0,Math.min(J-1.5,J*(1-f))),te=C/2-U*J,oe=P/2-Z*J,ne=2*(J+4),ie=t.useMemo(()=>{if(a&&null==y)return null;if(null!=y)return"function"==typeof y?y(B,c,u):y;const t=v?v(B):Math.round(B)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),b&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[y,B,c,u,v,b,J,a]),re=t.useMemo(()=>s&&null==y?{type:"gauge-value",text:v?v(B):Math.round(B)+""}:null,[s,y,B,v]),se=t.useMemo(()=>{if(!p)return null;const e=-Math.PI/2+E*Math.PI/180+F*N,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:m}},[p,F,E,N,ee,m]),ae=t.useMemo(()=>(t,o,n)=>{if("gauge-needle"===t.type){const i=(n.width||C)/2,r=(n.height||P)/2,s=Math.max(1,J-ee),a=Math.max(1,Math.min(2.5,.4*s)),l=Math.max(1,Math.min(5,.6*s));return e.jsxs("g",{transform:`translate(${i},${r})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+o)}if("gauge-label"===t.type){const i=-Math.PI/2+E*Math.PI/180+(t.value-c)/I*N,r=ee-14,s=(n.height||P)/2;return e.jsx("text",{x:(n.width||C)/2+Math.cos(i)*r,y:s+Math.sin(i)*r,textAnchor:"middle",dominantBaseline:"middle",fontSize:9,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"},children:t.label},"gauge-label-"+o)}return"gauge-value"===t.type?e.jsx("text",{x:(n.width||C)/2,y:(n.height||P)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+o):null},[C,P,c,I,E,N,ee,J]),le=t.useMemo(()=>{const e=[...$,...j||[]];return se&&e.push(se),re&&e.push(re),e},[$,j,se,re]),ce=t.useMemo(()=>t=>{var o;const n=(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o[0])||(null==t?void 0:t.data)||t,i=null==n?void 0:n._isFill;return e.jsxs("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))"},children:[e.jsx("div",{style:{fontWeight:600},children:(null==n?void 0:n._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(B):"Remaining"})]})},[B]);if(0===W.length)return e.jsx(Uo,{componentName:"GaugeChart",message:"No data to display",width:C,height:P});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:z,innerRadius:ee,startAngle:E,sweepAngle:x,centerContent:ie,size:[C,P],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:oe-ne/2,bottom:P-oe-ne/2,left:te-ne/2,right:C-te-ne/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:fo(k)||ce,svgAnnotationRules:ae},le.length>0&&{annotations:le}),L&&{title:L}),T&&{description:T}),R&&{summary:R}),void 0!==H&&{accessibleTable:H}),O&&{className:O}),null!=o.animate&&{animate:o.animate}),A);return e.jsx(on,{componentName:"GaugeChart",width:C,height:P,children:e.jsx(lo,Object.assign({ref:r},ue))})});Sn.displayName="GaugeChart";const Mn=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:f,colorBy:m,colorScheme:y,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:j,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,chartId:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:R,stroke:H,strokeWidth:B,opacity:I,showCategoryTicks:F,categoryFormat:W}=o,{width:D,height:$,enableHover:z,showGrid:N,showLegend:E,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=i,Z=t.useMemo(()=>p(s),[s]),U=un({data:Z,rawData:s,colorBy:m,colorScheme:y,legendInteraction:L,legendPosition:T,selection:j,linkedHover:A,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:M,chartType:"RidgelinePlot",chartId:_,showLegend:E,userMargin:a,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:D,height:$});if(U.earlyReturn)return U.earlyReturn;const J=zo(),ee=t.useMemo(()=>new Map,[Z]),te=t.useMemo(()=>e=>{const t=m?G(e,m,U.colorScale):No(R,J,y,void 0,ee);return{fill:t,stroke:t,fillOpacity:.5}},[m,U.colorScale,R,J,y,ee]),oe=t.useMemo(()=>Xo(te,{stroke:H,strokeWidth:B,opacity:I}),[te,H,B,I]),ne=t.useMemo(()=>Fo(oe,U.effectiveSelectionHook,U.resolvedSelection),[oe,U.effectiveSelectionHook,U.resolvedSelection]),ie=t.useMemo(()=>bn(),[]),re=cn({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(re)return e.jsx(Uo,{componentName:"RidgelinePlot",message:re,width:D,height:$});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({chartType:"ridgeline"},null!=s&&{data:Z}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ne,bins:h,size:[D,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K,rFormat:f}),W&&{oFormat:W}),{showGrid:N,showCategoryTicks:F,oSort:!1,amplitude:g}),U.legendBehaviorProps),po({title:q,description:V,summary:X,accessibleTable:Y,className:l,animate:o.animate})),yo({tooltip:b,defaultTooltipContent:ie})),mo({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"RidgelinePlot",width:D,height:$,children:e.jsx(lo,Object.assign({ref:r},se))})});Mn.displayName="RidgelinePlot";const _n=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),r=t.useRef(null);yn(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:y=!0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,emptyContent:_,legendInteraction:C,legendPosition:P,color:L,stroke:T,strokeWidth:R,opacity:H,categoryFormat:B}=o,I="vertical"===f,{width:F,height:W,enableHover:D,showLegend:$,title:z,description:N,summary:E,accessibleTable:q}=i,V=I?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>p(s),[s]),Y=h||d,Q=!Y,K=un({data:X,rawData:s,colorBy:Y,colorScheme:g,legendInteraction:C,legendPosition:P,selection:w,linkedHover:k,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"FunnelChart",chartId:S,showLegend:$,userMargin:a,marginDefaults:V,loading:M,emptyContent:_,width:F,height:W});if(K.earlyReturn)return K.earlyReturn;sn("FunnelChart",X,"stepAccessor",c),sn("FunnelChart",X,"valueAccessor",u);const Z=zo(),U=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(Q)return L||((null==Z?void 0:Z[0])?Z[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[Q,L,Z,g]),ee=x.pieceStyle,te=t.useMemo(()=>(e,t)=>{const o={};if(o.fill=J||(Y?G(e,Y,K.colorScale):No(L,Z,g,t,U)),ee){const n=ee(e,t);n.stroke&&(o.stroke=n.stroke),null!=n.strokeWidth&&(o.strokeWidth=n.strokeWidth),null!=n.strokeOpacity&&(o.strokeOpacity=n.strokeOpacity)}return o},[J,Y,K.colorScale,L,Z,g,U,ee]),oe=t.useMemo(()=>Xo(te,{stroke:T,strokeWidth:R,opacity:H}),[te,T,R,H]),ne=t.useMemo(()=>Fo(oe,K.effectiveSelectionHook,K.resolvedSelection),[oe,K.effectiveSelectionHook,K.resolvedSelection]),ie=t.useMemo(()=>t=>{var o,n,i,r,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(i=null!==(n=null!==(o=null==l?void 0:l.__funnelValue)&&void 0!==o?o:null==l?void 0:l.__barFunnelValue)&&void 0!==n?n:null==l?void 0:l.value)&&void 0!==i?i:"",d=null!==(r=null==l?void 0:l.__funnelPercent)&&void 0!==r?r:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:co,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),f&&f!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:f+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",p]})]})},[]),re=cn({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(re)return e.jsx(Uo,{componentName:"FunnelChart",message:re,width:F,height:W});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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:I?"bar-funnel":"funnel"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:I?"vertical":"horizontal",barPadding:I?40:0,pieceStyle:ne,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:I,showCategoryTicks:I}),B&&{oFormat:B}),{showGrid:I}),!I&&{connectorOpacity:m}),{showLabels:y}),K.legendBehaviorProps),z&&{title:z}),N&&{description:N}),E&&{summary:E}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===v?()=>null:!0===v||null==v?ie:fo(v)||ie}),(k||j||A||O)&&{customHoverBehavior:K.customHoverBehavior}),(j||A||k)&&{customClickBehavior:K.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(on,{componentName:"FunnelChart",width:F,height:W,children:e.jsx(lo,Object.assign({ref:r},se))})});_n.displayName="FunnelChart";const Cn={RdBu:H,PiYG:B,PRGn:I,BrBG:F,RdYlBu:W,RdYlGn:D,Spectral:$},Pn="__likert_neutral_neg",Ln="__likert_neutral_pos";function Tn(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Rn(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(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 o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function Hn(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Pn,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Ln,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Bn(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Pn?r=o:o.__likertLevel===Ln?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const In=t.forwardRef(function(o,n){const i=Go(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:g="count",levels:f,orientation:p="horizontal",colorScheme:m,barPadding:y=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,chartId:M,valueFormat:_,loading:C,emptyContent:P,legendInteraction:L,legendPosition:T,categoryFormat:R,stroke:H,strokeWidth:B,opacity:I}=o,{width:F,height:W,enableHover:D,showGrid:$,showLegend:z,title:N,description:q,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:K}=i,Z="horizontal"===p,U=void 0===s,J=!d,ee=function(){var e;const t=Wo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),te=t.useMemo(()=>m&&Array.isArray(m)&&m.length>=f.length?m:function(e,t){if(0>=e)return[];if(t){const o=Cn[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(f.length,ee),[m,f.length,ee]),oe=t.useMemo(()=>{const e=new Map;for(let t=0;f.length>t;t++)e.set(f[t],te[t]||"#888");return e},[f,te]),{processedData:ne,reAggregate:ie,accumulatorRef:re}=function({data:e,levels:o,categoryAccessor:n,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>Tn(n,"question"),[n]),d=t.useMemo(()=>c?Tn(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:Tn(r,"level"),[c,r]),g=t.useMemo(()=>c?null:Tn(s,"count"),[c,s]),f=e||[],p=t.useRef([]),m=t.useMemo(()=>{if(0===f.length)return[];let e=Rn(f,o,u,d,h,g);return a&&(e=Hn(e,o),e=Bn(e,o)),e},[f,o,u,d,h,g,a]),y=t.useCallback(e=>{var t;let n=Rn(e,o,u,d,h,g);a&&(n=Hn(n,o),n=Bn(n,o)),null===(t=l.current)||void 0===t||t.replace(n)},[o,u,d,h,g,a,l]);return{processedData:m,reAggregate:y,accumulatorRef:p}}({data:s,levels:f,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:g,isDiverging:Z,frameRef:r}),se="__likertLevelLabel",ae=function({isPushMode:e,colorBy:o,colorScheme:n,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=bo(),d=zo(),h=t.useCallback(e=>{const t=e[o];return null!=t?t+"":null},[o]),g=t.useCallback(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=h(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),n=!0)}n&&c(e=>e+1)},[e,o,h]),f=t.useCallback(t=>{if(!e||!o)return;const n=Array.from(new Set(t.map(String))),i=a.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(s.current=new Set(n),a.current=n,c(e=>e+1))},[e,o]),p=t.useCallback(e=>t=>{g([t]),e(t)},[g]),m=t.useCallback(e=>t=>{g(t),e(t)},[g]),y=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);Bo(e&&o?a.current:[]);const v=t.useMemo(()=>{if(!e||!o||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:d&&d.length>0?d:E,s=o,l=t.map(e=>({[s]:e})),c=V(l,s,r);return Io({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:G})},[e,o,i,n,u,d,l]),b=t.useMemo(()=>{if(v)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[v,r]);return{wrapPush:p,wrapPushMany:m,resetCategories:y,categories:a.current,categoryDomainProps:e&&o?{legendCategoryAccessor:o,onCategoriesChange:f}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:U,colorBy:se,colorScheme:te,showLegend:z,legendPosition:T}),le=t.useCallback(ae.wrapPush(e=>{re.current.push(e),ie(re.current)}),[ae.wrapPush,ie,re]),ce=t.useCallback(ae.wrapPushMany(e=>{re.current.push(...e),ie(re.current)}),[ae.wrapPushMany,ie,re]);t.useImperativeHandle(n,()=>({push:le,pushMany:ce,remove:e=>{var t,o;return null!==(o=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=r.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;re.current=[],ae.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:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[le,ce,ae.resetCategories,re]);const ue=un({data:ne,rawData:s,colorBy:se,colorScheme:te,legendInteraction:L,legendPosition:T,selection:k,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"LikertChart",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:F,height:W});if(ue.earlyReturn)return ue.earlyReturn;const de=t.useMemo(()=>{const e=f.length;return e%2!=0&&oe.get(f[Math.floor(e/2)])||"#888"},[f,oe]),he=w.pieceStyle,ge=t.useMemo(()=>(e,t)=>{var o,n;const i=e.__likertLevelLabel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);let s;if(r===Pn||r===Ln)s={fill:de};else{const e=i||r;s=e&&oe.has(e)?{fill:oe.get(e)}:{fill:"#888"}}if(he){const o=he(e,t);o.stroke&&(s.stroke=o.stroke),null!=o.strokeWidth&&(s.strokeWidth=o.strokeWidth),null!=o.strokeOpacity&&(s.strokeOpacity=o.strokeOpacity)}return s},[oe,de,he]),fe=t.useMemo(()=>Xo(ge,{stroke:H,strokeWidth:B,opacity:I}),[ge,H,B,I]),pe=t.useMemo(()=>Fo(fe,ue.effectiveSelectionHook,ue.resolvedSelection),[fe,ue.effectiveSelectionHook,ue.resolvedSelection]),me=t.useMemo(()=>{const e=f.length;return e%2!=0?f[Math.floor(e/2)]:""},[f]),ye=t.useMemo(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===Pn||o===Ln?me:o,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=o===Pn||o===Ln?2*r:r,a=t.__likertCount||0;return h.createElement("div",{className:"semiotic-tooltip",style:co},h.createElement("div",{style:{fontWeight:"bold"}},i),h.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[me]),ve=t.useMemo(()=>{if(!f||2>f.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!g)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return J?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),g&&(e.countAccessor=g)),cn({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:f}})},[s,c,u,d,g,f,J]),be=t.useMemo(()=>[{styleFn:e=>({fill:oe.get(e.label)||"#888"}),items:f.map(e=>({label:e})),label:""}],[f,oe]),xe=t.useMemo(()=>!1!==z?Object.assign(Object.assign({},ue.legendBehaviorProps),{legend:{legendGroups:be},legendPosition:T||ue.legendPosition||"bottom"}):ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,T,z,be]),we=t.useMemo(()=>{const e=Object.assign({},ue.margin);if(U&&!1!==z){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ae.streamingMarginAdjust)for(const[t,o]of Object.entries(ae.streamingMarginAdjust))o>e[t]&&(e[t]=o);return Z&&100>e.left&&(e.left=100),e},[ue.margin,ae.streamingMarginAdjust,Z,U,z,T]),ke=t.useMemo(()=>_||(Z?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Z,_]),je=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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!=s&&{data:ne}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Z?"horizontal":"vertical",pieceStyle:pe,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:we,barPadding:y,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K||(Z?void 0:"Percentage"),rFormat:ke}),R&&{oFormat:R}),{showGrid:$}),xe),N&&{title:N}),q&&{description:q}),X&&{summary:X}),void 0!==Y&&{accessibleTable:Y}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===v?()=>null:!0===v?ye:fo(v)||ye}),(j||A||O||S)&&{customHoverBehavior:ue.customHoverBehavior}),(A||O||j)&&{customClickBehavior:ue.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return ve?e.jsx(Uo,{componentName:"LikertChart",message:ve,width:F,height:W}):e.jsx(on,{componentName:"LikertChart",width:F,height:W,children:e.jsx(lo,Object.assign({ref:r},je))})});In.displayName="LikertChart";const Fn=t.forwardRef(function(o,n){const{data:i,layout:r,layoutConfig:s,categoryAccessor:a="category",valueAccessor:l="value",oExtent:c,rExtent:u,projection:d="vertical",margin:h,className:g,colorScheme:f,showAxes:p=!1,annotations:m,onObservation:y,onClick:v,selection:b,linkedHover:x,chartId:w,loading:k,emptyContent:j,frameProps:A={}}=o,{frameRef:O,resolved:S,safeData:M,setup:_,earlyReturn:C}=function(e){var o;const n=function(e){const o=t.useRef(null);return yn(e.imperativeRef,{variant:e.imperativeVariant,frameRef:o}),{frameRef:o,resolved:Go(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>function(e){if(null!=e)return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:e}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:r}=n,s=un({data:null!==(o=e.data)&&void 0!==o?o:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:i.showLegend,userMargin:r,marginDefaults:i.marginDefaults,loading:e.loading,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},n),{safeData:s.data,setup:s,earlyReturn:s.earlyReturn})}({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:i,colorScheme:f,selection:b,linkedHover:x,onObservation:y,onClick:v,chartId:w,loading:k,emptyContent:j,margin:h,width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,mode:o.mode});if(C)return C;const{width:P,height:L,enableHover:T,showGrid:R,title:H,description:B,summary:I,accessibleTable:F}=S,W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:M}),{customLayout:r,layoutConfig:s,oAccessor:a,rAccessor:l,oExtent:c,rExtent:u,projection:d,colorScheme:f,size:[P,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:_.margin,enableHover:T,showAxes:p,showGrid:R,annotations:m}),po({title:H,description:B,summary:I,accessibleTable:F,className:g,animate:o.animate})),mo({linkedHover:x,onObservation:y,onClick:v,hoverHighlight:!1,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior})),A);return e.jsx(on,{componentName:"OrdinalCustomChart",width:P,height:L,children:e.jsx(lo,Object.assign({ref:O},W))})});Fn.displayName="OrdinalCustomChart",exports.BarChart=hn,exports.BoxPlot=xn,exports.DonutChart=On,exports.DotPlot=jn,exports.FunnelChart=_n,exports.GaugeChart=Sn,exports.GroupedBarChart=fn,exports.Histogram=wn,exports.LikertChart=In,exports.OrdinalCustomChart=Fn,exports.PieChart=An,exports.RidgelinePlot=Mn,exports.StackedBarChart=gn,exports.StreamOrdinalFrame=lo,exports.SwarmPlot=vn,exports.SwimlaneChart=mn,exports.ViolinPlot=kn,exports.createHatchPattern=Zt;