semiotic 3.5.4 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CLAUDE.md +61 -3
  2. package/README.md +17 -10
  3. package/ai/dist/mcp-server.js +249 -2
  4. package/ai/schema.json +34 -9
  5. package/ai/system-prompt.md +1 -1
  6. package/dist/components/ai/audienceProfile.d.ts +90 -0
  7. package/dist/components/ai/audiences.d.ts +31 -0
  8. package/dist/components/ai/chartCapabilities.d.ts +55 -0
  9. package/dist/components/ai/chartCapabilityTypes.d.ts +196 -0
  10. package/dist/components/ai/diffProfile.d.ts +51 -0
  11. package/dist/components/ai/inferIntent.d.ts +24 -0
  12. package/dist/components/ai/intents.d.ts +34 -0
  13. package/dist/components/ai/profileData.d.ts +16 -0
  14. package/dist/components/ai/qualityFixtures.d.ts +2 -0
  15. package/dist/components/ai/qualityScorecard.d.ts +82 -0
  16. package/dist/components/ai/repairChartConfig.d.ts +73 -0
  17. package/dist/components/ai/streamingTypes.d.ts +64 -0
  18. package/dist/components/ai/suggestCharts.d.ts +76 -0
  19. package/dist/components/ai/suggestDashboard.d.ts +92 -0
  20. package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
  21. package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
  22. package/dist/components/ai/useChartSuggestions.d.ts +22 -0
  23. package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
  24. package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
  25. package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
  26. package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
  27. package/dist/components/charts/index.d.ts +1 -1
  28. package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
  29. package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
  30. package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
  31. package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
  32. package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
  33. package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
  34. package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
  35. package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
  36. package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
  37. package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
  38. package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
  39. package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
  40. package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
  41. package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
  42. package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
  43. package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
  44. package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
  45. package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
  46. package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
  47. package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
  48. package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
  49. package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
  50. package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
  51. package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
  52. package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
  53. package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
  54. package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
  55. package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
  56. package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
  57. package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
  58. package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
  59. package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
  60. package/dist/components/charts/shared/chartSpecs.d.ts +0 -34
  61. package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
  62. package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
  63. package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
  64. package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
  65. package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
  66. package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
  67. package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
  68. package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
  69. package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
  70. package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
  71. package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
  72. package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
  73. package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
  74. package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
  75. package/dist/components/data/DataSummarizer.d.ts +45 -0
  76. package/dist/components/semiotic-ai.d.ts +35 -0
  77. package/dist/components/semiotic-xy.d.ts +1 -1
  78. package/dist/components/semiotic.d.ts +1 -1
  79. package/dist/components/store/useChartFocus.d.ts +43 -0
  80. package/dist/components/store/useChartInterrogation.d.ts +141 -0
  81. package/dist/ordinal.min.js +1 -1
  82. package/dist/ordinal.module.min.js +1 -1
  83. package/dist/semiotic-ai.d.ts +35 -0
  84. package/dist/semiotic-ai.min.js +1 -1
  85. package/dist/semiotic-ai.module.min.js +1 -1
  86. package/dist/semiotic-utils.min.js +1 -1
  87. package/dist/semiotic-utils.module.min.js +1 -1
  88. package/dist/semiotic-xy.d.ts +1 -1
  89. package/dist/semiotic.d.ts +1 -1
  90. package/dist/semiotic.min.js +1 -1
  91. package/dist/semiotic.module.min.js +1 -1
  92. package/dist/xy.min.js +1 -1
  93. package/dist/xy.module.min.js +1 -1
  94. package/package.json +13 -4
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-scale"),o=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 n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const h=d(t),g=u(a),f=Object.freeze([]);function m(e){if(!e)return f;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class p{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=m(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 n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=m(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 n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),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 n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;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 n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+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),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class 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 n of e){const e=t?t(n):n;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,n){return e+(t-e)*n}function x(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function w(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}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,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function S(e){const t=e.map(j),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return A(e,n,o)}if(e>=1){const[e,o,i]=t[n];return A(e,o,i)}const o=e*n,i=Math.floor(o),r=o-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 O=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],M=S(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),C=S(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),_=S(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),P=S(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),L=S(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);S(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const R=S(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),T=S(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);S(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),S(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),S(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),S(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const B=S(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),$=S(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),H=S(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),I=S(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),E=S(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),F=S(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),D=S(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),N={category10:O,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:C,greens:_,oranges:P,purples:L,viridis:R,plasma:T},W=O,z=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],G=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 q(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||G.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):W[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%W.length]}function V(e,t,o="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(o))return n.scaleOrdinal().domain(i).range(o).unknown("#999");const s=N[o]||N.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:W;return n.scaleOrdinal().domain(i).range(e).unknown("#999")}}function X(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Y(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function Q(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=d&&!g&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,d=c+o*u,g=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*u,m=r(t.pieceData[0],t.name),p=0===e,y=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:d,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:m,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:f&&(v.roundedEnds={start:p,end:y}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),s.push(v)}return s}function Z(e){var t,n,o;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!==(n=i.quantile(e,.5))&&void 0!==n?n:(s+a)/2,q3:null!==(o=i.quantile(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}function K(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}const U={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,m="horizontal"===h,p=a.normalize,y=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);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 n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(p)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of y){const s=t.get(r);if(!s)continue;let a=s.total;p&&n>0&&(a/=n);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:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);g.push(Y(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(m){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);g.push(Y(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=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!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o: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 n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});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),n.length>0&&(n.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:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,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+n/2,a=l(0),d=l(c);u.push(Y(r,Math.min(a,d),o,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(Y(Math.min(a,d),r,Math.abs(d-a),o,g,i,h[s]))}}}}const m=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);m>0&&(e.roundedTop=m),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;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,m=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=f&&a[i]||c,y=l(t,e.name),v=y.r||5;let b,x;if(g){const t=p+(e.pctStart+e.pct/2)*m,n=u(r);b=Math.cos(t)*n,x=Math.sin(t)*n}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:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%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:o})}}return l},pie:Q,donut:Q,boxplot:function(e,t){var n,o,r,s,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:f,projection:m}=c,p=[],y="vertical"===m,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],m=null!==(n=i.quantile(c,.25))&&void 0!==n?n:u,b=null!==(o=i.quantile(c,.5))&&void 0!==o?o:(u+d)/2,x=null!==(r=i.quantile(c,.75))&&void 0!==r?r:d,w=x-m,k=m-1.5*w,j=x+1.5*w,A=null!==(s=c.find(e=>e>=k))&&void 0!==s?s:u,S=null!==(a=[...c].reverse().find(e=>j>=e))&&void 0!==a?a:d,O=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const n=h(e);if(k>n||n>j){const o=y?t.middle:f(n),i=y?f(n):t.middle;M.push({px:o,py:i,value:n,datum:e})}}if(p.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(m),medianPos:f(b),q3Pos:f(x),maxPos:f(S),stats:{n:c.length,min:A,q1:m,median:b,q3:x,max:S,mean:c.reduce((e,t)=>e+t,0)/c.length},style:O,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var n,o,r;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,g=[],f="vertical"===h,m=l.bins||20,p=!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)/m||1,h=Array(m).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),m-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;m>t;t++){const n=d(s+(t+.5)*l);b+=` L ${e.middle+h[t]/y*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=m-1;t>=0;t--){const n=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/y*v} ${n}`}b+=" Z"}else{b=`M ${d(s)} ${e.middle}`;for(let t=0;m>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/y*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=m-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(p&&t.length>=4){const l=null!==(n=i.quantile(t,.25))&&void 0!==n?n:s,c=null!==(o=i.quantile(t,.5))&&void 0!==o?o:(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:Z(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.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 n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,m=Math.max(...r,1),p=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/m)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(Y(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,p,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,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 o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const f=Math.max(...c,1),m=a(e.pieceData[0],e.name),p=e.width*g;let y="";if(h){const t=e.x+e.width;y=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)y+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*p}`;y+=` L ${l(i)} ${t} Z`}else{const t=e.x;y=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);y+=` L ${t+c[e]/f*p} ${n}`}y+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:v,stats:Z(t),style:Object.assign(Object.assign({},m),{fillOpacity:null!==(n=m.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(Y(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(Y(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var o,i,r,s,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:f}=e,m=[],p=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return m;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 n=0;for(const o of e.pieceData){const e=g?g(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(o);i.total+=r,i.pieces.push(o),n+=r}k.push({col:e,groups:t,stepTotal:n}),w||n>j&&(j=n)}if(w)for(const e of k){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>j&&(j=o)}if(0===j)return m;const A=new Map;for(const e of b){const t=k[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=k[0].stepTotal,O=w?.95*p:.9*t.width,M=n.scaleLinear().domain([0,j]).range([0,O]),C=null!==(i=e.config.connectorOpacity)&&void 0!==i?i:.3;let _=new Map;for(let t=0;k.length>t;t++){const n=k[t],o=n.col,i=0===t,d=o.width,h=.55*d,g=o.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=p,r=p;for(let s=0;b.length>s;s++){const l=b[s],c=n.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,S=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:j,__funnelStep:o.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});y&&(0===s&&(S.__funnelStepLabel=o.name,S.__funnelStepLabelX=p,S.__funnelStepLabelY=g,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+u/2,S.__funnelValueLabelY=g,S.__funnelBarW=u),m.push(Y(x,g,u,h,w,S,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=n.stepTotal,t=M(e),a=p-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=n.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:o.pieceData[0],d=c?l:o.name,x=f(u,d),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:i,category:c?l:o.name});y&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=g,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=g,k.__funnelBarW=t),m.push(Y(a,g,t,h,x,k,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&_.size>0){const t=w?b:[b[0]];for(const i of t){const t=_.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return f(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.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:C},datum:null!==(u=null===(c=n.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:o.pieceData[0],category:"_default"===i?o.name:i};m.push(a)}}_=v}return m},"bar-funnel":function(e,t){var n,o,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 m=g.length>1&&"_default"!==g[0],p=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}p.push({col:e,groups:t,stepTotal:n})}const y=new Map;for(const e of g){const t=null===(n=p[0])||void 0===n?void 0:n.groups.get(e);y.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=m?g.length:1,x=m?.15:0;for(let e=0;p.length>e;e++){const t=p[e],n=t.col,o=0===e,s=e>0?p[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const p=f.total,b=null!==(i=y.get(h))&&void 0!==i?i:p,x=b>0?p/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:p,j=o?0:Math.max(0,k-p),A=n.x+e*a+l/2,S=v(p),O=v(0)-S,M=c(f.pieces[0],m?h:n.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:p,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:j,__barFunnelCategory:"_default"===h?void 0:h,category:m?h:n.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(p+j)});if(d.push(Y(A,S,u,O,M,C,m?h:n.name)),j>0){const e=v(p+j),t=S-e,o=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:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:m?h:n.name});d.push(Y(A,e,u,t,o,i,m?h:n.name))}}}return d},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,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!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=d?Y(s,n.x,a,n.width,o,null,"__track__"):Y(n.x,s,n.width,a,o,null,"__track__");u.push(i)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=u.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=s?s(n):e.name,c=a(n,i);let f;if(d){const r=l(t),s=l(t+o);f=Y(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);f=Y(e.x,r,e.width,s-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=o}if(m>0&&u.length>n){const e=u.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:d?(t.cornerRadii={tl:m,bl:m},o.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},o.cornerRadii={tl:m,tr:m})}}return u}};class J{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 n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const i=o.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=n.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=t.innerRadius||0;h=n.scaleLinear().domain(a).range([i,o])}else l?(d=n.scaleBand().domain(s).range([0,e.height]).padding(u),h=n.scaleLinear().domain(a).range([0,e.width])):(d=n.scaleBand().domain(s).range([0,e.width]).padding(u),h=n.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(o,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?n.scaleLinear().domain([c,u]).range([0,e.width]):n.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=i;this.rAccessors.length>1&&(g=i.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(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,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){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(n&&void 0===o){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===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.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 n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){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,n,o,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"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct: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 n,o;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!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=U[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;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 n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,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===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.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 n,o,i;const r=this.config,s=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},a=function(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=N[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(r.colorScheme,r.themeCategorical,z),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!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...a]},resolveColor:K(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||z,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];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 n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,J.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._pointQuadtree=o.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const 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!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,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===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,u,d,h,g,f,m,p,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!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)d?(j.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(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 n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(m=t.endAngle)&&void 0!==m?m:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(p=t.innerRadius)&&void 0!==p?p: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:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}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,n,o,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 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)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=b(o.x,e._targetX,s),e.y=b(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=b(o.r,e._targetR,s))}else if("rect"===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)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=b(n.x,e._targetX,s),e.y=b(n.y,e._targetY,s),void 0!==n.w&&(e.w=b(n.w,e._targetW,s),e.h=b(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:b(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=b(n.startAngle,e._targetStartAngle,s),e.endAngle=b(n.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]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);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 n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(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 n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];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 ee(...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 te(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ne(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function oe(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function ie(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>te(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function re(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=ne(Math.atan2(i,o)),a=ne(e.startAngle),l=ne(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 se(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ae(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function le(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function ce(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}J.QUADTREE_THRESHOLD=500;const ue={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function de(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,ue[n])(o(e,t),i),r}function he({swatchSize:t}){return e.jsx("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ge(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const fe=(t,n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,m=[];let p=0;const y=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:w}=d;return f.forEach((t,u)=>{const d=de(t,u,h,g,b),k=ge(t,i,r),j=r&&r.size>0&&r.has(t.label);m.push(e.jsxs("g",{transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===s&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?j||!1:void 0,"aria-current":y&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,j&&e.jsx(he,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),p+=w}),m};function me({config:t,orientation:n="vertical",width:o=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"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(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+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:n,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+n,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 n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(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:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:g}=t,f=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(g),[m,p]=h.useState(0),[y,v]=h.useState(0),b=h.useCallback((e,t)=>{p(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:fe(t,o,i,r,s,a,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:m,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:a,metrics:f}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var g;let f=0;const m=[];t.forEach((t,n)=>{var g;let p=0;t.label&&(p+=16);const y=((t,n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:m}=t,p=[],{swatchSize:y,labelGap:v,itemGap:b,rowHeight:x,align:w}=d,k=!(!n&&!o),j="isolate"===u||void 0===u&&null!=r,A=m.map(e=>y+v+7*e.label.length),S=[];let O=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+b+e;h&&h>0&&M>0&&n>h?(S.push({start:O,end:t,width:M}),O=t,M=e):M=n}),m.length>0&&S.push({start:O,end:m.length,width:M}),S.forEach((t,u)=>{let d="center"===w?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===w?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=m[h],w=de(t,h,g,f,y),S=ge(t,i,r),O=r&&r.size>0&&r.has(t.label);p.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?l===s&&h===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&j?O||!1:void 0,"aria-current":k&&!j&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:k?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+m.length)%m.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(l,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+v+2+7*t.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,O&&e.jsx(he,{swatchSize:y}),e.jsx("text",{y:y/2,x:y+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=A[h]+b}});const C=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:p,offset:C,totalRows:_,totalHeight:_*x}})(t,i,r,s,a,l,c,n,u,d,h,null!==(g=h.maxWidth)&&void 0!==g?g:o);p+=y.offset+5,m.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),f+=p+12});const p=null!==(g=h.maxWidth)&&void 0!==g?g:o;let y=f>p?0:"center"===h.align?Math.max(0,(p-f)/2):"end"===h.align?Math.max(0,p-f):0;const v=[];return m.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${y},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)),y+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${y},0)`,children:o.items},"legend-group-"+i)),y+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:m,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:a,metrics:f}),w=!(!o&&!i);return e.jsxs("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"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}),x]})}function ye(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ve(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!o)return null;const m="top"===a||"bottom"===a,p=!!c,y=Math.max(1,m?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-y-10),b=s.top):"top"===a?(v=s.left,b=p?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(me,{config:o.gradient,orientation:m?"horizontal":"vertical",width:y}):ye(o)?e.jsx(pe,{legendGroups:o.legendGroups,title:"",width:y,orientation:m?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o)});var x}function be(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function xe(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function we(t,n,o,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(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const f=16,m=s?u?[s]:be(s,c):[],p=r?u?[r]:be(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))";m.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:m.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:f,children:t},n))},"annotation-note-title")),v=m.length*f),p.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:p.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:f,children:t},n))},"annotation-note-label"));let w=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(m.length+p.length)*f+(p.length>0?f:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),w=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,m.length+p.length-1)*f;let j=0;return"topBottom"===d?j=0>o?-(k+2):18:"leftRight"===d&&(j="middle"===h?-(k+f+(p.length>0&&m.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),w]})}function ke(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:xe((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function je(t,n,o,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,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.jsx("line",{x1:l,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*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 Ae(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:m={},"data-testid":p}=t,y=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":p},m,{children:[!y.has("connector")&&je(v,b,c,h,x,u),!y.has("subject")&&ke(x,u,h,n,o),!y.has("note")&&we(l,v,b,h)]}))}function Se(t){var n,o;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!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(Ae,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});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(Ae,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Oe(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o: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 Me(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o: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 Ce(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(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)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Oe(e,n),c=Me(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function _e(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Pe={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 Le(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function Re(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=n,{rTickValues:h,axisExtent:g}=n,f="radial"===(null==l?void 0:l.projection),m="horizontal"===(null==l?void 0:l.projection),p=t.useMemo(()=>!l||f?[]:(h||Le(l.r,5,g)).map(e=>({value:e,pixel:l.r(e),label:(d||Te)(e)})),[l,d,f,h,g]),y=u&&l&&!f,v=c&&l&&!f;return y||v?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:[y&&e.jsx("g",{className:"ordinal-grid",children:p.map((t,n)=>e.jsx("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:o,y2:m?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),v&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,m?{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:o,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:o,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 Te(e){return Math.round(100*e)/100+""}function Be(n){var o,i;const{width:a,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:f,showCategoryTicks:m,oLabel:p,rLabel:y,oFormat:v,rFormat:b,showGrid:x,title:w,legend:k,legendHoverBehavior:j,legendClickBehavior:A,legendHighlightedCategory:S,legendIsolatedCategories:O,legendPosition:M="right",legendLayout:C,foregroundGraphics:_,annotations:P,svgAnnotationRules:L,xAccessor:R,yAccessor:T,annotationData:B,underlayRendered:$,children:H}=n,I="radial"===(null==h?void 0:h.projection),E="horizontal"===(null==h?void 0:h.projection),F=!1!==m,D=t.useMemo(()=>f&&F&&h&&!I?h.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=h.o(e))&&void 0!==n?n:0)+h.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,F,h,v,I]),N=n.rTickValues,W=n.tickLabelEdgeAlign,z=n.axisExtent,G=t.useMemo(()=>f&&h&&!I?(N||Le(h.r,5,z)).map(e=>({value:e,pixel:h.r(e),label:(b||Te)(e)})):[],[f,h,b,I,N,z]),q=t.useRef(new Map),V=t.useRef(null!==(o=null==P?void 0:P.length)&&void 0!==o?o:0),X=null!==(i=null==P?void 0:P.length)&&void 0!==i?i:0;V.current!==X&&(V.current=X,q.current=new Map);const Y=t.useMemo(()=>{if(!P||0===P.length)return null;const t=function(t,n,o){var i,a,l,c,u,d,h,f,m,p,y,v,b,x,w,k,j,A,S,O,M,C,_,P,L,R,T,B,$,H,I,E,F,D,N,W,z,G,q,V,X,Y,Q,Z,K,U,J,ee;switch(t.type){case"label":{const i=Ce(t,n,o);if(!i)return null;const{x:r,y:s}=i;return _e(r,s,o)?e.jsx(Se,{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-"+n):null}case"callout":{const i=Ce(t,n,o);if(!i)return null;const{x:r,y:s}=i;return _e(r,s,o)?e.jsx(Se,{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-"+n):null}case"x-threshold":{const i=Oe(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.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-"+n)}case"y-threshold":{const i=Me(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);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=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.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-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Me(Object.assign(Object.assign({},e),{type:"point"}),o),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-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Me(Object.assign(Object.assign({},e),{type:"point"}),o)})).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-"+n)}case"highlight":{const i=o.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((n,i)=>{const r=Oe(n,o),a=Me(n,o);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=Oe(t,o),r=Me(t,o);return e.jsx(Se,{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-"+n)}case"trend":{const r=o.data||[];if(2>r.length)return null;const s=o.xAccessor||"x",f=o.yAccessor||"y",m="ordinal"===o.frameType,p="horizontal"===o.projection,y=m?s:null,v=m?f:null;let b;const x=[],w=new Map;if(m&&y&&v){for(const e of r){const t=e[y];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=r.map(e=>{const t=e[y],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=r.map(e=>[e[s],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(a=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==a?a:null===(l=o.scales)||void 0===l?void 0:l.time,j=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!k||!j)return null;const A=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=k,O=j;let M;if(m)if(p){const e=A(O);M=(t,n)=>[S(n),e(t)]}else{const e=A(S);M=(t,n)=>[e(t),O(n)]}else M=(e,t)=>[S(e),O(t)];const C=t.method||"linear";let _;_="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;n>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 m=u*g-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*f-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===C?g.default.polynomial(b,{order:t.order||2}):g.default.linear(b)).points;const P=_.map(([e,t])=>{const[n,o]=M(e,t);return`${n},${o}`}).join(" "),L=t.color||"#6366f1",R=_[_.length-1],[T,B]=M(R[0],R[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:P,fill:"none",stroke:L,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:T+4,y:B-4,fill:L,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.y)&&void 0!==m?m:null===(p=o.scales)||void 0===p?void 0:p.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:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.time,l=null!==(j=null===(k=o.scales)||void 0===k?void 0:k.y)&&void 0!==j?j:null===(A=o.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=Pe[o.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 m=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:m,fillOpacity:null!==(S=t.fillOpacity)&&void 0!==S?S:.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:m,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(M=null===(O=o.scales)||void 0===O?void 0:O.x)&&void 0!==M?M:null===(C=o.scales)||void 0===C?void 0:C.time,a=null!==(P=null===(_=o.scales)||void 0===_?void 0:_.y)&&void 0!==P?P:null===(L=o.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!==(R=t.threshold)&&void 0!==R?R:2,g=c-h*d,f=!1!==t.showBand,m=t.fill||"#6366f1",p=null!==(T=t.fillOpacity)&&void 0!==T?T:.1,y=t.anomalyColor||"#ef4444",v=null!==(B=t.anomalyRadius)&&void 0!==B?B: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:o.width||0,height:Math.abs(x-b),fill:m,fillOpacity:p}),w.map((t,n)=>{const i=Oe(t,o),r=Me(t,o);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-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:m,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(H=null===($=o.scales)||void 0===$?void 0:$.x)&&void 0!==H?H:null===(I=o.scales)||void 0===I?void 0:I.time,l=null!==(F=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==F?F:null===(D=o.scales)||void 0===D?void 0:D.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,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),m=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-m,2),0),y=null!==(N=t.confidence)&&void 0!==N?N:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(W=t.steps)&&void 0!==W?W: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),n=f*Math.sqrt(1+1/d+(p>0?Math.pow(e-m,2)/p:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}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`,S=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),O=`${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!==(z=t.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),e.jsx("polyline",{points:`${O} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(q=t.strokeDasharray)&&void 0!==q?q:"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-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Ce(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!_e(i,r,o))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!==(Z=t.content)&&void 0!==Z?Z: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-"+n)}case"text":{const i=Ce(t,n,o);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-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(K=o.scales)||void 0===K?void 0:K.o,a=null===(U=o.scales)||void 0===U?void 0:U.x,l=null===(J=o.scales)||void 0===J?void 0:J.y,c=r(s)?s:r(a)?a:r(l)?l:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",g=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,f=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===a)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}},n="horizontal"===(null==h?void 0:h.projection),o=(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:n?h.r:o||h.r,y:n&&o||h.r,time:h.r,value:h.r,o:h.o}:null,timeAxis:"x",xAccessor:R,yAccessor:T,width:a,height:l,data:B,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:q.current};return P.map((e,n)=>{if(L){const o=L(e,n,i);return null!=o?o:t(e,n,i)}return t(e,n,i)}).filter(Boolean)},[P,L,a,l,h,R,T,B]);return f||w||k||_||Y&&Y.length>0||x||H?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&&!$&&e.jsx("g",{className:"ordinal-grid",children:G.map((t,n)=>e.jsx("line",{x1:E?t.pixel:0,y1:E?0:t.pixel,x2:E?t.pixel:a,y2:E?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),f&&h&&!I&&(()=>{const t={fontSize:"var(--semiotic-tick-font-size, 10px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,E?{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!$&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},t),children:n.label})})]},"cat-"+o)),p&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:p})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!$&&e.jsx("line",{x1:0,y1:l,x2:a,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!$&&(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})(),G.map((n,o)=>{const i=W?0===o?"start":o===G.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${n.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:i,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)}),y&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:y})]})]}:{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!$&&(()=>{const t=(null==h?void 0:h.r)?h.r(0):l,n=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((n,o)=>e.jsxs("g",{transform:`translate(${n.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},t),children:n.label})})]},"cat-"+o)),p&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:p})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!$&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)),y&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:y})]})]})})})(),Y,_,H]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof w?w:null}),ve({legend:k,totalWidth:c,totalHeight:u,margin:d,legendPosition:M,title:w,legendLayout:C,legendHoverBehavior:j,legendClickBehavior:A,legendHighlightedCategory:S,legendIsolatedCategories:O})]}):null}function $e(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:{key:void 0,fn:null}}function He({width:n,height:o,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 m=t.useRef(!1),p=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],[n,o]]),t.on("brush end",e=>{if(m.current)return;const t=f.current;if(!t)return;if(!e.selection)return p.current=null,void g.current(null);const[n,o]=e.selection;let i;i=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.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}},[n,o,y]),t.useEffect(()=>{if(!a||!h.current||!p.current)return;if(!d.current)return;const e=p.current,t=l.select(d.current).select(".brush-g"),n=a.r(e.r[0]),o=a.r(e.r[1]);y?(m.current=!0,t.call(h.current.move,[n,o]),m.current=!1):(m.current=!0,t.call(h.current.move,[o,n]),m.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"}})})}function Ie(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Ee(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const Fe=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function De(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=Fe(i,r),t=Fe(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Fe(i,r),t=Fe(i,s),n=Fe(o,s),l=Fe(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return De(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),u=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),d=s-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return De(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const m=r+(g?c:0),p=s-(f?c:0),y=r+(g?u:0),v=s-(f?u:0),b=Fe(i,m),x=Fe(i,p),w=(i-l)*Math.cos(c),k=Fe(w,r),j=Fe(w,s),A=a?null:Fe(o,v),S=a?null:Fe(o,y),O=a?0:(o+l)*Math.cos(u),M=a?null:Fe(O,r),C=a?null:Fe(O,s),_=p-m>Math.PI?1:0,P=a?0:v-y>Math.PI?1:0;let L="";if(g)L+=`M${k.x},${k.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=Fe(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${_} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=Fe(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=Fe(o,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=Fe(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Ne(e){const t=De({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:De({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const We={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ze(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Ge(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const qe="undefined"==typeof window||"undefined"==typeof document,Ve="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Xe=()=>()=>{},Ye=()=>!1,Qe=()=>!0;function Ze(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Ke(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Ue(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 Je=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,et=new WeakMap;let tt=0,nt=!1,ot=null,it=null,rt=null;function st(e,t){var n,o;if(!t)return t;const i=Je.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(nt)return;if("undefined"==typeof window||"undefined"==typeof document)return;nt=!0;const e=()=>{tt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(ot=new MutationObserver(e),ot.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{it=window.matchMedia("(prefers-color-scheme: dark)"),rt=e,"function"==typeof it.addEventListener?it.addEventListener("change",rt):"function"==typeof it.addListener&&it.addListener(rt)}catch(e){}}();let s=et.get(r);s&&s.version===tt||(s={version:tt,map:new Map},et.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}const at=h.createContext(null),lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ct(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],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(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const ut=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},dt="semiotic-accessible-data-table",ht=dt+" semiotic-accessible-data-table-hidden",gt=dt+" semiotic-accessible-data-table-visible",ft={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, 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-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},mt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},pt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},yt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},vt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},bt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},xt={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function wt({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,a]=h.useState(!1),l=h.useContext(at),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:o?`Data summary for ${n} ${o}`:"Data summary for "+n,f=h.useCallback(()=>{s||c||a(!0)},[s,c]),m=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 o?e.jsx("span",{id:o,tabIndex:-1,style:lt}):null;if(!u)return e.jsx("div",{id:o,className:ht,tabIndex:-1,onFocus:f,style:lt,role:"region","aria-label":g,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const p=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,f,m,p,y,v,b,x,w,k,j,A,S;const O=[];if(!Array.isArray(e))return O;for(const M of e)if(M&&"object"==typeof M&&null!==M.datum)try{switch(M.type){case"point":O.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.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!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;O.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":O.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":O.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":O.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":O.push({label:"Arc",values:{id:null!==(p=null===(m=M.datum)||void 0===m?void 0:m.id)&&void 0!==p?p:"",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":O.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":O.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!==(S=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==S?S:""}})}}catch(e){}return O}(t),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ut(e.min)} to ${ut(e.max)}, mean ${ut(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(p.length,y),b=p.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:o,className:gt,tabIndex:-1,onBlur:m,style:ft,role:"region","aria-label":g,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:pt,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:mt,children:v}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:yt,children:[e.jsxs("caption",{className:"semiotic-accessible-data-table-caption",style:xt,children:["First ",b.length," of ",p.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:vt,children:"type"}),w.map(t=>e.jsx("th",{style:vt,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:bt,children:t.label}),w.map(n=>{return e.jsx("td",{style:bt,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":ut(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function kt({summary:t}){return t?e.jsx("div",{role:"note",style:lt,children:t}):null}function jt({tableId:t}){return e.jsx("a",{href:"#"+t,style:lt,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,lt)},children:"Skip to data table"})}function At({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:lt,children:n})}const St="var(--semiotic-focus, #005fcc)";function Ot({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:St,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:St,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:St,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 Mt(e){return Array.isArray(e)?e[0]:e}const Ct={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function _t(e,t){return"function"==typeof t?t(e):e[t]}function Pt(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 Lt(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=_t(t,o);a=Pt(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=_t(t,o);l.push({label:n,value:Pt(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=Pt(t[n],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Pt(t[e[0]],i))}}const c=Object.assign(Object.assign({},Ct),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,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Rt(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=Mt(!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!==(o=t.data)&&void 0!==o?o:{}:t),r=n(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:Ct,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Lt(t):Lt())}}function Tt({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=h.useRef(null),[d,g]=h.useState(null);h.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,i]);let f;f=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const m=function(e){if(!h.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),p=m?null:Ct;return c?e.jsx("div",{ref:u,className:m?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},p||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:f,pointerEvents:"none",zIndex:l,width:"max-content"}),children:s}):null}function Bt(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=$t(n);return[function({children:o,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>$t(n,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:o})},e=>{var n;const o=i(),s=null!==(n=t.useContext(o))&&void 0!==n?n: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 $t(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function Ht(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 It(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:Et})})),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 Et=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Ft={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}},Dt={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}},Nt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Et,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 Wt(e,t){if("light"===t)return Ft;if("dark"===t)return Dt;if("high-contrast"===t)return Nt;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?Dt:Ft;return It(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 It(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[zt,Gt]=Bt(e=>({theme:Ft,setTheme(t){e(e=>({theme:Wt(e.theme,t)}))}}));const qt="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Vt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Xt(e){const n=function(){const[e,n]=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 n(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=function(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&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=Vt(e.foregroundGraphics,r,s),u=Vt(e.backgroundGraphics,r,s),d=Gt(e=>e.theme),{transition:g,introEnabled:f}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),m="semiotic-table-"+h.useId(),p=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{p.current||(p.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{p.current&&(cancelAnimationFrame(p.current),p.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]),S=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 O=e.themeDirtyRef;return qt(()=>{O&&(tt++,O.current=!0,v())},[d,v,O]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:g,introEnabled:f,tableId:m,rafRef:p,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:S}}function Yt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Qt(e,t,n=.3){Yt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Zt(e,t,n=.6){var o,i,r,s,a;if(!Yt(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o: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*n,e.stroke()}function Kt(e,t,n,o=.35){Yt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ut(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)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 Jt(e,t,n){return null==t?n:"string"!=typeof t?t:st(e,t)||n}function en(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,i,r,s);for(const e of n)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(o,i,r,s),[h,g,f]=Ut(e,n);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function tn(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=Ee(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function nn(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 on=(e,t,n,o)=>{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)rn(e,t);else if(t.cornerRadii&&Ie(t.cornerRadii)){const n=Jt(e,t.style.fill,st(e,"var(--semiotic-primary, #007bff)")),o=nn(t),i=t.fillGradient&&"string"==typeof n?en(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,tn(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Jt(e,t.style.fill,st(e,"var(--semiotic-primary, #007bff)")),o=nn(t),i=t.fillGradient&&"string"==typeof n?en(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;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=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Jt(e,t.style.fill,st(e,"var(--semiotic-primary, #007bff)")),o=nn(t),i=t.fillGradient&&"string"==typeof n?en(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Qt(e,t),e.globalAlpha=1}};function rn(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;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+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const sn=(e,t,n,o)=>{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 n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=Jt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Jt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Zt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function an(e,t){var n,o,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=Ne({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=st(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function ln(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 cn(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=s.arc().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}const un=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)an(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(ln(e,t),Kt(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?st(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=De({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),cn(e,t)):(ln(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(ln(e,t),Kt(e,t)),e.globalAlpha=1}}},dn=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=st(e,"var(--semiotic-primary, #007bff)"),a=st(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?st(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?st(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(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},hn=(e,t,n,o)=>{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 n=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?st(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},gn=(e,t,n,o)=>{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 n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=st(e,n.style.stroke)||("string"==typeof n.style.fill?st(e,n.style.fill):n.style.fill)||st(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},fn=(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function mn(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 pn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let yn=null;function vn(e={},t){const{background:n="transparent",stroke:o="#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):(yn||(yn=document.createElement("canvas")),yn.width=e,yn.height=e,yn)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=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 bn=new Map;function xn(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=bn.get(n);if(void 0!==o)return o;const i=vn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return bn.set(n,i),i}function wn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function kn(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 jn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const An=e=>[gn,...e],Sn={bar:An([on]),clusterbar:An([on]),point:An([sn]),swarm:An([sn]),pie:[un],donut:[un],boxplot:An([dn,sn]),violin:An([hn]),histogram:An([on]),ridgeline:An([hn]),timeline:An([on]),funnel:[on,fn,(e,t,n,o)=>{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,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?mn(i):null!=r?`${mn(i)} (${pn(r)})`:mn(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=mn(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[on,(e,t,n,o)=>{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 n=("string"==typeof t.style.fill?t.style.fill:null)||st(e,"var(--semiotic-border, #999)"),o=xn(n,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),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=Ut(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,st(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 n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,u=r?jn(i):"",d=kn(o);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,m=r?32:17,p=n.__barFunnelLabelX,y=p-f/2,v=n.__barFunnelLabelY-m-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),wn(e,y,v,f,m,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),wn(e,y,v,f,m,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,p,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,p,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,p,v+3))}e.lineWidth=1}],swimlane:An([on]),custom:An([on,sn,un,dn,hn,fn])},On={top:50,right:40,bottom:60,left:70},Mn={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 Cn({hover:t}){var n,o,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:Mn,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 o=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:Mn,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[o," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:Mn,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:Mn,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",m=null!==(a=null!==(s=null!==(r=null!==(i=null!==(o=l.__aggregateValue)&&void 0!==o?o: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&&""===m){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:Mn,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:Mn,children:[f&&e.jsx("div",{style:{fontWeight:"bold"},children:f+""}),""!==m&&e.jsx("div",{children:"number"==typeof m?m.toLocaleString():m+""})]})}Cn.ownsChrome=!0;const _n=t.forwardRef(function(n,o){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:S,groupBy:O,multiAxis:M,timeAccessor:C,valueAccessor:_,categoryAccessor:P,projection:L="vertical",size:R=[600,400],responsiveWidth:T,responsiveHeight:B,margin:$,barPadding:H,roundedTop:I,gradientFill:E,trackFill:F,baselinePadding:D,innerRadius:N,cornerRadius:W,normalize:z,startAngle:G,sweepAngle:q,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:Z,connectorOpacity:K,showLabels:U,connectorAccessor:ne,connectorStyle:ue,dataIdAccessor:de,rExtent:he,oExtent:ge,extentPadding:fe=.05,oSort:me,windowMode:pe="sliding",windowSize:ye=200,pieceStyle:ve,summaryStyle:be,colorScheme:xe,barColors:we,showAxes:ke=!0,showCategoryTicks:je,categoryLabel:Ae,valueLabel:Se,categoryFormat:Oe,valueFormat:Me,oLabel:Ce,rLabel:_e,oFormat:Pe,rFormat:Le,rTickValues:Te,tickLabelEdgeAlign:Fe,axisExtent:Je,enableHover:et=!0,hoverAnnotation:tt,tooltipContent:nt,customHoverBehavior:ot,annotations:it,svgAnnotationRules:rt,showGrid:at=!1,legend:lt,legendHoverBehavior:ut,legendClickBehavior:dt,legendHighlightedCategory:ht,legendIsolatedCategories:gt,legendPosition:ft,legendLayout:mt,legendCategoryAccessor:pt,onCategoriesChange:yt,backgroundGraphics:vt,foregroundGraphics:bt,title:xt,className:St,background:Ct,centerContent:_t,decay:Pt,pulse:Lt,transition:Rt,animate:Bt,staleness:$t,brush:It,onBrush:Et,accessibleTable:Ft=!0,description:Dt,summary:Nt,customLayout:Wt,layoutConfig:zt}=n,Gt=t.useRef(!0),qt=Xt({sizeProp:R,responsiveWidth:T,responsiveHeight:B,userMargin:$,marginDefault:On,foregroundGraphics:bt,backgroundGraphics:vt,animate:Bt,transitionProp:Rt,themeDirtyRef:Gt}),{reducedMotionRef:Vt,responsiveRef:Yt,size:Qt,margin:Zt,adjustedWidth:Kt,adjustedHeight:Ut,resolvedForeground:Jt,resolvedBackground:en,currentTheme:tn,transition:nn,introEnabled:on,tableId:rn,rafRef:sn,renderFnRef:an,scheduleRender:ln}=qt,cn=function(){const[e,n]=t.useState(!1);return Ve(()=>{n(!0)},[]),e}(),un=function(){const e=t.useSyncExternalStore(Xe,Ye,Qe);return t.useRef(e).current}(),dn=t.useMemo(()=>m(w),[w]),hn=null!=Ae?Ae:Ce,gn=null!=Se?Se:_e,fn=null!=Oe?Oe:Pe,mn=null!=Me?Me:Le,pn=t.useRef(null),yn=t.useRef(null),vn=t.useRef([]),bn=t.useRef(pt),xn=t.useRef(yt);bn.current=pt,xn.current=yt;const[wn,kn]=t.useState(null),[jn,An]=t.useState(null),[Mn,_n]=t.useState(0),[Pn,Ln]=t.useState(!1),[Rn,Tn]=t.useState(null),Bn=t.useCallback(()=>{var e,t;Tn(null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),$n=et||tt,Hn="streaming"===x,In=t.useMemo(()=>{var e,t,n;return{chartType:b,runtimeMode:Hn?"streaming":"bounded",windowSize:ye,windowMode:pe,extentPadding:fe,projection:L,oAccessor:Hn?void 0:k,rAccessor:Hn?void 0:j,colorAccessor:A,stackBy:S,groupBy:O,multiAxis:M,timeAccessor:Hn?C:void 0,valueAccessor:Hn?_||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:Hn?P||k:void 0,rExtent:he,oExtent:ge,axisExtent:Je,barPadding:H,roundedTop:I,gradientFill:E,trackFill:F,baselinePadding:D,innerRadius:N,cornerRadius:W,normalize:z,startAngle:G,sweepAngle:q,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:Z,connectorOpacity:K,showLabels:U,connectorAccessor:ne,connectorStyle:ue,dataIdAccessor:de,oSort:me,pieceStyle:ve,summaryStyle:be,colorScheme:xe,themeCategorical:null===(e=null==tn?void 0:tn.colors)||void 0===e?void 0:e.categorical,themeSemantic:Ht(tn),themeSequential:null===(t=null==tn?void 0:tn.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==tn?void 0:tn.colors)||void 0===n?void 0:n.diverging,barColors:we,decay:Pt,pulse:Lt,transition:nn,introAnimation:on,staleness:$t,customLayout:Wt,layoutConfig:zt,layoutMargin:Zt}},[b,ye,pe,fe,L,k,j,A,S,O,M,C,_,P,he,ge,Je,H,I,E,F,D,N,W,z,G,q,V,X,Y,Q,Z,K,U,ne,ue,de,me,ve,be,xe,we,Pt,Lt,null==nn?void 0:nn.duration,null==nn?void 0:nn.easing,on,$t,Hn,tn,Wt,zt,Zt]),En=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ke(e,t);if(!Ue(e)||!Ue(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Ke(n,i))return!1}else{if(!Ue(n)||!Ue(i))return!1;if(!Ze(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(In),Fn=t.useRef(null);Fn.current||(Fn.current=new J(En));const Dn=t.useCallback(()=>{var e,t;const n=bn.current,o=xn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];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+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,vn.current)||(vn.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Fn.current)||void 0===e||e.updateConfig(En),Gt.current=!0,ln()},[En,ln]);const Nn=t.useRef(null);Nn.current||(Nn.current=new p(e=>{const t=Fn.current;t&&t.ingest(e)&&(Gt.current=!0,ln())}));const Wn=t.useCallback(e=>{var t;null===(t=Nn.current)||void 0===t||t.push(e)},[]),zn=t.useCallback(e=>{var t;null===(t=Nn.current)||void 0===t||t.pushMany(e)},[]),Gn=t.useCallback(()=>{var e,t;null===(e=Nn.current)||void 0===e||e.clear(),null===(t=Fn.current)||void 0===t||t.clear(),Gt.current=!0,ln()},[ln]),qn=t.useCallback(e=>{var t,n;null===(t=Nn.current)||void 0===t||t.clearLastData(),null===(n=Nn.current)||void 0===n||n.setReplacementData(e)},[]);t.useImperativeHandle(o,()=>({push:Wn,pushMany:zn,replace:qn,remove:e=>{var t,n,o,i;null===(t=Nn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=Fn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=yn.current)||void 0===i?void 0:i.data;!!yn.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(yn.current=null,kn(null)),Gt.current=!0,ln()}return r},update:(e,t)=>{var n,o,i;null===(n=Nn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Fn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Gt.current=!0,ln()),r},clear:Gn,getData:()=>{var e,t,n;return null===(e=Nn.current)||void 0===e||e.flush(),null!==(n=null===(t=Fn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Wn,zn,qn,Gn,ln]),t.useEffect(()=>{var e;w&&(null===(e=Nn.current)||void 0===e||e.setBoundedData(dn))},[w,dn]);const{hoverHandlerRef:Vn,hoverLeaveRef:Xn,onPointerMove:Yn,onPointerLeave:Qn}=qt;Vn.current=e=>{if(!$n)return;const t=pn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Zt.left,i=e.clientY-n.top-Zt.top;if(0>o||o>Kt||0>i||i>Ut)return void(yn.current&&(yn.current=null,kn(null),ot&&ot(null),ln()));const r=Fn.current;if(!r||0===r.scene.length)return;const s="radial"===L,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+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-n,a=Math.sqrt(r*r+s*s);te(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,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,n);break;case"point":if(i)break;e=ie(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=re(r,t,n);break;case"boxplot":e=se(r,t,n);break;case"violin":e=ae(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Kt/2:o,s?i-Ut/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(yn.current&&(yn.current=null,kn(null),ot&&ot(null),ln()));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:Mt(c),x:u,y:d,__semioticHoverData:!0},h));var c,u,d,h;yn.current=l,kn(l),ot&&(ot(l),Gt.current=!0),ln()},Xn.current=()=>{yn.current&&(yn.current=null,kn(null),ot&&(ot(null),Gt.current=!0),ln())};const Zn=t.useRef(-1),Kn=t.useRef(null),Un=t.useRef(null),Jn=t.useCallback(e=>{const t=Fn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Un.current&&Un.current.version===n)o=Un.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";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!==(o=r.group)&&void 0!==o?o: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){if(null===r.datum)continue;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;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.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===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),Un.current={version:n,graph:o}}const i=Zn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Zn.current=0;const t=o.flat[0];Kn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},ce(t)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b});return yn.current=n,kn(n),ot&&ot(n),void ln()}const r=function(e,t){var n,o;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!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);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=n.groups.indexOf(o);return n.groups.length-1>e?le(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?le(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return Zn.current=-1,Kn.current=null,yn.current=null,kn(null),ot&&ot(null),void ln();Zn.current=s;const a=o.flat[s];Kn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},ce(a)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b});yn.current=l,kn(l),ot&&ot(l),ln()},[ot,ln]),eo=t.useCallback(e=>{Zn.current=-1,Kn.current=null,Yn(e)},[Yn]);an.current=()=>{var e,t;sn.current=0;const n=pn.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Fn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Vt.current?r+1e6:r),a=!Vt.current&&s,l=Gt.current;l&&!s&&(i.computeScene({width:Kt,height:Ut}),Dn(),Bn(),Gt.current=!1),(l||a)&&n.setAttribute("aria-label",ct(i.scene,b+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=Qt[0]*c,d=Qt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Qt[0]+"px",n.style.height=Qt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Qt[0],Qt[1]);const h=null!==(e=null==$t?void 0:$t.threshold)&&void 0!==e?e:5e3,g=$t&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==$t?void 0:$t.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Ct&&!vt){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=Ct||(e&&"transparent"!==e?e:null),i=t?st(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,Qt[0],Qt[1]))}const f="radial"===L;o.save(),o.beginPath(),o.rect(Zt.left,Zt.top,Kt,Ut),o.clip(),f?(o.save(),o.translate(Zt.left+Kt/2,Zt.top+Ut/2)):o.translate(Zt.left,Zt.top);const m=Wt?Sn.custom:Sn[b]||[],p={width:Kt,height:Ut};for(const e of m)e(o,i.scene,i.scales,p);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(An(i.scales),_n(e=>e+1)),(null==$t?void 0:$t.showBadge)&&Ln(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(sn.current=requestAnimationFrame(()=>an.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;Ve(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);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:cn,wasHydratingFromSSR:un,storeRef:Fn,dirtyRef:Gt,renderFnRef:an,cleanup:()=>{var e;return null===(e=Nn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Gt.current=!0,ln()},[b,Kt,Ut,ke,Ct,ln]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}($t,Fn,Gt,ln,Pn,Ln);const to=$n&&wn?nt?nt(wn):e.jsx(Cn,{hover:wn}):null,no="radial"===L,oo=to?e.jsx(Tt,{x:wn?no?wn.x+Kt/2:wn.x:0,y:wn?no?wn.y+Ut/2:wn.y:0,containerWidth:Kt,containerHeight:Ut,margin:Zt,className:"stream-ordinal-tooltip",children:to}):null,io=$e(k,0,"__semiotic_resolvedO"),ro=$e(j,0,"__semiotic_resolvedR"),so=io.key,ao=ro.key,lo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(io,ro,it&&it.length>0||!1);if(qe||!cn&&un){const t=Fn.current;t&&w&&(t.ingest({inserts:dn,bounded:!0}),t.computeScene({width:Kt,height:Ut}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===L,c=l?Zt.left+Kt/2:Zt.left,u=l?Zt.top+Ut/2:Zt.top;return e.jsxs("div",{ref:Yt,className:"stream-ordinal-frame"+(St?" "+St:""),role:"img","aria-label":Dt||("string"==typeof xt?xt:"Ordinal chart"),style:{position:"relative",width:T?"100%":Qt[0],height:B?"100%":Qt[1]},children:[e.jsx(kt,{summary:Nt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Qt[0],height:Qt[1],style:{position:"absolute",left:0,top:0},children:[en&&e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:en}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[Ct&&e.jsx("rect",{x:0,y:0,width:Kt,height:Ut,fill:Ct}),n.map((t,n)=>function(t,n,o){var i,r,a,l,c,u,d,g,f;const m=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",p=e=>`ord-${t.type}-${m}-${n}-${e}`,y=`ord-${t.type}-${m}-${n}`;switch(t.type){case"rect":{const n=t,o=Ge(y)+"-grad",i=function(t,n){const o=t.fillGradient;if(!o)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 o){const t=o.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 n=0;t.length>n;n++)l.push(e.jsx("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=ze(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(n,o),r=i?`url(#${o})`:ze(n.style.fill);if(n.cornerRadii&&Ie(n.cornerRadii)){const t=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=Ee(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(n);return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:t,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:s,w:a,h:l}=n;let c;switch(n.roundedEdge){case"right":c=`M${o},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+t},${s} A${t},${t} 0 0 0 ${o},${s+t} L${o},${s+l-t} A${t},${t} 0 0 0 ${o+t},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o+t},${s+l} A${t},${t} 0 0 1 ${o},${s+l-t} Z`;break;default:c=`M${o},${s+l} L${o},${s+t} A${t},${t} 0 0 1 ${o+t},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l} Z`}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:ze(n.style.fill),opacity:null!==(i=n.style.opacity)&&void 0!==i?i:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},y)}case"wedge":{const i=t;if(i._gradientBand&&i._gradientBand.colors.length>0){const t=Ge(`${o?o+"-":""}gauge-grad-${i.category||y}-${n}`),{clipPath:s,slices:u}=Ne({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:null===(a=null===(r=i.roundedEnds)||void 0===r?void 0:r.start)||void 0===a||a,roundEnd:null===(c=null===(l=i.roundedEnds)||void 0===l?void 0:l.end)||void 0===c||c,colors:i._gradientBand.colors});return e.jsxs("g",{transform:`translate(${i.cx},${i.cy})`,opacity:i.style.opacity,fillOpacity:i.style.fillOpacity,children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("path",{d:s})})}),e.jsx("g",{clipPath:`url(#${t})`,children:u.map((t,n)=>e.jsx("path",{d:t.d,fill:ze(t.color)},n))}),i.style.stroke&&"none"!==i.style.stroke&&e.jsx("path",{d:s,fill:"none",stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},y)}let u;if(i.roundedEnds)u=De({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:i.roundedEnds.start,roundEnd:i.roundedEnds.end});else{const e=s.arc().innerRadius(i.innerRadius).outerRadius(i.outerRadius).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2);i.cornerRadius&&e.cornerRadius(i.cornerRadius),u=e(We)||""}return e.jsx("path",{d:u,transform:`translate(${i.cx},${i.cy})`,fill:ze(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},y)}case"boxplot":{const n=t,o=n.columnWidth/2;return e.jsxs("g","vertical"===n.projection?{children:[e.jsx("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:ze(n.style.fill),fillOpacity:null!==(u=n.style.fillOpacity)&&void 0!==u?u:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:ze(n.style.fill),fillOpacity:null!==(d=n.style.fillOpacity)&&void 0!==d?d:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1})]},y)}case"violin":{const n=t,o=[e.jsx("path",{d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:ze(n.style.fill),fillOpacity:null!==(g=n.style.fillOpacity)&&void 0!==g?g:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1},p("path"))];if(n.iqrLine&&n.bounds){const t=n.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?o.push(e.jsx("line",{x1:i,y1:n.iqrLine.q1Pos,x2:i,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2},p("iqr")),e.jsx("circle",{cx:i,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},p("med"))):o.push(e.jsx("line",{x1:n.iqrLine.q1Pos,y1:r,x2:n.iqrLine.q3Pos,y2:r,stroke:n.style.stroke||"#333",strokeWidth:2},p("iqr")),e.jsx("circle",{cx:n.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},p("med")))}return e.jsx("g",{children:o},y)}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!==(f=t.style.opacity)&&void 0!==f?f:.5},y);case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:o,fill:ze(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},y)}default:return null}}(t,n,rn)).filter(Boolean)]})]}),e.jsx(Be,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:o,showAxes:ke,showCategoryTicks:je,oLabel:hn,rLabel:gn,oFormat:fn,rFormat:mn,rTickValues:Te,tickLabelEdgeAlign:Fe,axisExtent:Je,showGrid:at,title:xt,legend:lt,legendHoverBehavior:ut,legendClickBehavior:dt,legendHighlightedCategory:ht,legendIsolatedCategories:gt,legendPosition:ft,legendLayout:mt,foregroundGraphics:ee(Jt,null===(a=Fn.current)||void 0===a?void 0:a.customLayoutOverlays),annotations:it,svgAnnotationRules:rt,annotationFrame:0,xAccessor:so,yAccessor:ao,annotationData:lo(null==t?void 0:t.getData())}),_t&&"radial"===L&&e.jsx("div",{style:{position:"absolute",left:Zt.left+Kt/2,top:Zt.top+Ut/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:_t})]})}return e.jsxs("div",{ref:Yt,className:"stream-ordinal-frame"+(St?" "+St:""),role:"group","aria-label":Dt||("string"==typeof xt?xt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":Qt[0],height:B?"100%":Qt[1],overflow:"visible"},onKeyDown:Jn,children:[Ft&&e.jsx(jt,{tableId:rn}),Ft&&e.jsx(wt,{scene:null!==(c=null===(l=Fn.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:b+" chart",tableId:rn,chartTitle:"string"==typeof xt?xt:void 0}),e.jsx(kt,{summary:Nt}),e.jsxs("div",{role:"img","aria-label":Dt||("string"==typeof xt?xt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:$n?eo:void 0,onMouseLeave:$n?Qn:void 0,children:[en&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:Qt[0],height:Qt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:en})}),e.jsx(Re,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:jn,showAxes:ke,showGrid:at,rFormat:mn,rTickValues:Te,axisExtent:Je}),e.jsx("canvas",{ref:pn,"aria-label":ct(null!==(d=null===(u=Fn.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:Qt[0],height:Qt[1]}}),e.jsx(At,{hoverPoint:wn}),e.jsx(Be,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:jn,showAxes:ke,showCategoryTicks:je,oLabel:hn,rLabel:gn,oFormat:fn,rFormat:mn,rTickValues:Te,axisExtent:Je,showGrid:at,title:xt,legend:lt,legendHoverBehavior:ut,legendClickBehavior:dt,legendHighlightedCategory:ht,legendIsolatedCategories:gt,legendPosition:ft,legendLayout:mt,foregroundGraphics:ee(Jt,Rn),annotations:it,svgAnnotationRules:rt,annotationFrame:Mn,xAccessor:so,yAccessor:ao,annotationData:lo(null===(g=Fn.current)||void 0===g?void 0:g.getData()),underlayRendered:!0}),(It||Et)&&"radial"!==L&&e.jsx(He,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:jn,onBrush:Et||(()=>{})}),_t&&"radial"===L&&e.jsx("div",{style:{position:"absolute",left:Zt.left+Kt/2,top:Zt.top+Ut/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:_t}),(null==$t?void 0:$t.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===$t.badgePosition?{top:4,left:4}:"bottom-left"===$t.badgePosition?{bottom:4,left:4}:"bottom-right"===$t.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Pn?"#dc3545":"#28a745",color:"white"}),children:Pn?"STALE":"LIVE"}),e.jsx(Ot,{active:Zn.current>=0,hoverPoint:wn,margin:Zt,size:Qt,shape:null===(f=Kn.current)||void 0===f?void 0:f.shape,width:null===(y=Kn.current)||void 0===y?void 0:y.w,height:null===(v=Kn.current)||void 0===v?void 0:v.h}),oo]})]})});function Pn(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a}=e,l={};return t&&(l.title=t),n&&(l.description=n),o&&(l.summary=o),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),void 0!==a&&(l.axisExtent=a),l}function Ln(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function Rn(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Rt(t)||n}}_n.displayName="StreamOrdinalFrame";const Tn=t.createContext(null);function Bn(){return t.useContext(Tn)}function $n(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Hn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[In,En]=Bt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Hn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Hn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Fn,Dn]=Bt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let Nn={positions:new Map};const Wn=new Set;function zn(){for(const e of Wn)e()}function Gn(e,t){const n=Nn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Nn.positions);o.delete(e),Nn={positions:o},zn()}function qn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=En(e=>e.selections.get(i)),s=En(e=>e.setClause),a=En(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 n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push($n(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{a(i,o)},[a,i,o]),clientId:o}}function Vn(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const Xn=t.createContext(!1),Yn=t.createContext(null),Qn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Zn(e){const n=t.useContext(Yn),o=t.useId(),i=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=t.useRef([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,i)||(r.current=i);const s=r.current;Qn(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),Qn(()=>{n&&n.registerCategories(o,s)},[n,o,s])}function Kn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},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?o(s,t,n):n?n(i):z[r%z.length];return{label:i+"",color:a}}),label:""}]}}function Un(){return Gt(e=>e.theme)}function Jn(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function eo(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 to(){var e;const t=Un(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function no(e,n,o){return t.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return e;const t=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return t.sort("asc"===n?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,n,o])}h.createContext(void 0);const oo={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 io(e,t,n){var o,i,r,s,a,l,c;const u=oo[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.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:ro(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function ro(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function so(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function ao(e,t){if(!t)return so(e);try{const n=t(e);return null==n?so(e):n}catch(t){return so(e)}}function lo(e,t){return"function"==typeof t?t(e):e[t]}function co({categoryAccessor:t,valueAccessor:n,groupAccessor:o,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=lo(c,t),d=lo(c,n),h=o?lo(c,o):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:Ct,children:[e.jsx("div",{style:{fontWeight:"bold"},children:so(u)}),e.jsx("div",{style:{marginTop:4},children:ao(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||(g=o,"string"==typeof g?g:"value"),": ",so(h)]})]});var g}}function uo({componentName:t,message:n,diagnosticHint:o,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:n}),o&&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:o})]})})}class ho extends h.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(uo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var go;const fo="undefined"!=typeof process&&"production"!==(null===(go=process.env)||void 0===go?void 0:go.NODE_ENV);function mo({componentName:t,width:n,height:o,children:i}){return e.jsx(ho,{fallback:i=>e.jsx(uo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const po={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"},yo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function vo(e,t,n,o){if(!fo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function bo(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function xo(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=bo(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function wo({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=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(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=xo(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function ko(n){const{data:o,rawData:i,colorBy:r,colorScheme:s,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:f,chartId:p,showLegend:y,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,loading:k,loadingContent:j,emptyContent:A,width:S,height:O}=n,M=void 0===i,C=t.useMemo(()=>m(o),[o]),[_,P]=t.useState([]),L=t.useCallback(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),R="string"==typeof n.colorBy?n.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:B,customHoverBehavior:$,customClickBehavior:H,crosshairSourceId:I}=function({selection:e,linkedHover:n,fallbackFields:o=[],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}(n,o),g=qn({name:(null==e?void 0:e.name)||"__unused__"}),f=function(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=qn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:i,isActive:r}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),m=Dn(e=>e.pushObservation),p=e?{isActive:g.isActive,predicate:g.predicate}:null,[y,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==y||!b)return null;const e=y,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,y,b]),w=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=Jn(e,t,h.xField);null!=n&&function(e,t,n){const o=Nn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Nn={positions:new Map(Nn.positions).set(e,{xValue:t,sourceId:n})},zn())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&f.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Gn(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 n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(r||m){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=eo(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),m&&m(e)}}},[n,f,h,d,r,s,a,m,c,b]),k=t.useCallback(e=>{var t,n,o,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 n=Jn(e,t,h.xField);null!=n&&function(e,t,n){const o=Nn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Nn.positions);return t.delete(e),Nn={positions:t},zn(),!1}Nn={positions:new Map(Nn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},zn()}(h.name||"hover",n,d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||m){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const n=eo(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),m&&m(e)}}},[l,r,m,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 n=Nn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Nn.positions);o.delete(e),Nn={positions:o},zn()}(e,d),Gn(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:p,hoverSelectionHook:x,customHoverBehavior:w,customClickBehavior:k,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:f,chartId:p,onClick:x,hoverHighlight:w,colorByField:R}),E=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(u,I),F=function(e,n,o){const i=Bn(),r=to();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(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,n,s);return e=>i[e]||t(e)}return V(e,n,s)}if(i&&Object.keys(i).length>0){const e=V([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}(C,r,s),D=t.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of C){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[C,r]),N=t.useMemo(()=>M&&_.length>0?_:D,[M,_,D]),W=function(e,n,o){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 n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,r,N),G=t.useMemo(()=>B||(W.legendSelectionHook?W.legendSelectionHook:T),[B,W.legendSelectionHook,T]),X=function(e){const n=Gt(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}(c),Y=to(),Q=Bn(),Z=t.useMemo(()=>{if(F)return F;if(!r||0===N.length)return;const e=Array.isArray(s)&&s.length>0||"string"==typeof s&&s.length>0?s:Y&&Y.length>0?Y:z,t="__streamCat",n=V(N.map(e=>({[t]:e})),t,e);return e=>(null==Q?void 0:Q[e])||n(e)||"#999"},[F,r,N,s,Y,Q]),{legend:K,margin:U,legendPosition:J}=function({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(Xn),u=null!==t.useContext(Yn),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),g=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[l,n,e,h]);Zn(u&&n?g:[]);const f=t.useMemo(()=>{if(!d||!n)return;const t=Kn({data:e,colorBy:n,colorScale:o,getColor:q,categories:g});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,g]),m=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,s,f,r]);return{legend:f,margin:m,legendPosition:r}}({data:C,colorBy:r,colorScale:Z,showLegend:y,legendPosition:l,userMargin:v,defaults:b,categories:N}),ee=t.useMemo(()=>{const e={};return K&&(e.legend=K,e.legendPosition=J),a&&"none"!==a&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),M&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=L),e},[K,J,a,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,M,r,L]),te=Array.isArray(i)?m(i):i,ne=function(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},yo),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(k,S,O,j),oe=ne?null:function(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},po),{width:n,height:o}),children:i||"No data available"}):null}(te,S,O,A);return{data:C,colorScale:F,allCategories:N,legendState:W,effectiveSelectionHook:G,activeSelectionHook:T,customHoverBehavior:$,customClickBehavior:H,legend:K,margin:U,legendPosition:J,earlyReturn:ne||oe||null,legendBehaviorProps:ee,crosshairProps:E,resolvedSelection:X}}function jo({ref:e,frameRef:n,setup:o}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i;return null!==(i=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[n]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}function Ao(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function So(e){const{colorBy:n,colorScale:o,color:i,themeCategorical:r,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:p=!1}=e,y=t.useMemo(()=>(e,t)=>{const l="function"==typeof m?m(e,t):m,c=l?Object.assign({},l):{};if(void 0===c.fill)if(n){if(!o)return c;c.fill=q(e,n,o)}else c.fill=function(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=N[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}(i,r,s,f?t:void 0,a);return p&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[n,o,i,r,s,a,f,m,p]),v=t.useMemo(()=>Ao(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},y(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},y(e,t)),l):y,{stroke:c,strokeWidth:u,opacity:d}),[y,l,c,u,d]);return t.useMemo(()=>{return e=v,n=g,(t=null!=h?h:null)?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e;var e,t,n},[v,h,g])}function Oo(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}const Mo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),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:p=!1,barPadding:y=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,regression:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:B,legendInteraction:$,legendPosition:H,color:I,stroke:E,strokeWidth:F,opacity:D,showCategoryTicks:N,categoryFormat:W,dataIdAccessor:z}=n,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>m(s),[s]),ne=ko({data:te,rawData:s,colorBy:g,colorScheme:f,legendInteraction:$,legendPosition:H,selection:O,linkedHover:M,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:B,width:G,height:q}),{effectiveLegendProps:oe,effectiveMargin:ie}=jo({ref:o,frameRef:r,setup:ne});if(ne.earlyReturn)return ne.earlyReturn;vo("BarChart",te,"categoryAccessor",c),vo("BarChart",te,"valueAccessor",u);const re=no(te,p,u),se=to(),ae=t.useMemo(()=>new Map,[te]),le=So({colorBy:g,colorScale:ne.colorScale,color:I,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:E,strokeWidth:F,opacity:D,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=t.useMemo(()=>co({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),ue=wo({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(uo,{componentName:"BarChart",message:ue,width:G,height:q});const de=Oo(j),he=de?[de,...k||[]]:k,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(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:re}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,barPadding:y}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:V,showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:N,oSort:p}),oe),Pn({title:Q,description:Z,summary:K,accessibleTable:U,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:w,defaultTooltipContent:ce})),Ln({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"BarChart",width:G,height:q,children:e.jsx(_n,Object.assign({ref:r},ge))})});Mo.displayName="BarChart";const Co=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),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:p,normalize:y=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:B,legendInteraction:$,legendPosition:H,color:I,stroke:E,strokeWidth:F,opacity:D,categoryFormat:N}=n,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=t.useMemo(()=>m(s),[s]),ee=f||u,te=ko({data:J,rawData:s,colorBy:ee,colorScheme:p,legendInteraction:$,legendPosition:H,selection:O,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:B,width:W,height:z});if(te.earlyReturn)return te.earlyReturn;const ne=to(),oe=t.useMemo(()=>new Map,[J]),ie=So({colorBy:ee,colorScale:te.colorScale,color:I,themeCategorical:ne,colorScheme:p,categoryIndexMap:oe,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:E,strokeWidth:F,opacity:D,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=t.useMemo(()=>co({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),se=wo({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=jo({ref:o,frameRef:r,setup:te}),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:"bar"},null!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:v,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:g}),N&&{oFormat:N}),{showGrid:q}),ae),Pn({title:X,description:Y,summary:Q,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:k,defaultTooltipContent:re})),Ln({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),j&&j.length>0&&{annotations:j}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return se?e.jsx(uo,{componentName:"StackedBarChart",message:se,width:W,height:z}):e.jsx(mo,{componentName:"StackedBarChart",width:W,height:z,children:e.jsx(_n,Object.assign({ref:r},ce))})});Co.displayName="StackedBarChart";const _o=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),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:p,sort:y=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:B,legendPosition:$,color:H,stroke:I,strokeWidth:E,opacity:F,categoryFormat:D}=n,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=i,U=t.useMemo(()=>m(s),[s]),J=f||u,ee=ko({data:U,rawData:s,colorBy:J,colorScheme:p,legendInteraction:B,legendPosition:$,selection:S,linkedHover:O,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:N,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=to(),ne=t.useMemo(()=>new Map,[U]),oe=So({colorBy:J,colorScale:ee.colorScale,color:H,themeCategorical:te,colorScheme:p,categoryIndexMap:ne,userPieceStyle:A.pieceStyle,stroke:I,strokeWidth:E,opacity:F,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=t.useMemo(()=>co({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),re=wo({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=jo({ref:o,frameRef:r,setup:ee}),le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:U}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ae,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:K,rFormat:g}),D&&{oFormat:D}),{showGrid:G}),se),Pn({title:V,description:X,summary:Y,accessibleTable:Q,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:w,defaultTooltipContent:ie})),Ln({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,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 re?e.jsx(uo,{componentName:"GroupedBarChart",message:re,width:N,height:W}):e.jsx(mo,{componentName:"GroupedBarChart",width:N,height:W,children:e.jsx(_n,Object.assign({ref:r},le))})});function Po({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:i}){const r=(s="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(e){const{name:n,xField:o,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=qn({name:n}),c=o&&i?"xyBrush":o?"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)?(o&&(t[o]=[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&&Vn(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Vn(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,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==n||n(e)},[n,r]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}_o.displayName="GroupedBarChart";const Lo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),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:p,barPadding:y,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:j={},selection:A,linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,chartId:_,loading:P,loadingContent:L,emptyContent:R,legendInteraction:T,legendPosition:B,color:$,stroke:H,strokeWidth:I,opacity:E,categoryFormat:F,rTickValues:D,tickLabelEdgeAlign:N,showCategoryTicks:W,gradientFill:z,trackFill:G,roundedTop:q,valueExtent:V}=n,{width:X,height:Y,enableHover:Q,showGrid:Z,showLegend:K,title:U,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=i,ie=t.useMemo(()=>m(s),[s]),re=f||u,se=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==n.mode)return 40;const e=new Set(ie.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?Y:X)-2*t)/(t-1))):1},[y,n.mode,ie,c,h,X,Y]),ae=ko({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:T,legendPosition:B,selection:A,linkedHover:S,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:_,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:P,loadingContent:L,emptyContent:R,width:X,height:Y}),le=Po({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:d});if(ae.earlyReturn)return ae.earlyReturn;const ce=to(),ue=t.useMemo(()=>new Map,[ie]),de=So({colorBy:re,colorScale:ae.colorScale,color:$,themeCategorical:ce,colorScheme:p,categoryIndexMap:ue,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:H,strokeWidth:I,opacity:E,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=t.useMemo(()=>co({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ge=wo({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:fe,effectiveMargin:me}=jo({ref:o,frameRef:r,setup:ae}),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:ie}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[X,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:me,barPadding:se,enableHover:Q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===W?void 0:ne,rLabel:oe,rFormat:g}),D&&{rTickValues:D}),null!=N&&{tickLabelEdgeAlign:N}),F&&{oFormat:F}),void 0!==W&&{showCategoryTicks:W}),{showGrid:Z}),fe),Pn({title:U,description:J,summary:ee,accessibleTable:te,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:he})),Ln({linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),b&&b.length>0&&{annotations:b}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=G&&{trackFill:G}),null!=q&&{roundedTop:q}),V&&{rExtent:V}),le.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(uo,{componentName:"SwimlaneChart",message:ge,width:X,height:Y}):e.jsx(mo,{componentName:"SwimlaneChart",width:X,height:Y,children:e.jsx(_n,Object.assign({ref:r},pe))})});function Ro(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);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,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}Lo.displayName="SwimlaneChart";const To=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ro(o,{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:p,sizeRange:y=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:j,brush:A,onBrush:S,linkedBrush:O,frameProps:M={},selection:C,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:R,chartId:T,loading:B,loadingContent:$,emptyContent:H,legendInteraction:I,legendPosition:E,color:F,stroke:D,strokeWidth:N,opacity:W,showCategoryTicks:z,categoryFormat:G}=n,{width:q,height:V,enableHover:Y,showGrid:Q,showLegend:Z,title:K,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ne}=i,oe=t.useMemo(()=>m(s),[s]),ie=ko({data:oe,rawData:s,colorBy:g,colorScheme:f,legendInteraction:I,legendPosition:E,selection:C,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:R,chartType:"SwarmPlot",chartId:T,showLegend:Z,userMargin:a,marginDefaults:i.marginDefaults,loading:B,loadingContent:$,emptyContent:H,width:q,height:V}),re=Po({brushProp:A,onBrushProp:S,linkedBrush:O,valueAccessor:u});if(ie.earlyReturn)return ie.earlyReturn;const se=t.useMemo(()=>{if(!p)return;const e=oe.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[oe,p]),ae=to(),le=t.useMemo(()=>new Map,[oe]),ce=So({colorBy:g,colorScale:ie.colorScale,color:F,themeCategorical:ae,colorScheme:f,categoryIndexMap:le,userPieceStyle:null==M?void 0:M.pieceStyle,stroke:D,strokeWidth:N,opacity:W,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:p?X(e,p,y,se):v})}),ue=t.useMemo(()=>co({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),de=wo({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(de)return e.jsx(uo,{componentName:"SwarmPlot",message:de,width:q,height:V});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({chartType:"swarm"},null!=s&&{data:oe}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,barPadding:x,enableHover:Y}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:te,rLabel:ne,rFormat:h}),G&&{oFormat:G}),{showGrid:Q,showCategoryTicks:z}),ie.legendBehaviorProps),Pn({title:K,description:U,summary:J,accessibleTable:ee,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:w,defaultTooltipContent:ue})),Ln({linkedHover:_,onObservation:P,onClick:L,hoverHighlight:R,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),k&&k.length>0&&{annotations:k}),j&&{rExtent:j}),re.brushStreamProps),Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"SwarmPlot",width:q,height:V,children:e.jsx(_n,Object.assign({ref:r},he))})});function Bo(t){return n=>{var o;const i=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",r=n.stats||(n.data||n).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:Ct,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 o=t.valueAccessor,r=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=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:Ct,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:Ct,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}To.displayName="SwarmPlot";const $o=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ro(o,{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:p=!0,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,loading:C,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:R,color:T,stroke:B,strokeWidth:$,opacity:H,showCategoryTicks:I,categoryFormat:E}=n,{width:F,height:D,enableHover:N,showGrid:W,showLegend:z,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=i,Z=t.useMemo(()=>m(s),[s]),K=ko({data:Z,rawData:s,colorBy:g,colorScheme:f,legendInteraction:L,legendPosition:R,selection:k,linkedHover:j,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"BoxPlot",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,loadingContent:_,emptyContent:P,width:F,height:D});if(K.earlyReturn)return K.earlyReturn;const U=to(),J=t.useMemo(()=>new Map,[Z]),ee=So({colorBy:g,colorScale:K.colorScale,color:T,themeCategorical:U,colorScheme:f,categoryIndexMap:J,userPieceStyle:void 0,stroke:B,strokeWidth:$,opacity:H,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=t.useMemo(()=>Bo(),[]),ne=wo({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(uo,{componentName:"BoxPlot",message:ne,width:F,height:D});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Z}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,showOutliers:p,size:[F,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:y,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q,rFormat:h}),E&&{oFormat:E}),{showGrid:W,showCategoryTicks:I}),K.legendBehaviorProps),Pn({title:G,description:q,summary:V,accessibleTable:X,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:te})),Ln({linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"BoxPlot",width:F,height:D,children:e.jsx(_n,Object.assign({ref:r},oe))})});$o.displayName="BoxPlot";const Ho=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),r=t.useRef(null);Ro(o,{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:p,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:k,linkedBrush:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:B,legendPosition:$,color:H,stroke:I,strokeWidth:E,opacity:F,showCategoryTicks:D,categoryFormat:N}=n,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=t.useMemo(()=>m(s),[s]),ee=ko({data:J,rawData:s,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:$,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"Histogram",chartId:P,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:W,height:z}),te=Po({brushProp:w,onBrushProp:k,linkedBrush:j,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const ne=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of J){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[J,u]),oe=to(),ie=t.useMemo(()=>new Map,[J]),re=So({colorBy:f,colorScale:ee.colorScale,color:H,themeCategorical:oe,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:I,strokeWidth:E,opacity:F,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=t.useMemo(()=>t=>{const n=t.data||t,o=n.category||t.category||"",i=n.count,r=n.range;return e.jsxs("div",{className:"semiotic-tooltip",style:Ct,children:[o&&e.jsx("div",{style:{fontWeight:"bold"},children:o+""}),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)]})]})},[]),ae=wo({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(uo,{componentName:"Histogram",message:ae,width:W,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),x?{rExtent:x}:ne&&{rExtent:ne}),{size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:g}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:D}),ee.legendBehaviorProps),Pn({title:X,description:Y,summary:Q,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:se})),Ln({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,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(mo,{componentName:"Histogram",width:W,height:z,children:e.jsx(_n,Object.assign({ref:r},le))})});Ho.displayName="Histogram";const Io=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ro(o,{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:p,colorScheme:y,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:j,linkedBrush:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:B,legendInteraction:$,legendPosition:H,color:I,stroke:E,strokeWidth:F,opacity:D,showCategoryTicks:N,categoryFormat:W}=n,{width:z,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:Z,accessibleTable:K,categoryLabel:U,valueLabel:J}=i,ee=t.useMemo(()=>m(s),[s]),te=ko({data:ee,rawData:s,colorBy:p,colorScheme:y,legendInteraction:$,legendPosition:H,selection:O,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:B,width:z,height:G}),ne=Po({brushProp:k,onBrushProp:j,linkedBrush:A,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const oe=to(),ie=t.useMemo(()=>new Map,[ee]),re=So({colorBy:p,colorScale:te.colorScale,color:I,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:F,opacity:D,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=t.useMemo(()=>Bo({valueAccessor:u}),[u]),ae=wo({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(uo,{componentName:"ViolinPlot",message:ae,width:z,height:G});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[z,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:v,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:V,showCategoryTicks:N}),te.legendBehaviorProps),Pn({title:Y,description:Q,summary:Z,accessibleTable:K,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:b,defaultTooltipContent:se})),Ln({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),ne.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"ViolinPlot",width:z,height:G,children:e.jsx(_n,Object.assign({ref:r},le))})});Io.displayName="ViolinPlot";const Eo=t.forwardRef(function(n,o){var i;const r=io(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);Ro(o,{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:p,sort:y="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:k,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:B,legendPosition:$,color:H,stroke:I,strokeWidth:E,opacity:F,categoryFormat:D}=n,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=r,U=t.useMemo(()=>m(a),[a]),J=ko({data:U,rawData:a,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:$,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:q,userMargin:l,marginDefaults:r.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:N,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=no(U,y,d),te=to(),ne=t.useMemo(()=>new Map,[U]),oe=So({colorBy:f,colorScale:J.colorScale,color:H,themeCategorical:te,colorScheme:p,categoryIndexMap:ne,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:I,strokeWidth:E,opacity:F,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),ie=t.useMemo(()=>co({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),re=wo({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(uo,{componentName:"DotPlot",message:re,width:N,height:W});const se=Oo(k),ae=se?[se,...w||[]]:w,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:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:b,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Z,rLabel:K,rFormat:g}),D&&{oFormat:D}),{showGrid:G,oSort:y}),J.legendBehaviorProps),Pn({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:x,defaultTooltipContent:ie})),Ln({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"DotPlot",width:N,height:W,children:e.jsx(_n,Object.assign({ref:s},le))})});Eo.displayName="DotPlot";const Fo=t.forwardRef(function(n,o){var i,r;const s=io(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:B,opacity:$}=n,{width:H,height:I,enableHover:E,showLegend:F,title:D,description:N,summary:W,accessibleTable:z}=s,G=t.useMemo(()=>m(l),[l]),q=g||d,V=ko({data:G,rawData:l,colorBy:q,colorScheme:f,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:F,userMargin:c,marginDefaults:s.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:H,height:I});if(V.earlyReturn)return V.earlyReturn;const X=to(),Y=t.useMemo(()=>new Map,[G]),Q=So({colorBy:q,colorScale:V.colorScale,color:R,themeCategorical:X,colorScheme:f,categoryIndexMap:Y,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:B,opacity:$,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection,cycleByCategory:!0}),Z=t.useMemo(()=>co({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),K=wo({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:U,effectiveMargin:J}=jo({ref:o,frameRef:a,setup:V}),ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=l&&{data:G}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:Q,startAngle:p}),null!=y&&{cornerRadius:y}),{size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),U),Pn({title:D,description:N,summary:W,accessibleTable:z,className:u,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:Z})),Ln({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e.jsx(uo,{componentName:"PieChart",message:K,width:H,height:I}):e.jsx(mo,{componentName:"PieChart",width:H,height:I,children:e.jsx(_n,Object.assign({ref:a},ee))})});Fo.displayName="PieChart";const Do=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.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:p=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:B,opacity:$}=n,{width:H,height:I,enableHover:E,showLegend:F,title:D,description:N,summary:W,accessibleTable:z}=i,G=t.useMemo(()=>m(s),[s]),q=g||c,V=ko({data:G,rawData:s,colorBy:q,colorScheme:f,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"DonutChart",chartId:O,showLegend:F,userMargin:a,marginDefaults:i.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:H,height:I});if(V.earlyReturn)return V.earlyReturn;const X=null!=d?d:Math.max(2,.15*Math.min(H,I)),Y=to(),Q=t.useMemo(()=>new Map,[G]),Z=So({colorBy:q,colorScale:V.colorScale,color:R,themeCategorical:Y,colorScheme:f,categoryIndexMap:Q,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:B,opacity:$,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection,cycleByCategory:!0}),K=t.useMemo(()=>co({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),U=wo({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=jo({ref:o,frameRef:r,setup:V}),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=s&&{data:G}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:Z,innerRadius:X,startAngle:p}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),J),Pn({title:D,description:N,summary:W,accessibleTable:z,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:K})),Ln({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return U?e.jsx(uo,{componentName:"DonutChart",message:U,width:H,height:I}):e.jsx(mo,{componentName:"DonutChart",width:H,height:I,children:e.jsx(_n,Object.assign({ref:r},te))})});function No(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function Wo(e){return Math.max(0,Math.min(1,e))}function zo(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function Go(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function qo(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Wo(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=Wo(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,s=r>0?(o-t.offset)/r:0,a=zo(t.color),l=zo(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,u,d]=a,[h,g,f]=l;return Go(c+(h-c)*s,u+(g-u)*s,d+(f-d)*s)}return n[n.length-1].color}function Vo(e,t,n){return`${e}-${t}`}Do.displayName="DonutChart";const Xo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),r=t.useRef(null),s="context"===n.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,gradientFill:h,color:g,backgroundColor:f="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:p,showNeedle:y=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!a,sweep:k=240,fillZones:j=!0,tooltip:A,annotations:S,frameProps:O={},className:M,stroke:C,strokeWidth:_,opacity:P}=n,{width:L,height:R,title:T,description:B,summary:$,accessibleTable:H}=i,I=h&&"object"==typeof h?h:void 0,E=Math.max(c,Math.min(u,l)),F=u-c||1,D=(E-c)/F,{gaugeData:N,pieceStyle:W,gaugeAnnotations:z}=t.useMemo(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>g[g.length-1].value&&g.push({value:n,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,m=[],p=new Map,y=[];if(f){const e=a?h:1,t=Vo("bg",0);if(m.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),p.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(qo(c.colorStops,e*(t+.5)/n));const i=Vo("fill",0);m.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),p.set(i,{fill:o[0]||s})}}else{let e=t;for(let n=0;g.length>n;n++){const o=g[n],i=(o.value-e)/d,r=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-r),u=a?Math.max(0,i-c):0;if(c>0){const e=Vo("fill",n);m.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),p.set(e,{fill:o.color})}if(u>0){const e=Vo("bg",n);m.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),p.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:m,pieceStyle:(e,t)=>p.get(t||e.category)||{fill:s},gaugeAnnotations:y}}({min:c,max:u,value:l,thresholds:d,fillColor:g,backgroundColor:f,fillZones:j,showScaleLabels:w,gradientFill:I}),[l,c,u,d,g,f,w,j,I]),G=t.useMemo(()=>Ao(W,{stroke:C,strokeWidth:_,opacity:P}),[W,C,_,P]),{sweepRad:q,startAngleDeg:V}=No(k),X=function(e=240){const{sweepRad:t,offsetRad:n}=No(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(k),Y=Math.min(10,Math.max(1,Math.min(L,R)/12)),Q=X.cx,Z=X.cy,K=Math.max(4,Math.min((L-2*Y)/X.width,(R-2*Y)/X.height)-2),U=Math.max(0,Math.min(K-1.5,K*(1-m))),J=L/2-Q*K,ee=R/2-Z*K,te=2*(K+4),ne=t.useMemo(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(E,c,u):b;const t=x?x(E):Math.round(E)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),w&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[b,E,c,u,x,w,K,a]),oe=t.useMemo(()=>s&&null==b?{type:"gauge-value",text:x?x(E):Math.round(E)+""}:null,[s,b,E,x]),ie=t.useMemo(()=>{if(!y)return null;const e=-Math.PI/2+V*Math.PI/180+D*q,t=U>20?U-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[y,D,V,q,U,v]),re=t.useMemo(()=>(t,n,o)=>{if("gauge-needle"===t.type){const i=(o.width||L)/2,r=(o.height||R)/2,s=Math.max(1,K-U),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-"+n)}if("gauge-label"===t.type){const i=-Math.PI/2+V*Math.PI/180+(t.value-c)/F*q,r=(o.width||L)/2,s=(o.height||R)/2,a=U-1,l=K+1,u=Math.cos(i)*a,d=Math.sin(i)*a,h=Math.cos(i)*l,g=Math.sin(i)*l,f=K+10,m=Math.cos(i)*f,p=Math.sin(i)*f,y=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let v="middle",b="middle";return y>=11||1>y?(v="middle",b="auto"):y>=1&&5>y?(v="start",b="middle"):y>=5&&7>y?(v="middle",b="hanging"):(v="end",b="middle"),e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:u,y1:d,x2:h,y2:g,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("text",{x:m,y:p,textAnchor:v,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:t.label})]},"gauge-label-"+n)}return"gauge-value"===t.type?e.jsx("text",{x:(o.width||L)/2,y:(o.height||R)/2-.2*U,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+n):null},[L,R,c,F,V,q,U,K]),se=t.useMemo(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),oe&&e.push(oe),e},[z,S,ie,oe]),ae=t.useMemo(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,i=null==o?void 0:o._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==o?void 0:o._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===N.length)return e.jsx(uo,{componentName:"GaugeChart",message:"No data to display",width:L,height:R});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:N,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:G,innerRadius:U,startAngle:V,sweepAngle:k},null!=p&&{cornerRadius:p}),{centerContent:ne,size:[L,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ee-te/2,bottom:R-ee-te/2,left:J-te/2,right:L-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===A?()=>null:Rt(A)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),T&&{title:T}),B&&{description:B}),$&&{summary:$}),void 0!==H&&{accessibleTable:H}),M&&{className:M}),null!=n.animate&&{animate:n.animate}),O);return e.jsx(mo,{componentName:"GaugeChart",width:L,height:R,children:e.jsx(_n,Object.assign({ref:r},le))})});Xo.displayName="GaugeChart";const Yo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ro(o,{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:p,colorScheme:y,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:j,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:T,color:B,stroke:$,strokeWidth:H,opacity:I,showCategoryTicks:E,categoryFormat:F}=n,{width:D,height:N,enableHover:W,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:Z}=i,K=t.useMemo(()=>m(s),[s]),U=ko({data:K,rawData:s,colorBy:p,colorScheme:y,legendInteraction:R,legendPosition:T,selection:j,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:M,chartType:"RidgelinePlot",chartId:C,showLegend:G,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:D,height:N});if(U.earlyReturn)return U.earlyReturn;const J=to(),ee=t.useMemo(()=>new Map,[K]),te=So({colorBy:p,colorScale:U.colorScale,color:B,themeCategorical:J,colorScheme:y,categoryIndexMap:ee,userPieceStyle:void 0,stroke:$,strokeWidth:H,opacity:I,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=t.useMemo(()=>Bo(),[]),oe=wo({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(oe)return e.jsx(uo,{componentName:"RidgelinePlot",message:oe,width:D,height:N});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,bins:h,size:[D,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U.margin,barPadding:v,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:Z,rFormat:f}),F&&{oFormat:F}),{showGrid:z,showCategoryTicks:E,oSort:!1,amplitude:g}),U.legendBehaviorProps),Pn({title:q,description:V,summary:X,accessibleTable:Y,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:b,defaultTooltipContent:ne})),Ln({linkedHover:A,onObservation:S,onClick:O,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(mo,{componentName:"RidgelinePlot",width:D,height:N,children:e.jsx(_n,Object.assign({ref:r},ie))})});Yo.displayName="RidgelinePlot";const Qo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),r=t.useRef(null);Ro(o,{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:p=.3,showLabels:y=!0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:B,opacity:$,categoryFormat:H}=n,I="vertical"===f,{width:E,height:F,enableHover:D,showLegend:N,title:W,description:z,summary:G,accessibleTable:q}=i,V=I?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>m(s),[s]),Y=h||d,Q=!Y,Z=ko({data:X,rawData:s,colorBy:Y,colorScheme:g,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"FunnelChart",chartId:O,showLegend:N,userMargin:a,marginDefaults:V,loading:M,loadingContent:C,emptyContent:_,width:E,height:F});if(Z.earlyReturn)return Z.earlyReturn;vo("FunnelChart",X,"stepAccessor",c),vo("FunnelChart",X,"valueAccessor",u);const K=to(),U=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(Q)return R||((null==K?void 0:K[0])?K[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[Q,R,K,g]),ee=So({colorBy:J?void 0:Y,colorScale:Z.colorScale,color:null!=J?J:R,themeCategorical:K,colorScheme:g,categoryIndexMap:U,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:B,opacity:$,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),te=t.useMemo(()=>t=>{var n,o,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!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==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,m=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:Ct,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+"",m]})]})},[]),ne=wo({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(ne)return e.jsx(uo,{componentName:"FunnelChart",message:ne,width:E,height:F});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:ee,size:[E,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:I,showCategoryTicks:I}),H&&{oFormat:H}),{showGrid:I}),!I&&{connectorOpacity:p}),{showLabels:y}),Z.legendBehaviorProps),W&&{title:W}),z&&{description:z}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:!0===v||null==v?te:Rt(v)||te}),(k||j||A||S)&&{customHoverBehavior:Z.customHoverBehavior}),(j||A||k)&&{customClickBehavior:Z.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"FunnelChart",width:E,height:F,children:e.jsx(_n,Object.assign({ref:r},oe))})});Qo.displayName="FunnelChart";const Zo={RdBu:B,PiYG:$,PRGn:H,BrBG:I,RdYlBu:E,RdYlGn:F,Spectral:D},Ko="__likert_neutral_neg",Uo="__likert_neutral_pos";function Jo(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ei(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];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,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function ti(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Ko,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Uo,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function ni(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/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 n of e)n.__likertLevel===Ko?r=n:n.__likertLevel===Uo?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const oi=new Map,ii=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:g="count",levels:f,orientation:m="horizontal",colorScheme:p,barPadding:y=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,valueFormat:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:T,categoryFormat:B,stroke:$,strokeWidth:H,opacity:I}=n,{width:E,height:F,enableHover:D,showGrid:N,showLegend:W,title:G,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=i,U="horizontal"===m,J=void 0===s,ee=!d,te=function(){var e;const t=Un();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ne=t.useMemo(()=>p&&Array.isArray(p)&&p.length>=f.length?p:function(e,t){if(0>=e)return[];if(t){const n=Zo[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#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(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(f.length,te),[p,f.length,te]),oe=t.useMemo(()=>{const e=new Map;for(let t=0;f.length>t;t++)e.set(f[t],ne[t]||"#888");return e},[f,ne]),{processedData:ie,reAggregate:re,accumulatorRef:se}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>Jo(o,"question"),[o]),d=t.useMemo(()=>c?Jo(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:Jo(r,"level"),[c,r]),g=t.useMemo(()=>c?null:Jo(s,"count"),[c,s]),f=e||[],m=t.useRef([]),p=t.useMemo(()=>{if(0===f.length)return[];let e=ei(f,n,u,d,h,g);return a&&(e=ti(e,n),e=ni(e,n)),e},[f,n,u,d,h,g,a]),y=t.useCallback(e=>{var t;let o=ei(e,n,u,d,h,g);a&&(o=ti(o,n),o=ni(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,g,a,l]);return{processedData:p,reAggregate:y,accumulatorRef:m}}({data:s,levels:f,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:g,isDiverging:U,frameRef:r}),ae="__likertLevelLabel",le=function({isPushMode:e,colorBy:n,colorScheme:o,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=Bn(),d=to(),h=t.useCallback(e=>{const t=e[n];return null!=t?t+"":null},[n]),g=t.useCallback(t=>{if(!e||!n)return;let o=!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),o=!0)}o&&c(e=>e+1)},[e,n,h]),f=t.useCallback(t=>{if(!e||!n)return;const o=Array.from(new Set(t.map(String))),i=a.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(s.current=new Set(o),a.current=o,c(e=>e+1))},[e,n]),m=t.useCallback(e=>t=>{g([t]),e(t)},[g]),p=t.useCallback(e=>t=>{g(t),e(t)},[g]),y=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);Zn(e&&n?a.current:[]);const v=t.useMemo(()=>{if(!e||!n||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:d&&d.length>0?d:z,s=n,l=t.map(e=>({[s]:e})),c=V(l,s,r);return Kn({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:q})},[e,n,i,o,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:m,wrapPushMany:p,resetCategories:y,categories:a.current,categoryDomainProps:e&&n?{legendCategoryAccessor:n,onCategoriesChange:f}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:J,colorBy:ae,colorScheme:ne,showLegend:W,legendPosition:T}),ce=t.useCallback(le.wrapPush(e=>{se.current.push(e),re(se.current)}),[le.wrapPush,re,se]),ue=t.useCallback(le.wrapPushMany(e=>{se.current.push(...e),re(se.current)}),[le.wrapPushMany,re,se]);t.useImperativeHandle(o,()=>({push:ce,pushMany:ue,remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;se.current=[],le.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}}),[ce,ue,le.resetCategories,se]);const de=ko({data:ie,rawData:s,colorBy:ae,colorScheme:ne,legendInteraction:R,legendPosition:T,selection:k,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"LikertChart",chartId:M,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:E,height:F});if(de.earlyReturn)return de.earlyReturn;const he=t.useMemo(()=>{const e=f.length;return e%2!=0&&oe.get(f[Math.floor(e/2)])||"#888"},[f,oe]),ge=So({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:oi,userPieceStyle:null==w?void 0:w.pieceStyle,stroke:$,strokeWidth:H,opacity:I,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===Ko||i===Uo)return{fill:he};const r=o||i;return r&&oe.has(r)?{fill:oe.get(r)}:{fill:"#888"}}}),fe=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,n=t.__likertLevel||"Unknown",o=n===Ko||n===Uo?fe:n,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=n===Ko||n===Uo?2*r:r,a=t.__likertCount||0;return h.createElement("div",{className:"semiotic-tooltip",style:Ct},h.createElement("div",{style:{fontWeight:"bold"}},i),h.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[fe]),pe=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 ee?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),g&&(e.countAccessor=g)),wo({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:f}})},[s,c,u,d,g,f,ee]),ye=t.useMemo(()=>[{styleFn:e=>({fill:oe.get(e.label)||"#888"}),items:f.map(e=>({label:e})),label:""}],[f,oe]),ve=t.useMemo(()=>!1!==W?Object.assign(Object.assign({},de.legendBehaviorProps),{legend:{legendGroups:ye},legendPosition:T||de.legendPosition||"bottom"}):de.legendBehaviorProps,[de.legendBehaviorProps,de.legendPosition,T,W,ye]),be=t.useMemo(()=>{const e=Object.assign({},de.margin);if(J&&!1!==W){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(le.streamingMarginAdjust)for(const[t,n]of Object.entries(le.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[de.margin,le.streamingMarginAdjust,U,J,W,T]),xe=t.useMemo(()=>C||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,C]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:ge,size:[E,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:be,barPadding:y,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:K||(U?void 0:"Percentage"),rFormat:xe}),B&&{oFormat:B}),{showGrid:N}),ve),G&&{title:G}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),{tooltipContent:!1===v?()=>null:!0===v?me:Rt(v)||me}),(j||A||S||O)&&{customHoverBehavior:de.customHoverBehavior}),(A||S||j)&&{customClickBehavior:de.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return pe?e.jsx(uo,{componentName:"LikertChart",message:pe,width:E,height:F}):e.jsx(mo,{componentName:"LikertChart",width:E,height:F,children:e.jsx(_n,Object.assign({ref:r},we))})});ii.displayName="LikertChart";const ri=t.forwardRef(function(n,o){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:m=!1,annotations:p,onObservation:y,onClick:v,selection:b,linkedHover:x,chartId:w,loading:k,loadingContent:j,emptyContent:A,frameProps:S={}}=n,{frameRef:O,resolved:M,safeData:C,setup:_,earlyReturn:P}=function(e){var n;const o=function(e){const n=t.useRef(null);return Ro(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:io(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;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:r}=o,s=ko({data:null!==(n=e.data)&&void 0!==n?n:[],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,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},o),{safeData:s.data,setup:s,earlyReturn:s.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:i,colorScheme:f,selection:b,linkedHover:x,onObservation:y,onClick:v,chartId:w,loading:k,loadingContent:j,emptyContent:A,margin:h,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,mode:n.mode});if(P)return P;const{width:L,height:R,enableHover:T,showGrid:B,title:$,description:H,summary:I,accessibleTable:E}=M,F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:C}),{customLayout:r,layoutConfig:s,oAccessor:a,rAccessor:l,oExtent:c,rExtent:u,projection:d,colorScheme:f,size:[L,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:_.margin,enableHover:T,showAxes:m,showGrid:B,annotations:p}),Pn({title:$,description:H,summary:I,accessibleTable:E,className:g,animate:n.animate,axisExtent:n.axisExtent})),Ln({linkedHover:x,onObservation:y,onClick:v,hoverHighlight:!1,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior})),S);return e.jsx(mo,{componentName:"OrdinalCustomChart",width:L,height:R,children:e.jsx(_n,Object.assign({ref:O},F))})});ri.displayName="OrdinalCustomChart",exports.BarChart=Mo,exports.BoxPlot=$o,exports.DonutChart=Do,exports.DotPlot=Eo,exports.FunnelChart=Qo,exports.GaugeChart=Xo,exports.GroupedBarChart=_o,exports.Histogram=Ho,exports.LikertChart=ii,exports.OrdinalCustomChart=ri,exports.PieChart=Fo,exports.RidgelinePlot=Yo,exports.StackedBarChart=Co,exports.StreamOrdinalFrame=_n,exports.SwarmPlot=To,exports.SwimlaneChart=Lo,exports.ViolinPlot=Io,exports.createHatchPattern=vn;
2
+ "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-scale"),o=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 n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const h=d(t),g=u(a),f=Object.freeze([]);function m(e){if(!e)return f;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class p{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=m(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 n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=m(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 n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),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 n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;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 n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+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),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class 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 n of e){const e=t?t(n):n;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,n){return e+(t-e)*n}function x(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function w(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}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,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function S(e){const t=e.map(j),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return A(e,n,o)}if(e>=1){const[e,o,i]=t[n];return A(e,o,i)}const o=e*n,i=Math.floor(o),r=o-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 O=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],M=S(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),C=S(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),_=S(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),P=S(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),L=S(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);S(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const R=S(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),T=S(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);S(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),S(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),S(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),S(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const B=S(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),$=S(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),H=S(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),I=S(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),E=S(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),F=S(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),D=S(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),N={category10:O,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:C,greens:_,oranges:P,purples:L,viridis:R,plasma:T},W=O,z=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],G=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 q(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||G.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):W[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%W.length]}function V(e,t,o="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(o))return n.scaleOrdinal().domain(i).range(o).unknown("#999");const s=N[o]||N.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:W;return n.scaleOrdinal().domain(i).range(e).unknown("#999")}}function X(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Y(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function Q(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=d&&!g&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,d=c+o*u,g=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*u,m=r(t.pieceData[0],t.name),p=0===e,y=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:d,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:m,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:f&&(v.roundedEnds={start:p,end:y}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),s.push(v)}return s}function Z(e){var t,n,o;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!==(n=i.quantile(e,.5))&&void 0!==n?n:(s+a)/2,q3:null!==(o=i.quantile(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}function K(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}const U={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,m="horizontal"===h,p=a.normalize,y=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);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 n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(p)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of y){const s=t.get(r);if(!s)continue;let a=s.total;p&&n>0&&(a/=n);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:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);g.push(Y(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(m){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);g.push(Y(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=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!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o: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 n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});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),n.length>0&&(n.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:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,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+n/2,a=l(0),d=l(c);u.push(Y(r,Math.min(a,d),o,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(Y(Math.min(a,d),r,Math.abs(d-a),o,g,i,h[s]))}}}}const m=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);m>0&&(e.roundedTop=m),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;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,m=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=f&&a[i]||c,y=l(t,e.name),v=y.r||5;let b,x;if(g){const t=p+(e.pctStart+e.pct/2)*m,n=u(r);b=Math.cos(t)*n,x=Math.sin(t)*n}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:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%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:o})}}return l},pie:Q,donut:Q,boxplot:function(e,t){var n,o,r,s,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:f,projection:m}=c,p=[],y="vertical"===m,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],m=null!==(n=i.quantile(c,.25))&&void 0!==n?n:u,b=null!==(o=i.quantile(c,.5))&&void 0!==o?o:(u+d)/2,x=null!==(r=i.quantile(c,.75))&&void 0!==r?r:d,w=x-m,k=m-1.5*w,j=x+1.5*w,A=null!==(s=c.find(e=>e>=k))&&void 0!==s?s:u,S=null!==(a=[...c].reverse().find(e=>j>=e))&&void 0!==a?a:d,O=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const n=h(e);if(k>n||n>j){const o=y?t.middle:f(n),i=y?f(n):t.middle;M.push({px:o,py:i,value:n,datum:e})}}if(p.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(m),medianPos:f(b),q3Pos:f(x),maxPos:f(S),stats:{n:c.length,min:A,q1:m,median:b,q3:x,max:S,mean:c.reduce((e,t)=>e+t,0)/c.length},style:O,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var n,o,r;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,g=[],f="vertical"===h,m=l.bins||20,p=!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)/m||1,h=Array(m).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),m-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;m>t;t++){const n=d(s+(t+.5)*l);b+=` L ${e.middle+h[t]/y*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=m-1;t>=0;t--){const n=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/y*v} ${n}`}b+=" Z"}else{b=`M ${d(s)} ${e.middle}`;for(let t=0;m>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/y*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=m-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(p&&t.length>=4){const l=null!==(n=i.quantile(t,.25))&&void 0!==n?n:s,c=null!==(o=i.quantile(t,.5))&&void 0!==o?o:(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:Z(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.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 n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,m=Math.max(...r,1),p=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/m)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(Y(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,p,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,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 o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const f=Math.max(...c,1),m=a(e.pieceData[0],e.name),p=e.width*g;let y="";if(h){const t=e.x+e.width;y=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)y+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*p}`;y+=` L ${l(i)} ${t} Z`}else{const t=e.x;y=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);y+=` L ${t+c[e]/f*p} ${n}`}y+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:v,stats:Z(t),style:Object.assign(Object.assign({},m),{fillOpacity:null!==(n=m.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(Y(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(Y(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var o,i,r,s,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:f}=e,m=[],p=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return m;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 n=0;for(const o of e.pieceData){const e=g?g(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(o);i.total+=r,i.pieces.push(o),n+=r}k.push({col:e,groups:t,stepTotal:n}),w||n>j&&(j=n)}if(w)for(const e of k){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>j&&(j=o)}if(0===j)return m;const A=new Map;for(const e of b){const t=k[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=k[0].stepTotal,O=w?.95*p:.9*t.width,M=n.scaleLinear().domain([0,j]).range([0,O]),C=null!==(i=e.config.connectorOpacity)&&void 0!==i?i:.3;let _=new Map;for(let t=0;k.length>t;t++){const n=k[t],o=n.col,i=0===t,d=o.width,h=.55*d,g=o.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=p,r=p;for(let s=0;b.length>s;s++){const l=b[s],c=n.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,S=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:j,__funnelStep:o.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});y&&(0===s&&(S.__funnelStepLabel=o.name,S.__funnelStepLabelX=p,S.__funnelStepLabelY=g,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+u/2,S.__funnelValueLabelY=g,S.__funnelBarW=u),m.push(Y(x,g,u,h,w,S,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=n.stepTotal,t=M(e),a=p-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=n.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:o.pieceData[0],d=c?l:o.name,x=f(u,d),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:i,category:c?l:o.name});y&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=g,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=g,k.__funnelBarW=t),m.push(Y(a,g,t,h,x,k,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&_.size>0){const t=w?b:[b[0]];for(const i of t){const t=_.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return f(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.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:C},datum:null!==(u=null===(c=n.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:o.pieceData[0],category:"_default"===i?o.name:i};m.push(a)}}_=v}return m},"bar-funnel":function(e,t){var n,o,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 m=g.length>1&&"_default"!==g[0],p=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}p.push({col:e,groups:t,stepTotal:n})}const y=new Map;for(const e of g){const t=null===(n=p[0])||void 0===n?void 0:n.groups.get(e);y.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=m?g.length:1,x=m?.15:0;for(let e=0;p.length>e;e++){const t=p[e],n=t.col,o=0===e,s=e>0?p[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const p=f.total,b=null!==(i=y.get(h))&&void 0!==i?i:p,x=b>0?p/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:p,j=o?0:Math.max(0,k-p),A=n.x+e*a+l/2,S=v(p),O=v(0)-S,M=c(f.pieces[0],m?h:n.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:p,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:j,__barFunnelCategory:"_default"===h?void 0:h,category:m?h:n.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(p+j)});if(d.push(Y(A,S,u,O,M,C,m?h:n.name)),j>0){const e=v(p+j),t=S-e,o=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:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:m?h:n.name});d.push(Y(A,e,u,t,o,i,m?h:n.name))}}}return d},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,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!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=d?Y(s,n.x,a,n.width,o,null,"__track__"):Y(n.x,s,n.width,a,o,null,"__track__");u.push(i)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=u.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=s?s(n):e.name,c=a(n,i);let f;if(d){const r=l(t),s=l(t+o);f=Y(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);f=Y(e.x,r,e.width,s-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=o}if(m>0&&u.length>n){const e=u.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:d?(t.cornerRadii={tl:m,bl:m},o.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},o.cornerRadii={tl:m,tr:m})}}return u}};class J{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 n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const i=o.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=n.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=t.innerRadius||0;h=n.scaleLinear().domain(a).range([i,o])}else l?(d=n.scaleBand().domain(s).range([0,e.height]).padding(u),h=n.scaleLinear().domain(a).range([0,e.width])):(d=n.scaleBand().domain(s).range([0,e.width]).padding(u),h=n.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(o,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?n.scaleLinear().domain([c,u]).range([0,e.width]):n.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=i;this.rAccessors.length>1&&(g=i.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(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,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){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(n&&void 0===o){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===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.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 n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){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,n,o,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"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct: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 n,o;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!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=U[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;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 n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,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===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.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 n,o,i;const r=this.config,s=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},a=function(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=N[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(r.colorScheme,r.themeCategorical,z),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!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...a]},resolveColor:K(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||z,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];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 n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,J.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._pointQuadtree=o.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const 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!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,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===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,u,d,h,g,f,m,p,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!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)d?(j.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(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 n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(m=t.endAngle)&&void 0!==m?m:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(p=t.innerRadius)&&void 0!==p?p: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:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}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,n,o,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 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)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=b(o.x,e._targetX,s),e.y=b(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=b(o.r,e._targetR,s))}else if("rect"===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)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=b(n.x,e._targetX,s),e.y=b(n.y,e._targetY,s),void 0!==n.w&&(e.w=b(n.w,e._targetW,s),e.h=b(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:b(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=b(n.startAngle,e._targetStartAngle,s),e.endAngle=b(n.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]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);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 n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(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 n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];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 ee(...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 te(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ne(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function oe(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function ie(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>te(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function re(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=ne(Math.atan2(i,o)),a=ne(e.startAngle),l=ne(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 se(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ae(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function le(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function ce(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}J.QUADTREE_THRESHOLD=500;const ue={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function de(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,ue[n])(o(e,t),i),r}function he({swatchSize:t}){return e.jsx("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ge(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const fe=(t,n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,m=[];let p=0;const y=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:w}=d;return f.forEach((t,u)=>{const d=de(t,u,h,g,b),k=ge(t,i,r),j=r&&r.size>0&&r.has(t.label);m.push(e.jsxs("g",{transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===s&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?j||!1:void 0,"aria-current":y&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,j&&e.jsx(he,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),p+=w}),m};function me({config:t,orientation:n="vertical",width:o=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"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(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+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:n,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+n,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 n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(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:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:g}=t,f=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(g),[m,p]=h.useState(0),[y,v]=h.useState(0),b=h.useCallback((e,t)=>{p(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:fe(t,o,i,r,s,a,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:m,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:a,metrics:f}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var g;let f=0;const m=[];t.forEach((t,n)=>{var g;let p=0;t.label&&(p+=16);const y=((t,n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:m}=t,p=[],{swatchSize:y,labelGap:v,itemGap:b,rowHeight:x,align:w}=d,k=!(!n&&!o),j="isolate"===u||void 0===u&&null!=r,A=m.map(e=>y+v+7*e.label.length),S=[];let O=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+b+e;h&&h>0&&M>0&&n>h?(S.push({start:O,end:t,width:M}),O=t,M=e):M=n}),m.length>0&&S.push({start:O,end:m.length,width:M}),S.forEach((t,u)=>{let d="center"===w?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===w?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=m[h],w=de(t,h,g,f,y),S=ge(t,i,r),O=r&&r.size>0&&r.has(t.label);p.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?l===s&&h===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&j?O||!1:void 0,"aria-current":k&&!j&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:k?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+m.length)%m.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(l,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+v+2+7*t.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,O&&e.jsx(he,{swatchSize:y}),e.jsx("text",{y:y/2,x:y+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=A[h]+b}});const C=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:p,offset:C,totalRows:_,totalHeight:_*x}})(t,i,r,s,a,l,c,n,u,d,h,null!==(g=h.maxWidth)&&void 0!==g?g:o);p+=y.offset+5,m.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),f+=p+12});const p=null!==(g=h.maxWidth)&&void 0!==g?g:o;let y=f>p?0:"center"===h.align?Math.max(0,(p-f)/2):"end"===h.align?Math.max(0,p-f):0;const v=[];return m.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${y},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)),y+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${y},0)`,children:o.items},"legend-group-"+i)),y+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:m,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:a,metrics:f}),w=!(!o&&!i);return e.jsxs("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"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}),x]})}function ye(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ve(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!o)return null;const m="top"===a||"bottom"===a,p=!!c,y=Math.max(1,m?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-y-10),b=s.top):"top"===a?(v=s.left,b=p?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(me,{config:o.gradient,orientation:m?"horizontal":"vertical",width:y}):ye(o)?e.jsx(pe,{legendGroups:o.legendGroups,title:"",width:y,orientation:m?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o)});var x}function be(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function xe(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function we(t,n,o,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(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const f=16,m=s?u?[s]:be(s,c):[],p=r?u?[r]:be(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))";m.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:m.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:f,children:t},n))},"annotation-note-title")),v=m.length*f),p.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:p.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:f,children:t},n))},"annotation-note-label"));let w=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(m.length+p.length)*f+(p.length>0?f:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),w=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,m.length+p.length-1)*f;let j=0;return"topBottom"===d?j=0>o?-(k+2):18:"leftRight"===d&&(j="middle"===h?-(k+f+(p.length>0&&m.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),w]})}function ke(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:xe((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function je(t,n,o,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,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.jsx("line",{x1:l,y1:c,x2:t,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.jsx("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*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 Ae(t){const{x:n=0,y:o=0,dx:i,dy:r,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:m={},"data-testid":p}=t,y=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":p},m,{children:[!y.has("connector")&&je(v,b,c,h,x,u),!y.has("subject")&&ke(x,u,h,n,o),!y.has("note")&&we(l,v,b,h)]}))}function Se(t){var n,o;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!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(Ae,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});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(Ae,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Oe(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o: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 Me(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o: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 Ce(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(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)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Oe(e,n),c=Me(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function _e(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Pe={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 Le(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function Re(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=n,{rTickValues:h,axisExtent:g}=n,f="radial"===(null==l?void 0:l.projection),m="horizontal"===(null==l?void 0:l.projection),p=t.useMemo(()=>!l||f?[]:(h||Le(l.r,5,g)).map(e=>({value:e,pixel:l.r(e),label:(d||Te)(e)})),[l,d,f,h,g]),y=u&&l&&!f,v=c&&l&&!f;return y||v?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:[y&&e.jsx("g",{className:"ordinal-grid",children:p.map((t,n)=>e.jsx("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:o,y2:m?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),v&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,m?{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:o,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:o,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 Te(e){return Math.round(100*e)/100+""}function Be(n){var o,i;const{width:a,height:l,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:f,showCategoryTicks:m,oLabel:p,rLabel:y,oFormat:v,rFormat:b,showGrid:x,title:w,legend:k,legendHoverBehavior:j,legendClickBehavior:A,legendHighlightedCategory:S,legendIsolatedCategories:O,legendPosition:M="right",legendLayout:C,foregroundGraphics:_,annotations:P,svgAnnotationRules:L,xAccessor:R,yAccessor:T,annotationData:B,underlayRendered:$,children:H}=n,I="radial"===(null==h?void 0:h.projection),E="horizontal"===(null==h?void 0:h.projection),F=!1!==m,D=t.useMemo(()=>f&&F&&h&&!I?h.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=h.o(e))&&void 0!==n?n:0)+h.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,F,h,v,I]),N=n.rTickValues,W=n.tickLabelEdgeAlign,z=n.axisExtent,G=t.useMemo(()=>f&&h&&!I?(N||Le(h.r,5,z)).map(e=>({value:e,pixel:h.r(e),label:(b||Te)(e)})):[],[f,h,b,I,N,z]),q=t.useRef(new Map),V=t.useRef(null!==(o=null==P?void 0:P.length)&&void 0!==o?o:0),X=null!==(i=null==P?void 0:P.length)&&void 0!==i?i:0;V.current!==X&&(V.current=X,q.current=new Map);const Y=t.useMemo(()=>{if(!P||0===P.length)return null;const t=function(t,n,o){var i,a,l,c,u,d,h,f,m,p,y,v,b,x,w,k,j,A,S,O,M,C,_,P,L,R,T,B,$,H,I,E,F,D,N,W,z,G,q,V,X,Y,Q,Z,K,U,J,ee;switch(t.type){case"label":{const i=Ce(t,n,o);if(!i)return null;const{x:r,y:s}=i;return _e(r,s,o)?e.jsx(Se,{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-"+n):null}case"callout":{const i=Ce(t,n,o);if(!i)return null;const{x:r,y:s}=i;return _e(r,s,o)?e.jsx(Se,{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-"+n):null}case"x-threshold":{const i=Oe(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.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-"+n)}case"y-threshold":{const i=Me(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);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=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.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-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Me(Object.assign(Object.assign({},e),{type:"point"}),o),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-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Me(Object.assign(Object.assign({},e),{type:"point"}),o)})).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-"+n)}case"highlight":{const i=o.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((n,i)=>{const r=Oe(n,o),a=Me(n,o);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=Oe(t,o),r=Me(t,o);return e.jsx(Se,{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-"+n)}case"trend":{const r=o.data||[];if(2>r.length)return null;const s=o.xAccessor||"x",f=o.yAccessor||"y",m="ordinal"===o.frameType,p="horizontal"===o.projection,y=m?s:null,v=m?f:null;let b;const x=[],w=new Map;if(m&&y&&v){for(const e of r){const t=e[y];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=r.map(e=>{const t=e[y],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=r.map(e=>[e[s],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(a=null===(i=o.scales)||void 0===i?void 0:i.x)&&void 0!==a?a:null===(l=o.scales)||void 0===l?void 0:l.time,j=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.y)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.value;if(!k||!j)return null;const A=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=k,O=j;let M;if(m)if(p){const e=A(O);M=(t,n)=>[S(n),e(t)]}else{const e=A(S);M=(t,n)=>[e(t),O(n)]}else M=(e,t)=>[S(e),O(t)];const C=t.method||"linear";let _;_="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;n>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 m=u*g-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*f-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(h=t.bandwidth)&&void 0!==h?h:.3):("polynomial"===C?g.default.polynomial(b,{order:t.order||2}):g.default.linear(b)).points;const P=_.map(([e,t])=>{const[n,o]=M(e,t);return`${n},${o}`}).join(" "),L=t.color||"#6366f1",R=_[_.length-1],[T,B]=M(R[0],R[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:P,fill:"none",stroke:L,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:T+4,y:B-4,fill:L,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.y)&&void 0!==m?m:null===(p=o.scales)||void 0===p?void 0:p.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:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.x)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.time,l=null!==(j=null===(k=o.scales)||void 0===k?void 0:k.y)&&void 0!==j?j:null===(A=o.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=Pe[o.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 m=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:m,fillOpacity:null!==(S=t.fillOpacity)&&void 0!==S?S:.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:m,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(M=null===(O=o.scales)||void 0===O?void 0:O.x)&&void 0!==M?M:null===(C=o.scales)||void 0===C?void 0:C.time,a=null!==(P=null===(_=o.scales)||void 0===_?void 0:_.y)&&void 0!==P?P:null===(L=o.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!==(R=t.threshold)&&void 0!==R?R:2,g=c-h*d,f=!1!==t.showBand,m=t.fill||"#6366f1",p=null!==(T=t.fillOpacity)&&void 0!==T?T:.1,y=t.anomalyColor||"#ef4444",v=null!==(B=t.anomalyRadius)&&void 0!==B?B: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:o.width||0,height:Math.abs(x-b),fill:m,fillOpacity:p}),w.map((t,n)=>{const i=Oe(t,o),r=Me(t,o);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-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:m,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(H=null===($=o.scales)||void 0===$?void 0:$.x)&&void 0!==H?H:null===(I=o.scales)||void 0===I?void 0:I.time,l=null!==(F=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==F?F:null===(D=o.scales)||void 0===D?void 0:D.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,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),m=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-m,2),0),y=null!==(N=t.confidence)&&void 0!==N?N:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(W=t.steps)&&void 0!==W?W: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),n=f*Math.sqrt(1+1/d+(p>0?Math.pow(e-m,2)/p:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}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`,S=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),O=`${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!==(z=t.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),e.jsx("polyline",{points:`${O} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(q=t.strokeDasharray)&&void 0!==q?q:"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-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Ce(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!_e(i,r,o))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!==(Z=t.content)&&void 0!==Z?Z: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-"+n)}case"text":{const i=Ce(t,n,o);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-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(K=o.scales)||void 0===K?void 0:K.o,a=null===(U=o.scales)||void 0===U?void 0:U.x,l=null===(J=o.scales)||void 0===J?void 0:J.y,c=r(s)?s:r(a)?a:r(l)?l:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",g=null!==(ee=t.opacity)&&void 0!==ee?ee:.15,f=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===a)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}},n="horizontal"===(null==h?void 0:h.projection),o=(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:n?h.r:o||h.r,y:n&&o||h.r,time:h.r,value:h.r,o:h.o}:null,timeAxis:"x",xAccessor:R,yAccessor:T,width:a,height:l,data:B,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:q.current};return P.map((e,n)=>{if(L){const o=L(e,n,i);return null!=o?o:t(e,n,i)}return t(e,n,i)}).filter(Boolean)},[P,L,a,l,h,R,T,B]);return f||w||k||_||Y&&Y.length>0||x||H?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&&!$&&e.jsx("g",{className:"ordinal-grid",children:G.map((t,n)=>e.jsx("line",{x1:E?t.pixel:0,y1:E?0:t.pixel,x2:E?t.pixel:a,y2:E?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),f&&h&&!I&&(()=>{const t={fontSize:"var(--semiotic-tick-font-size, 10px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,E?{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!$&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},t),children:n.label})})]},"cat-"+o)),p&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:p})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!$&&e.jsx("line",{x1:0,y1:l,x2:a,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!$&&(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})(),G.map((n,o)=>{const i=W?0===o?"start":o===G.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${n.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:i,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)}),y&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:y})]})]}:{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!$&&(()=>{const t=(null==h?void 0:h.r)?h.r(0):l,n=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((n,o)=>e.jsxs("g",{transform:`translate(${n.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},t),children:n.label})})]},"cat-"+o)),p&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:p})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!$&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)),y&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:y})]})]})})})(),Y,_,H]}),w&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof w?w:null}),ve({legend:k,totalWidth:c,totalHeight:u,margin:d,legendPosition:M,title:w,legendLayout:C,legendHoverBehavior:j,legendClickBehavior:A,legendHighlightedCategory:S,legendIsolatedCategories:O})]}):null}function $e(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:{key:void 0,fn:null}}function He({width:n,height:o,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 m=t.useRef(!1),p=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],[n,o]]),t.on("brush end",e=>{if(m.current)return;const t=f.current;if(!t)return;if(!e.selection)return p.current=null,void g.current(null);const[n,o]=e.selection;let i;i=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.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}},[n,o,y]),t.useEffect(()=>{if(!a||!h.current||!p.current)return;if(!d.current)return;const e=p.current,t=l.select(d.current).select(".brush-g"),n=a.r(e.r[0]),o=a.r(e.r[1]);y?(m.current=!0,t.call(h.current.move,[n,o]),m.current=!1):(m.current=!0,t.call(h.current.move,[o,n]),m.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"}})})}function Ie(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Ee(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const Fe=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function De(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=Fe(i,r),t=Fe(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Fe(i,r),t=Fe(i,s),n=Fe(o,s),l=Fe(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return De(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),u=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),d=s-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return De(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const m=r+(g?c:0),p=s-(f?c:0),y=r+(g?u:0),v=s-(f?u:0),b=Fe(i,m),x=Fe(i,p),w=(i-l)*Math.cos(c),k=Fe(w,r),j=Fe(w,s),A=a?null:Fe(o,v),S=a?null:Fe(o,y),O=a?0:(o+l)*Math.cos(u),M=a?null:Fe(O,r),C=a?null:Fe(O,s),_=p-m>Math.PI?1:0,P=a?0:v-y>Math.PI?1:0;let L="";if(g)L+=`M${k.x},${k.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=Fe(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${_} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=Fe(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=Fe(o,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=Fe(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Ne(e){const t=De({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:De({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const We={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ze(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Ge(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const qe="undefined"==typeof window||"undefined"==typeof document,Ve="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Xe=()=>()=>{},Ye=()=>!1,Qe=()=>!0;function Ze(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Ke(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Ue(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 Je=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,et=new WeakMap;let tt=0,nt=!1,ot=null,it=null,rt=null;function st(e,t){var n,o;if(!t)return t;const i=Je.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(nt)return;if("undefined"==typeof window||"undefined"==typeof document)return;nt=!0;const e=()=>{tt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(ot=new MutationObserver(e),ot.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{it=window.matchMedia("(prefers-color-scheme: dark)"),rt=e,"function"==typeof it.addEventListener?it.addEventListener("change",rt):"function"==typeof it.addListener&&it.addListener(rt)}catch(e){}}();let s=et.get(r);s&&s.version===tt||(s={version:tt,map:new Map},et.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}const at=h.createContext(null),lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ct(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],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(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const ut=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},dt="semiotic-accessible-data-table",ht=dt+" semiotic-accessible-data-table-hidden",gt=dt+" semiotic-accessible-data-table-visible",ft={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, 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-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},mt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},pt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},yt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},vt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},bt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},xt={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function wt({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,a]=h.useState(!1),l=h.useContext(at),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:o?`Data summary for ${n} ${o}`:"Data summary for "+n,f=h.useCallback(()=>{s||c||a(!0)},[s,c]),m=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 o?e.jsx("span",{id:o,tabIndex:-1,style:lt}):null;if(!u)return e.jsx("div",{id:o,className:ht,tabIndex:-1,onFocus:f,style:lt,role:"region","aria-label":g,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const p=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,f,m,p,y,v,b,x,w,k,j,A,S;const O=[];if(!Array.isArray(e))return O;for(const M of e)if(M&&"object"==typeof M&&null!==M.datum)try{switch(M.type){case"point":O.push({label:"Point",values:{x:M.x,y:M.y}});break;case"line":{const e=M.path,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=M.topPath,t=Array.isArray(M.datum)?M.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&O.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!==(n=null!==(t=e.category)&&void 0!==t?t:M.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;O.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":O.push({label:"Cell",values:{x:M.x,y:M.y,value:M.value}});break;case"wedge":O.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":O.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":O.push({label:"Arc",values:{id:null!==(p=null===(m=M.datum)||void 0===m?void 0:m.id)&&void 0!==p?p:"",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":O.push({label:"Candlestick",values:{x:M.x,open:M.open,high:M.high,low:M.low,close:M.close}});break;case"geoarea":O.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!==(S=null===(A=M.datum)||void 0===A?void 0:A.value)&&void 0!==S?S:""}})}}catch(e){}return O}(t),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),v=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ut(e.min)} to ${ut(e.max)}, mean ${ut(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(p.length,y),b=p.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:o,className:gt,tabIndex:-1,onBlur:m,style:ft,role:"region","aria-label":g,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:pt,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:mt,children:v}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:yt,children:[e.jsxs("caption",{className:"semiotic-accessible-data-table-caption",style:xt,children:["First ",b.length," of ",p.length," data points"]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:vt,children:"type"}),w.map(t=>e.jsx("th",{style:vt,children:t},t))]})}),e.jsx("tbody",{children:b.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:bt,children:t.label}),w.map(n=>{return e.jsx("td",{style:bt,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":ut(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]})]})}function kt({summary:t}){return t?e.jsx("div",{role:"note",style:lt,children:t}):null}function jt({tableId:t}){return e.jsx("a",{href:"#"+t,style:lt,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,lt)},children:"Skip to data table"})}function At({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:lt,children:n})}const St="var(--semiotic-focus, #005fcc)";function Ot({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:St,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:St,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:St,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 Mt(e){return Array.isArray(e)?e[0]:e}const Ct={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function _t(e,t){return"function"==typeof t?t(e):e[t]}function Pt(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 Lt(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=_t(t,o);a=Pt(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=_t(t,o);l.push({label:n,value:Pt(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=Pt(t[n],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Pt(t[e[0]],i))}}const c=Object.assign(Object.assign({},Ct),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,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Rt(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=Mt(!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!==(o=t.data)&&void 0!==o?o:{}:t),r=n(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:Ct,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Lt(t):Lt())}}function Tt({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=h.useRef(null),[d,g]=h.useState(null);h.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,i]);let f;f=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const m=function(e){if(!h.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),p=m?null:Ct;return c?e.jsx("div",{ref:u,className:m?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},p||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:f,pointerEvents:"none",zIndex:l,width:"max-content"}),children:s}):null}function Bt(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=$t(n);return[function({children:o,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>$t(n,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:o})},e=>{var n;const o=i(),s=null!==(n=t.useContext(o))&&void 0!==n?n: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 $t(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function Ht(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 It(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:Et})})),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 Et=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Ft={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}},Dt={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}},Nt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Et,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 Wt(e,t){if("light"===t)return Ft;if("dark"===t)return Dt;if("high-contrast"===t)return Nt;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?Dt:Ft;return It(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 It(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[zt,Gt]=Bt(e=>({theme:Ft,setTheme(t){e(e=>({theme:Wt(e.theme,t)}))}}));const qt="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Vt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Xt(e){const n=function(){const[e,n]=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 n(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=function(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&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=Vt(e.foregroundGraphics,r,s),u=Vt(e.backgroundGraphics,r,s),d=Gt(e=>e.theme),{transition:g,introEnabled:f}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),m="semiotic-table-"+h.useId(),p=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{p.current||(p.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{p.current&&(cancelAnimationFrame(p.current),p.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]),S=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 O=e.themeDirtyRef;return qt(()=>{O&&(tt++,O.current=!0,v())},[d,v,O]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:g,introEnabled:f,tableId:m,rafRef:p,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:S}}function Yt(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Qt(e,t,n=.3){Yt(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Zt(e,t,n=.6){var o,i,r,s,a;if(!Yt(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o: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*n,e.stroke()}function Kt(e,t,n,o=.35){Yt(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Ut(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)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 Jt(e,t,n){return null==t?n:"string"!=typeof t?t:st(e,t)||n}function en(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,i,r,s);for(const e of n)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(o,i,r,s),[h,g,f]=Ut(e,n);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function tn(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=Ee(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function nn(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 on=(e,t,n,o)=>{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)rn(e,t);else if(t.cornerRadii&&Ie(t.cornerRadii)){const n=Jt(e,t.style.fill,st(e,"var(--semiotic-primary, #007bff)")),o=nn(t),i=t.fillGradient&&"string"==typeof n?en(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,tn(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Jt(e,t.style.fill,st(e,"var(--semiotic-primary, #007bff)")),o=nn(t),i=t.fillGradient&&"string"==typeof n?en(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;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=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Jt(e,t.style.fill,st(e,"var(--semiotic-primary, #007bff)")),o=nn(t),i=t.fillGradient&&"string"==typeof n?en(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Qt(e,t),e.globalAlpha=1}};function rn(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;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+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const sn=(e,t,n,o)=>{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 n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=Jt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Jt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Zt(e,t),e.globalAlpha=1}}finally{e.restore()}}};function an(e,t){var n,o,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=Ne({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=st(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function ln(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 cn(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=s.arc().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}const un=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)an(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(ln(e,t),Kt(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?st(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=De({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),cn(e,t)):(ln(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(ln(e,t),Kt(e,t)),e.globalAlpha=1}}},dn=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=st(e,"var(--semiotic-primary, #007bff)"),a=st(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?st(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?st(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(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},hn=(e,t,n,o)=>{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 n=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?st(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},gn=(e,t,n,o)=>{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 n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=st(e,n.style.stroke)||("string"==typeof n.style.fill?st(e,n.style.fill):n.style.fill)||st(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},fn=(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=st(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function mn(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 pn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let yn=null;function vn(e={},t){const{background:n="transparent",stroke:o="#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):(yn||(yn=document.createElement("canvas")),yn.width=e,yn.height=e,yn)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=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 bn=new Map;function xn(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=bn.get(n);if(void 0!==o)return o;const i=vn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return bn.set(n,i),i}function wn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function kn(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 jn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const An=e=>[gn,...e],Sn={bar:An([on]),clusterbar:An([on]),point:An([sn]),swarm:An([sn]),pie:[un],donut:[un],boxplot:An([dn,sn]),violin:An([hn]),histogram:An([on]),ridgeline:An([hn]),timeline:An([on]),funnel:[on,fn,(e,t,n,o)=>{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,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?mn(i):null!=r?`${mn(i)} (${pn(r)})`:mn(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=mn(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[on,(e,t,n,o)=>{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 n=("string"==typeof t.style.fill?t.style.fill:null)||st(e,"var(--semiotic-border, #999)"),o=xn(n,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),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=Ut(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,st(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 n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,u=r?jn(i):"",d=kn(o);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,m=r?32:17,p=n.__barFunnelLabelX,y=p-f/2,v=n.__barFunnelLabelY-m-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),wn(e,y,v,f,m,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),wn(e,y,v,f,m,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,p,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,p,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,p,v+3))}e.lineWidth=1}],swimlane:An([on]),custom:An([on,sn,un,dn,hn,fn])},On={top:50,right:40,bottom:60,left:70},Mn={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 Cn({hover:t}){var n,o,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:Mn,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 o=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:Mn,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[o," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:Mn,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:Mn,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",m=null!==(a=null!==(s=null!==(r=null!==(i=null!==(o=l.__aggregateValue)&&void 0!==o?o: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&&""===m){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:Mn,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:Mn,children:[f&&e.jsx("div",{style:{fontWeight:"bold"},children:f+""}),""!==m&&e.jsx("div",{children:"number"==typeof m?m.toLocaleString():m+""})]})}Cn.ownsChrome=!0;const _n=t.forwardRef(function(n,o){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:S,groupBy:O,multiAxis:M,timeAccessor:C,valueAccessor:_,categoryAccessor:P,projection:L="vertical",size:R=[600,400],responsiveWidth:T,responsiveHeight:B,margin:$,barPadding:H,roundedTop:I,gradientFill:E,trackFill:F,baselinePadding:D,innerRadius:N,cornerRadius:W,normalize:z,startAngle:G,sweepAngle:q,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:Z,connectorOpacity:K,showLabels:U,connectorAccessor:ne,connectorStyle:ue,dataIdAccessor:de,rExtent:he,oExtent:ge,extentPadding:fe=.05,oSort:me,windowMode:pe="sliding",windowSize:ye=200,pieceStyle:ve,summaryStyle:be,colorScheme:xe,barColors:we,showAxes:ke=!0,showCategoryTicks:je,categoryLabel:Ae,valueLabel:Se,categoryFormat:Oe,valueFormat:Me,oLabel:Ce,rLabel:_e,oFormat:Pe,rFormat:Le,rTickValues:Te,tickLabelEdgeAlign:Fe,axisExtent:Je,enableHover:et=!0,hoverAnnotation:tt,tooltipContent:nt,customHoverBehavior:ot,annotations:it,svgAnnotationRules:rt,showGrid:at=!1,legend:lt,legendHoverBehavior:ut,legendClickBehavior:dt,legendHighlightedCategory:ht,legendIsolatedCategories:gt,legendPosition:ft,legendLayout:mt,legendCategoryAccessor:pt,onCategoriesChange:yt,backgroundGraphics:vt,foregroundGraphics:bt,title:xt,className:St,background:Ct,centerContent:_t,decay:Pt,pulse:Lt,transition:Rt,animate:Bt,staleness:$t,brush:It,onBrush:Et,accessibleTable:Ft=!0,description:Dt,summary:Nt,customLayout:Wt,layoutConfig:zt}=n,Gt=t.useRef(!0),qt=Xt({sizeProp:R,responsiveWidth:T,responsiveHeight:B,userMargin:$,marginDefault:On,foregroundGraphics:bt,backgroundGraphics:vt,animate:Bt,transitionProp:Rt,themeDirtyRef:Gt}),{reducedMotionRef:Vt,responsiveRef:Yt,size:Qt,margin:Zt,adjustedWidth:Kt,adjustedHeight:Ut,resolvedForeground:Jt,resolvedBackground:en,currentTheme:tn,transition:nn,introEnabled:on,tableId:rn,rafRef:sn,renderFnRef:an,scheduleRender:ln}=qt,cn=function(){const[e,n]=t.useState(!1);return Ve(()=>{n(!0)},[]),e}(),un=function(){const e=t.useSyncExternalStore(Xe,Ye,Qe);return t.useRef(e).current}(),dn=t.useMemo(()=>m(w),[w]),hn=null!=Ae?Ae:Ce,gn=null!=Se?Se:_e,fn=null!=Oe?Oe:Pe,mn=null!=Me?Me:Le,pn=t.useRef(null),yn=t.useRef(null),vn=t.useRef([]),bn=t.useRef(pt),xn=t.useRef(yt);bn.current=pt,xn.current=yt;const[wn,kn]=t.useState(null),[jn,An]=t.useState(null),[Mn,_n]=t.useState(0),[Pn,Ln]=t.useState(!1),[Rn,Tn]=t.useState(null),Bn=t.useCallback(()=>{var e,t;Tn(null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),$n=et||tt,Hn="streaming"===x,In=t.useMemo(()=>{var e,t,n;return{chartType:b,runtimeMode:Hn?"streaming":"bounded",windowSize:ye,windowMode:pe,extentPadding:fe,projection:L,oAccessor:Hn?void 0:k,rAccessor:Hn?void 0:j,colorAccessor:A,stackBy:S,groupBy:O,multiAxis:M,timeAccessor:Hn?C:void 0,valueAccessor:Hn?_||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:Hn?P||k:void 0,rExtent:he,oExtent:ge,axisExtent:Je,barPadding:H,roundedTop:I,gradientFill:E,trackFill:F,baselinePadding:D,innerRadius:N,cornerRadius:W,normalize:z,startAngle:G,sweepAngle:q,dynamicColumnWidth:V,bins:X,showOutliers:Y,showIQR:Q,amplitude:Z,connectorOpacity:K,showLabels:U,connectorAccessor:ne,connectorStyle:ue,dataIdAccessor:de,oSort:me,pieceStyle:ve,summaryStyle:be,colorScheme:xe,themeCategorical:null===(e=null==tn?void 0:tn.colors)||void 0===e?void 0:e.categorical,themeSemantic:Ht(tn),themeSequential:null===(t=null==tn?void 0:tn.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==tn?void 0:tn.colors)||void 0===n?void 0:n.diverging,barColors:we,decay:Pt,pulse:Lt,transition:nn,introAnimation:on,staleness:$t,customLayout:Wt,layoutConfig:zt,layoutMargin:Zt}},[b,ye,pe,fe,L,k,j,A,S,O,M,C,_,P,he,ge,Je,H,I,E,F,D,N,W,z,G,q,V,X,Y,Q,Z,K,U,ne,ue,de,me,ve,be,xe,we,Pt,Lt,null==nn?void 0:nn.duration,null==nn?void 0:nn.easing,on,$t,Hn,tn,Wt,zt,Zt]),En=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ke(e,t);if(!Ue(e)||!Ue(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Ke(n,i))return!1}else{if(!Ue(n)||!Ue(i))return!1;if(!Ze(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(In),Fn=t.useRef(null);Fn.current||(Fn.current=new J(En));const Dn=t.useCallback(()=>{var e,t;const n=bn.current,o=xn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];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+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,vn.current)||(vn.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Fn.current)||void 0===e||e.updateConfig(En),Gt.current=!0,ln()},[En,ln]);const Nn=t.useRef(null);Nn.current||(Nn.current=new p(e=>{const t=Fn.current;t&&t.ingest(e)&&(Gt.current=!0,ln())}));const Wn=t.useCallback(e=>{var t;null===(t=Nn.current)||void 0===t||t.push(e)},[]),zn=t.useCallback(e=>{var t;null===(t=Nn.current)||void 0===t||t.pushMany(e)},[]),Gn=t.useCallback(()=>{var e,t;null===(e=Nn.current)||void 0===e||e.clear(),null===(t=Fn.current)||void 0===t||t.clear(),Gt.current=!0,ln()},[ln]),qn=t.useCallback(e=>{var t,n;null===(t=Nn.current)||void 0===t||t.clearLastData(),null===(n=Nn.current)||void 0===n||n.setReplacementData(e)},[]);t.useImperativeHandle(o,()=>({push:Wn,pushMany:zn,replace:qn,remove:e=>{var t,n,o,i;null===(t=Nn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=Fn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=yn.current)||void 0===i?void 0:i.data;!!yn.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(yn.current=null,kn(null)),Gt.current=!0,ln()}return r},update:(e,t)=>{var n,o,i;null===(n=Nn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Fn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Gt.current=!0,ln()),r},clear:Gn,getData:()=>{var e,t,n;return null===(e=Nn.current)||void 0===e||e.flush(),null!==(n=null===(t=Fn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Wn,zn,qn,Gn,ln]),t.useEffect(()=>{var e;w&&(null===(e=Nn.current)||void 0===e||e.setBoundedData(dn))},[w,dn]);const{hoverHandlerRef:Vn,hoverLeaveRef:Xn,onPointerMove:Yn,onPointerLeave:Qn}=qt;Vn.current=e=>{if(!$n)return;const t=pn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Zt.left,i=e.clientY-n.top-Zt.top;if(0>o||o>Kt||0>i||i>Ut)return void(yn.current&&(yn.current=null,kn(null),ot&&ot(null),ln()));const r=Fn.current;if(!r||0===r.scene.length)return;const s="radial"===L,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+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-n,a=Math.sqrt(r*r+s*s);te(e.r,o)>=a&&d>a&&(u=e,d=a),i=i.next}while(i)}return!1}),u?{node:u,distance:d}:null}(i,t,n,o,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,n);break;case"point":if(i)break;e=ie(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=re(r,t,n);break;case"boxplot":e=se(r,t,n);break;case"violin":e=ae(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Kt/2:o,s?i-Ut/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(yn.current&&(yn.current=null,kn(null),ot&&ot(null),ln()));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:Mt(c),x:u,y:d,__semioticHoverData:!0},h));var c,u,d,h;yn.current=l,kn(l),ot&&(ot(l),Gt.current=!0),ln()},Xn.current=()=>{yn.current&&(yn.current=null,kn(null),ot&&(ot(null),Gt.current=!0),ln())};const Zn=t.useRef(-1),Kn=t.useRef(null),Un=t.useRef(null),Jn=t.useCallback(e=>{const t=Fn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Un.current&&Un.current.version===n)o=Un.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";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!==(o=r.group)&&void 0!==o?o: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){if(null===r.datum)continue;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;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.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===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),Un.current={version:n,graph:o}}const i=Zn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Zn.current=0;const t=o.flat[0];Kn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},ce(t)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b});return yn.current=n,kn(n),ot&&ot(n),void ln()}const r=function(e,t){var n,o;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!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);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=n.groups.indexOf(o);return n.groups.length-1>e?le(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?le(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return Zn.current=-1,Kn.current=null,yn.current=null,kn(null),ot&&ot(null),void ln();Zn.current=s;const a=o.flat[s];Kn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},ce(a)),{__oAccessor:"string"==typeof k?k:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:b});yn.current=l,kn(l),ot&&ot(l),ln()},[ot,ln]),eo=t.useCallback(e=>{Zn.current=-1,Kn.current=null,Yn(e)},[Yn]);an.current=()=>{var e,t;sn.current=0;const n=pn.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Fn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Vt.current?r+1e6:r),a=!Vt.current&&s,l=Gt.current;l&&!s&&(i.computeScene({width:Kt,height:Ut}),Dn(),Bn(),Gt.current=!1),(l||a)&&n.setAttribute("aria-label",ct(i.scene,b+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=Qt[0]*c,d=Qt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Qt[0]+"px",n.style.height=Qt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Qt[0],Qt[1]);const h=null!==(e=null==$t?void 0:$t.threshold)&&void 0!==e?e:5e3,g=$t&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==$t?void 0:$t.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Ct&&!vt){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=Ct||(e&&"transparent"!==e?e:null),i=t?st(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,Qt[0],Qt[1]))}const f="radial"===L;o.save(),o.beginPath(),o.rect(Zt.left,Zt.top,Kt,Ut),o.clip(),f?(o.save(),o.translate(Zt.left+Kt/2,Zt.top+Ut/2)):o.translate(Zt.left,Zt.top);const m=Wt?Sn.custom:Sn[b]||[],p={width:Kt,height:Ut};for(const e of m)e(o,i.scene,i.scales,p);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(An(i.scales),_n(e=>e+1)),(null==$t?void 0:$t.showBadge)&&Ln(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(sn.current=requestAnimationFrame(()=>an.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;Ve(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);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:cn,wasHydratingFromSSR:un,storeRef:Fn,dirtyRef:Gt,renderFnRef:an,cleanup:()=>{var e;return null===(e=Nn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Gt.current=!0,ln()},[b,Kt,Ut,ke,Ct,ln]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}($t,Fn,Gt,ln,Pn,Ln);const to=$n&&wn?nt?nt(wn):e.jsx(Cn,{hover:wn}):null,no="radial"===L,oo=to?e.jsx(Tt,{x:wn?no?wn.x+Kt/2:wn.x:0,y:wn?no?wn.y+Ut/2:wn.y:0,containerWidth:Kt,containerHeight:Ut,margin:Zt,className:"stream-ordinal-tooltip",children:to}):null,io=$e(k,0,"__semiotic_resolvedO"),ro=$e(j,0,"__semiotic_resolvedR"),so=io.key,ao=ro.key,lo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(io,ro,it&&it.length>0||!1);if(qe||!cn&&un){const t=Fn.current;t&&w&&(t.ingest({inserts:dn,bounded:!0}),t.computeScene({width:Kt,height:Ut}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===L,c=l?Zt.left+Kt/2:Zt.left,u=l?Zt.top+Ut/2:Zt.top;return e.jsxs("div",{ref:Yt,className:"stream-ordinal-frame"+(St?" "+St:""),role:"img","aria-label":Dt||("string"==typeof xt?xt:"Ordinal chart"),style:{position:"relative",width:T?"100%":Qt[0],height:B?"100%":Qt[1]},children:[e.jsx(kt,{summary:Nt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Qt[0],height:Qt[1],style:{position:"absolute",left:0,top:0},children:[en&&e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:en}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[Ct&&e.jsx("rect",{x:0,y:0,width:Kt,height:Ut,fill:Ct}),n.map((t,n)=>function(t,n,o){var i,r,a,l,c,u,d,g,f;const m=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",p=e=>`ord-${t.type}-${m}-${n}-${e}`,y=`ord-${t.type}-${m}-${n}`;switch(t.type){case"rect":{const n=t,o=Ge(y)+"-grad",i=function(t,n){const o=t.fillGradient;if(!o)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 o){const t=o.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 n=0;t.length>n;n++)l.push(e.jsx("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=ze(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(n,o),r=i?`url(#${o})`:ze(n.style.fill);if(n.cornerRadii&&Ie(n.cornerRadii)){const t=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=Ee(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(n);return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:t,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:s,w:a,h:l}=n;let c;switch(n.roundedEdge){case"right":c=`M${o},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+t},${s} A${t},${t} 0 0 0 ${o},${s+t} L${o},${s+l-t} A${t},${t} 0 0 0 ${o+t},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o+t},${s+l} A${t},${t} 0 0 1 ${o},${s+l-t} Z`;break;default:c=`M${o},${s+l} L${o},${s+t} A${t},${t} 0 0 1 ${o+t},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l} Z`}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:ze(n.style.fill),opacity:null!==(i=n.style.opacity)&&void 0!==i?i:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},y)}case"wedge":{const i=t;if(i._gradientBand&&i._gradientBand.colors.length>0){const t=Ge(`${o?o+"-":""}gauge-grad-${i.category||y}-${n}`),{clipPath:s,slices:u}=Ne({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:null===(a=null===(r=i.roundedEnds)||void 0===r?void 0:r.start)||void 0===a||a,roundEnd:null===(c=null===(l=i.roundedEnds)||void 0===l?void 0:l.end)||void 0===c||c,colors:i._gradientBand.colors});return e.jsxs("g",{transform:`translate(${i.cx},${i.cy})`,opacity:i.style.opacity,fillOpacity:i.style.fillOpacity,children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("path",{d:s})})}),e.jsx("g",{clipPath:`url(#${t})`,children:u.map((t,n)=>e.jsx("path",{d:t.d,fill:ze(t.color)},n))}),i.style.stroke&&"none"!==i.style.stroke&&e.jsx("path",{d:s,fill:"none",stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},y)}let u;if(i.roundedEnds)u=De({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:i.roundedEnds.start,roundEnd:i.roundedEnds.end});else{const e=s.arc().innerRadius(i.innerRadius).outerRadius(i.outerRadius).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2);i.cornerRadius&&e.cornerRadius(i.cornerRadius),u=e(We)||""}return e.jsx("path",{d:u,transform:`translate(${i.cx},${i.cy})`,fill:ze(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},y)}case"boxplot":{const n=t,o=n.columnWidth/2;return e.jsxs("g","vertical"===n.projection?{children:[e.jsx("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:ze(n.style.fill),fillOpacity:null!==(u=n.style.fillOpacity)&&void 0!==u?u:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:ze(n.style.fill),fillOpacity:null!==(d=n.style.fillOpacity)&&void 0!==d?d:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1})]},y)}case"violin":{const n=t,o=[e.jsx("path",{d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:ze(n.style.fill),fillOpacity:null!==(g=n.style.fillOpacity)&&void 0!==g?g:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1},p("path"))];if(n.iqrLine&&n.bounds){const t=n.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?o.push(e.jsx("line",{x1:i,y1:n.iqrLine.q1Pos,x2:i,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2},p("iqr")),e.jsx("circle",{cx:i,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},p("med"))):o.push(e.jsx("line",{x1:n.iqrLine.q1Pos,y1:r,x2:n.iqrLine.q3Pos,y2:r,stroke:n.style.stroke||"#333",strokeWidth:2},p("iqr")),e.jsx("circle",{cx:n.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},p("med")))}return e.jsx("g",{children:o},y)}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!==(f=t.style.opacity)&&void 0!==f?f:.5},y);case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:o,fill:ze(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},y)}default:return null}}(t,n,rn)).filter(Boolean)]})]}),e.jsx(Be,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:o,showAxes:ke,showCategoryTicks:je,oLabel:hn,rLabel:gn,oFormat:fn,rFormat:mn,rTickValues:Te,tickLabelEdgeAlign:Fe,axisExtent:Je,showGrid:at,title:xt,legend:lt,legendHoverBehavior:ut,legendClickBehavior:dt,legendHighlightedCategory:ht,legendIsolatedCategories:gt,legendPosition:ft,legendLayout:mt,foregroundGraphics:ee(Jt,null===(a=Fn.current)||void 0===a?void 0:a.customLayoutOverlays),annotations:it,svgAnnotationRules:rt,annotationFrame:0,xAccessor:so,yAccessor:ao,annotationData:lo(null==t?void 0:t.getData())}),_t&&"radial"===L&&e.jsx("div",{style:{position:"absolute",left:Zt.left+Kt/2,top:Zt.top+Ut/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:_t})]})}return e.jsxs("div",{ref:Yt,className:"stream-ordinal-frame"+(St?" "+St:""),role:"group","aria-label":Dt||("string"==typeof xt?xt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":Qt[0],height:B?"100%":Qt[1],overflow:"visible"},onKeyDown:Jn,children:[Ft&&e.jsx(jt,{tableId:rn}),Ft&&e.jsx(wt,{scene:null!==(c=null===(l=Fn.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:b+" chart",tableId:rn,chartTitle:"string"==typeof xt?xt:void 0}),e.jsx(kt,{summary:Nt}),e.jsxs("div",{role:"img","aria-label":Dt||("string"==typeof xt?xt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:$n?eo:void 0,onMouseLeave:$n?Qn:void 0,children:[en&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:Qt[0],height:Qt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Zt.left},${Zt.top})`,children:en})}),e.jsx(Re,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:jn,showAxes:ke,showGrid:at,rFormat:mn,rTickValues:Te,axisExtent:Je}),e.jsx("canvas",{ref:pn,"aria-label":ct(null!==(d=null===(u=Fn.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:Qt[0],height:Qt[1]}}),e.jsx(At,{hoverPoint:wn}),e.jsx(Be,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:jn,showAxes:ke,showCategoryTicks:je,oLabel:hn,rLabel:gn,oFormat:fn,rFormat:mn,rTickValues:Te,axisExtent:Je,showGrid:at,title:xt,legend:lt,legendHoverBehavior:ut,legendClickBehavior:dt,legendHighlightedCategory:ht,legendIsolatedCategories:gt,legendPosition:ft,legendLayout:mt,foregroundGraphics:ee(Jt,Rn),annotations:it,svgAnnotationRules:rt,annotationFrame:Mn,xAccessor:so,yAccessor:ao,annotationData:lo(null===(g=Fn.current)||void 0===g?void 0:g.getData()),underlayRendered:!0}),(It||Et)&&"radial"!==L&&e.jsx(He,{width:Kt,height:Ut,totalWidth:Qt[0],totalHeight:Qt[1],margin:Zt,scales:jn,onBrush:Et||(()=>{})}),_t&&"radial"===L&&e.jsx("div",{style:{position:"absolute",left:Zt.left+Kt/2,top:Zt.top+Ut/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:_t}),(null==$t?void 0:$t.showBadge)&&e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===$t.badgePosition?{top:4,left:4}:"bottom-left"===$t.badgePosition?{bottom:4,left:4}:"bottom-right"===$t.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Pn?"#dc3545":"#28a745",color:"white"}),children:Pn?"STALE":"LIVE"}),e.jsx(Ot,{active:Zn.current>=0,hoverPoint:wn,margin:Zt,size:Qt,shape:null===(f=Kn.current)||void 0===f?void 0:f.shape,width:null===(y=Kn.current)||void 0===y?void 0:y.w,height:null===(v=Kn.current)||void 0===v?void 0:v.h}),oo]})]})});function Pn(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a}=e,l={};return t&&(l.title=t),n&&(l.description=n),o&&(l.summary=o),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),void 0!==a&&(l.axisExtent=a),l}function Ln(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function Rn(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Rt(t)||n}}_n.displayName="StreamOrdinalFrame";const Tn=t.createContext(null);function Bn(){return t.useContext(Tn)}function $n(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Hn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[In,En]=Bt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Hn(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Hn(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Fn,Dn]=Bt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let Nn={positions:new Map};const Wn=new Set;function zn(){for(const e of Wn)e()}function Gn(e,t){const n=Nn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Nn.positions);o.delete(e),Nn={positions:o},zn()}function qn(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=En(e=>e.selections.get(i)),s=En(e=>e.setClause),a=En(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 n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push($n(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{a(i,o)},[a,i,o]),clientId:o}}function Vn(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const Xn=t.createContext(!1),Yn=t.createContext(null),Qn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Zn(e){const n=t.useContext(Yn),o=t.useId(),i=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=t.useRef([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,i)||(r.current=i);const s=r.current;Qn(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),Qn(()=>{n&&n.registerCategories(o,s)},[n,o,s])}function Kn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},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?o(s,t,n):n?n(i):z[r%z.length];return{label:i+"",color:a}}),label:""}]}}function Un(){return Gt(e=>e.theme)}function Jn(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function eo(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 to(){var e;const t=Un(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function no(e,n,o){return t.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return e;const t=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return t.sort("asc"===n?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,n,o])}h.createContext(void 0);const oo={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 io(e,t,n){var o,i,r,s,a,l,c;const u=oo[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.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:ro(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function ro(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function so(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function ao(e,t){if(!t)return so(e);try{const n=t(e);return null==n?so(e):n}catch(t){return so(e)}}function lo(e,t){return"function"==typeof t?t(e):e[t]}function co({categoryAccessor:t,valueAccessor:n,groupAccessor:o,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=lo(c,t),d=lo(c,n),h=o?lo(c,o):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:Ct,children:[e.jsx("div",{style:{fontWeight:"bold"},children:so(u)}),e.jsx("div",{style:{marginTop:4},children:ao(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||(g=o,"string"==typeof g?g:"value"),": ",so(h)]})]});var g}}function uo({componentName:t,message:n,diagnosticHint:o,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:n}),o&&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:o})]})})}class ho extends h.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(uo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var go;const fo="undefined"!=typeof process&&"production"!==(null===(go=process.env)||void 0===go?void 0:go.NODE_ENV);function mo({componentName:t,width:n,height:o,children:i}){return e.jsx(ho,{fallback:i=>e.jsx(uo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const po={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"},yo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function vo(e,t,n,o){if(!fo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function bo(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function xo(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=bo(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function wo({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=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(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=xo(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function ko(n){const{data:o,rawData:i,colorBy:r,colorScheme:s,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:g,chartType:f,chartId:p,showLegend:y,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,loading:k,loadingContent:j,emptyContent:A,width:S,height:O}=n,M=void 0===i,C=t.useMemo(()=>m(o),[o]),[_,P]=t.useState([]),L=t.useCallback(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),R="string"==typeof n.colorBy?n.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:B,customHoverBehavior:$,customClickBehavior:H,crosshairSourceId:I}=function({selection:e,linkedHover:n,fallbackFields:o=[],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}(n,o),g=qn({name:(null==e?void 0:e.name)||"__unused__"}),f=function(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=qn({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:i,isActive:r}}({name:(null==h?void 0:h.name)||"hover",fields:(null==h?void 0:h.fields)||o||[]}),m=Dn(e=>e.pushObservation),p=e?{isActive:g.isActive,predicate:g.predicate}:null,[y,v]=t.useState(null),b=u||o[0],x=t.useMemo(()=>{if(!c||null==y||!b)return null;const e=y,t=b;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,y,b]),w=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=Jn(e,t,h.xField);null!=n&&function(e,t,n){const o=Nn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Nn={positions:new Map(Nn.positions).set(e,{xValue:t,sourceId:n})},zn())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&f.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Gn(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 n=null==t?void 0:t[b];v(null!=n?n+"":null)}else v(null);if(r||m){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=eo(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),m&&m(e)}}},[n,f,h,d,r,s,a,m,c,b]),k=t.useCallback(e=>{var t,n,o,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 n=Jn(e,t,h.xField);null!=n&&function(e,t,n){const o=Nn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Nn.positions);return t.delete(e),Nn={positions:t},zn(),!1}Nn={positions:new Map(Nn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},zn()}(h.name||"hover",n,d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||m){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const n=eo(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),m&&m(e)}}},[l,r,m,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 n=Nn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Nn.positions);o.delete(e),Nn={positions:o},zn()}(e,d),Gn(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:p,hoverSelectionHook:x,customHoverBehavior:w,customClickBehavior:k,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:g,chartType:f,chartId:p,onClick:x,hoverHighlight:w,colorByField:R}),E=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(u,I),F=function(e,n,o){const i=Bn(),r=to();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(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,n,s);return e=>i[e]||t(e)}return V(e,n,s)}if(i&&Object.keys(i).length>0){const e=V([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}(C,r,s),D=t.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of C){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[C,r]),N=t.useMemo(()=>M&&_.length>0?_:D,[M,_,D]),W=function(e,n,o){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 n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,r,N),G=t.useMemo(()=>B||(W.legendSelectionHook?W.legendSelectionHook:T),[B,W.legendSelectionHook,T]),X=function(e){const n=Gt(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}(c),Y=to(),Q=Bn(),Z=t.useMemo(()=>{if(F)return F;if(!r||0===N.length)return;const e=Array.isArray(s)&&s.length>0||"string"==typeof s&&s.length>0?s:Y&&Y.length>0?Y:z,t="__streamCat",n=V(N.map(e=>({[t]:e})),t,e);return e=>(null==Q?void 0:Q[e])||n(e)||"#999"},[F,r,N,s,Y,Q]),{legend:K,margin:U,legendPosition:J}=function({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(Xn),u=null!==t.useContext(Yn),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),g=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[l,n,e,h]);Zn(u&&n?g:[]);const f=t.useMemo(()=>{if(!d||!n)return;const t=Kn({data:e,colorBy:n,colorScale:o,getColor:q,categories:g});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,g]),m=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,s,f,r]);return{legend:f,margin:m,legendPosition:r}}({data:C,colorBy:r,colorScale:Z,showLegend:y,legendPosition:l,userMargin:v,defaults:b,categories:N}),ee=t.useMemo(()=>{const e={};return K&&(e.legend=K,e.legendPosition=J),a&&"none"!==a&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),M&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=L),e},[K,J,a,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,M,r,L]),te=Array.isArray(i)?m(i):i,ne=function(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},yo),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(k,S,O,j),oe=ne?null:function(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},po),{width:n,height:o}),children:i||"No data available"}):null}(te,S,O,A);return{data:C,colorScale:F,allCategories:N,legendState:W,effectiveSelectionHook:G,activeSelectionHook:T,customHoverBehavior:$,customClickBehavior:H,legend:K,margin:U,legendPosition:J,earlyReturn:ne||oe||null,legendBehaviorProps:ee,crosshairProps:E,resolvedSelection:X}}function jo({ref:e,frameRef:n,setup:o}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i;return null!==(i=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[n]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}function Ao(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function So(e){const{colorBy:n,colorScale:o,color:i,themeCategorical:r,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:p=!1}=e,y=t.useMemo(()=>(e,t)=>{const l="function"==typeof m?m(e,t):m,c=l?Object.assign({},l):{};if(void 0===c.fill)if(n){if(!o)return c;c.fill=q(e,n,o)}else c.fill=function(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=N[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}(i,r,s,f?t:void 0,a);return p&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[n,o,i,r,s,a,f,m,p]),v=t.useMemo(()=>Ao(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},y(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},y(e,t)),l):y,{stroke:c,strokeWidth:u,opacity:d}),[y,l,c,u,d]);return t.useMemo(()=>{return e=v,n=g,(t=null!=h?h:null)?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e;var e,t,n},[v,h,g])}function Oo(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}const Mo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),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:p=!1,barPadding:y=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,regression:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:B,legendInteraction:$,legendPosition:H,color:I,stroke:E,strokeWidth:F,opacity:D,showCategoryTicks:N,categoryFormat:W,dataIdAccessor:z}=n,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>m(s),[s]),ne=ko({data:te,rawData:s,colorBy:g,colorScheme:f,legendInteraction:$,legendPosition:H,selection:O,linkedHover:M,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:B,width:G,height:q}),{effectiveLegendProps:oe,effectiveMargin:ie}=jo({ref:o,frameRef:r,setup:ne});if(ne.earlyReturn)return ne.earlyReturn;vo("BarChart",te,"categoryAccessor",c),vo("BarChart",te,"valueAccessor",u);const re=no(te,p,u),se=to(),ae=t.useMemo(()=>new Map,[te]),le=So({colorBy:g,colorScale:ne.colorScale,color:I,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:E,strokeWidth:F,opacity:D,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=t.useMemo(()=>co({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]),ue=wo({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(uo,{componentName:"BarChart",message:ue,width:G,height:q});const de=Oo(j),he=de?[de,...k||[]]:k,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(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:re}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,barPadding:y}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:V,showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:N,oSort:p}),oe),Pn({title:Q,description:Z,summary:K,accessibleTable:U,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:w,defaultTooltipContent:ce})),Ln({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"BarChart",width:G,height:q,children:e.jsx(_n,Object.assign({ref:r},ge))})});Mo.displayName="BarChart";const Co=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),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:p,normalize:y=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:j,valueExtent:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:B,legendInteraction:$,legendPosition:H,color:I,stroke:E,strokeWidth:F,opacity:D,categoryFormat:N}=n,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=t.useMemo(()=>m(s),[s]),ee=f||u,te=ko({data:J,rawData:s,colorBy:ee,colorScheme:p,legendInteraction:$,legendPosition:H,selection:O,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:B,width:W,height:z});if(te.earlyReturn)return te.earlyReturn;const ne=to(),oe=t.useMemo(()=>new Map,[J]),ie=So({colorBy:ee,colorScale:te.colorScale,color:I,themeCategorical:ne,colorScheme:p,categoryIndexMap:oe,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:E,strokeWidth:F,opacity:D,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=t.useMemo(()=>co({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),se=wo({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=jo({ref:o,frameRef:r,setup:te}),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:"bar"},null!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:v,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:g}),N&&{oFormat:N}),{showGrid:q}),ae),Pn({title:X,description:Y,summary:Q,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:k,defaultTooltipContent:re})),Ln({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),j&&j.length>0&&{annotations:j}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return se?e.jsx(uo,{componentName:"StackedBarChart",message:se,width:W,height:z}):e.jsx(mo,{componentName:"StackedBarChart",width:W,height:z,children:e.jsx(_n,Object.assign({ref:r},ce))})});Co.displayName="StackedBarChart";const _o=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),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:p,sort:y=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:B,legendPosition:$,color:H,stroke:I,strokeWidth:E,opacity:F,categoryFormat:D}=n,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=i,U=t.useMemo(()=>m(s),[s]),J=f||u,ee=ko({data:U,rawData:s,colorBy:J,colorScheme:p,legendInteraction:B,legendPosition:$,selection:S,linkedHover:O,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:N,height:W});if(ee.earlyReturn)return ee.earlyReturn;const te=to(),ne=t.useMemo(()=>new Map,[U]),oe=So({colorBy:J,colorScale:ee.colorScale,color:H,themeCategorical:te,colorScheme:p,categoryIndexMap:ne,userPieceStyle:A.pieceStyle,stroke:I,strokeWidth:E,opacity:F,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=t.useMemo(()=>co({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),re=wo({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=jo({ref:o,frameRef:r,setup:ee}),le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:U}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ae,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:K,rFormat:g}),D&&{oFormat:D}),{showGrid:G}),se),Pn({title:V,description:X,summary:Y,accessibleTable:Q,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:w,defaultTooltipContent:ie})),Ln({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,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 re?e.jsx(uo,{componentName:"GroupedBarChart",message:re,width:N,height:W}):e.jsx(mo,{componentName:"GroupedBarChart",width:N,height:W,children:e.jsx(_n,Object.assign({ref:r},le))})});function Po({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:i}){const r=(s="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(e){const{name:n,xField:o,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=qn({name:n}),c=o&&i?"xyBrush":o?"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)?(o&&(t[o]=[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&&Vn(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Vn(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,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==n||n(e)},[n,r]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}_o.displayName="GroupedBarChart";const Lo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),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:p,barPadding:y,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:j={},selection:A,linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,chartId:_,loading:P,loadingContent:L,emptyContent:R,legendInteraction:T,legendPosition:B,color:$,stroke:H,strokeWidth:I,opacity:E,categoryFormat:F,rTickValues:D,tickLabelEdgeAlign:N,showCategoryTicks:W,gradientFill:z,trackFill:G,roundedTop:q,valueExtent:V}=n,{width:X,height:Y,enableHover:Q,showGrid:Z,showLegend:K,title:U,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=i,ie=t.useMemo(()=>m(s),[s]),re=f||u,se=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==n.mode)return 40;const e=new Set(ie.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?Y:X)-2*t)/(t-1))):1},[y,n.mode,ie,c,h,X,Y]),ae=ko({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:T,legendPosition:B,selection:A,linkedHover:S,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:_,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:P,loadingContent:L,emptyContent:R,width:X,height:Y}),le=Po({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:d});if(ae.earlyReturn)return ae.earlyReturn;const ce=to(),ue=t.useMemo(()=>new Map,[ie]),de=So({colorBy:re,colorScale:ae.colorScale,color:$,themeCategorical:ce,colorScheme:p,categoryIndexMap:ue,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:H,strokeWidth:I,opacity:E,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=t.useMemo(()=>co({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ge=wo({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:fe,effectiveMargin:me}=jo({ref:o,frameRef:r,setup:ae}),pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:ie}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[X,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:me,barPadding:se,enableHover:Q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===W?void 0:ne,rLabel:oe,rFormat:g}),D&&{rTickValues:D}),null!=N&&{tickLabelEdgeAlign:N}),F&&{oFormat:F}),void 0!==W&&{showCategoryTicks:W}),{showGrid:Z}),fe),Pn({title:U,description:J,summary:ee,accessibleTable:te,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:he})),Ln({linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),b&&b.length>0&&{annotations:b}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=G&&{trackFill:G}),null!=q&&{roundedTop:q}),V&&{rExtent:V}),le.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(uo,{componentName:"SwimlaneChart",message:ge,width:X,height:Y}):e.jsx(mo,{componentName:"SwimlaneChart",width:X,height:Y,children:e.jsx(_n,Object.assign({ref:r},pe))})});function Ro(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);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,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}Lo.displayName="SwimlaneChart";const To=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ro(o,{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:p,sizeRange:y=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:j,brush:A,onBrush:S,linkedBrush:O,frameProps:M={},selection:C,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:R,chartId:T,loading:B,loadingContent:$,emptyContent:H,legendInteraction:I,legendPosition:E,color:F,stroke:D,strokeWidth:N,opacity:W,showCategoryTicks:z,categoryFormat:G}=n,{width:q,height:V,enableHover:Y,showGrid:Q,showLegend:Z,title:K,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ne}=i,oe=t.useMemo(()=>m(s),[s]),ie=ko({data:oe,rawData:s,colorBy:g,colorScheme:f,legendInteraction:I,legendPosition:E,selection:C,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:R,chartType:"SwarmPlot",chartId:T,showLegend:Z,userMargin:a,marginDefaults:i.marginDefaults,loading:B,loadingContent:$,emptyContent:H,width:q,height:V}),re=Po({brushProp:A,onBrushProp:S,linkedBrush:O,valueAccessor:u});if(ie.earlyReturn)return ie.earlyReturn;const se=t.useMemo(()=>{if(!p)return;const e=oe.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[oe,p]),ae=to(),le=t.useMemo(()=>new Map,[oe]),ce=So({colorBy:g,colorScale:ie.colorScale,color:F,themeCategorical:ae,colorScheme:f,categoryIndexMap:le,userPieceStyle:null==M?void 0:M.pieceStyle,stroke:D,strokeWidth:N,opacity:W,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:p?X(e,p,y,se):v})}),ue=t.useMemo(()=>co({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]),de=wo({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(de)return e.jsx(uo,{componentName:"SwarmPlot",message:de,width:q,height:V});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({chartType:"swarm"},null!=s&&{data:oe}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,barPadding:x,enableHover:Y}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:te,rLabel:ne,rFormat:h}),G&&{oFormat:G}),{showGrid:Q,showCategoryTicks:z}),ie.legendBehaviorProps),Pn({title:K,description:U,summary:J,accessibleTable:ee,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:w,defaultTooltipContent:ue})),Ln({linkedHover:_,onObservation:P,onClick:L,hoverHighlight:R,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),k&&k.length>0&&{annotations:k}),j&&{rExtent:j}),re.brushStreamProps),Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"SwarmPlot",width:q,height:V,children:e.jsx(_n,Object.assign({ref:r},he))})});function Bo(t){return n=>{var o;const i=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",r=n.stats||(n.data||n).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:Ct,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 o=t.valueAccessor,r=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=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:Ct,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:Ct,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}To.displayName="SwarmPlot";const $o=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ro(o,{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:p=!0,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,loading:C,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:R,color:T,stroke:B,strokeWidth:$,opacity:H,showCategoryTicks:I,categoryFormat:E}=n,{width:F,height:D,enableHover:N,showGrid:W,showLegend:z,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=i,Z=t.useMemo(()=>m(s),[s]),K=ko({data:Z,rawData:s,colorBy:g,colorScheme:f,legendInteraction:L,legendPosition:R,selection:k,linkedHover:j,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"BoxPlot",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,loadingContent:_,emptyContent:P,width:F,height:D});if(K.earlyReturn)return K.earlyReturn;const U=to(),J=t.useMemo(()=>new Map,[Z]),ee=So({colorBy:g,colorScale:K.colorScale,color:T,themeCategorical:U,colorScheme:f,categoryIndexMap:J,userPieceStyle:void 0,stroke:B,strokeWidth:$,opacity:H,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=t.useMemo(()=>Bo(),[]),ne=wo({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(uo,{componentName:"BoxPlot",message:ne,width:F,height:D});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Z}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,showOutliers:p,size:[F,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:y,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q,rFormat:h}),E&&{oFormat:E}),{showGrid:W,showCategoryTicks:I}),K.legendBehaviorProps),Pn({title:G,description:q,summary:V,accessibleTable:X,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:te})),Ln({linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"BoxPlot",width:F,height:D,children:e.jsx(_n,Object.assign({ref:r},oe))})});$o.displayName="BoxPlot";const Ho=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},Io=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),r=t.useRef(null);Ro(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c=Ho,valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:f,colorScheme:p,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:k,linkedBrush:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:B,legendPosition:$,color:H,stroke:I,strokeWidth:E,opacity:F,showCategoryTicks:D,categoryFormat:N}=n,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=t.useMemo(()=>m(s),[s]),ee=ko({data:J,rawData:s,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:$,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"Histogram",chartId:P,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:W,height:z}),te=Po({brushProp:w,onBrushProp:k,linkedBrush:j,valueAccessor:u});if(ee.earlyReturn)return ee.earlyReturn;const ne=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of J){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[J,u]),oe=to(),ie=t.useMemo(()=>new Map,[J]),re=So({colorBy:f,colorScale:ee.colorScale,color:H,themeCategorical:oe,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:I,strokeWidth:E,opacity:F,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=t.useMemo(()=>t=>{const n=t.data||t,o=n.category||t.category||"",i=n.count,r=n.range;return e.jsxs("div",{className:"semiotic-tooltip",style:Ct,children:[o&&e.jsx("div",{style:{fontWeight:"bold"},children:o+""}),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)]})]})},[]),ae=wo({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(uo,{componentName:"Histogram",message:ae,width:W,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),x?{rExtent:x}:ne&&{rExtent:ne}),{size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:g}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:D}),ee.legendBehaviorProps),Pn({title:X,description:Y,summary:Q,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:se})),Ln({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,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(mo,{componentName:"Histogram",width:W,height:z,children:e.jsx(_n,Object.assign({ref:r},le))})});Io.displayName="Histogram";const Eo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ro(o,{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:p,colorScheme:y,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:j,linkedBrush:A,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:B,legendInteraction:$,legendPosition:H,color:I,stroke:E,strokeWidth:F,opacity:D,showCategoryTicks:N,categoryFormat:W}=n,{width:z,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:Z,accessibleTable:K,categoryLabel:U,valueLabel:J}=i,ee=t.useMemo(()=>m(s),[s]),te=ko({data:ee,rawData:s,colorBy:p,colorScheme:y,legendInteraction:$,legendPosition:H,selection:O,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:B,width:z,height:G}),ne=Po({brushProp:k,onBrushProp:j,linkedBrush:A,valueAccessor:u});if(te.earlyReturn)return te.earlyReturn;const oe=to(),ie=t.useMemo(()=>new Map,[ee]),re=So({colorBy:p,colorScale:te.colorScale,color:I,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:F,opacity:D,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=t.useMemo(()=>Bo({valueAccessor:u}),[u]),ae=wo({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(uo,{componentName:"ViolinPlot",message:ae,width:z,height:G});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[z,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:v,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:V,showCategoryTicks:N}),te.legendBehaviorProps),Pn({title:Y,description:Q,summary:Z,accessibleTable:K,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:b,defaultTooltipContent:se})),Ln({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),ne.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"ViolinPlot",width:z,height:G,children:e.jsx(_n,Object.assign({ref:r},le))})});Eo.displayName="ViolinPlot";const Fo=t.forwardRef(function(n,o){var i;const r=io(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);Ro(o,{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:p,sort:y="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:k,valueExtent:j,frameProps:A={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:B,legendPosition:$,color:H,stroke:I,strokeWidth:E,opacity:F,categoryFormat:D}=n,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=r,U=t.useMemo(()=>m(a),[a]),J=ko({data:U,rawData:a,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:$,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:q,userMargin:l,marginDefaults:r.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:N,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=no(U,y,d),te=to(),ne=t.useMemo(()=>new Map,[U]),oe=So({colorBy:f,colorScale:J.colorScale,color:H,themeCategorical:te,colorScheme:p,categoryIndexMap:ne,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:I,strokeWidth:E,opacity:F,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),ie=t.useMemo(()=>co({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]),re=wo({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(uo,{componentName:"DotPlot",message:re,width:N,height:W});const se=Oo(k),ae=se?[se,...w||[]]:w,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:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:b,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Z,rLabel:K,rFormat:g}),D&&{oFormat:D}),{showGrid:G,oSort:y}),J.legendBehaviorProps),Pn({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:x,defaultTooltipContent:ie})),Ln({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"DotPlot",width:N,height:W,children:e.jsx(_n,Object.assign({ref:s},le))})});Fo.displayName="DotPlot";const Do=t.forwardRef(function(n,o){var i,r;const s=io(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:B,opacity:$}=n,{width:H,height:I,enableHover:E,showLegend:F,title:D,description:N,summary:W,accessibleTable:z}=s,G=t.useMemo(()=>m(l),[l]),q=g||d,V=ko({data:G,rawData:l,colorBy:q,colorScheme:f,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:F,userMargin:c,marginDefaults:s.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:H,height:I});if(V.earlyReturn)return V.earlyReturn;const X=to(),Y=t.useMemo(()=>new Map,[G]),Q=So({colorBy:q,colorScale:V.colorScale,color:R,themeCategorical:X,colorScheme:f,categoryIndexMap:Y,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:B,opacity:$,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection,cycleByCategory:!0}),Z=t.useMemo(()=>co({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),K=wo({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:U,effectiveMargin:J}=jo({ref:o,frameRef:a,setup:V}),ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=l&&{data:G}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:Q,startAngle:p}),null!=y&&{cornerRadius:y}),{size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),U),Pn({title:D,description:N,summary:W,accessibleTable:z,className:u,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:Z})),Ln({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e.jsx(uo,{componentName:"PieChart",message:K,width:H,height:I}):e.jsx(mo,{componentName:"PieChart",width:H,height:I,children:e.jsx(_n,Object.assign({ref:a},ee))})});Do.displayName="PieChart";const No=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.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:p=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:B,opacity:$}=n,{width:H,height:I,enableHover:E,showLegend:F,title:D,description:N,summary:W,accessibleTable:z}=i,G=t.useMemo(()=>m(s),[s]),q=g||c,V=ko({data:G,rawData:s,colorBy:q,colorScheme:f,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"DonutChart",chartId:O,showLegend:F,userMargin:a,marginDefaults:i.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:H,height:I});if(V.earlyReturn)return V.earlyReturn;const X=null!=d?d:Math.max(2,.15*Math.min(H,I)),Y=to(),Q=t.useMemo(()=>new Map,[G]),Z=So({colorBy:q,colorScale:V.colorScale,color:R,themeCategorical:Y,colorScheme:f,categoryIndexMap:Q,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:B,opacity:$,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection,cycleByCategory:!0}),K=t.useMemo(()=>co({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),U=wo({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=jo({ref:o,frameRef:r,setup:V}),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=s&&{data:G}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:Z,innerRadius:X,startAngle:p}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),J),Pn({title:D,description:N,summary:W,accessibleTable:z,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:v,defaultTooltipContent:K})),Ln({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return U?e.jsx(uo,{componentName:"DonutChart",message:U,width:H,height:I}):e.jsx(mo,{componentName:"DonutChart",width:H,height:I,children:e.jsx(_n,Object.assign({ref:r},te))})});function Wo(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function zo(e){return Math.max(0,Math.min(1,e))}function Go(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function qo(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Vo(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:zo(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=zo(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,s=r>0?(o-t.offset)/r:0,a=Go(t.color),l=Go(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,u,d]=a,[h,g,f]=l;return qo(c+(h-c)*s,u+(g-u)*s,d+(f-d)*s)}return n[n.length-1].color}function Xo(e,t,n){return`${e}-${t}`}No.displayName="DonutChart";const Yo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),r=t.useRef(null),s="context"===n.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,gradientFill:h,color:g,backgroundColor:f="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:p,showNeedle:y=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!a,sweep:k=240,fillZones:j=!0,tooltip:A,annotations:S,frameProps:O={},className:M,stroke:C,strokeWidth:_,opacity:P}=n,{width:L,height:R,title:T,description:B,summary:$,accessibleTable:H}=i,I=h&&"object"==typeof h?h:void 0,E=Math.max(c,Math.min(u,l)),F=u-c||1,D=(E-c)/F,{gaugeData:N,pieceStyle:W,gaugeAnnotations:z}=t.useMemo(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>g[g.length-1].value&&g.push({value:n,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,m=[],p=new Map,y=[];if(f){const e=a?h:1,t=Xo("bg",0);if(m.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),p.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(Vo(c.colorStops,e*(t+.5)/n));const i=Xo("fill",0);m.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),p.set(i,{fill:o[0]||s})}}else{let e=t;for(let n=0;g.length>n;n++){const o=g[n],i=(o.value-e)/d,r=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-r),u=a?Math.max(0,i-c):0;if(c>0){const e=Xo("fill",n);m.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),p.set(e,{fill:o.color})}if(u>0){const e=Xo("bg",n);m.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),p.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:m,pieceStyle:(e,t)=>p.get(t||e.category)||{fill:s},gaugeAnnotations:y}}({min:c,max:u,value:l,thresholds:d,fillColor:g,backgroundColor:f,fillZones:j,showScaleLabels:w,gradientFill:I}),[l,c,u,d,g,f,w,j,I]),G=t.useMemo(()=>Ao(W,{stroke:C,strokeWidth:_,opacity:P}),[W,C,_,P]),{sweepRad:q,startAngleDeg:V}=Wo(k),X=function(e=240){const{sweepRad:t,offsetRad:n}=Wo(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(k),Y=Math.min(10,Math.max(1,Math.min(L,R)/12)),Q=X.cx,Z=X.cy,K=Math.max(4,Math.min((L-2*Y)/X.width,(R-2*Y)/X.height)-2),U=Math.max(0,Math.min(K-1.5,K*(1-m))),J=L/2-Q*K,ee=R/2-Z*K,te=2*(K+4),ne=t.useMemo(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(E,c,u):b;const t=x?x(E):Math.round(E)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),w&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[b,E,c,u,x,w,K,a]),oe=t.useMemo(()=>s&&null==b?{type:"gauge-value",text:x?x(E):Math.round(E)+""}:null,[s,b,E,x]),ie=t.useMemo(()=>{if(!y)return null;const e=-Math.PI/2+V*Math.PI/180+D*q,t=U>20?U-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[y,D,V,q,U,v]),re=t.useMemo(()=>(t,n,o)=>{if("gauge-needle"===t.type){const i=(o.width||L)/2,r=(o.height||R)/2,s=Math.max(1,K-U),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-"+n)}if("gauge-label"===t.type){const i=-Math.PI/2+V*Math.PI/180+(t.value-c)/F*q,r=(o.width||L)/2,s=(o.height||R)/2,a=U-1,l=K+1,u=Math.cos(i)*a,d=Math.sin(i)*a,h=Math.cos(i)*l,g=Math.sin(i)*l,f=K+10,m=Math.cos(i)*f,p=Math.sin(i)*f,y=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let v="middle",b="middle";return y>=11||1>y?(v="middle",b="auto"):y>=1&&5>y?(v="start",b="middle"):y>=5&&7>y?(v="middle",b="hanging"):(v="end",b="middle"),e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:u,y1:d,x2:h,y2:g,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("text",{x:m,y:p,textAnchor:v,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:t.label})]},"gauge-label-"+n)}return"gauge-value"===t.type?e.jsx("text",{x:(o.width||L)/2,y:(o.height||R)/2-.2*U,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+n):null},[L,R,c,F,V,q,U,K]),se=t.useMemo(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),oe&&e.push(oe),e},[z,S,ie,oe]),ae=t.useMemo(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,i=null==o?void 0:o._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==o?void 0:o._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===N.length)return e.jsx(uo,{componentName:"GaugeChart",message:"No data to display",width:L,height:R});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:N,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:G,innerRadius:U,startAngle:V,sweepAngle:k},null!=p&&{cornerRadius:p}),{centerContent:ne,size:[L,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ee-te/2,bottom:R-ee-te/2,left:J-te/2,right:L-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===A?()=>null:Rt(A)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),T&&{title:T}),B&&{description:B}),$&&{summary:$}),void 0!==H&&{accessibleTable:H}),M&&{className:M}),null!=n.animate&&{animate:n.animate}),O);return e.jsx(mo,{componentName:"GaugeChart",width:L,height:R,children:e.jsx(_n,Object.assign({ref:r},le))})});Yo.displayName="GaugeChart";const Qo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);Ro(o,{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:p,colorScheme:y,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:j,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:T,color:B,stroke:$,strokeWidth:H,opacity:I,showCategoryTicks:E,categoryFormat:F}=n,{width:D,height:N,enableHover:W,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:Z}=i,K=t.useMemo(()=>m(s),[s]),U=ko({data:K,rawData:s,colorBy:p,colorScheme:y,legendInteraction:R,legendPosition:T,selection:j,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:M,chartType:"RidgelinePlot",chartId:C,showLegend:G,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:D,height:N});if(U.earlyReturn)return U.earlyReturn;const J=to(),ee=t.useMemo(()=>new Map,[K]),te=So({colorBy:p,colorScale:U.colorScale,color:B,themeCategorical:J,colorScheme:y,categoryIndexMap:ee,userPieceStyle:void 0,stroke:$,strokeWidth:H,opacity:I,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=t.useMemo(()=>Bo(),[]),oe=wo({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(oe)return e.jsx(uo,{componentName:"RidgelinePlot",message:oe,width:D,height:N});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,bins:h,size:[D,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U.margin,barPadding:v,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:Z,rFormat:f}),F&&{oFormat:F}),{showGrid:z,showCategoryTicks:E,oSort:!1,amplitude:g}),U.legendBehaviorProps),Pn({title:q,description:V,summary:X,accessibleTable:Y,className:l,animate:n.animate,axisExtent:n.axisExtent})),Rn({tooltip:b,defaultTooltipContent:ne})),Ln({linkedHover:A,onObservation:S,onClick:O,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(mo,{componentName:"RidgelinePlot",width:D,height:N,children:e.jsx(_n,Object.assign({ref:r},ie))})});Qo.displayName="RidgelinePlot";const Zo=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),r=t.useRef(null);Ro(o,{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:p=.3,showLabels:y=!0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:B,opacity:$,categoryFormat:H}=n,I="vertical"===f,{width:E,height:F,enableHover:D,showLegend:N,title:W,description:z,summary:G,accessibleTable:q}=i,V=I?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>m(s),[s]),Y=h||d,Q=!Y,Z=ko({data:X,rawData:s,colorBy:Y,colorScheme:g,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:S,chartType:"FunnelChart",chartId:O,showLegend:N,userMargin:a,marginDefaults:V,loading:M,loadingContent:C,emptyContent:_,width:E,height:F});if(Z.earlyReturn)return Z.earlyReturn;vo("FunnelChart",X,"stepAccessor",c),vo("FunnelChart",X,"valueAccessor",u);const K=to(),U=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(Q)return R||((null==K?void 0:K[0])?K[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[Q,R,K,g]),ee=So({colorBy:J?void 0:Y,colorScale:Z.colorScale,color:null!=J?J:R,themeCategorical:K,colorScheme:g,categoryIndexMap:U,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:B,opacity:$,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),te=t.useMemo(()=>t=>{var n,o,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!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==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,m=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:Ct,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+"",m]})]})},[]),ne=wo({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(ne)return e.jsx(uo,{componentName:"FunnelChart",message:ne,width:E,height:F});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:ee,size:[E,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:I,showCategoryTicks:I}),H&&{oFormat:H}),{showGrid:I}),!I&&{connectorOpacity:p}),{showLabels:y}),Z.legendBehaviorProps),W&&{title:W}),z&&{description:z}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:!0===v||null==v?te:Rt(v)||te}),(k||j||A||S)&&{customHoverBehavior:Z.customHoverBehavior}),(j||A||k)&&{customClickBehavior:Z.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(mo,{componentName:"FunnelChart",width:E,height:F,children:e.jsx(_n,Object.assign({ref:r},oe))})});Zo.displayName="FunnelChart";const Ko={RdBu:B,PiYG:$,PRGn:H,BrBG:I,RdYlBu:E,RdYlGn:F,Spectral:D},Uo="__likert_neutral_neg",Jo="__likert_neutral_pos";function ei(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ti(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];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,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function ni(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Uo,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Jo,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function oi(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/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 n of e)n.__likertLevel===Uo?r=n:n.__likertLevel===Jo?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const ii=["Very Low","Low","Neutral","High","Very High"],ri=new Map,si=t.forwardRef(function(n,o){const i=io(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:g="count",levels:f=ii,orientation:m="horizontal",colorScheme:p,barPadding:y=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:S,hoverHighlight:O,chartId:M,valueFormat:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:T,categoryFormat:B,stroke:$,strokeWidth:H,opacity:I}=n,{width:E,height:F,enableHover:D,showGrid:N,showLegend:W,title:G,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=i,U="horizontal"===m,J=void 0===s,ee=!d,te=function(){var e;const t=Un();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ne=t.useMemo(()=>p&&Array.isArray(p)&&p.length>=f.length?p:function(e,t){if(0>=e)return[];if(t){const n=Ko[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#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(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(f.length,te),[p,f.length,te]),oe=t.useMemo(()=>{const e=new Map;for(let t=0;f.length>t;t++)e.set(f[t],ne[t]||"#888");return e},[f,ne]),{processedData:ie,reAggregate:re,accumulatorRef:se}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>ei(o,"question"),[o]),d=t.useMemo(()=>c?ei(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:ei(r,"level"),[c,r]),g=t.useMemo(()=>c?null:ei(s,"count"),[c,s]),f=e||[],m=t.useRef([]),p=t.useMemo(()=>{if(0===f.length)return[];let e=ti(f,n,u,d,h,g);return a&&(e=ni(e,n),e=oi(e,n)),e},[f,n,u,d,h,g,a]),y=t.useCallback(e=>{var t;let o=ti(e,n,u,d,h,g);a&&(o=ni(o,n),o=oi(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,g,a,l]);return{processedData:p,reAggregate:y,accumulatorRef:m}}({data:s,levels:f,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:g,isDiverging:U,frameRef:r}),ae="__likertLevelLabel",le=function({isPushMode:e,colorBy:n,colorScheme:o,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=Bn(),d=to(),h=t.useCallback(e=>{const t=e[n];return null!=t?t+"":null},[n]),g=t.useCallback(t=>{if(!e||!n)return;let o=!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),o=!0)}o&&c(e=>e+1)},[e,n,h]),f=t.useCallback(t=>{if(!e||!n)return;const o=Array.from(new Set(t.map(String))),i=a.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(s.current=new Set(o),a.current=o,c(e=>e+1))},[e,n]),m=t.useCallback(e=>t=>{g([t]),e(t)},[g]),p=t.useCallback(e=>t=>{g(t),e(t)},[g]),y=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);Zn(e&&n?a.current:[]);const v=t.useMemo(()=>{if(!e||!n||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:d&&d.length>0?d:z,s=n,l=t.map(e=>({[s]:e})),c=V(l,s,r);return Kn({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:q})},[e,n,i,o,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:m,wrapPushMany:p,resetCategories:y,categories:a.current,categoryDomainProps:e&&n?{legendCategoryAccessor:n,onCategoriesChange:f}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:J,colorBy:ae,colorScheme:ne,showLegend:W,legendPosition:T}),ce=t.useCallback(le.wrapPush(e=>{se.current.push(e),re(se.current)}),[le.wrapPush,re,se]),ue=t.useCallback(le.wrapPushMany(e=>{se.current.push(...e),re(se.current)}),[le.wrapPushMany,re,se]);t.useImperativeHandle(o,()=>({push:ce,pushMany:ue,remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;se.current=[],le.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}}),[ce,ue,le.resetCategories,se]);const de=ko({data:ie,rawData:s,colorBy:ae,colorScheme:ne,legendInteraction:R,legendPosition:T,selection:k,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"LikertChart",chartId:M,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:E,height:F});if(de.earlyReturn)return de.earlyReturn;const he=t.useMemo(()=>{const e=f.length;return e%2!=0&&oe.get(f[Math.floor(e/2)])||"#888"},[f,oe]),ge=So({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:ri,userPieceStyle:null==w?void 0:w.pieceStyle,stroke:$,strokeWidth:H,opacity:I,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===Uo||i===Jo)return{fill:he};const r=o||i;return r&&oe.has(r)?{fill:oe.get(r)}:{fill:"#888"}}}),fe=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,n=t.__likertLevel||"Unknown",o=n===Uo||n===Jo?fe:n,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=n===Uo||n===Jo?2*r:r,a=t.__likertCount||0;return h.createElement("div",{className:"semiotic-tooltip",style:Ct},h.createElement("div",{style:{fontWeight:"bold"}},i),h.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[fe]),pe=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 ee?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),g&&(e.countAccessor=g)),wo({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:f}})},[s,c,u,d,g,f,ee]),ye=t.useMemo(()=>[{styleFn:e=>({fill:oe.get(e.label)||"#888"}),items:f.map(e=>({label:e})),label:""}],[f,oe]),ve=t.useMemo(()=>!1!==W?Object.assign(Object.assign({},de.legendBehaviorProps),{legend:{legendGroups:ye},legendPosition:T||de.legendPosition||"bottom"}):de.legendBehaviorProps,[de.legendBehaviorProps,de.legendPosition,T,W,ye]),be=t.useMemo(()=>{const e=Object.assign({},de.margin);if(J&&!1!==W){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(le.streamingMarginAdjust)for(const[t,n]of Object.entries(le.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[de.margin,le.streamingMarginAdjust,U,J,W,T]),xe=t.useMemo(()=>C||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,C]),we=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:ge,size:[E,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:be,barPadding:y,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:K||(U?void 0:"Percentage"),rFormat:xe}),B&&{oFormat:B}),{showGrid:N}),ve),G&&{title:G}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),{tooltipContent:!1===v?()=>null:!0===v?me:Rt(v)||me}),(j||A||S||O)&&{customHoverBehavior:de.customHoverBehavior}),(A||S||j)&&{customClickBehavior:de.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return pe?e.jsx(uo,{componentName:"LikertChart",message:pe,width:E,height:F}):e.jsx(mo,{componentName:"LikertChart",width:E,height:F,children:e.jsx(_n,Object.assign({ref:r},we))})});si.displayName="LikertChart";const ai=t.forwardRef(function(n,o){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:m=!1,annotations:p,onObservation:y,onClick:v,selection:b,linkedHover:x,chartId:w,loading:k,loadingContent:j,emptyContent:A,frameProps:S={}}=n,{frameRef:O,resolved:M,safeData:C,setup:_,earlyReturn:P}=function(e){var n;const o=function(e){const n=t.useRef(null);return Ro(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:io(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;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:r}=o,s=ko({data:null!==(n=e.data)&&void 0!==n?n:[],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,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},o),{safeData:s.data,setup:s,earlyReturn:s.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:i,colorScheme:f,selection:b,linkedHover:x,onObservation:y,onClick:v,chartId:w,loading:k,loadingContent:j,emptyContent:A,margin:h,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,mode:n.mode});if(P)return P;const{width:L,height:R,enableHover:T,showGrid:B,title:$,description:H,summary:I,accessibleTable:E}=M,F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:C}),{customLayout:r,layoutConfig:s,oAccessor:a,rAccessor:l,oExtent:c,rExtent:u,projection:d,colorScheme:f,size:[L,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:_.margin,enableHover:T,showAxes:m,showGrid:B,annotations:p}),Pn({title:$,description:H,summary:I,accessibleTable:E,className:g,animate:n.animate,axisExtent:n.axisExtent})),Ln({linkedHover:x,onObservation:y,onClick:v,hoverHighlight:!1,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior})),S);return e.jsx(mo,{componentName:"OrdinalCustomChart",width:L,height:R,children:e.jsx(_n,Object.assign({ref:O},F))})});ai.displayName="OrdinalCustomChart",exports.BarChart=Mo,exports.BoxPlot=$o,exports.DonutChart=No,exports.DotPlot=Fo,exports.FunnelChart=Zo,exports.GaugeChart=Yo,exports.GroupedBarChart=_o,exports.Histogram=Io,exports.LikertChart=si,exports.OrdinalCustomChart=ai,exports.PieChart=Do,exports.RidgelinePlot=Qo,exports.StackedBarChart=Co,exports.StreamOrdinalFrame=_n,exports.SwarmPlot=To,exports.SwimlaneChart=Lo,exports.ViolinPlot=Eo,exports.createHatchPattern=vn;