semiotic 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CLAUDE.md +10 -4
  2. package/README.md +1 -1
  3. package/ai/dist/mcp-server.js +104 -9
  4. package/ai/schema.json +1 -1
  5. package/dist/components/LinkedCharts.d.ts +8 -0
  6. package/dist/components/charts/index.d.ts +1 -1
  7. package/dist/components/charts/ordinal/BarChart.d.ts +7 -1
  8. package/dist/components/charts/ordinal/DotPlot.d.ts +9 -1
  9. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +2 -2
  10. package/dist/components/charts/ordinal/LikertChart.d.ts +5 -2
  11. package/dist/components/charts/ordinal/StackedBarChart.d.ts +2 -2
  12. package/dist/components/charts/shared/hooks.d.ts +15 -2
  13. package/dist/components/charts/shared/selectionUtils.d.ts +9 -7
  14. package/dist/components/charts/shared/tooltipUtils.d.ts +13 -1
  15. package/dist/components/charts/shared/types.d.ts +5 -6
  16. package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
  17. package/dist/components/charts/shared/useResolvedSelection.d.ts +2 -0
  18. package/dist/components/realtime/types.d.ts +12 -0
  19. package/dist/components/semiotic-geo.d.ts +4 -0
  20. package/dist/components/semiotic-network.d.ts +7 -0
  21. package/dist/components/semiotic-ordinal.d.ts +8 -0
  22. package/dist/components/semiotic-xy.d.ts +9 -0
  23. package/dist/components/server/renderToStaticSVG.d.ts +1 -1
  24. package/dist/components/store/ThemeStore.d.ts +2 -0
  25. package/dist/components/stream/CanvasHitTester.d.ts +8 -3
  26. package/dist/components/stream/DataSourceAdapter.d.ts +17 -0
  27. package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
  28. package/dist/components/stream/GeoPipelineStore.d.ts +19 -1
  29. package/dist/components/stream/NetworkPipelineStore.d.ts +5 -0
  30. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +3 -1
  31. package/dist/components/stream/OrdinalPipelineStore.d.ts +38 -1
  32. package/dist/components/stream/ParticlePool.d.ts +4 -0
  33. package/dist/components/stream/PipelineStore.d.ts +17 -2
  34. package/dist/components/stream/StreamXYFrame.d.ts +17 -0
  35. package/dist/components/stream/geoTypes.d.ts +7 -0
  36. package/dist/components/stream/hoverUtils.d.ts +12 -0
  37. package/dist/components/stream/networkTypes.d.ts +19 -1
  38. package/dist/components/stream/ordinalTypes.d.ts +53 -12
  39. package/dist/components/stream/pipelineTransitionUtils.d.ts +21 -0
  40. package/dist/components/stream/quadtreeHitTest.d.ts +22 -0
  41. package/dist/components/stream/renderers/resolveCSSColor.d.ts +23 -6
  42. package/dist/components/stream/types.d.ts +18 -0
  43. package/dist/components/stream/useFrame.d.ts +122 -0
  44. package/dist/geo.min.js +1 -1
  45. package/dist/geo.module.min.js +1 -1
  46. package/dist/network.min.js +1 -1
  47. package/dist/network.module.min.js +1 -1
  48. package/dist/ordinal.min.js +1 -1
  49. package/dist/ordinal.module.min.js +1 -1
  50. package/dist/realtime.min.js +1 -1
  51. package/dist/realtime.module.min.js +1 -1
  52. package/dist/semiotic-ai.min.js +1 -1
  53. package/dist/semiotic-ai.module.min.js +1 -1
  54. package/dist/semiotic-geo.d.ts +4 -0
  55. package/dist/semiotic-network.d.ts +7 -0
  56. package/dist/semiotic-ordinal.d.ts +8 -0
  57. package/dist/semiotic-themes.min.js +1 -1
  58. package/dist/semiotic-themes.module.min.js +1 -1
  59. package/dist/semiotic-utils.min.js +1 -1
  60. package/dist/semiotic-utils.module.min.js +1 -1
  61. package/dist/semiotic-xy.d.ts +9 -0
  62. package/dist/semiotic.min.js +1 -1
  63. package/dist/semiotic.module.min.js +1 -1
  64. package/dist/server.min.js +1 -1
  65. package/dist/server.module.min.js +1 -1
  66. package/dist/test-utils/canvasMock.d.ts +26 -0
  67. package/dist/test-utils/ordinalFixtures.d.ts +48 -0
  68. package/dist/xy.min.js +1 -1
  69. package/dist/xy.module.min.js +1 -1
  70. package/package.json +15 -14
@@ -1 +1 @@
1
- import*as e from"react";import{useRef as t,useMemo as n,useEffect as o,useState as r,useSyncExternalStore as i,createContext as s,useContext as a,useCallback as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{select as h}from"d3-selection";import{brushX as g,brushY as p,brush as y}from"d3-brush";import{scaleOrdinal as f,scaleLinear as m,scaleLog as v,scaleTime as b,scaleSequential as x}from"d3-scale";import{quadtree as k}from"d3-quadtree";import{schemeCategory10 as w,interpolatePlasma as A,interpolateViridis as O,interpolatePurples as S,interpolateOranges as j,interpolateGreens as E,interpolateReds as C,interpolateBlues as M,schemeSet3 as P,schemeTableau10 as _}from"d3-scale-chromatic";import{bin as B}from"d3-array";import{packEnclose as L}from"d3-hierarchy";import{area as N,curveCatmullRom as T,curveCardinal as H,curveBasis as I,curveStepBefore as z,curveStepAfter as F,curveStep as $,curveMonotoneY as W,curveMonotoneX as D,curveLinear as R,line as G,curveNatural as Y}from"d3-shape";import q from"regression";function X(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function V(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function U({width:r,height:i,totalWidth:s,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:f,snap:m,binBoundaries:v,snapDuring:b,streaming:x}){const k=t(null),w=t(null),A=t(d);A.current=d;const O=t(u);O.current=u;const S=n(()=>v?[...v].sort((e,t)=>e-t):void 0,[v]),j=t(S);j.current=S;const E=t(!1),C=t(null);return o(()=>{if(!k.current)return;const e=h(k.current).select(".brush-g"),t="x"===c?g():"y"===c?p():y();return t.extent([[0,0],[r,i]]),t.on("brush end",n=>{if(E.current)return;const o=O.current;if(!o)return;if(!n.selection)return C.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=n.selection;s=[o.x.invert(e),o.x.invert(t)],a=[o.y.invert(i),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;s=[o.x.invert(0),o.x.invert(r)],a=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[r,i]]=n.selection;s=[o.x.invert(e),o.x.invert(r)],a=[o.y.invert(i),o.y.invert(t)]}if("bin"===m&&"y"!==c&&("end"===n.type||"brush"===n.type&&b)){const r=j.current;r&&r.length>0?s=function(e,t){return 0===t.length?e:[X(e[0],t),V(e[1],t)]}(s,r):f&&f>0&&(s=[Math.floor(s[0]/f)*f,Math.ceil(s[1]/f)*f]);const i=o.x(s[0]),a=o.x(s[1]);if(E.current=!0,"x"===c)e.call(t.move,[i,a]);else if("xy"===c){const o=n.selection;e.call(t.move,[[i,o[0][1]],[a,o[1][1]]])}E.current=!1}const l={x:s,y:a};C.current=l,A.current(l)}),e.call(t),w.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),w.current=null}},[r,i,c,m,f,b]),o(()=>{if(!(x&&u&&w.current&&C.current))return;if(!k.current)return;if("y"===c)return;const e=C.current,t=u.x.domain()[0],n=h(k.current).select(".brush-g");if(t>=e.x[1])return E.current=!0,n.call(w.current.move,null),E.current=!1,C.current=null,void A.current(null);let o=e.x[0],r=!1;if(t>e.x[0]){if(o=t,"bin"===m){const e=j.current;e&&e.length>0?o=V(t,e):f&&f>0&&(o=Math.ceil(t/f)*f)}if(o>=e.x[1])return E.current=!0,n.call(w.current.move,null),E.current=!1,C.current=null,void A.current(null);r=!0}const i=u.x(o),s=u.x(e.x[1]);if(E.current=!0,"x"===c)n.call(w.current.move,[i,s]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[i,t],[s,o]])}if(E.current=!1,r){const t={x:[o,e.x[1]],y:e.y};C.current=t,A.current(t)}},[u,x,c,m,f]),e.createElement("svg",{ref:k,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`}))}class Q{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class K{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class J{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Z(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function ee(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function te(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function ne(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function oe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}const re={category10:w,tableau10:_,set3:P,blues:M,reds:C,greens:E,oranges:j,purples:S,viridis:O,plasma:A},ie=w,se=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ae=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 le(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")||ae.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):ie[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+""))%ie.length]}function ce(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return f().domain(o).range(n).unknown("#999");const i=re[n]||re.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:ie;return f().domain(o).range(e).unknown("#999")}}function ue(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}function de(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}function he(e,t,n){var o;const r=null!==(o=e.duration)&&void 0!==o?o:500,i=n-t;return r>i?1-i/r:0}function ge(e,t,n){return e+(t-e)*n}function pe(e,t,n){var o,r,i,s;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(r=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==r?r:null===(i=t.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function ye(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function fe(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function me(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(null==a||null==l||Number.isNaN(a)||Number.isNaN(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function ve(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function be(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function xe(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],r=[];for(const n of t){const t=e.getX(n),i=e.getY(n);if(null==t||null==i||Number.isNaN(t)||Number.isNaN(i))continue;const s=e.getBounds(n),a=e.scales.x(t);if(s&&0!==s)o.push([a,e.scales.y(i+s)]),r.push([a,e.scales.y(i-s)]);else{const t=e.scales.y(i);o.push([a,t]),r.push([a,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:r,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function ke(e,t,n,o){var r;if(!e.config.pointStyle)return;const i=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const a=null!==(r=o.r)&&void 0!==r?r:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=me(s,e.scales,e.getX,i,a,o,l);c&&n.push(c)}}}const we={blues:M,reds:C,greens:E,viridis:O},Ae=new Map;class Oe{constructor(e){if(this.xExtent=new J,this.yExtent=new J,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.xIsDate=!1,this._quadtree=null,this.config=e,this.buffer=new K(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=te(e.timeAccessor||e.xAccessor,"time"),this.getY=te(e.valueAccessor||e.yAccessor,"value")):(this.getX=te(e.xAccessor,"x"),this.getY=te(e.yAccessor,"y")),this.getGroup=oe(e.groupAccessor),this.getCategory=oe(e.categoryAccessor),this.getSize=e.sizeAccessor?te(e.sizeAccessor,"size"):void 0,this.getColor=oe(e.colorAccessor),this.getBounds=e.boundsAccessor?te(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?te(e.y0Accessor,"y0"):void 0,this.getPointId=oe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?te(e.openAccessor,"open"):void 0,this.getHigh=te(e.highAccessor,"high"),this.getLow=te(e.lowAccessor,"low"),this.getClose=n?te(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new K(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?te(this.config.timeAccessor||this.config.xAccessor,"time"):te(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}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.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,s,a;const{config:l,buffer:c}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.getBufferArray(),d=this.xExtent.extent,h=this.yExtent.extent;let g=l.xExtent?[null!==(n=l.xExtent[0])&&void 0!==n?n:d[0],null!==(o=l.xExtent[1])&&void 0!==o?o:d[1]]:d,p=l.yExtent?[null!==(r=l.yExtent[0])&&void 0!==r?r:h[0],null!==(i=l.yExtent[1])&&void 0!==i?i:h[1]]:h;const y=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!y&&c.size>0)if(l.normalize)p=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)p=this._stackExtentCache.yDomain;else{const t=this.groupData(u),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);p=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:p}}}else if("bar"===l.chartType&&l.binSize&&!y&&c.size>0){const[,e]=function(e,t,n,o,r){const i=Z(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(c,this.getX,this.getY,l.binSize,this.getCategory);p=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!y&&c.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(c,this.getY),n=t-e,o=n>0?n*l.extentPadding:1;p=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!y&&p[0]!==1/0){if(this.getBounds)for(const e of u){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>p[1]&&(p[1]=t+n),p[0]>t-n&&(p[0]=t-n))}const e=p[1]-p[0],t=e>0?e*l.extentPadding:1,n=null===(s=l.yExtent)||void 0===s?void 0:s[0],o=null===(a=l.yExtent)||void 0===a?void 0:a[1];p=[null!=n?p[0]:p[0]-t,null!=o?p[1]:p[1]+t],"log"===l.yScaleType&&0>=p[0]&&h[0]>0&&(p[0]=null!=n?p[0]:h[0]/(1+l.extentPadding))}if(g[0]===1/0||g[1]===-1/0)if("time"===l.xScaleType){const e=Date.now();g=[e-864e5,e]}else g=[0,1];p[0]!==1/0&&p[1]!==-1/0||(p=[0,1]);const f="streaming"===l.runtimeMode,x=Math.max(0,Math.min(l.scalePadding||0,Math.min(e.width,e.height)/2-1));if(f)if("x"==("up"===(k=l.arrowOfTime)||"down"===k?"y":"x")){const t="right"===l.arrowOfTime?[x,e.width-x]:[e.width-x,x];this.scales={x:m().domain(g).range(t),y:m().domain(p).range([e.height-x,x])}}else{const t="down"===l.arrowOfTime?[x,e.height-x]:[e.height-x,x];this.scales={x:m().domain(p).range([x,e.width-x]),y:m().domain(g).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)};this.scales={x:t(l.xScaleType,g,[x,e.width-x]),y:t(l.yScaleType,p,[e.height-x,x])}}var k;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,u),this.config.decay&&this.applyDecay(this.scene,u),this.config.pulse&&this.applyPulse(this.scene,u),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return void(this._quadtree=null);const t=this.scene.filter(e=>"point"===e.type);this._quadtree=t.length>Oe.QUADTREE_THRESHOLD?k().x(e=>e.x).y(e=>e.y).addAll(t):null}get quadtree(){return this._quadtree}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:r}=this;if(!r||0===t.length)return[];const i={scales:r,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),r=[],i=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of o){const n=xe(e,t.data,t.key);n&&r.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=ye(t.data,e.scales,e.getX,e.getY,n,t.key);i&&i.length>0&&(o.colorThresholds=i),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),r.push(o)}return ke(e,o,r),r}(i,t);case"area":return function(e,t){const n=e.groupData(t),o=[],r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=fe(t.data,e.scales,e.getX,e.getY,r,n,t.key,i);e.config.gradientFill&&(s.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return ke(e,n,o),o}(i,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set,i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=fe(t.data,e.scales,e.getX,e.getY,i,n,t.key,s);e.config.gradientFill&&(r.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=ye(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return ke(e,n,o),o}(i,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:r,stackedTops:i}=function(e,t,n,o,r,i,s){var a;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(a=u.get(o.key))||void 0===a?void 0:a.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,p=new Map;for(const e of c)p.set(e,0);for(const n of e){const e=u.get(n.key),o=[],a=[],l=new Map;for(const n of c){let r=e.get(n)||0;const s=p.get(n);i&&(r/=d.get(n));const c=s+r,u=t.x(n);a.push([u,t.y(s)]),o.push([u,t.y(c)]),p.set(n,c),l.set(n,c)}g.set(n.key,l);const y={type:"area",topPath:o,bottomPath:a,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(y.curve=s),h.push(y)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),s=r;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=i.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};ke(e,n,s,o)}return s}(i,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:"#4e79a7",opacity:.8},a=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(a=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t=Object.assign(Object.assign({},t),{fill:s.get(n)}))}const l=e.getPointId?e.getPointId(r)+"":void 0,c=me(r,e.scales,e.getX,e.getY,a,t,l);c&&n.push(c)}return n}(i,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,r,i;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),a=Math.max(1,Math.floor(null!==(r=e.config.heatmapYBins)&&void 0!==r?r:20)),l=null!==(i=e.config.heatmapAggregation)&&void 0!==i?i:"count",c=te(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),p=(d-u||1)/s,y=(g-h||1)/a,f=s*a;if(f>1e6)return[];const m=new Int32Array(f),v=new Float64Array(f);for(let n=0;t.length>n;n++){const o=t[n],r=e.getX(o),i=e.getY(o);if(!isFinite(r)||!isFinite(i))continue;const l=Math.min(Math.floor((r-u)/p),s-1),d=Math.min(Math.floor((i-h)/y),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const f=c(o);v[g]+=isFinite(f)?f:0}let b=1/0,x=-1/0;for(let e=0;f>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/s,A=n.height/a,O=e.config.showValues,S=e.config.heatmapValueFormat,j=[];for(let e=0;a>e;e++){const t=e*s;for(let n=0;s>n;n++){const o=t+n;if(0===m[o])continue;let r;switch(l){case"sum":r=v[o];break;case"mean":r=v[o]/m[o];break;default:r=m[o]}const i=(r-b)/k;j.push(be(n*w,(a-1-e)*A,w,A,`rgb(${220-(180*i+.5)|0},${220-(100*i+.5)|0},${255-(50*i+.5)|0})`,{xi:n,yi:e,value:r,count:m[o],sum:v[o]},O?{value:r,showValues:!0,valueFormat:S}:void 0))}}return j}(e,t,n);if(0===t.length)return[];const o=te(e.config.valueAccessor,"value"),r=ne(e.config.xAccessor,"x"),i=ne(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),p=h.every(e=>"number"==typeof e&&!isNaN(e)),y=g.every(e=>"number"==typeof e&&!isNaN(e));if(p){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(y){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[e],e)}const f=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const d=o(n),h=i*u+r,g=b.get(h);let p;void 0!==g?p=g:(p=x++,b.set(h,p)),f[p]=h,m[p]=d,v[p]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in we?e:"blues";let n=Ae.get(t);if(n)return n;n=Array(256);const o=we[t]||M;for(let e=0;256>e;e++)n[e]=o(e/255);return Ae.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:"blues"),O=255/(w-k||1),S=n.width/u,j=n.height/d,E=e.config.showValues,C=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=f[e],o=n%u;P.push(be(o*S,(d-1-(n-o)/u)*j,S,j,A[Math.min((t-k)*O+.5|0,255)],v[e],E?{value:t,showValues:!0,valueFormat:C}:void 0))}return P}(i,t,e);case"bar":{const e=function(e,t){var n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Z(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(n),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const i=[],s=e.scales,[a,l]=s.x.domain();for(const t of o.values()){const o=Math.max(t.start,a),c=Math.min(t.end,l);if(o>=c)continue;const u=s.x(o),d=s.x(c),h=Math.abs(d-u),g=h>2?1:0,p=Math.min(u,d)+g/2,y=Math.max(h-g,1);if(y>0)if(r&&t.categories.size>0){let o=0;for(const a of r){const r=t.categories.get(a)||0;if(0===r)continue;const l=s.y(o),c=s.y(o+r);i.push(ve(p,Math.min(l,c),y,Math.abs(l-c),{fill:(null===(n=e.config.barColors)||void 0===n?void 0:n[a])||"#4e79a7"},{binStart:t.start,binEnd:t.end,total:t.total,category:a,categoryValue:r},a)),o+=r}}else{const e=s.y(0),n=s.y(t.total);i.push(ve(p,Math.min(e,n),y,Math.abs(e-n),{fill:"#007bff"},{binStart:t.start,binEnd:t.end,total:t.total}))}}const c=new Set;for(const e of o.values())c.add(e.start),c.add(e.end);return{nodes:i,binBoundaries:Array.from(c).sort((e,t)=>e-t)}}(i,t);return this._barCategoryCache=null!==(n=i.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,r,i;const s=[],a=e.config.swarmStyle||{},l=null!==(n=a.radius)&&void 0!==n?n:3,c=null!==(o=a.fill)&&void 0!==o?o:"#007bff",u=null!==(r=a.opacity)&&void 0!==r?r:.7,d=a.stroke,h=a.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const r=e.scales.x(t),a=e.scales.y(o);let g=c;if(e.getCategory){const t=e.getCategory(n);g=(null===(i=e.config.barColors)||void 0===i?void 0:i[t])||g}const p={type:"point",x:r,y:a,r:l,style:{fill:g,opacity:u,stroke:d,strokeWidth:h},datum:n};e.getPointId&&(p.pointId=e.getPointId(n)+""),s.push(p)}return s}(i,t);case"waterfall":return function(e,t,n){var o,r,i;const s=[],a=e.scales,l=e.config.waterfallStyle,c=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===c.length)return s;const u=null!==(o=null==l?void 0:l.positiveColor)&&void 0!==o?o:"#28a745",d=null!==(r=null==l?void 0:l.negativeColor)&&void 0!==r?r:"#dc3545",h=null!==(i=null==l?void 0:l.gap)&&void 0!==i?i:1,g=null==l?void 0:l.stroke,p=null==l?void 0:l.strokeWidth;let y=0;for(let t=0;c.length>t;t++){const o=c[t],r=e.getX(o),i=e.getY(o),f=y+i;let m;m=c.length-1>t?e.getX(c[t+1])-r:t>0?r-e.getX(c[t-1]):0;const v=a.x(r),b=0!==m?a.x(r+m):v+n.width/10,x=Math.min(v,b)+h/2,k=Math.max(v,b)-h/2-x;if(0>=k){y=f;continue}const w=a.y(y),A=a.y(f);s.push(ve(x,Math.min(w,A),k,Math.abs(w-A),{fill:0>i?d:u,stroke:g,strokeWidth:p},Object.assign(Object.assign({},o),{baseline:y,cumEnd:f,delta:i,_connectorStroke:null==l?void 0:l.connectorStroke,_connectorWidth:null==l?void 0:l.connectorWidth}))),y=f}return s}(i,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const r=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(r||e.getOpen&&e.getClose))return[];const i=[],s=e.config.candlestickStyle||{},a=s.rangeColor||"#6366f1",l=r?a:s.upColor||"#28a745",c=r?a:s.downColor||"#dc3545",u=r?a:s.wickColor||"#333",d=s.wickWidth||(r?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=r?0:null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(!r&&null==s.bodyWidth&&h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else r||null!=s.bodyWidth||(g=6);for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const a=r?o:e.getOpen(n),h=r?s:e.getClose(n);if(!r&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const p=h>=a,y={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:p,datum:n};r&&(y.isRange=!0),i.push(y)}return i}(i,t);default:return[]}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?de(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,r;const i=n.length;if(1>=i)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let r=!1;for(let n=0;t.length>n;n++){const a=s.get(t[n]);null!=a?(o[n]=de(e,a,i),1>o[n]&&(r=!0)):o[n]=1}r&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const r=Array(o);let a=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(r[n]=de(e,o,i),1>r[n]&&(a=!0)):r[n]=1}a&&(n._decayOpacities=r)}else{let r=1;for(const n of t){const t=s.get(n);if(null!=t){const n=de(e,t,i);r>n&&(r=n)}}if(1>r){const e=Array(o);e.fill(r),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const a=de(e,t,i);if("heatcell"===n.type)n.style={opacity:a};else if("candlestick"===n.type)n._decayOpacity=a;else{const e=null!==(r=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var r,i;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(r=e.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(i=e.glowRadius)&&void 0!==i?i:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0;for(const n of t){const t=c.get(n);if(null==t)continue;const i=o.get(t);if(null==i)continue;const a=he(e,i,s);a>r&&(r=a)}r>0&&(n._pulseIntensity=r,n._pulseColor=a);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);if(null==r)continue;const i=he(e,r,s);i>0&&(n._pulseIntensity=i,n._pulseColor=a,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=e.duration)&&void 0!==n?n:500,i=t.peek();return null!=i&&r>o-i}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var r,i,s;n.clear(),o.clear();for(let a=0;t.length>a;a++){const l=t[a],c=pe(e,l,a);c&&("point"===l.type?n.set(c,{x:l.x,y:l.y,r:l.r,opacity:l.style.opacity}):"rect"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:l.style.opacity}):"heatcell"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:null===(r=l.style)||void 0===r?void 0:r.opacity}):"candlestick"===l.type?n.set(c,{x:l.x,y:l.openY}):"line"===l.type?o.set(c,{path:l.path.map(e=>[e[0],e[1]]),opacity:null===(i=l.style)||void 0===i?void 0:i.opacity}):"area"===l.type&&o.set(c,{topPath:l.topPath.map(e=>[e[0],e[1]]),bottomPath:l.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(s=l.style)||void 0===s?void 0:s.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r){var i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,k,w,A,O,S,j,E,C,M,P,_,B;if(0===o.size&&0===r.size)return n;const L=null!==(i=t.duration)&&void 0!==i?i:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let N=!1;const T=new Set,H=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],A=pe(e,i,t);if(!A)continue;if(i._transitionKey=A,"line"===i.type||"area"===i.type){const e=r.get(A);if(e){if(H.add(A),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];N=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];N=!0}i._targetOpacity=null!==(s=i.style.opacity)&&void 0!==s?s:1,i._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:i.style.opacity)&&void 0!==l?l:1}else i._targetOpacity=null!==(c=i.style.opacity)&&void 0!==c?c:1,i._startOpacity=0,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;continue}const O=o.get(A);if("point"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=null!==(u=i.style.opacity)&&void 0!==u?u:1,O.x===e.x&&O.y===e.y&&O.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=O.x,i.y=O.y,i.r=null!==(d=O.r)&&void 0!==d?d:i.r,N=!0)}else i._targetOpacity=null!==(h=i.style.opacity)&&void 0!==h?h:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;else if("rect"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(g=i.style.opacity)&&void 0!==g?g:1,O.x===e.x&&O.y===e.y&&O.w===e.w&&O.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=O.x,i.y=O.y,i.w=null!==(p=O.w)&&void 0!==p?p:i.w,i.h=null!==(y=O.h)&&void 0!==y?y:i.h,N=!0)}else i._targetOpacity=null!==(f=i.style.opacity)&&void 0!==f?f:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;else if("heatcell"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(v=null===(m=i.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,O.x===e.x&&O.y===e.y&&O.w===e.w&&O.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=O.x,i.y=O.y,i.w=null!==(b=O.w)&&void 0!==b?b:i.w,i.h=null!==(x=O.h)&&void 0!==x?x:i.h,N=!0)}else i._targetOpacity=null!==(w=null===(k=i.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,i.style=Object.assign(Object.assign({},i.style||{}),{opacity:0}),N=!0}for(const[e,t]of r)if(!H.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(A=t.opacity)&&void 0!==A?A:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),N=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(O=t.opacity)&&void 0!==O?O:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),N=!0}for(const[e,t]of o)if(!T.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(S=t.r)&&void 0!==S?S:3,style:{opacity:null!==(j=t.opacity)&&void 0!==j?j:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(E=t.w)&&void 0!==E?E:0,h:null!==(C=t.h)&&void 0!==C?C:0,style:{opacity:null!==(M=t.opacity)&&void 0!==M?M:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(P=t.w)&&void 0!==P?P:0,h:null!==(_=t.h)&&void 0!==_?_:0,fill:"#999",datum:null,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}N=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),N&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:L}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var r,i,s,a,l;if(!n.activeTransition)return!1;const c=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),u=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(c,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=ge(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ge(n.x,e._targetX,u),e.y=ge(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=ge(n.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=ge(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ge(n.x,e._targetX,u),e.y=ge(n.y,e._targetY,u),void 0!==n.w&&(e.w=ge(n.w,e._targetW,u)),void 0!==n.h&&(e.h=ge(n.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:ge(r,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ge(n.x,e._targetX,u),e.y=ge(n.y,e._targetY,u),void 0!==n.w&&(e.w=ge(n.w,e._targetW,u)),void 0!==n.h&&(e.h=ge(n.h,e._targetH,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(a=e._startOpacity)&&void 0!==a?a:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ge(t,e._targetOpacity,u)})}const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=ge(t[o][0],n[o][0],u),e.path[o][1]=ge(t[o][1],n[o][1],u)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ge(t,e._targetOpacity,u)})}const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=ge(t[n][0],o[n][0],u),e.topPath[n][1]=ge(t[n][1],o[n][1],u);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=ge(n[t][0],r[t][0],u),e.bottomPath[t][1]=ge(n[t][1],r[t][1],u)}}if(c>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;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 if("heatcell"===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 if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.map;const r=Array.isArray(this.config.colorScheme)?this.config.colorScheme:se,i=new Map;for(let e=0;n.length>e;e++)i.set(n[e],r[e%r.length]);return this._colorMapCache={key:o,map:i},i}resolveLineStyle(e,t){const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}return n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}if(o&&"object"==typeof o)return{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2};const r=this.resolveGroupColor(e)||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:se,o=n[this._groupColorMap.size%n.length];return this._groupColorMap.set(e,o),o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,r;const i=Object.assign({},this.config);void 0!==e.colorScheme&&(this._colorMapCache=null,this._groupColorMap=new Map),void 0===e.barColors&&void 0===e.colorScheme||(this._barCategoryCache=null),void 0===e.normalize&&void 0===e.extentPadding&&void 0===e.xAccessor&&void 0===e.yAccessor&&void 0===e.groupAccessor&&void 0===e.categoryAccessor&&void 0===e.chartType||(this._stackExtentCache=null);let s=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(a||void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor){const l=a||!ee(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=a||!ee(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(r=i.yAccessor)&&void 0!==r?r:i.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=te(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=te(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=te(this.config.xAccessor,"x"),this.getY=te(this.config.yAccessor,"y")),s=!0)}if("groupAccessor"in e&&!ee(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?oe(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!ee(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?oe(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!ee(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?te(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!ee(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?oe(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!ee(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?te(this.config.y0Accessor,"y0"):void 0,s=!0),"pointIdAccessor"in e&&!ee(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?oe(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!ee(e.openAccessor,i.openAccessor)||"closeAccessor"in e&&!ee(e.closeAccessor,i.closeAccessor)||"highAccessor"in e&&!ee(e.highAccessor,i.highAccessor)||"lowAccessor"in e&&!ee(e.lowAccessor,i.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?te(this.config.openAccessor,"open"):void 0,this.getHigh=te(this.config.highAccessor,"high"),this.getLow=te(this.config.lowAccessor,"low"),this.getClose=t?te(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){s=!0;break}}s&&(this.needsFullRebuild=!0)}}function Se(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}}function je(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ee(e,t){const n=je(e);if(!n)return!1;const o=je(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function Ce(e,t,n,o=30,r){let i=null,s=!1;if(r){const e=r.find(t,n,o);if(e){const r=Pe(e,t,n,o);r&&o>r.distance&&(i=r,s=!0)}}for(const a of e){let e=null;switch(a.type){case"point":if(r&&s)break;e=Pe(a,t,n,o);break;case"line":e=_e(a,t,n,o);break;case"rect":e=Le(a,t,n);break;case"heatcell":e=Ne(a,t,n);break;case"area":if(!1===a.interactive)break;e=He(a,t,n);break;case"candlestick":e=Te(a,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}function Me(e,t,n){if(0===e.length)return null;const o=Ie(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function Pe(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i),a=function(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}(e.r,o);return s>a?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function _e(e,t,n,o=30){var r,i,s,a;if(0===e.path.length)return null;const l=Ie(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let o=1/0;const r=Math.max(0,l-1),i=Math.min(e.path.length-2,l);for(let s=r;i>=s;s++){const[r,i]=e.path[s],[a,l]=e.path[s+1],c=Be(t,n,r,i,a,l);o>c&&(o=c)}d=o}else{const e=t-c,o=n-u;d=Math.sqrt(e*e+o*o)}const h=null!==(a=null!==(i=null===(r=e.style)||void 0===r?void 0:r.strokeWidth)&&void 0!==i?i:null===(s=e.style)||void 0===s?void 0:s.lineWidth)&&void 0!==a?a:1;return d>Math.max(5,h/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function Be(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Le(e,t,n){const o=Se(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ne(e,t,n){const o=Se(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Te(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function He(e,t,n){if(0===e.topPath.length)return null;const o=Ie(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function Ie(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function ze(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function Fe(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}Oe.QUADTREE_THRESHOLD=500;const $e={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function We(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,$e[n])(o(e,t)),r}function De(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Re(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function Ge({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),s&&e.createElement("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},s&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function Ye(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[p,y]=e.useState(0),f=e.useCallback((e,t)=>{g(e),y(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let y=0;const f=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=We(t,u,d,h),b=Re(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:f?l===s&&u===a?0:-1:void 0,role:f?"option":void 0,"aria-selected":f&&m?x||!1:void 0,"aria-current":f&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:f?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:f?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:f?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:f?"pointer":"default",opacity:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},f&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(De,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),y+=22}),p})(t,o,r,i,s,a,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const y=((t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,y=[];let f=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;p.forEach((t,u)=>{const x=We(t,u,h,g),k=Re(t,r,i),w=i&&i.size>0&&i.has(t.label),A=26+7*t.label.length;d&&d>0&&f>0&&f+A>d&&(m++,f=0),y.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${f},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.createElement(De,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),f+=A});let x=0,k=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&k>0&&k+t>d?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:y,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,s,a,l,c,n,u,d,o);p+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const y=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(y.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),p+=16),y.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${p},0)`},o.items)),p+=o.offset+5,t[r+1]&&y.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8})),p+=12}),e.createElement("g",null,y)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:f,legendInteraction:a}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)"},l),m)}function qe(e){return"string"==typeof e?{type:e}:e}function Xe({orient:t,config:o,values:r,scale:i,size:s,length:a}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===t||"bottom"===t,u=n(()=>{if(0===r.length)return null;const n=i.domain(),o=s-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(r);if(!n)return null;const{q1:s,median:a,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*o,20),p=(o-g)/2+4;if(c){const n=i(s),o=i(u),r=i(a),c=i(d),y=i(h),f="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+f*(p+g/2),x2:y,y2:m+f*(p+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+f*p,x2:c,y2:m+f*(p+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:y,y1:m+f*p,x2:y,y2:m+f*(p+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-p-g:m+p,width:Math.abs(o-n),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-p-g:m+p,x2:r,y2:"top"===t?m-p:m+p+g,stroke:l.fill,strokeWidth:2}))}{const n=i(s),o=i(u),r=i(a),c=i(d),y=i(h),f="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+f*(p+g/2),y1:c,x2:m+f*(p+g/2),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*p,y1:c,x2:m+f*(p+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*p,y1:y,x2:m+f*(p+g),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-p-g:m+p,y:Math.min(n,o),width:g,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-p-g:m+p,y1:r,x2:"left"===t?m-p:m+p+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=B().domain(n).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,r)=>{if(null==n.x0||null==n.x1)return null;const s=n.length/d*o;if(c){const o=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-s:4,width:Math.max(a,.5),height:s,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-s:4,y:Math.min(o,o+a),width:s,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const s=e.length/d*(o/2),a=i((e.x0+e.x1)/2);r.push(c?`${a},${"top"===t?-(n-s):n-s}`:`${"left"===t?-(n-s):n-s},${a}`)}for(let e=u.length-1;e>=0;e--){const s=u[e];if(null==s.x0||null==s.x1)continue;const a=s.length/d*(o/2),l=i((s.x0+s.x1)/2);r.push(c?`${l},${"top"===t?-(n+a):n+a}`:`${"left"===t?-(n+a):n+a},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);n.push(`L${s},${"top"===t?-r-4:r+4}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${s},${e}`),n.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${s}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${e},${s}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,s,a,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function Ve(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Ue(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 Qe(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:y={},"data-testid":f}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":f},y),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.createElement("path",{key:"bracket-path",d:Ue((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,y=s?u?[s]:Ve(s,c):[],f=i?u?[i]:Ve(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=y.length*p),f.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t))));let k=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+f.length)*p+(f.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,y.length+f.length-1)*p;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+p+(f.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),k)}(l,v,b,h))}function Ke(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.createElement(Qe,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:s}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Qe,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:a},r,{type:s}))}function Je(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function Ze(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function et(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Je(e,n),c=Ze(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function tt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const nt={linear:R,monotoneX:D,monotoneY:W,step:$,stepAfter:F,stepBefore:z,basis:I,cardinal:H,catmullRom:T};let ot={positions:new Map};const rt=new Set;function it(){for(const e of rt)e()}function st(e,t){const n=ot.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},it()}function at(e,t){const n=ot.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(ot.positions);o.delete(e),ot={positions:o},it()}function lt(){return ot}function ct(e){return rt.add(e),()=>rt.delete(e)}const ut={positions:new Map};function dt(){return()=>{}}function ht(){return ut}function gt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function pt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function yt(t){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,p=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||h||ft,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=l.x.ticks(Math.min(r,Math.max(2,Math.floor(o/70)))),s=i.map(e=>e.valueOf()),a=i.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,s)})),c=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return mt(a,Math.max(55,c+8))},[l,u,h,o]),y=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||g||ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return mt(l.y.ticks(Math.min(o,Math.max(2,Math.floor(r/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,r]),f=d&&l,m=c&&l;if(!f&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,A=(null==b?void 0:b.jaggedBase)||!1,O="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},f&&(()=>{var t,n;const i=gt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=gt(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},p.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i})),y.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s})))})(),x&&!w&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:O,strokeWidth:1}),w&&e.createElement("path",{d:pt("bottom",o,r),fill:"none",stroke:O,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:O,strokeWidth:1}),A&&e.createElement("path",{d:pt("left",o,r),fill:"none",stroke:O,strokeWidth:1})))}function ft(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function mt(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function vt(r){var s,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:p,axes:y,xLabel:f,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:O,legendClickBehavior:S,legendHighlightedCategory:j,legendIsolatedCategories:E,legendPosition:C="right",foregroundGraphics:M,marginalGraphics:P,xValues:_,yValues:B,annotations:T,svgAnnotationRules:H,xAccessor:I,yAccessor:z,annotationData:F,pointNodes:$,curve:W,underlayRendered:D,linkedCrosshairName:G,linkedCrosshairSourceId:Y,children:X}=r,V=n(()=>{var e;if(!p||!g)return[];const t=null==y?void 0:y.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=g.x.ticks(Math.min(o,Math.max(2,Math.floor(l/70)))),i=r.map(e=>e.valueOf()),s=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),a=s.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=mt(s,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[p,g,y,b,l]),U=n(()=>{var e;if(!p||!g)return[];const t=null==y?void 0:y.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||ft,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=mt(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=g.y.domain()[1],t=g.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[p,g,y,x,c]),Q=n(()=>{var e;if(!p||!g)return[];const t=null==y?void 0:y.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||ft,o=null!==(e=t.ticks)&&void 0!==e?e:5;return mt(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[p,g,y,x,c]),K=t(new Map),J=t(null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0),Z=null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0;J.current!==Z&&(J.current=Z,K.current=new Map);const ee=n(()=>{if(!T||0===T.length)return null;const t=function(t,n,o){var r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,k,w,A,O,S,j,E,C,M,P,_,B,T,H,I,z,F,$,W,D,G,Y,X,V,U,Q,K,J,Z,ee,te;switch(t.type){case"label":{const r=et(t,n,o);if(!r)return null;const{x:i,y:s}=r;return tt(i,s,o)?e.createElement(Ke,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=et(t,n,o);if(!r)return null;const{x:i,y:s}=r;return tt(i,s,o)?e.createElement(Ke,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Je(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:a,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=Ze(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:a,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Je(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ze(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=L(r),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Je(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ze(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Je(n,o),a=Ze(n,o);if(null==i||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:a,r:l},c))}))}case"bracket":{const r=Je(t,o),i=Ze(t,o);return e.createElement(Ke,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",p=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const y=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(s=o.scales)||void 0===s?void 0:s.time,f=null!==(l=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!y||!f)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*g-d*d;if(1e-12>Math.abs(y))a.push([t,h/u]);else{const e=(u*p-d*h)/y;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?q.polynomial(p,{order:t.order||2}):q.linear(p)).points;const b=v.map(([e,t])=>`${y(e)},${f(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:y(v[v.length-1][0])+4,y:f(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(p=null==r?void 0:r(t.y0))&&void 0!==p?p:0,s=null!==(y=null==r?void 0:r(t.y1))&&void 0!==y?y:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(m=null===(f=o.scales)||void 0===f?void 0:f.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=nt[o.curve||"linear"]||R,g=N().x(e=>s(e[i])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(h)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:p,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:s(d[d.length-1][i])+4,y:a(d[d.length-1][l])-4,fill:p,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(O=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==O?O:null===(S=o.scales)||void 0===S?void 0:S.time,a=null!==(E=null===(j=o.scales)||void 0===j?void 0:j.y)&&void 0!==E?E:null===(C=o.scales)||void 0===C?void 0:C.value;if(!s||!a)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(M=t.threshold)&&void 0!==M?M:2,g=c-h*d,p=!1!==t.showBand,y=t.fill||"#6366f1",f=null!==(P=t.fillOpacity)&&void 0!==P?P:.1,m=t.anomalyColor||"#ef4444",v=null!==(_=t.anomalyRadius)&&void 0!==_?_:6,b=a(c+h*d),x=a(g),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},p&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:f}),k.map((t,n)=>{const r=Je(t,o),i=Ze(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(T=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==T?T:null===(H=o.scales)||void 0===H?void 0:H.time,l=null!==(z=null===(I=o.scales)||void 0===I?void 0:I.y)&&void 0!==z?z:null===(F=o.scales)||void 0===F?void 0:F.value;if(!a||!l)return null;const c=r.map(e=>[e[i],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=q.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),p=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),f=null!==($=t.confidence)&&void 0!==$?$:.95,m=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,v=null!==(W=t.steps)&&void 0!==W?W:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;v>=e;e++)k.push(b+e*x);const w=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-p,2)/y:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(b)},${l(u(b))}`,j=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(D=t.fillOpacity)&&void 0!==D?D:.15,stroke:"none"}),e.createElement("polyline",{points:`${S} ${O}`,fill:"none",stroke:j,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(Y=t.strokeDasharray)&&void 0!==Y?Y:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:a(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:j,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=et(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!tt(r,i,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,a=null!==(V=t.dy)&&void 0!==V?V:0,l=null!==(U=t.width)&&void 0!==U?U:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(K=t.content)&&void 0!==K?K:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=et(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(J=o.scales)||void 0===J?void 0:J.o,s=null===(Z=o.scales)||void 0===Z?void 0:Z.x,a=null===(ee=o.scales)||void 0===ee?void 0:ee.y,l=(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(te=t.opacity)&&void 0!==te?te:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===s)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}},n={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:I,yAccessor:z,width:l,height:c,data:F,frameType:"xy",pointNodes:$,curve:W,stickyPositionCache:K.current};return T.map((e,o)=>{if(H){const r=H(e,o,n);return null!=r?r:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[T,H,l,c,I,z,F,g,$,W]),te=function(e){var t;const n=i(e?ct:dt,e?lt:ht,e?lt:ht);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(G);return o(()=>{if(!(null==te?void 0:te.locked)||!G)return;const e=e=>{"Escape"===e.key&&at(G)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==te?void 0:te.locked,G]),p||w||A||M||P||ee&&ee.length>0||k||X||te?e.createElement("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof w?w:"XY Chart"),e.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${h.left},${h.top})`},k&&g&&!D&&(()=>{var t,n;const o=gt(null===(t=null==y?void 0:y.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=gt(null===(n=null==y?void 0:y.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},V.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:c,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})),U.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:l,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r})))})(),p&&g&&(()=>{const t=null==y?void 0:y.find(e=>"left"===e.orient),n=null==y?void 0:y.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,i=(null==t?void 0:t.jaggedBase)||!1,s=(null==n?void 0:n.jaggedBase)||!1,a=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&V.length>1&&(()=>{const e=l/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!D&&r&&!s&&e.createElement("line",{x1:0,y1:c,x2:l,y2:c,stroke:d,strokeWidth:1}),!D&&s&&e.createElement("path",{d:pt("bottom",l,c),fill:"none",stroke:d,strokeWidth:1}),V.map((t,n)=>{const o=!!a&&("function"==typeof a?a(t.value,n):Ee(t.value,n>0?V[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${c})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))}),f&&e.createElement("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:p,style:{userSelect:"none"}},f),!D&&o&&!i&&e.createElement("line",{x1:0,y1:0,x2:0,y2:c,stroke:d,strokeWidth:1}),!D&&i&&e.createElement("path",{d:pt("left",l,c),fill:"none",stroke:d,strokeWidth:1}),U.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):Ee(t.value,n>0?U[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.createElement("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:p,transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==y?void 0:y.find(e=>"right"===e.orient);if(!t||0===Q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:l,y1:0,x2:l,y2:c,stroke:d,strokeWidth:1}),Q.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):Ee(t.value,o>0?Q[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${l},${t.pixel})`},e.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},t.label)))}),o&&e.createElement("text",{x:l+h.right-15,y:c/2,textAnchor:"middle",fontSize:12,fill:p,transform:`rotate(90, ${l+h.right-15}, ${c/2})`,style:{userSelect:"none"}},o))})())})(),ee,P&&g&&_&&B&&e.createElement(e.Fragment,null,P.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Xe,{orient:"top",config:qe(P.top),values:_,scale:g.x,size:h.top,length:l})),P.bottom&&e.createElement("g",{transform:`translate(0, ${c})`},e.createElement(Xe,{orient:"bottom",config:qe(P.bottom),values:_,scale:g.x,size:h.bottom,length:l})),P.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Xe,{orient:"left",config:qe(P.left),values:B,scale:g.y,size:h.left,length:c})),P.right&&e.createElement("g",{transform:`translate(${l}, 0)`},e.createElement(Xe,{orient:"right",config:qe(P.right),values:B,scale:g.y,size:h.right,length:c}))),M,te&&te.sourceId!==Y&&(null==g?void 0:g.x)&&(()=>{const t=g.x(te.xValue);if(null==t||0>t||t>l)return null;const n=te.locked;return e.createElement("line",{x1:t,y1:0,x2:t,y2:c,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),X),w&&e.createElement("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,y;return"left"===s?(p=4,y=i.top):"top"===s?(p=0,y=a?32:8):"bottom"===s?(p=0,y=r-i.bottom+50):(p=o-i.right+10,y=i.top),e.createElement("g",{transform:`translate(${p}, ${y})`},"object"==typeof(f=n)&&null!==f&&"gradient"in f?e.createElement(Ge,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(Ye,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var f}({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:w,legendHoverBehavior:O,legendClickBehavior:S,legendHighlightedCategory:j,legendIsolatedCategories:E})):null}function bt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const xt="undefined"==typeof window||"undefined"==typeof document,kt=e.createContext(null),wt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function At(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const Ot=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},St={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},jt={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Et={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Ct={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Mt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},Pt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},_t={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Bt({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[s,a]=e.useState(!1),l=e.useContext(kt),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=s||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{s||c||a(!0)},[s,c]),p=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:wt}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:wt,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",t.length," elements)"));const y=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,y,f,m,v,b,x,k,w,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const E of e)if(E&&"object"==typeof E)try{switch(E.type){case"point":j.push({label:"Point",values:{x:E.x,y:E.y}});break;case"line":{const e=E.path,t=Array.isArray(E.datum)?E.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=E.topPath,t=Array.isArray(E.datum)?E.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=E.datum&&"object"==typeof E.datum?E.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:E.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;j.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:E.x,y:E.y,value:E.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=E.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=E.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=E.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(d=E.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=E.cx)&&void 0!==g?g:E.x,y:null!==(p=E.cy)&&void 0!==p?p:E.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(f=null===(y=E.datum)||void 0===y?void 0:y.id)&&void 0!==f?f:"",x:null!==(m=E.cx)&&void 0!==m?m:E.x,y:null!==(v=E.cy)&&void 0!==v?v:E.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:E.x,open:E.open,high:E.high,low:E.low,close:E.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=E.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=E.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(S=null===(O=E.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return j}(t),f=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ot(e.min)} to ${Ot(e.max)}, mean ${Ot(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,f),v=y.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:p,style:St,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Et},"×"),e.createElement("div",{role:"note",style:jt},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:Ct},e.createElement("caption",{style:_t},"First ",v.length," of ",y.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:Mt},"type"),x.map(t=>e.createElement("th",{key:t,style:Mt},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:Pt},t.label),x.map(n=>{return e.createElement("td",{key:n,style:Pt},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ot(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function Lt({summary:t}){return t?e.createElement("div",{role:"note",style:wt},t):null}function Nt({tableId:t}){return e.createElement("a",{href:"#"+t,style:wt,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,wt)}},"Skip to data table")}function Tt({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:wt},n)}const Ht="var(--semiotic-focus, #005fcc)";function It({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ht,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ht,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ht,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function zt({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:a,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},s)}function Ft(o){const r=s(null),c=$t(o);return[function({children:t}){const i=n(()=>$t(o),[]);return e.createElement(r.Provider,{value:i,children:t})},e=>{var n;const o=null!==(n=a(r))&&void 0!==n?n:c,s=t(e);s.current=e;const u=l(()=>s.current(o.getState()),[o]),d=l(()=>s.current(o.getState()),[o]);return i(o.subscribe,u,d)}]}function $t(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}const Wt={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Dt={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Rt={mode:"light",colors:{primary:"#0000cc",categorical:["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[Gt,Yt]=Ft(e=>({theme:Wt,setTheme(t){e(e=>{if("light"===t)return{theme:Wt};if("dark"===t)return{theme:Dt};if("high-contrast"===t)return{theme:Rt};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Dt:Wt;return{theme:Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})})}}return{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})}})}}));function qt(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}const Xt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Vt=new WeakMap;function Ut(e,t){var n,o;if(!t)return t;const r=Xt.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;let s=Vt.get(i);if(s||(s=new Map,Vt.set(i,s)),s.has(t))return s.get(t);const a=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.set(t,a),a}function Qt(e){switch(e){case"monotoneX":return D;case"monotoneY":return W;case"cardinal":return H;case"catmullRom":return T;case"step":return $;case"stepBefore":return z;case"stepAfter":return F;case"basis":return I;case"natural":return Y;default:return null}}function Kt(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Jt(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const Zt=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a.style.stroke||"#007bff",c=a.style.strokeWidth||2,u=a.colorThresholds,d=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=c,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const y=null!==(r=a.style.opacity)&&void 0!==r?r:1;Jt(e,a.path,l,c,y,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Qt(a.curve),g=u&&u.length>0&&d&&d.length===a.path.length,p=a._decayOpacities;if(p&&p.length===a.path.length&&!g){e.strokeStyle=l;const f=null!==(i=a.style.opacity)&&void 0!==i?i:1;for(let m=0;a.path.length-1>m;m++)e.globalAlpha=.5*(p[m]+p[m+1])*f,e.beginPath(),e.moveTo(a.path[m][0],a.path[m][1]),e.lineTo(a.path[m+1][0],a.path[m+1][1]),e.stroke()}else if(g){let v=null,b=null,x=null,k=null,w=!1;function A(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),w=!0}function O(){w&&(e.stroke(),w=!1)}for(let S=0;a.path.length>S;S++){const[j,E]=a.path[S],C=d[S],M=Kt(C,u,l);if(null!==v&&null!==k&&null!==x){if(M===k)e.lineTo(j,E);else{const P=[];for(const _ of u){const B=_.value;(x>B||B>C)&&(B>x||C>B)||x===B||C===B||P.push({t:(B-x)/(C-x)})}P.sort((e,t)=>e.t-t.t);for(const L of P){const N=v+(j-v)*L.t,T=b+(E-b)*L.t,H=Kt(x+(C-x)*Math.min(L.t+1e-4,1),u,l);e.lineTo(N,T),O(),A(H,N,T)}e.lineTo(j,E)}v=j,b=E,x=C,k=M}else A(M,j,E),v=j,b=E,x=C,k=M}O()}else{if(e.beginPath(),!a.strokeGradient||2>a.strokeGradient.colorStops.length||2>a.path.length)e.strokeStyle=l;else{const I=e.createLinearGradient(a.path[0][0],0,a.path[a.path.length-1][0],0);for(const z of a.strokeGradient.colorStops)I.addColorStop(Math.max(0,Math.min(1,z.offset)),z.color);e.strokeStyle=I}if(h)G().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(a.path);else{const[F,$]=a.path[0];e.moveTo(F,$);for(let W=1;a.path.length>W;W++)e.lineTo(a.path[W][0],a.path[W][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=("string"==typeof a.style.fill?Ut(e,a.style.fill):a.style.fill)||a.style.fill,h&&!g)G().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(a.path);else{const[R,Y]=a.path[0];e.moveTo(R,Y);for(let q=1;a.path.length>q;q++)e.lineTo(a.path[q][0],a.path[q][1])}const D=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(D,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function en(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function tn(e,t,n=.3){en(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 nn(e,t,n=.6){var o,r,i,s,a;if(!en(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function on(e,t,n,o=.35){en(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function rn(e){switch(e){case"monotoneX":return D;case"monotoneY":return W;case"cardinal":return H;case"catmullRom":return T;case"step":return $;case"stepBefore":return z;case"stepAfter":return F;case"basis":return I;case"natural":return Y;default:return null}}function sn(e){if(e.startsWith("#")){const t=4===e.length?e[1]+e[1]+e[2]+e[2]+e[3]+e[3]:e.slice(1,7);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[78,121,167]}function an(e,t){const n=rn(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=N().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const ln=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;const n=t.style.fill||"#4e79a7",o=t._decayOpacities;if(o&&o.length===t.topPath.length){const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;e.fillStyle=n;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1])*i,e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Ut(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(o[n]+o[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(an(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let r=-1/0;for(const e of t.bottomPath)e[1]>r&&(r=e[1]);const i=e.createLinearGradient(0,o,0,r);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||i.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const e=sn("string"==typeof n?n:"#4e79a7");i.addColorStop(0,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.topOpacity})`),i.addColorStop(1,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.bottomOpacity})`)}e.fillStyle=i,e.globalAlpha=a}else{const o=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=o*a,e.fillStyle=n}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(an(e,t),on(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=a,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=Ut(e,t.style.stroke)||t.style.stroke;else{const n=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)n.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=n}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=rn(t.curve);if(e.beginPath(),n)G().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}e.globalAlpha=1}},cn=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?Ut(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Ut(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),nn(e,t),e.globalAlpha=1}}finally{e.restore()}}},un=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)dn(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?Ut(e,t.style.fill):t.style.fill)||"#007bff";const n=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:o,y:r,w:i,h:s}=t;switch(t.roundedEdge){case"right":e.moveTo(o,r),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o,r+s);break;case"left":e.moveTo(o+i,r),e.lineTo(o+n,r),e.arcTo(o,r,o,r+n,n),e.lineTo(o,r+s-n),e.arcTo(o,r+s,o+n,r+s,n),e.lineTo(o+i,r+s);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o+n,r+s),e.arcTo(o,r+s,o,r+s-n,n);break;default:e.moveTo(o,r+s),e.lineTo(o,r+n),e.arcTo(o,r,o+n,r,n),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ut(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?Ut(e,t.style.fill):t.style.fill)||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ut(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));tn(e,t),e.globalAlpha=1}};function dn(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function hn(e,t,n,o){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:n,time:t,value:n}),o)}function gn(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function pn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const yn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function fn(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${yn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${yn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const mn={line:[ln,Zt,cn],area:[ln,cn],stackedarea:[ln,cn],scatter:[cn],bubble:[cn],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),tn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):pn(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=gn(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[un],swarm:[cn],waterfall:[(e,t,n,o)=>{var r,i,s;un(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const o=a[t],r=a[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(s=r.datum)||void 0===s?void 0:s.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const o=t._decayOpacity;if(null!=o&&1!==o&&(e.globalAlpha=o),e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke(),t.isRange){const n=Math.max(2*t.wickWidth,4);e.fillStyle=t.wickColor,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}e.restore()}}],mixed:[ln,Zt,cn]},vn={top:20,right:20,bottom:30,left:40},bn={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white"},xn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function kn({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:xn},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}const wn=c(function(i,s){var a,c,d,h,g,p,y,f,m,v,b;const{chartType:x,runtimeMode:k,data:w,chunkThreshold:A,chunkSize:O,xAccessor:S,yAccessor:j,colorAccessor:E,sizeAccessor:C,groupAccessor:M,lineDataAccessor:P,curve:_,normalize:B,binSize:L,valueAccessor:N,arrowOfTime:T="right",windowMode:H="sliding",windowSize:I=200,timeAccessor:z,xExtent:F,yExtent:$,extentPadding:W=.1,scalePadding:D,sizeRange:R,size:G=[500,300],responsiveWidth:Y,responsiveHeight:q,margin:X,className:V,background:K,lineStyle:J,pointStyle:Z,areaStyle:ee,waterfallStyle:te,swarmStyle:ne,barColors:oe,colorScheme:re,boundsAccessor:ie,boundsStyle:se,y0Accessor:ae,gradientFill:le,lineGradient:ce,areaGroups:ue,openAccessor:de,highAccessor:he,lowAccessor:ge,closeAccessor:pe,candlestickStyle:ye,showAxes:fe=!0,axes:me,xLabel:ve,yLabel:be,yLabelRight:xe,xFormat:ke,yFormat:we,tickFormatTime:Ae,tickFormatValue:Se,hoverAnnotation:je,tooltipContent:Ee,customHoverBehavior:Pe,customClickBehavior:_e,enableHover:Be,hoverRadius:Le=30,tooltipMode:Ne,annotations:Te,svgAnnotationRules:He,showGrid:$e,legend:We,legendHoverBehavior:De,legendClickBehavior:Re,legendHighlightedCategory:Ge,legendIsolatedCategories:Ye,legendPosition:qe,backgroundGraphics:Xe,foregroundGraphics:Ve,canvasPreRenderers:Ue,svgPreRenderers:Qe,title:Ke,categoryAccessor:Je,brush:Ze,onBrush:et,decay:tt,pulse:nt,transition:ot,staleness:rt,heatmapAggregation:it,heatmapXBins:st,heatmapYBins:at,showValues:lt,heatmapValueFormat:ct,marginalGraphics:ut,pointIdAccessor:dt,xScaleType:ht,yScaleType:gt,accessibleTable:pt=!0,description:ft,summary:mt,linkedCrosshairName:kt,linkedCrosshairSourceId:wt}=i,Ot=function(){const[e,t]=r(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return o(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),St=t(Ot);St.current=Ot;const[jt,Et]=function(e,n,i){const s=t(null),[a,l]=r(null);return o(()=>{if(!n&&!i)return;const e=s.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,i]),[s,[n&&a?a.w:e[0],i&&a?a.h:e[1]]]}(G,Y,q),Ct=Object.assign(Object.assign({},vn),X);if(ut){const e=60;ut.top&&e>Ct.top&&(Ct.top=e),ut.bottom&&e>Ct.bottom&&(Ct.bottom=e),ut.left&&e>Ct.left&&(Ct.left=e),ut.right&&e>Ct.right&&(Ct.right=e)}const Mt=Et[0]-Ct.left-Ct.right,Pt=Et[1]-Ct.top-Ct.bottom,_t="function"==typeof Ve?Ve({size:Et,margin:Ct}):Ve,Ht="function"==typeof Xe?Xe({size:Et,margin:Ct}):Xe,Ft=null!=je?je:Be,$t=t(null),Wt=t(null),Dt=t(0),Rt=t(!1),Gt=Yt(e=>e.theme),[Xt,Ut]=r(0),[Qt,Kt]=r(null),Jt=t(null),Zt=t(null),[en,tn]=r(null),[nn,on]=r(!1),[rn,sn]=r([]),[an,ln]=r([]),cn=t(()=>{}),un="streaming"===k||["bar","swarm","waterfall"].includes(x),dn=n(()=>({chartType:x,runtimeMode:un?"streaming":"bounded",windowSize:I,windowMode:H,arrowOfTime:un?T:"right",extentPadding:W,scalePadding:D,xAccessor:un?void 0:S,yAccessor:un?void 0:j,timeAccessor:un?z:void 0,valueAccessor:N,colorAccessor:E,sizeAccessor:C,groupAccessor:M||(P?"_lineGroup":void 0),categoryAccessor:Je,lineDataAccessor:P,xScaleType:ht,yScaleType:gt,xExtent:F,yExtent:$,sizeRange:R,binSize:L,normalize:B,boundsAccessor:ie,boundsStyle:se,y0Accessor:ae,gradientFill:!0===le?{topOpacity:.8,bottomOpacity:.05}:!1===le?void 0:le,areaGroups:ue?new Set(ue):void 0,lineGradient:ce,openAccessor:de,highAccessor:he,lowAccessor:ge,closeAccessor:pe,candlestickStyle:ye,lineStyle:J,pointStyle:Z,areaStyle:ee,swarmStyle:ne,waterfallStyle:te,colorScheme:re,barColors:oe,annotations:Te,decay:tt,pulse:nt,transition:ot,staleness:rt,heatmapAggregation:it,heatmapXBins:st,heatmapYBins:at,showValues:lt,heatmapValueFormat:ct,pointIdAccessor:dt,curve:_}),[x,I,H,T,W,D,S,j,z,N,ht,gt,E,C,M,Je,P,F,$,R,L,B,ie,se,ae,le,ce,ue,de,he,ge,pe,ye,J,Z,ee,ne,te,re,oe,Te,tt,nt,ot,rt,it,st,at,lt,ct,un,dt,_]),gn=t(null);gn.current||(gn.current=new Oe(dn));const pn=l(()=>{Dt.current||(Dt.current=requestAnimationFrame(()=>cn.current()))},[]);o(()=>{var e;null===(e=gn.current)||void 0===e||e.updateConfig(dn),Rt.current=!0,pn()},[dn,pn]),o(()=>{$t.current&&Vt.delete($t.current),Rt.current=!0,pn()},[Gt,pn]);const yn=t(null);yn.current||(yn.current=new Q(e=>{const t=gn.current;t&&t.ingest(e)&&(Rt.current=!0,pn())},{chunkThreshold:A,chunkSize:O})),o(()=>{var e;null===(e=yn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:O})},[A,O]);const xn=l(e=>{var t;null===(t=yn.current)||void 0===t||t.push(e)},[]),wn=l(e=>{var t;null===(t=yn.current)||void 0===t||t.pushMany(e)},[]),An=l(()=>{var e,t;null===(e=yn.current)||void 0===e||e.clear(),null===(t=gn.current)||void 0===t||t.clear(),Rt.current=!0,pn()},[pn]);u(s,()=>({push:xn,pushMany:wn,remove:e=>{var t,n,o;null===(t=yn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=gn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return r.length>0&&(Jt.current&&r.some(e=>{var t;return e===(null===(t=Jt.current)||void 0===t?void 0:t.data)})&&(Jt.current=null,tn(null)),Rt.current=!0,pn()),r},update:(e,t)=>{var n,o,r;null===(n=yn.current)||void 0===n||n.flush();const i=null!==(r=null===(o=gn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(Rt.current=!0,pn()),i},clear:An,getData:()=>{var e,t,n;return null===(e=yn.current)||void 0===e||e.flush(),null!==(n=null===(t=gn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=gn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=gn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[xn,wn,An,pn]),o(()=>{var e,t;if(w){if(P&&w.length>0&&"object"==typeof w[0]&&null!==w[0]){const t="string"==typeof P?P:"coordinates";if(Array.isArray(w[0][t])){const n=[];for(const e of w){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=yn.current)||void 0===e||e.setBoundedData(n))}}null===(t=yn.current)||void 0===t||t.setBoundedData(w)}},[w,P]);const On=t(()=>{}),Sn=t(()=>{});On.current=e=>{if(!Ft)return;const t=$t.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ct.left,r=e.clientY-n.top-Ct.top;if(0>o||o>Mt||0>r||r>Pt)return void(Jt.current&&(Jt.current=null,Zt.current=null,tn(null),Pe&&(Pe(null),Rt.current=!0),pn()));const i=gn.current;if(!i||0===i.scene.length)return;const s=Ce(i.scene,o,r,Le,i.quadtree);if(!s)return void(Jt.current&&(Jt.current=null,Zt.current=null,tn(null),Pe&&Pe(null),pn()));const a=hn(s.datum||{},s.x,s.y);if("multi"===Ne&&i.scene.length>0&&i.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=Me(e.path,t,n);if(null===i)continue;const s=Ie(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=Me(e.topPath,t,n);if(null===i)continue;const s=Ie(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.topPath[s][0],y:i,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(i.scene,s.x,Le),t=i.scales.y.invert,n=i.scales.x.invert;if(e.length>0){const o=n?n(s.x):s.x;a.xValue=o,a.xPx=s.x,a.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||"#007bff",datum:e.datum}))}}Jt.current=a,Zt.current=s.node,tn(a),Pe&&(Pe(a),Rt.current=!0),pn()},Sn.current=()=>{Jt.current&&(Jt.current=null,Zt.current=null,tn(null),Pe&&(Pe(null),Rt.current=!0),pn())},l(e=>On.current(e),[]);const jn=l(()=>Sn.current(),[]),En=t(()=>{});En.current=e=>{if(!_e)return;const t=$t.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ct.left,r=e.clientY-n.top-Ct.top;if(0>o||o>Mt||0>r||r>Pt)return void _e(null);const i=gn.current;if(!i||0===i.scene.length)return void _e(null);const s=Ce(i.scene,o,r,Le,i.quadtree);_e(s?hn(s.datum||{},s.x,s.y):null)};const Cn=l(e=>En.current(e),[]),Mn=t(-1),Pn=t(null),_n=t(null),Bn=l(e=>{const t=gn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(_n.current&&_n.current.version===n)o=_n.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)switch(s.type){case"point":i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(t=s.group)&&void 0!==t?t:"_default"});break;case"line":{const e=s,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.path.length>n&&t.length>n;n++)i.push({x:e.path[n][0],y:e.path[n][1],datum:t[n],shape:"circle",group:o});break}case"area":{const e=s,t=Array.isArray(e.datum)?e.datum:[],n=null!==(o=e.group)&&void 0!==o?o:"_default";for(let o=0;e.topPath.length>o&&t.length>o;o++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});break}case"rect":i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(r=s.group)&&void 0!==r?r:"_default"});break;case"heatcell":i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),_n.current={version:n,graph:o}}const r=Mn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Mn.current=0;const t=o.flat[0];Pn.current={shape:t.shape,w:t.w,h:t.h};const n=Fe(t);return Jt.current=n,tn(n),Pe&&Pe(n),void pn()}const i=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?ze(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?ze(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return Mn.current=-1,Pn.current=null,Jt.current=null,Zt.current=null,tn(null),Pe&&Pe(null),void pn();Mn.current=s;const a=o.flat[s];Pn.current={shape:a.shape,w:a.w,h:a.h};const l=Fe(a);Jt.current=l,tn(l),Pe&&Pe(l),pn()},[Pe,pn]),Ln=l(e=>{Mn.current=-1,Pn.current=null,On.current(e)},[]);cn.current=()=>{var e,t;Dt.current=0;const n=$t.current,o=Wt.current;if(!n||!o)return;const r=gn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(St.current?i+1e6:i),a=!St.current&&s,l=Rt.current||s;l&&!a&&r.computeScene({width:Mt,height:Pt});const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return bn;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||s||n?{axisStroke:a||bn.axisStroke,tickText:i||bn.tickText,crosshair:i?i+"66":bn.crosshair,hoverFill:l?l+"4D":bn.hoverFill,hoverStroke:i?i+"99":bn.hoverStroke,pointRing:l||bn.pointRing}:bn}(n),d=null!==(e=null==rt?void 0:rt.threshold)&&void 0!==e?e:5e3,h=rt&&r.lastIngestTime>0&&i-r.lastIngestTime>d;if(l){const e=qt(n,Et,Ct,c);if(e){e.clearRect(-Ct.left,-Ct.top,Et[0],Et[1]),h&&(e.globalAlpha=null!==(t=null==rt?void 0:rt.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=K||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-Ct.left,-Ct.top,Et[0],Et[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Mt,Pt),e.clip()),Ue&&r.scales)for(const t of Ue)e.save(),t(e,r.scene,r.scales,{width:Mt,height:Pt}),e.restore();const s=mn[x];if(s&&r.scales)for(const t of s)t(e,r.scene,r.scales,{width:Mt,height:Pt});e.restore(),h&&(e.globalAlpha=1)}}{const e=qt(o,Et,Ct,c);if(e&&(e.clearRect(-Ct.left,-Ct.top,Et[0],Et[1]),Ft&&Jt.current&&r.scales&&function(e,t,n,o,r,i,s){var a,l;if(!1===r.crosshair)return;const c=t.allSeries,u=c&&c.length>0,d=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const h="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=h.stroke||s.crosshair,e.lineWidth=h.strokeWidth||1,e.setLineDash(h.strokeDasharray?h.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(u?d:t.x,0),e.lineTo(u?d:t.x,o),e.stroke(),u||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),u){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of c)null!=t.valuePx&&(e.beginPath(),e.arc(d,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||"#007bff",e.fill(),e.stroke())}else{let n="";try{(null===(l=e.canvas)||void 0===l?void 0:l.parentElement)&&(n=getComputedStyle(e.canvas).getPropertyValue("--semiotic-primary").trim())}catch(e){}const o=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||n||"#007bff";e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,Jt.current,Mt,Pt,"object"==typeof Ft?Ft:{},Zt.current,u),Zt.current&&Array.isArray(je))){const t=je.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,r.scene,Zt.current,t)}}l&&n&&n.setAttribute("aria-label",At(r.scene,x+" chart"));const g=Rt.current;if(Rt.current=!1,g&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Qt||e(Qt.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Qt.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Qt.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Qt.y.domain()[1])!==e(r.scales.y.domain()[1])||Qt.x.range()[0]!==r.scales.x.range()[0]||Qt.x.range()[1]!==r.scales.x.range()[1]||Qt.y.range()[0]!==r.scales.y.range()[0]||Qt.y.range()[1]!==r.scales.y.range()[1])&&Kt(r.scales),ut){const e=r.getData(),t="function"==typeof S?S:e=>e[S||"x"],n="function"==typeof j?j:e=>e[j||"y"];sn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),ln(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Te&&Te.length>0&&Ut(e=>e+1),(null==rt?void 0:rt.showBadge)&&on(!!h),(a||r.hasActivePulses)&&(Dt.current=requestAnimationFrame(()=>cn.current()))},o(()=>(pn(),()=>{Dt.current&&(cancelAnimationFrame(Dt.current),Dt.current=0)}),[pn]),o(()=>{Rt.current=!0,pn()},[x,Mt,Pt,fe,K,J,Ue,pn]),function(e,t,n,r,i,s){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(rt,gn,Rt,pn,nn,on);const Nn=n(()=>{if(ke||Ae)return;const e=gn.current;return(null==e?void 0:e.xIsDate)&&Qt?fn(Qt.x.domain()):void 0},[ke,Ae,Qt]),Tn=ke||Ae||Nn,Hn=Ft&&en?Ee?Ee(en):e.createElement(kn,{hover:en}):null,In=Hn?e.createElement(zt,{x:en.x,y:en.y,containerWidth:Mt,containerHeight:Pt,margin:Ct,className:"stream-frame-tooltip"},Hn):null,zn=Pn.current,Fn=e.createElement(It,{active:Mn.current>=0,hoverPoint:en,margin:Ct,size:Et,shape:null==zn?void 0:zn.shape,width:null==zn?void 0:zn.w,height:null==zn?void 0:zn.h}),$n=(e,t,n,o)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null},Wn=$n(S,z,"__semiotic_resolvedX","__semiotic_resolvedTime"),Dn=$n(j,N,"__semiotic_resolvedY","__semiotic_resolvedValue"),Rn=Wn.key,Gn=Dn.key,Yn=Te&&Te.length>0,qn=e=>{if(!e||!Yn||!Wn.fn&&!Dn.fn)return e;let t=!1;const n=e.map(e=>{const n=Wn.fn&&Wn.key&&!(Wn.key in e),o=Dn.fn&&Dn.key&&!(Dn.key in e);if(!n&&!o)return e;t=!0;const r=Object.assign({},e);return n&&(r[Wn.key]=Wn.fn(e)),o&&(r[Dn.key]=Dn.fn(e)),r});return t?n:e};if(xt){const t=gn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:Mt,height:Pt}));const n=null!==(a=null==t?void 0:t.scene)&&void 0!==a?a:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r=Tn||(()=>{if((null==t?void 0:t.xIsDate)&&o)return fn(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(V?" "+V:""),role:"img","aria-label":ft||("string"==typeof Ke?Ke:"XY chart"),style:{position:"relative",width:Et[0],height:Et[1]}},e.createElement(Lt,{summary:mt}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Et[0],height:Et[1],style:{position:"absolute",left:0,top:0}},e.createElement("g",{transform:`translate(${Ct.left},${Ct.top})`},Ht),e.createElement("g",{transform:`translate(${Ct.left},${Ct.top})`},K&&e.createElement("rect",{x:0,y:0,width:Mt,height:Pt,fill:K}),Qe&&o&&Qe.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:Mt,height:Pt}))),n.map((t,n)=>function(t,n){var o,r,i;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})}case"area":{const i=t;if(0===i.topPath.length)return null;const s=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),a=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${s}L${a}Z`,fill:bt(i.style.fill),fillOpacity:null!==(r=null!==(o=i.style.fillOpacity)&&void 0!==o?o:i.style.opacity)&&void 0!==r?r:.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:bt(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"rect":{const o=t;return e.createElement("rect",{key:"rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:bt(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,i,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),a=.299*r+.587*i+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.createElement("g",{key:"heatcell-"+n},e.createElement("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.createElement("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px"},t))}return e.createElement("rect",{key:"heatcell-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill})}case"candlestick":{const o=t,r=Math.min(o.openY,o.closeY),i=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e.createElement("g",{key:"candle-"+n},e.createElement("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.createElement("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:i,fill:s,stroke:s,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(vt,{width:Mt,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:Ct,scales:o,showAxes:fe,axes:me,xLabel:ve,yLabel:be,yLabelRight:xe,xFormat:r,yFormat:we||Se,showGrid:$e,title:Ke,legend:We,legendHoverBehavior:De,legendClickBehavior:Re,legendHighlightedCategory:Ge,legendIsolatedCategories:Ye,legendPosition:qe,foregroundGraphics:_t,marginalGraphics:ut,xValues:[],yValues:[],annotations:Te,svgAnnotationRules:He,annotationFrame:0,xAccessor:Rn,yAccessor:Gn,annotationData:qn(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof _?_:void 0,linkedCrosshairName:kt,linkedCrosshairSourceId:wt}))}const Xn="semiotic-table-"+e.useId();return e.createElement("div",{ref:jt,className:"stream-xy-frame"+(V?" "+V:""),role:"group","aria-label":ft||("string"==typeof Ke?Ke:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":Et[0],height:q?"100%":Et[1],overflow:"visible"},onKeyDown:Bn},pt&&e.createElement(Nt,{tableId:Xn}),pt&&e.createElement(Bt,{scene:null!==(h=null===(d=gn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:x+" chart",tableId:Xn,chartTitle:"string"==typeof Ke?Ke:void 0}),e.createElement(Lt,{summary:mt}),e.createElement("div",{role:"img","aria-label":ft||("string"==typeof Ke?Ke:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ft?Ln:void 0,onMouseLeave:Ft?jn:void 0,onClick:_e?Cn:void 0},Ht&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Et[0],height:Et[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Ct.left},${Ct.top})`},Ht)),e.createElement(yt,{width:Mt,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:Ct,scales:Qt,showAxes:fe,axes:me,showGrid:$e,xFormat:Tn,yFormat:we||Se}),e.createElement("canvas",{ref:$t,"aria-label":At(null!==(p=null===(g=gn.current)||void 0===g?void 0:g.scene)&&void 0!==p?p:[],x+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Wt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(Tt,{hoverPoint:en}),e.createElement(vt,{width:Mt,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:Ct,scales:Qt,showAxes:fe,axes:me,xLabel:ve,yLabel:be,yLabelRight:xe,xFormat:Tn,yFormat:we||Se,showGrid:$e,title:Ke,legend:We,legendHoverBehavior:De,legendClickBehavior:Re,legendHighlightedCategory:Ge,legendIsolatedCategories:Ye,legendPosition:qe,foregroundGraphics:_t,marginalGraphics:ut,xValues:rn,yValues:an,annotations:Te,svgAnnotationRules:He,annotationFrame:Xt,xAccessor:Rn,yAccessor:Gn,annotationData:qn(null===(y=gn.current)||void 0===y?void 0:y.getData()),pointNodes:null===(f=gn.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type),curve:"string"==typeof _?_:void 0,underlayRendered:!0,linkedCrosshairName:kt,linkedCrosshairSourceId:wt}),(Ze||et)&&e.createElement(U,{width:Mt,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:Ct,dimension:null!==(m=null==Ze?void 0:Ze.dimension)&&void 0!==m?m:"xy",scales:Qt,onBrush:null!=et?et:()=>{},binSize:L,snap:null==Ze?void 0:Ze.snap,binBoundaries:null!==(v=null==Ze?void 0:Ze.binBoundaries)&&void 0!==v?v:"bar"===x?null===(b=gn.current)||void 0===b?void 0:b.getBinBoundaries():void 0,snapDuring:null==Ze?void 0:Ze.snapDuring,streaming:"streaming"===k}),(null==rt?void 0:rt.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===rt.badgePosition?{top:4,left:4}:"bottom-left"===rt.badgePosition?{bottom:4,left:4}:"bottom-right"===rt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:nn?"#dc3545":"#28a745",color:"white"})},nn?"STALE":"LIVE"),Fn,In))});wn.displayName="StreamXYFrame";const An=s(null);function On(){return a(An)}function Sn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function jn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[En,Cn]=Ft(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=jn(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=jn(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Mn,Pn]=Ft(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function _n(e){const t=d(),o=e.clientId||t,{name:r}=e,i=Cn(e=>e.selections.get(r)),s=Cn(e=>e.setClause),a=Cn(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Sn(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:c,selectPoints:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(r,{clientId:o,type:"point",fields:t})},[o,r,s]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(r,{clientId:o,type:"interval",fields:t})},[o,r,s]),clear:l(()=>{a(r,o)},[a,r,o]),clientId:o}}function Bn(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=_n({name:t});return{onHover:l(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}function Ln(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:s,selectInterval:a,clear:c}=_n({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[u,o,r,a,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}const Nn=s(!1);function Tn({selections:e}){const t=Cn(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Hn({categoryColors:n,interaction:i,selectionName:s,field:a}){const c=Object.entries(n);if(0===c.length)return null;const u=c.map(([e])=>e),d=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],h=Bn({name:s,fields:[a]}),g=_n({name:s,clientId:"__linked-legend-isolate__"}),[p,y]=r(new Set),[f,m]=r(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(p.size>0?v.current({[a]:Array.from(p)}):b.current())},[i,p,a]);const x=l(e=>{"highlight"===i&&(e?(m(e.label),h.onHover({[a]:e.label})):(m(null),h.onHover(null)))},[i,a,h]),k=l(e=>{"isolate"===i&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[i,u.length]);return e.createElement("svg",{width:"100%",height:30,style:{display:"block",overflow:"visible"}},e.createElement(Ye,{legendGroups:d,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:f,isolatedCategories:p}))}function In({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:s="legend",legendField:a="category"}){const l=On(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(En,null,e.createElement(Mn,null,n&&e.createElement(Tn,{selections:n}),e.createElement(Nn.Provider,{value:c},c&&"top"===r&&l&&e.createElement(Hn,{categoryColors:l,interaction:i,selectionName:s,field:a}),t,c&&"bottom"===r&&l&&e.createElement(Hn,{categoryColors:l,interaction:i,selectionName:s,field:a}))))}function zn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):se[i%se.length];return{label:r+"",color:a}}),label:""}]}}function Fn(e){return e?"string"==typeof e?{name:e}:e:null}function $n(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}e.createContext(void 0);const Wn="#007bff";function Dn(){var e;const t=Yt(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function Rn(e){return"function"==typeof e?e:t=>t[e]}function Gn(e,t,o){const r=On(),i=Dn();return n(()=>{var n;if(!t)return;const s=null!==(n=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==n?n:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(r&&Object.keys(r).length>0){const e=ce(n.map(e=>({_cat:e})),"_cat",s);return t=>r[t]||e(t)}return ce(n.map(e=>({_cat:e})),"_cat",s)}if(r&&Object.keys(r).length>0){const n=ce(e,t,s);return e=>r[e]||n(e)}return ce(e,t,s)}if(r&&Object.keys(r).length>0){const e=ce([{_:"a"}],"_",s);return t=>r[t]||e(t)}},[e,t,o,r,i])}function Yn({selection:e,linkedHover:t,fallbackFields:i=[],unwrapData:s=!1,onObservation:a,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:p}){const y=d(),f=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,i),m=_n({name:(null==e?void 0:e.name)||"__unused__"}),v=Bn({name:(null==f?void 0:f.name)||"hover",fields:(null==f?void 0:f.fields)||i||[]}),b=Pn(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=r(null),A=p||i[0],O=n(()=>{if(!g||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[g,k,A]),S=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==f?void 0:f.mode)&&f.xField){const e=null==t?void 0:t[f.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=ot.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n})},it())}(f.name||"hover",Number(e),y)}"x-position"!==(null==f?void 0:f.mode)&&v.onHover(t)}else"x-position"===(null==f?void 0:f.mode)&&st(f.name||"hover",y),"x-position"!==(null==f?void 0:f.mode)&&v.onHover(null);if(g&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(a||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});a&&a(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});a&&a(e),b&&b(e)}}},[t,v,f,y,a,c,u,b,g,A]),j=l(e=>{var t,n,o,r;if("x-position"===(null==f?void 0:f.mode)&&f.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[f.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=ot.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(ot.positions);return t.delete(e),ot={positions:t},it(),!1}ot={positions:new Map(ot.positions).set(e,{xValue:t,sourceId:n,locked:!0})},it()}(f.name||"hover",Number(n),y)}if(e&&h){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),h(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(a||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});a&&a(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});a&&a(e),b&&b(e)}}},[h,a,b,c,u,f,y]);return o(()=>{if("x-position"!==(null==f?void 0:f.mode))return;const e=f.name||"hover";return()=>{at(e,y),st(e,y)}},[null==f?void 0:f.mode,null==f?void 0:f.name,y]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:j,crosshairSourceId:y}}function qn(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}}function Xn({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=a(Nn),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return zn({data:e,colorBy:t,colorScale:o,getColor:le,categories:c})},[d,t,e,o,c]),g=n(()=>{const e=Object.assign(Object.assign({},l),s);return h&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,s,h,i]);return{legend:h,margin:g,legendPosition:i}}function Vn(e,t,o){const[i,s]=r(null),[a,c]=r(new Set),u=l(t=>{"highlight"===e&&s(t?t.label:null)},[e]),d=l(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===i}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,i,a]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const Un={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 Qn(e,t,n){var o,r,i,s,a,l,c;const u=Un[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!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Kn(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function Kn(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}const Jn={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 Zn(e,t){return"function"==typeof t?t(e):e[t]}function eo(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 to(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=Zn(t,o);a=eo(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Zn(t,o);l.push({label:n,value:eo(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=eo(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=eo(t[e[0]],r))}}const c=Object.assign(Object.assign({},Jn),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function no(t){if(!0===t)return to();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:Jn},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?to(t):to())}function oo(e){return"string"==typeof e?e:"value"}function ro(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function io(e,t){return"function"==typeof t?t(e):e[t]}function so(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const r=t.data;if(!r)return null;const i=n?ro(io(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:Jn},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=ro(io(r,t.accessor));return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.7}},t.label,": "),e.createElement("span",null,o))}))}}function ao({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},o)))}class lo extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(ao,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function co(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function uo(e,t,n=3){let o,r=n+1;for(const n of t){const t=co(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function ho(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function go(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=uo(e,t,3))&&void 0!==n?n:null)}function po({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=ho(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=go(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const yo={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},fo={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},mo={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},vo=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],bo=["vertical","horizontal"],xo={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vo},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:vo},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),fo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bo},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:bo},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bo},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bo},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bo},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:bo},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},yo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},yo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},yo),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},yo),mo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},yo),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},yo),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:bo},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},yo),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},yo),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},yo),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},yo),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},yo),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},yo),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},yo),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},yo),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},yo),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},yo),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},yo),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function ko(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const wo=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Ao=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Oo=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),So=new Set(["LineChart","AreaChart","StackedAreaChart"]),jo=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Eo(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function Co(e,t){const n=Eo(e),o=Eo(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Mo=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Po(e,t){const n=[],o=function(e,t){const n=[],o=xo[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(xo).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!ko(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=uo(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const s=po({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=ho(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=go(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return xo[e]?(function(e,t,n){const o=xo[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=xo[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){wo.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){Ao.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=xo[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Oo.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!So.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=xo[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(i.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!jo.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Co(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=Co(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of Mo)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var _o;const Bo="undefined"!=typeof process&&"production"!==(null===(_o=process.env)||void 0===_o?void 0:_o.NODE_ENV);function Lo({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(lo,{fallback:i=>{let s="";if(Bo&&r)try{const e=Po(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(ao,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})}},i)}const No={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"},To={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ho(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},No),{width:n,height:o})},r||"No data available"):null}function Io(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},To),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function zo(e,t,n,o){if(!Bo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Fo(e,t,n,o){return new(n||(n=Promise))(function(r,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function a(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const $o="__forecastSegment";let Wo=null;function Do(){return Fo(this,void 0,void 0,function*(){return Wo||(Wo=yield import("./xy-statisticalOverlays-C2PPlmXv.js")),Wo})}const Ro=c(function(i,s){var a,c;const d=t(null);u(s,()=>({push:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=d.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=d.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=d.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=d.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const h=Qn(i.mode,{width:i.width,height:i.height,showGrid:i.showGrid,enableHover:i.enableHover,showLegend:i.showLegend,title:i.title,description:i.description,summary:i.summary,accessibleTable:i.accessibleTable,xLabel:i.xLabel,yLabel:i.yLabel}),{data:g,margin:p,className:y,xFormat:f,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:O="linear",showPoints:S=!1,pointRadius:j=3,fillArea:E=!1,areaOpacity:C=.3,lineWidth:M=2,lineGradient:P,tooltip:_,pointIdAccessor:B,annotations:L,directLabel:N,gapStrategy:T="break",anomaly:H,forecast:I,frameProps:z={},selection:F,linkedHover:$,onObservation:W,onClick:D,hoverHighlight:R,hoverRadius:G,chartId:Y,loading:q,emptyContent:X,legendInteraction:V,legendPosition:U,xScaleType:Q,yScaleType:K,color:J}=i,Z=h.width,ee=h.height,te=h.enableHover,ne=h.showGrid,oe=h.showLegend,re=h.title,ie=h.description,se=h.summary,ae=h.accessibleTable,ce=h.xLabel,ue=h.yLabel,de=Io(q,Z,ee),he=de?null:Ho(g,Z,ee,X),ge=g||[];zo("LineChart",ge,"xAccessor",v),zo("LineChart",ge,"yAccessor",b);const pe="string"==typeof v?v:"__semiotic_resolvedX",ye="string"==typeof b?b:"__semiotic_resolvedY",[fe,me]=r(null),[ve,be]=r([]),xe=n(()=>{if(!I&&!H)return ge;const e="function"==typeof v,t="function"==typeof b;return e||t?ge.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):ge},[ge,I,H,v,b]),ke=t(I),we=t(H);o(()=>{if(!I&&!H)return void((ke.current||we.current)&&(me(null),be([]),ke.current=I,we.current=H));let e=!1;const t=I!==ke.current||H!==we.current;if(ke.current=I,we.current=H,t&&(me(null),be([])),I){const t=x&&"string"==typeof x&&"object"==typeof I?Object.assign(Object.assign({},I),{_groupBy:x}):I;(function(...e){return Fo(this,void 0,void 0,function*(){return(yield Do()).buildForecast(...e)})})(xe,pe,ye,t,H).then(t=>{e||(me(t),be(t.annotations))}).catch(()=>{e||(me(null),be([]))})}else H&&function(...e){return Fo(this,void 0,void 0,function*(){return(yield Do()).buildAnomalyAnnotations(...e)})}(H).then(t=>{e||(me(null),be(t))}).catch(()=>{e||be([])});return()=>{e=!0}},[xe,I,H,pe,ye]);const Ae=fe?fe.processedData:ge,Oe="__compoundGroup",Se=!(!I||!x),je=Se?Oe:I?$o:x,Ee=n(()=>{if(!Se)return Ae;const e="function"==typeof x?x:e=>e[x];return Ae.map(t=>{const n=Object.assign({},t);return n[Oe]=`${e(t)}__${t[$o]||"observed"}`,n})},[Ae,Se,x]),Ce=Se?Ee:Ae,Me=n(()=>{if(!I)return;const e=I.upperBounds,t=I.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=fe?fe.processedData:ge;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[I,fe,ge,b]),{activeSelectionHook:Pe,hoverSelectionHook:_e,customHoverBehavior:Be,customClickBehavior:Le,crosshairSourceId:Ne}=Yn({selection:F,linkedHover:$,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:W,onClick:D,chartType:"LineChart",chartId:Y,hoverHighlight:R,colorByField:"string"==typeof w?w:void 0}),Te=qn($,Ne),He=l(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Ie=void 0!==(null===(a=Ce[0])||void 0===a?void 0:a[k]),ze=n(()=>{if(Ie)return Ce;if(je){const e=Ce.reduce((e,t)=>{const n="function"==typeof je?je(t):t[je];if(!e[n]){const o={[k]:[]};"string"==typeof je&&(o[je]=n),Se&&(o[$o]=t[$o],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Ce}]},[Ce,je,k,Ie]),{gapProcessedLineData:Fe,hasGaps:$e}=n(()=>{if("interpolate"===T){let e=!1;const t=[];for(const n of ze){const o=(n[k]||[]).filter(t=>!He(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const n of ze){const o=n[k]||[];let r=[],i=0;const s=je&&"string"==typeof je?n[je]:void 0;for(const a of o)if(He(a))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of ze){const r=o[k]||[],i=[];for(const n of r)He(n)?(e=!0,i.push(Object.assign(Object.assign({},n),{[t]:0}))):i.push(n);n.push(Object.assign(Object.assign({},o),{[k]:i}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:ze,hasGaps:!1}},[ze,T,k,He,je,b]),We=Gn(Ae,w,A),De=n(()=>{if(!w)return[];const e=new Set;for(const t of Ae){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[Ae,w]),Re=Vn(V,w,De),Ge=n(()=>_e||(Re.legendSelectionHook?Re.legendSelectionHook:Pe),[_e,Re.legendSelectionHook,Pe]),Ye=n(()=>(e,t)=>{const n={strokeWidth:M},o=!0===E||Array.isArray(E)&&null!=t&&E.includes(t);return w?We&&(n.stroke=le(e,w,We),o&&(n.fill=n.stroke,n.fillOpacity=C)):(n.stroke=J||Wn,o&&(n.fill=J||Wn,n.fillOpacity=C)),n},[w,We,M,E,C,J]),[qe,Xe]=r(null);o(()=>{if(!I)return void Xe(null);let e=!1;return function(...e){return Fo(this,void 0,void 0,function*(){return(yield Do()).createSegmentLineStyle(...e)})}(Ye,I).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,I]);const Ve=qe||Ye,Ue=n(()=>$n(Ve,Ge,F),[Ve,Ge,F]),Qe=n(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return w?We&&(t.fill=le(e.parentLine||e,w,We)):t.fill=J||Wn,t}},[S,j,w,We,J]),Ke=Array.isArray(E)?"mixed":E?"area":"line",Je="object"==typeof N?N:{},Ze=Je.position||"end",et=Je.fontSize||11,tt=n(()=>{var e,t;if(!N||!w)return[];const n="function"==typeof v?v:e=>e[v],o="function"==typeof b?b:e=>e[b],r="function"==typeof w?w:e=>e[w],i=new Map;for(const n of Fe){const o=n[k]||[];if(0===o.length)continue;const s="end"===Ze?o[o.length-1]:o[0],a=null!==(t=null!==(e=r(s))&&void 0!==e?e:r(n))&&void 0!==t?t:"";a&&!i.has(a+"")&&i.set(a+"",s)}const s=Array.from(i.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof v?v:"x"]:n(t),["string"==typeof b?b:"y"]:o(t),dx:"end"===Ze?6:-6,dy:0,color:We?We(e):Wn,fontSize:et}));s.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof b?b:"y",n=s[e-1],o=s[e];et+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=et+2)}return s},[N,w,We,Fe,k,v,b,Ze,et]),nt=(!N||void 0!==oe)&&oe,ot=n(()=>{if(!N)return h.marginDefaults;const e=tt.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*et);return Math.max(e,o)},0),t=e+10,n="end"===Ze?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[N,tt,et,Ze,h.marginDefaults]),{legend:rt,margin:it,legendPosition:st}=Xn({data:Fe,colorBy:w,colorScale:We,showLegend:nt,legendPosition:U,userMargin:p,defaults:ot}),at=x||w,lt=n(()=>so([{label:ce||oo(v),accessor:v,role:"x"},{label:ue||oo(b),accessor:b,role:"y"},...at?[{label:oo(at),accessor:at,role:"group"}]:[]]),[v,b,ce,ue,at]),ct=po({componentName:"LineChart",data:Ie?(null===(c=Ae[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),ut=n(()=>Ie||je||$e?Fe.flatMap(e=>{const t=e[k]||[];return je&&"string"==typeof je?t.map(t=>Object.assign(Object.assign({},t),{[je]:e[je]})):t}):Ce,[Fe,k,Ie,je,Ce,$e]),dt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:Ke},Array.isArray(E)&&{areaGroups:E}),P&&{lineGradient:P}),null!=G&&{hoverRadius:G}),null!=g&&{data:ut}),{xAccessor:v,yAccessor:b,xScaleType:Q,yScaleType:K}),Me&&{yExtent:Me}),{groupAccessor:"break"===T&&$e?"_gapSegment":je||void 0,curve:O,lineStyle:Ue}),S&&{pointStyle:Qe}),{size:[Z,ee],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:it,showAxes:h.showAxes,xLabel:ce,yLabel:ue,xFormat:f,yFormat:m,enableHover:te,showGrid:ne}),rt&&{legend:rt,legendPosition:st}),V&&"none"!==V&&{legendHoverBehavior:Re.onLegendHover,legendClickBehavior:Re.onLegendClick,legendHighlightedCategory:Re.highlightedCategory,legendIsolatedCategories:Re.isolatedCategories}),re&&{title:re}),ie&&{description:ie}),se&&{summary:se}),void 0!==ae&&{accessibleTable:ae}),y&&{className:y}),{tooltipContent:!1===_?()=>null:"multi"===_?t=>{var n,o,r,i,s,a,l,c,u,d;const h=t.allSeries;if(!h||0===h.length){const a=null!==(s=null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(r=t.data)||void 0===r?void 0:r.y)&&void 0!==i?i:t.value)&&void 0!==s?s:t.y;return e.createElement("div",{className:"semiotic-tooltip",style:Jn},e.createElement("div",null,eo(a)))}const g=null!==(d=null!==(c=null!==(a=t.xValue)&&void 0!==a?a:null===(l=t.data)||void 0===l?void 0:l.time)&&void 0!==c?c:null===(u=t.data)||void 0===u?void 0:u.x)&&void 0!==d?d:t.time;return e.createElement("div",{className:"semiotic-tooltip",style:Jn},null!=g&&e.createElement("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4}},eo(g)),h.map((t,n)=>e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"}},e.createElement("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.createElement("span",{style:{flex:1,fontSize:"0.85em"}},t.group),e.createElement("span",{style:{fontWeight:500,fontSize:"0.85em"}},eo(t.value)))))}:no(_)||lt}),"multi"===_&&{tooltipMode:"multi"}),($||W||D||R)&&{customHoverBehavior:Be}),(W||D||$)&&{customClickBehavior:Le}),B&&{pointIdAccessor:B}),((null==L?void 0:L.length)||ve.length||tt.length)&&{annotations:[...L||[],...ve,...tt]}),Te),z);return de||he||(ct?e.createElement(ao,{componentName:"LineChart",message:ct,width:Z,height:ee}):e.createElement(Lo,{componentName:"LineChart",width:Z,height:ee},e.createElement(wn,Object.assign({ref:d},dt))))});Ro.displayName="LineChart";const Go=c(function(o,r){var i;const s=t(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const a=Qn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:p="x",yAccessor:y="y",areaBy:f,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:O,showLine:S=!0,lineWidth:j=2,showPoints:E=!1,pointRadius:C=3,tooltip:M,annotations:P,frameProps:_={},selection:B,linkedHover:L,onObservation:N,onClick:T,hoverHighlight:H,chartId:I,loading:z,emptyContent:F,legendInteraction:$,legendPosition:W,color:D}=o,R=a.width,G=a.height,Y=a.enableHover,q=a.showGrid,X=a.showLegend,V=a.title,U=a.description,Q=a.summary,K=a.accessibleTable,J=a.xLabel,Z=a.yLabel,ee=Io(z,R,G),te=ee?null:Ho(l,R,G,F),ne=l||[];zo("AreaChart",ne,"xAccessor",p),zo("AreaChart",ne,"yAccessor",y);const{activeSelectionHook:oe,hoverSelectionHook:re,customHoverBehavior:ie,customClickBehavior:se,crosshairSourceId:ae}=Yn({selection:B,linkedHover:L,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:N,onClick:T,chartType:"AreaChart",chartId:I,hoverHighlight:H,colorByField:"string"==typeof x?x:void 0}),ce=qn(L,ae),ue=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[b]),de=n(()=>{if(ue)return ne;if(f){const e=ne.reduce((e,t)=>{const n="function"==typeof f?f(t):t[f];if(!e[n]){const t={[b]:[]};"string"==typeof f&&(t[f]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:ne}]},[ne,f,b,ue]),he=Gn(ne,x,k),ge=n(()=>{if(!x)return[];const e=new Set;for(const t of ne){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[ne,x]),pe=Vn($,x,ge),ye=n(()=>re||(pe.legendSelectionHook?pe.legendSelectionHook:oe),[re,pe.legendSelectionHook,oe]),fe=n(()=>e=>{const t={};if(x){if(he){const n=le(e,x,he);t.fill=n,S?(t.stroke=n,t.strokeWidth=j):t.stroke="none"}}else{const e=D||Wn;t.fill=e,S?(t.stroke=e,t.strokeWidth=j):t.stroke="none"}return t.fillOpacity=A,t},[x,he,D,A,S,j]),me=n(()=>$n(fe,ye,B),[fe,ye,B]),ve=n(()=>{if(E)return e=>{const t={r:C,fillOpacity:1};return x?he&&(t.fill=le(e.parentLine||e,x,he)):t.fill=Wn,t}},[E,C,x,he]),{legend:be,margin:xe,legendPosition:ke}=Xn({data:de,colorBy:x,colorScale:he,showLegend:X,legendPosition:W,userMargin:c,defaults:a.marginDefaults}),we=f||x,Ae=n(()=>so([{label:J||oo(p),accessor:p,role:"x"},{label:Z||oo(y),accessor:y,role:"y"},...we?[{label:oo(we),accessor:we,role:"group"}]:[]]),[p,y,J,Z,we]),Oe=po({componentName:"AreaChart",data:l,accessors:{xAccessor:p,yAccessor:y}}),Se=n(()=>ue||f?de.flatMap(e=>{const t=e[b]||[];return f&&"string"==typeof f?t.map(t=>Object.assign(Object.assign({},t),{[f]:e[f]})):t}):ne,[de,b,ue,f,ne]),je=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:Se}),{xAccessor:p,yAccessor:y,groupAccessor:f||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),O&&{lineGradient:O}),{curve:w,lineStyle:me}),E&&ve&&{pointStyle:ve}),{size:[R,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:xe,showAxes:a.showAxes,xLabel:J,yLabel:Z,xFormat:h,yFormat:g,enableHover:Y}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:q}),be&&{legend:be,legendPosition:ke}),$&&"none"!==$&&{legendHoverBehavior:pe.onLegendHover,legendClickBehavior:pe.onLegendClick,legendHighlightedCategory:pe.highlightedCategory,legendIsolatedCategories:pe.isolatedCategories}),V&&{title:V}),U&&{description:U}),Q&&{summary:Q}),void 0!==K&&{accessibleTable:K}),d&&{className:d}),{tooltipContent:!1===M?()=>null:no(M)||Ae}),(L||N||T||H)&&{customHoverBehavior:ie}),(N||T||L)&&{customClickBehavior:se}),P&&P.length>0&&{annotations:P}),ce),_);return ee||te||(Oe?e.createElement(ao,{componentName:"AreaChart",message:Oe,width:R,height:G}):e.createElement(Lo,{componentName:"AreaChart",width:R,height:G},e.createElement(wn,Object.assign({ref:s},je))))});function Yo({isPushMode:e,colorBy:o,colorScheme:i,showLegend:s,legendPosition:a="right"}){const c=t(new Set),u=t([]),[d,h]=r(0),g=l(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),p=l(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),y=l(e=>t=>{p([t]),e(t)},[p]),f=l(e=>t=>{p(t),e(t)},[p]),m=l(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!o||!1===s)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:se,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const a="string"==typeof o?o:"__streamCat";return zn({data:t.map(e=>({[a]:e})),colorBy:a,colorScale:e=>r.get(e)||"#999",getColor:le})},[e,o,s,i,d]),b=n(()=>{if(v)return"right"===a?{right:110}:"left"===a?{left:110}:"top"===a?{top:50}:"bottom"===a?{bottom:80}:{right:110}},[v,a]);return{wrapPush:y,wrapPushMany:f,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}Go.displayName="AreaChart";const qo=c(function(o,r){var i;const s=t(null),a=Qn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:p,xAccessor:y="x",yAccessor:f="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:O=2,showPoints:S=!1,pointRadius:j=3,normalize:E=!1,tooltip:C,annotations:M,frameProps:P={},selection:_,linkedHover:B,onObservation:L,onClick:N,hoverHighlight:T,chartId:H,loading:I,emptyContent:z,legendInteraction:F,legendPosition:$,color:W}=o,D=a.width,R=a.height,G=a.enableHover,Y=a.showGrid,q=a.showLegend,X=a.title,V=a.description,U=a.summary,Q=a.accessibleTable,K=a.xLabel,J=a.yLabel,Z=Io(I,D,R),ee=Z?null:Ho(c,D,R,z),te=c||[],ne=Yo({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:q,legendPosition:$}),oe=l(ne.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[ne.wrapPush]),re=l(ne.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[ne.wrapPushMany]);u(r,()=>({push:oe,pushMany:re,remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ne.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[oe,re,ne.resetCategories]);const{activeSelectionHook:ie,hoverSelectionHook:se,customHoverBehavior:ae,customClickBehavior:ce,crosshairSourceId:ue}=Yn({selection:_,linkedHover:B,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:L,onClick:N,chartType:"StackedAreaChart",chartId:H,hoverHighlight:T,colorByField:"string"==typeof b?b:void 0}),de=qn(B,ue),he=void 0!==(null===(i=te[0])||void 0===i?void 0:i[v]),ge=n(()=>{if(he)return te;if(m){const e=te.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:te}]},[te,m,v,he]),pe=Gn(te,b,x),ye=n(()=>{if(!b)return[];const e=new Set;for(const t of te){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[te,b]),fe=Vn(F,b,ye),me=n(()=>se||(fe.legendSelectionHook?fe.legendSelectionHook:ie),[se,fe.legendSelectionHook,ie]),ve=n(()=>e=>{const t={};if(b&&pe){const n=le(e,b,pe);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}else if(!b){const e=W||Wn;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=O)}return t.fillOpacity=w,t},[b,pe,w,A,O,W]),be=n(()=>$n(ve,me,_),[ve,me,_]),xe=n(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return b?pe&&(t.fill=le(e.parentLine||e,b,pe)):t.fill=W||Wn,t}},[S,j,b,pe,W]),{legend:ke,margin:we,legendPosition:Ae}=Xn({data:ge,colorBy:b,colorScale:pe,showLegend:q,legendPosition:$,userMargin:d,defaults:a.marginDefaults}),Oe=ne.streamingLegend||ke,Se=$||Ae,je=n(()=>{if(ne.streamingMarginAdjust){const e=Object.assign({},we);for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return we},[we,ne.streamingMarginAdjust]),Ee=m||b,Ce=n(()=>so([{label:K||oo(y),accessor:y,role:"x"},{label:J||oo(f),accessor:f,role:"y"},...Ee?[{label:oo(Ee),accessor:Ee,role:"group"}]:[]]),[y,f,K,J,Ee]),Me=po({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:y,yAccessor:f}}),Pe=n(()=>he||m?ge.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):te,[ge,v,he,m,te]),_e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"stackedarea"},null!=c&&{data:Pe}),{xAccessor:y,yAccessor:f,groupAccessor:m||void 0,curve:k,normalize:E,lineStyle:be}),S&&xe&&{pointStyle:xe}),{size:[D,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:je,showAxes:a.showAxes,xLabel:K,yLabel:J,xFormat:g,yFormat:p,enableHover:G}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:Y}),Oe&&{legend:Oe,legendPosition:Se}),F&&"none"!==F&&{legendHoverBehavior:fe.onLegendHover,legendClickBehavior:fe.onLegendClick,legendHighlightedCategory:fe.highlightedCategory,legendIsolatedCategories:fe.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==Q&&{accessibleTable:Q}),h&&{className:h}),{tooltipContent:!1===C?()=>null:no(C)||Ce}),(B||L||N||T)&&{customHoverBehavior:ae}),(L||N||B)&&{customClickBehavior:ce}),M&&M.length>0&&{annotations:M}),de),P);return Z||ee||(Me?e.createElement(ao,{componentName:"StackedAreaChart",message:Me,width:D,height:R}):e.createElement(Lo,{componentName:"StackedAreaChart",width:D,height:R},e.createElement(wn,Object.assign({ref:s},_e))))});function Xo(e){const{data:t,rawData:o,colorBy:r,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:p,showLegend:y,userMargin:f,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,O="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:S,hoverSelectionHook:j,customHoverBehavior:E,customClickBehavior:C,crosshairSourceId:M}=Yn({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:p,onClick:v,hoverHighlight:b,colorByField:O}),P=qn(c,M),_=Gn(t,r,i),B=n(()=>{if(!r)return[];const e=new Set;for(const n of t){const t="function"==typeof r?r(n):n[r];null!=t&&e.add(t+"")}return Array.from(e)},[t,r]),L=Vn(s,r,B),N=n(()=>j||(L.legendSelectionHook?L.legendSelectionHook:S),[j,L.legendSelectionHook,S]),{legend:T,margin:H,legendPosition:I}=Xn({data:t,colorBy:r,colorScale:_,showLegend:y,legendPosition:a,userMargin:f,defaults:m}),z=n(()=>{const e={};return T&&(e.legend=T,e.legendPosition=I),s&&"none"!==s&&(e.legendHoverBehavior=L.onLegendHover,e.legendClickBehavior=L.onLegendClick,e.legendHighlightedCategory=L.highlightedCategory,e.legendIsolatedCategories=L.isolatedCategories),e},[T,I,s,L.onLegendHover,L.onLegendClick,L.highlightedCategory,L.isolatedCategories]),F=Io(x,w,A),$=F?null:Ho(o,w,A,k);return{colorScale:_,allCategories:B,legendState:L,effectiveSelectionHook:N,activeSelectionHook:S,customHoverBehavior:E,customClickBehavior:C,legend:T,margin:H,legendPosition:I,earlyReturn:F||$||null,legendBehaviorProps:z,crosshairProps:P}}qo.displayName="StackedAreaChart";const Vo=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Qn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:a,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:p="x",yAccessor:y="y",colorBy:f,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:O,annotations:S,frameProps:j={},selection:E,linkedHover:C,linkedBrush:M,onObservation:P,onClick:_,hoverHighlight:B,chartId:L,loading:N,emptyContent:T,legendInteraction:H,legendPosition:I,color:z}=o,F=s.width,$=s.height,W=s.enableHover,D=s.showGrid,R=s.title,G=s.description,Y=s.summary,q=s.accessibleTable,X=s.xLabel,V=s.yLabel,U=a||[],Q=Xo({data:U,rawData:a,colorBy:f,colorScheme:m,legendInteraction:H,legendPosition:I,selection:E,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:_,hoverHighlight:B,chartType:"Scatterplot",chartId:L,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:N,emptyContent:T,width:F,height:$}),K=Fn(M),J=Ln({name:(null==K?void 0:K.name)||"__unused_brush__",xField:(null==K?void 0:K.xField)||("string"==typeof p?p:void 0),yField:(null==K?void 0:K.yField)||("string"==typeof y?y:void 0)}),Z=K?"xyBrush"===J.brushInteraction.brush?"xy":"xBrush"===J.brushInteraction.brush?"x":"y":void 0,ee=e.useRef(J.brushInteraction);ee.current=J.brushInteraction;const te=l(e=>{const t=ee.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(Q.earlyReturn)return Q.earlyReturn;zo("Scatterplot",U,"xAccessor",p),zo("Scatterplot",U,"yAccessor",y);const ne=n(()=>{if(!v||0===U.length)return;const e=U.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[U,v]),oe=n(()=>e=>{const t={fillOpacity:k};return f?Q.colorScale&&(t.fill=le(e,f,Q.colorScale)):t.fill=z||Wn,t.r=v?ue(e,v,b,ne):x,t},[f,Q.colorScale,v,b,ne,x,k,z]),re=n(()=>$n(oe,Q.effectiveSelectionHook,E),[oe,Q.effectiveSelectionHook,E]),ie=n(()=>so([{label:X||oo(p),accessor:p,role:"x"},{label:V||oo(y),accessor:y,role:"y"},...f?[{label:oo(f),accessor:f,role:"color"}]:[],...v?[{label:oo(v),accessor:v,role:"size"}]:[]]),[p,y,X,V,f,v]),se=po({componentName:"Scatterplot",data:a,accessors:{xAccessor:p,yAccessor:y}});if(se)return e.createElement(ao,{componentName:"Scatterplot",message:se,width:F,height:$});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:U}),{xAccessor:p,yAccessor:y,colorAccessor:f||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:re,colorScheme:m,size:[F,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q.margin,showAxes:s.showAxes,xLabel:X,yLabel:V,xFormat:h,yFormat:g,enableHover:W,showGrid:D}),Q.legendBehaviorProps),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),{tooltipContent:!1===w?()=>null:no(w)||ie}),(C||P||_||B)&&{customHoverBehavior:Q.customHoverBehavior}),(P||_||C)&&{customClickBehavior:Q.customClickBehavior}),A&&{marginalGraphics:A}),O&&{pointIdAccessor:O}),S&&S.length>0&&{annotations:S}),K&&{brush:{dimension:Z},onBrush:te}),Q.crosshairProps),j);return e.createElement(Lo,{componentName:"Scatterplot",width:F,height:$},e.createElement(wn,Object.assign({ref:i},ae)))});function Uo(e,t){return O(1===t?.5:e/(t-1))}Vo.displayName="Scatterplot";const Qo=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Qn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:a,className:l,xFormat:c,yFormat:d,xAccessor:h="x",yAccessor:g="y",orderAccessor:p,orderLabel:y,pointRadius:f=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:E,emptyContent:C,legendInteraction:M}=o,P=s.width,_=s.height,B=s.enableHover,L=s.showGrid,N=s.title,T=s.description,H=s.summary,I=s.accessibleTable,z=s.xLabel,F=s.yLabel,$=a||[],{safeData:W,orderMap:D}=n(()=>{const e="function"==typeof h?h:e=>e[h],t="function"==typeof g?g:e=>e[g];let n=$;if(p&&$.length>0){const e="function"==typeof p?p:e=>e[p];n=[...$].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const o=new WeakMap;let r=0;for(const o of n){const n=e(o),i=t(o);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let i=0;for(const s of n){const n=e(s),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[$,p,h,g]);zo("ConnectedScatterplot",W,"xAccessor",h),zo("ConnectedScatterplot",W,"yAccessor",g);const{activeSelectionHook:R,hoverSelectionHook:G,customHoverBehavior:Y,customClickBehavior:q,crosshairSourceId:X}=Yn({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,onClick:O,chartType:"ConnectedScatterplot",chartId:j,hoverHighlight:S,colorByField:void 0}),V=qn(w,X),U=Vn(M,void 0,[]),Q=n(()=>G||(U.legendSelectionHook?U.legendSelectionHook:R),[G,U.legendSelectionHook,R]),K=n(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==Q?void 0:Q.isActive,s=null==Q?void 0:Q.predicate,a=100>r.length,l=r.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=r[t],u=r[t+1],d=Uo(t,l),h=!i||!s||s(null!==(n=c.datum)&&void 0!==n?n:c)||s(null!==(o=u.datum)&&void 0!==o?o:u),g=i?h?1:.2:1;a&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=f+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=f,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[f,Q]),J=n(()=>[K],[K]),Z=n(()=>(t,n,o)=>{var r,i;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const a=s.length,l=100>a,c=[];for(let t=0;a-1>t;t++){const n=s[t],o=s[t+1],u=Uo(t,a),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,g=Math.min(d,h);l&&c.push(e.createElement("line",{key:"halo-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:f+2,strokeLinecap:"round",opacity:.5*g})),c.push(e.createElement("line",{key:"seg-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:f,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[f]),ee=n(()=>[Z],[Z]),te=n(()=>e=>{var t,n;const o=D.get(e),r=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,i=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:i>0?Uo(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:f,fillOpacity:1}},[f,D]),ne=n(()=>$n(te,Q,k),[te,Q,k]),oe=Object.assign({top:50,right:40,bottom:60,left:70},o.margin),re=y||("string"==typeof p?p:"Order"),ie=n(()=>so([{label:z||oo(h),accessor:h,role:"x"},{label:F||oo(g),accessor:g,role:"y"},...p?[{label:re,accessor:p,role:"group"}]:[]]),[h,g,z,F,p,re]),se=po({componentName:"ConnectedScatterplot",data:a,accessors:{xAccessor:h,yAccessor:g}}),ae=Io(E,P,_),le=ae?null:Ho(a,P,_,C),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:"scatter"},null!=a&&{data:W}),{xAccessor:h,yAccessor:g,pointStyle:ne,size:[P,_],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,showAxes:s.showAxes,xLabel:z,yLabel:F,xFormat:c,yFormat:d,enableHover:B,showGrid:L}),N&&{title:N}),T&&{description:T}),H&&{summary:H}),void 0!==I&&{accessibleTable:I}),l&&{className:l}),{tooltipContent:!1===m?()=>null:no(m)||ie}),(w||A||O||S)&&{customHoverBehavior:Y}),(A||O||w)&&{customClickBehavior:q}),v&&{pointIdAccessor:v}),{canvasPreRenderers:J,svgPreRenderers:ee}),b&&b.length>0&&{annotations:b}),V),x);return ae||le||(se?e.createElement(ao,{componentName:"ConnectedScatterplot",message:se,width:P,height:_}):e.createElement(Lo,{componentName:"ConnectedScatterplot",width:P,height:_},e.createElement(wn,Object.assign({ref:i},ce))))});Qo.displayName="ConnectedScatterplot";const Ko=c(function(o,i){const s=t(null),a=Qn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:p,xAccessor:y="x",yAccessor:f="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:O,marginalGraphics:S,pointIdAccessor:j,annotations:E,frameProps:C={},selection:M,linkedHover:P,linkedBrush:_,onObservation:B,onClick:L,hoverHighlight:N,chartId:T,loading:H,emptyContent:I,legendInteraction:z,legendPosition:F,color:$}=o,W=a.width,D=a.height,R=a.enableHover,G=a.showGrid,Y=a.showLegend,q=a.title,X=a.description,V=a.summary,U=a.accessibleTable,Q=a.xLabel,K=a.yLabel,J=Io(H,W,D),Z=J?null:Ho(c,W,D,I),ee=c||[],te=void 0===c,ne=t(null),[oe,re]=r(0),ie=l(e=>{if(!te)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];null!=e&&isFinite(e)&&(ne.current?(ne.current[0]>e&&(ne.current[0]=e,t=!0),e>ne.current[1]&&(ne.current[1]=e,t=!0)):(ne.current=[e,e],t=!0))}t&&re(e=>e+1)},[te,m]),se=Yo({isPushMode:te,colorBy:b,colorScheme:x,showLegend:Y,legendPosition:F}),ae=l(se.wrapPush(e=>{var t;ie([e]),null===(t=s.current)||void 0===t||t.push(e)}),[se.wrapPush,ie]),ce=l(se.wrapPushMany(e=>{var t;ie(e),null===(t=s.current)||void 0===t||t.pushMany(e)}),[se.wrapPushMany,ie]);u(i,()=>({push:ae,pushMany:ce,remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;se.resetCategories(),ne.current=null,re(e=>e+1),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[ae,ce,se.resetCategories]);const{activeSelectionHook:de,hoverSelectionHook:he,customHoverBehavior:ge,customClickBehavior:pe,crosshairSourceId:ye}=Yn({selection:M,linkedHover:P,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:B,onClick:L,chartType:"BubbleChart",chartId:T,hoverHighlight:N,colorByField:"string"==typeof b?b:void 0}),fe=qn(P,ye),me=Fn(_);Ln({name:(null==me?void 0:me.name)||"__unused_brush__",xField:(null==me?void 0:me.xField)||("string"==typeof y?y:void 0),yField:(null==me?void 0:me.yField)||("string"==typeof f?f:void 0)});const ve=Gn(ee,b,x),be=n(()=>{if(!b)return[];const e=new Set;for(const t of ee){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[ee,b]),xe=Vn(z,b,be),ke=n(()=>he||(xe.legendSelectionHook?xe.legendSelectionHook:de),[he,xe.legendSelectionHook,de]),we=n(()=>{if(te)return ne.current||[0,1];const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m,te,oe]),Ae=n(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?ve&&(t.fill=le(e,b,ve)):t.fill=$||Wn,t.r=ue(e,m,v,we),t},[b,ve,m,v,we,k,w,A,$]),Oe=n(()=>$n(Ae,ke,M),[Ae,ke,M]),{legend:Se,margin:je,legendPosition:Ee}=Xn({data:ee,colorBy:b,colorScale:ve,showLegend:Y,legendPosition:F,userMargin:d,defaults:a.marginDefaults}),Ce=se.streamingLegend||Se,Me=F||Ee,Pe=n(()=>{if(se.streamingMarginAdjust){const e=Object.assign({},je);for(const[t,n]of Object.entries(se.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return je},[je,se.streamingMarginAdjust]),_e=n(()=>so([{label:Q||oo(y),accessor:y,role:"x"},{label:K||oo(f),accessor:f,role:"y"},{label:oo(m),accessor:m,role:"size"},...b?[{label:oo(b),accessor:b,role:"color"}]:[]]),[y,f,Q,K,m,b]),Be=po({componentName:"BubbleChart",data:c,accessors:{xAccessor:y,yAccessor:f},requiredProps:{sizeBy:m}});if(Be)return e.createElement(ao,{componentName:"BubbleChart",message:Be,width:W,height:D});const Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=c&&{data:ee}),{xAccessor:y,yAccessor:f,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:Oe,colorScheme:x,size:[W,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Pe,showAxes:a.showAxes,xLabel:Q,yLabel:K,xFormat:g,yFormat:p,enableHover:R,showGrid:G}),Ce&&{legend:Ce,legendPosition:Me}),z&&"none"!==z&&{legendHoverBehavior:xe.onLegendHover,legendClickBehavior:xe.onLegendClick,legendHighlightedCategory:xe.highlightedCategory,legendIsolatedCategories:xe.isolatedCategories}),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),{tooltipContent:!1===O?()=>null:no(O)||_e}),(P||B||L||N)&&{customHoverBehavior:ge}),(B||L||P)&&{customClickBehavior:pe}),S&&{marginalGraphics:S}),j&&{pointIdAccessor:j}),E&&E.length>0&&{annotations:E}),fe),C);return J||Z||e.createElement(Lo,{componentName:"BubbleChart",width:W,height:D},e.createElement(wn,Object.assign({ref:s},Le)))});Ko.displayName="BubbleChart";const Jo=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Qn(o.mode,{width:o.width,height:o.height,showGrid:void 0,enableHover:o.enableHover,showLegend:void 0,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:a,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:p,yFormat:y,colorScheme:f="blues",customColorScale:m,showValues:v=!1,valueFormat:b,cellBorderColor:k="#fff",cellBorderWidth:w=1,tooltip:A,annotations:S,frameProps:j={},selection:P,linkedHover:_,onObservation:B,onClick:L,hoverHighlight:N,chartId:T,loading:H,emptyContent:I,showLegend:z,legendPosition:F,legendInteraction:$}=o,W=s.width,D=s.height,R=s.enableHover,G=s.title,Y=s.description,q=s.summary,X=s.accessibleTable,V=s.xLabel,U=s.yLabel,Q=Io(H,W,D),K=Q?null:Ho(a,W,D,I),J=a||[],Z=null!=z&&z,ee=null!=F?F:"right",{margin:te}=Xn({data:J,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:ee,userMargin:l,defaults:s.marginDefaults}),{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:se}=Yn({selection:P,linkedHover:_,fallbackFields:[],onObservation:B,onClick:L,chartType:"Heatmap",chartId:T,hoverHighlight:N,colorByField:void 0}),ae=qn(_,se),le=Vn($,void 0,[]),ce=n(()=>oe||(le.legendSelectionHook?le.legendSelectionHook:ne),[oe,le.legendSelectionHook,ne]),ue=n(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),de=n(()=>{const e=J.map(ue);return[Math.min(...e),Math.max(...e)]},[J,ue]),he=n(()=>"custom"===f&&m?m:x({blues:M,reds:C,greens:E,viridis:O}[f]||M).domain(de),[f,m,de]);n(()=>{const e=Rn(d),t=Rn(h);return{xBinCount:new Set(J.map(e)).size,yBinCount:new Set(J.map(t)).size}},[J,d,h]),n(()=>({coordinates:J}),[J]);const ge=n(()=>e=>{const t=ue(e);return{fill:he(t),stroke:k,strokeWidth:w}},[ue,he,k,w]);n(()=>$n(ge,ce,P),[ge,ce,P]);const pe=n(()=>so([{label:V||oo(d),accessor:d,role:"x"},{label:U||oo(h),accessor:h,role:"y"},{label:oo(g),accessor:g,role:"value"}]),[d,h,V,U,g]),ye=po({componentName:"Heatmap",data:a,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),fe=n(()=>{if(Z)return{gradient:{colorFn:e=>he(e),domain:de,label:"string"==typeof g?g:"value",format:b}}},[Z,he,de,g,b]),me=Object.assign(Object.assign(Object.assign(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:"heatmap"},null!=a&&{data:J}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==f?f:void 0,showValues:v,heatmapValueFormat:b,size:[W,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,showAxes:s.showAxes,xLabel:V,yLabel:U,xFormat:p,yFormat:y,enableHover:R}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),fe&&{legend:fe,legendPosition:ee}),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),{tooltipContent:!1===A?()=>null:no(A)||pe}),(_||B||L||N)&&{customHoverBehavior:re}),(B||L||_)&&{customClickBehavior:ie}),S&&S.length>0&&{annotations:S}),ae),j);return Q||K||(ye?e.createElement(ao,{componentName:"Heatmap",message:ye,width:W,height:D}):e.createElement(Lo,{componentName:"Heatmap",width:W,height:D},e.createElement(wn,Object.assign({ref:i},me))))});Jo.displayName="Heatmap";const Zo="__splomIdx",er={top:4,bottom:4,left:4,right:4};function tr({frameRef:n,cellSize:r,onBrush:i}){const s=t(null),a=r-er.left-er.right,l=r-er.top-er.bottom;return o(()=>{if(!s.current)return;const e=h(s.current).select(".brush-g"),t=y().extent([[0,0],[a,l]]).on("brush end",e=>{var t;const o=null===(t=n.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void i(null);const[[r,s],[a,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];i(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,l,n,i]),e.createElement("svg",{ref:s,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${er.left},${er.top})`}))}function nr({data:n,xField:o,yField:r,cellSize:i,pointRadius:s,pointOpacity:a,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:p,onPointHover:y}){const f=t(null),m=_n({name:d,clientId:`splom-${o}-${r}`}),v=Ln({name:d,xField:o,yField:r}),b=_n({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,k=l(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[Zo];void 0!==n&&(x({[Zo]:[n]}),null==y||y(t,e.x+er.left,e.y+er.top))},[x,y]),A=l(e=>{const t={opacity:a,r:s};return t.fill=c?le(e,c,u):Wn,"hover"===p?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*a):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,a,s,p,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(wn,{ref:f,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:er,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?w:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e.createElement(tr,{frameRef:f,cellSize:i,xField:o,yField:r,onBrush:k}))}function or({data:t,field:o,label:r,cellSize:i,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=_n({name:c,clientId:"splom-diag-"+o}),g=_n({name:u,clientId:`splom-diag-${o}-hover`}),p="hover"===d?g:h,y=p.isActive,f=p.predicate,m=n(()=>{const e=t.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const n=Math.min(...e),r=(Math.max(...e)-n)/s||1,l="string"==typeof a?a:null,c=l?[...new Set(t.map(e=>e[l]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(s).fill(0),h=Array(s).fill(0),g=Array.from({length:s},()=>Array(c.length).fill(0)),p=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of t){const t=e[o];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-n)/r),s-1);if(d[i]++,y&&!f(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,y&&!f(e)||p[i][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),a={x:t/s*i,w:i/s-1,h:r,y0:n,category:c[o]};return n+=r,a})}),b=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),a={x:t/s*i,w:i/s-1,h:r,y0:n,category:c[o]};return n+=r,a})});return{bars:d.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/m*(i-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,o,s,i,y,f,a]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`bg-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Wn,opacity:y?.3:.6}))):m.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Wn,opacity:y?.3:.6})),y&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`sel-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Wn,opacity:.7}))):m.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Wn,opacity:.7}))))}function rr({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function ir(t){const{data:o,fields:i,fieldLabels:s={},colorBy:a,colorScheme:c,cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:p="histogram",histogramBins:y=20,brushMode:f="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:O,chartId:S}=t,j="splom",E="splom-hover",C=m?"hover":f?"brush":"hover",M=Cn(e=>e.clearSelection),[P,_]=r(null),B=l(()=>{M(E),_(null)},[M,E]),L=n(()=>(o||[]).map((e,t)=>void 0!==e[Zo]?e:Object.assign(Object.assign({},e),{[Zo]:t})),[o]),N=Gn(L,a,c),T=void 0!==k?k:!!a,H=n(()=>{if(!T||!a)return null;const e="string"==typeof a?a:null;return e?[...new Set(L.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):Wn})):null},[T,a,L,N]),I=n(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>u+"px").join(" "),gridTemplateRows:i.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[i,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},H&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},H.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:I,onMouseLeave:"hover"===C?B:void 0},i.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t),i.map((o,r)=>n===r?"label"===p?e.createElement(rr,{key:"diag-"+t,label:s[t]||t,cellSize:u}):e.createElement(or,{key:"diag-"+t,data:L,field:t,label:s[t]||t,cellSize:u,bins:y,colorBy:a,colorScale:N,brushSelectionName:j,hoverSelectionName:E,unselectedOpacity:v,mode:C}):e.createElement(nr,{key:`cell-${t}-${o}`,data:L,xField:o,yField:t,fieldLabels:s,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:a,colorScale:N,brushSelectionName:j,hoverSelectionName:E,unselectedOpacity:v,showGrid:b,tooltip:x,mode:C,onPointHover:"hover"===C?(e,i,s)=>{e?(_({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=s?s:0}),O&&O({type:"hover",datum:e,x:null!=i?i:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})):(_(null),O&&O({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S}))}:void 0})))),e.createElement("div",null)," ",i.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t))),P&&"hover"===C&&(()=>{const t=P.datum,n=s[P.xField]||P.xField,o=s[P.yField]||P.yField,r=a?"function"==typeof a?a(t):t[a]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[Zo];return e.createElement("div",{style:{position:"absolute",left:40+P.colIndex*(u+d)+P.px,top:P.rowIndex*(u+d)+P.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[P.xField]?Number(t[P.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[P.yField]?Number(t[P.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof a?a:"group",": ",r+""))})())}function sr(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(In,{selections:r},e.createElement(ir,Object.assign({},t)))}function ar({width:n,height:r,margin:i,scales:s,brushDirection:a,extent:l,onBrush:c}){const u=t(null),d=t(null),y=t(!1),f=n+i.left+i.right,m=r+i.top+i.bottom;return o(()=>{if(!u.current||!s)return;const e=h(u.current).select(".brush-group"),t="x"===a?g().extent([[0,0],[n,r]]):p().extent([[0,0],[n,r]]);return t.on("brush end",e=>{if(y.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===a?s.x:s.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[s,n,r,a,c]),o(()=>{if(!d.current||!s||!u.current)return;const e=h(u.current).select(".brush-group"),t="x"===a?s.x:s.y;if(y.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);y.current=!1},[l,s,a]),e.createElement("svg",{ref:u,width:f,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${i.left},${i.top})`}))}function lr(i){var s,a;const{data:c,width:u=600,height:d=400,margin:h,className:g,title:p,description:y,summary:f,xLabel:m,yLabel:v,xFormat:b,yFormat:x,xAccessor:k="x",yAccessor:w="y",lineBy:A,lineDataAccessor:O="coordinates",colorBy:S,colorScheme:j,curve:E="linear",lineWidth:C=2,fillArea:M=!1,areaOpacity:P=.3,showPoints:_=!1,pointRadius:B=3,enableHover:L=!0,showGrid:N=!1,showLegend:T,legendPosition:H,tooltip:I,minimap:z={},renderBefore:F=!1,onBrush:$,brushExtent:W,frameProps:D={},loading:R,emptyContent:G}=i,Y=Io(R,u,d),q=Y?null:Ho(c,u,d,G),X=c||[],[V,U]=r(null),Q=null!=W?W:V,K=l(e=>{W||U(e),null==$||$(e)},[W,$]),J=t(null),[Z,ee]=r(null);o(()=>{const e=()=>{var t,n;const o=null===(n=null===(t=J.current)||void 0===t?void 0:t.getScales)||void 0===n?void 0:n.call(t);o?ee(o):requestAnimationFrame(e)};requestAnimationFrame(e)},[c]);const te=void 0!==(null===(s=X[0])||void 0===s?void 0:s[O]),ne=n(()=>{if(te)return X;if(A){const e=X.reduce((e,t)=>{const n="function"==typeof A?A(t):t[A];if(!e[n]){const t={[O]:[]};"string"==typeof A&&(t[A]=n),e[n]=t}return e[n][O].push(t),e},{});return Object.values(e)}return[{[O]:X}]},[X,A,O,te]),oe=n(()=>te||A?ne.flatMap(e=>{const t=e[O]||[];return A&&"string"==typeof A?t.map(t=>Object.assign(Object.assign({},t),{[A]:e[A]})):t}):X,[ne,O,te,A,X]),re=Gn(X,S,j),ie=n(()=>e=>{const t={strokeWidth:C};return t.stroke=S?le(e,S,re):Wn,M&&(t.fill=t.stroke,t.fillOpacity=P),t},[S,re,C,M,P]),se=n(()=>z.lineStyle?z.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=S?le(e,S,re):Wn,t},[S,re,z.lineStyle]),ae=n(()=>{if(_)return e=>{const t={r:B,fillOpacity:1};return t.fill=S?le(e.parentLine||e,S,re):Wn,t}},[_,B,S,re]),{legend:ce,margin:ue,legendPosition:de}=Xn({data:ne,colorBy:S,colorScale:re,showLegend:T,legendPosition:H,userMargin:h}),he=z.height||60,ge=n(()=>{var e,t,n,o,r,i,s,a;return{top:null!==(t=null===(e=z.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=z.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=z.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:ue.left,right:null!==(a=null===(s=z.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[z.margin,ue]),pe=z.brushDirection||"x",ye=po({componentName:"MinimapChart",data:c,accessors:{xAccessor:k,yAccessor:w}});if(ye)return e.createElement(ao,{componentName:"MinimapChart",message:ye,width:u,height:d});const fe=M?"area":"line",me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:fe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:E,lineStyle:ie},_&&{pointStyle:ae}),{size:[u,d],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:ue,showAxes:!0,xLabel:m,yLabel:v,xFormat:b,yFormat:x,enableHover:L,showGrid:N}),ce&&{legend:ce,legendPosition:de}),p&&{title:p}),y&&{description:y}),f&&{summary:f}),I&&{tooltipContent:no(I)||void 0}),Q&&{xExtent:Q}),D),ve={chartType:fe,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:E,lineStyle:se,size:[u,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(a=z.showAxes)&&void 0!==a&&a,background:z.background,enableHover:!1},be=e.createElement("div",{key:"minimap",style:{position:"relative",width:u,overflow:"hidden"}},e.createElement(wn,Object.assign({ref:J},ve)),e.createElement(ar,{width:u-ge.left-ge.right,height:he,margin:ge,scales:Z,brushDirection:pe,extent:Q,onBrush:K})),xe=e.createElement("div",{key:"main",style:{overflow:"hidden"}},e.createElement(wn,Object.assign({},me)));return Y||q||e.createElement(Lo,{componentName:"MinimapChart",width:u,height:d},e.createElement("div",{className:"minimap-chart"+(g?" "+g:"")},F?be:xe,F?xe:be))}sr.displayName="ScatterplotMatrix",lr.displayName="MinimapChart";const cr=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const s=Qn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:a,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:p="y",xCenter:y,yCenter:f,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w,sizeBy:A,sizeRange:O=[3,15],pointRadius:S=5,pointOpacity:j=.8,tooltip:E,pointIdAccessor:C,annotations:M,frameProps:P={},selection:_,linkedHover:B,onObservation:L,onClick:N,hoverHighlight:T,chartId:H,loading:I,emptyContent:z,legendInteraction:F,legendPosition:$,color:W}=o,D=s.width,R=s.height,G=s.enableHover,Y=s.showGrid,q=s.showLegend,X=s.title,V=s.description,U=s.summary,Q=s.accessibleTable,K=s.xLabel,J=s.yLabel,Z=Io(I,D,R),ee=Z?null:Ho(a,D,R,z),te=a||[];zo("QuadrantChart",te,"xAccessor",g),zo("QuadrantChart",te,"yAccessor",p);const{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:se}=Yn({selection:_,linkedHover:B,fallbackFields:"string"==typeof k?[k]:[],onObservation:L,onClick:N,chartType:"QuadrantChart",chartId:H,hoverHighlight:T,colorByField:"string"==typeof k?k:void 0}),ae=qn(B,se),ce=Gn(te,k,w),de=n(()=>{if(!k)return[];const e=new Set;for(const t of te){const n="function"==typeof k?k(t):t[k];null!=n&&e.add(n+"")}return Array.from(e)},[te,k]),he=Vn(F,k,de),ge=n(()=>oe||(he.legendSelectionHook?he.legendSelectionHook:ne),[oe,he.legendSelectionHook,ne]),pe=n(()=>{if(!te.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of te){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=f&&isFinite(f)&&(r>f&&(r=f),f>i&&(i=f)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[te,g,p,y,f]),ye=n(()=>{if(!A||0===te.length)return;const e=te.map(e=>"function"==typeof A?A(e):e[A]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[te,A]),fe=n(()=>"function"==typeof g?g:e=>+e[g],[g]),me=n(()=>"function"==typeof p?p:e=>+e[p],[p]),ve=n(()=>e=>{const t={fillOpacity:j};if(k)ce&&(t.fill=le(e,k,ce));else{const n=fe(e),o=me(e),r=null!=y?n>=y:void 0,i=null!=f?o>=f:void 0;t.fill=void 0===i||void 0===r?W||Wn:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?ue(e,A,O,ye):S,t},[k,ce,A,O,ye,S,j,fe,me,y,f,m,W]),be=n(()=>$n(ve,ge,_),[ve,ge,_]),{legend:xe,margin:ke,legendPosition:we}=Xn({data:te,colorBy:k,colorScale:ce,showLegend:q,legendPosition:$,userMargin:l,defaults:s.marginDefaults}),Ae=n(()=>{if(!te.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof p&&e.add(p),"string"==typeof k&&e.add(k),"string"==typeof A&&e.add(A);const t=te[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[te,g,p,k,A]),Oe=n(()=>so([...Ae?[{label:Ae,accessor:Ae,role:"title"}]:[],{label:K||oo(g),accessor:g,role:"x"},{label:J||oo(p),accessor:p,role:"y"},...k?[{label:oo(k),accessor:k,role:"color"}]:[],...A?[{label:oo(A),accessor:A,role:"size"}]:[]]),[Ae,g,p,K,J,k,A]),Se=po({componentName:"QuadrantChart",data:a,accessors:{xAccessor:g,yAccessor:p}}),je=n(()=>{var e;const t={stroke:v.stroke||"#999",strokeWidth:null!==(e=v.strokeWidth)&&void 0!==e?e:1,dashArray:v.strokeDasharray||[]};return[(e,n,o,r)=>{var i;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=r.width,a=r.height,l=null!=y?o.x(y):s/2,c=null!=f?o.y(f):a/2;if(null!=y&&!isFinite(l))return;if(null!=f&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:s-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:a-d},{config:m.bottomRight,x:u,y:d,w:s-u,h:a-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(i=t.config.opacity)&&void 0!==i?i:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[y,f,m,v]),Ee=n(()=>b?[...je,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const r=o.width,i=o.height,s=null!=y?n.x(y):r/2,a=null!=f?n.y(f):i/2;(null==y||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${x}px sans-serif`,e.globalAlpha=.5,e.fillStyle=m.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(m.topLeft.label,8,8),e.fillStyle=m.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(m.topRight.label,r-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,i-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:je,[je,b,x,m,y,f]),Ce=n(()=>{const e=P.canvasPreRenderers||[];return[...Ee,...e]},[Ee,P.canvasPreRenderers]),Me=n(()=>{var t;const n={stroke:v.stroke||"#999",strokeWidth:null!==(t=v.strokeWidth)&&void 0!==t?t:1,dashArray:v.strokeDasharray?Array.isArray(v.strokeDasharray)?v.strokeDasharray.join(","):v.strokeDasharray:void 0};return[(t,o,r)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const i=r.width,s=r.height,a=null!=y?o.x(y):i/2,l=null!=f?o.y(f):s/2;if(null!=y&&!isFinite(a))return null;if(null!=f&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l));return e.createElement(e.Fragment,null,[{config:m.topLeft,x:0,y:0,w:c,h:u},{config:m.topRight,x:c,y:0,w:i-c,h:u},{config:m.bottomLeft,x:0,y:u,w:c,h:s-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:s-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.createElement("rect",{key:"qf-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08}):null}),e.createElement("line",{x1:c,y1:0,x2:c,y2:s,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.createElement("line",{x1:0,y1:u,x2:i,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),b&&e.createElement(e.Fragment,null,e.createElement("text",{x:8,y:8+x,fill:m.topLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.topLeft.label),e.createElement("text",{x:i-8,y:8+x,fill:m.topRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.topRight.label),e.createElement("text",{x:8,y:s-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:s-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[y,f,m,v,b,x]),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:"scatter"},null!=a&&{data:te}),{xAccessor:g,yAccessor:p,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:O,pointStyle:be,colorScheme:w,size:[D,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ke,showAxes:s.showAxes,xLabel:K,yLabel:J,xFormat:d,yFormat:h,enableHover:G,showGrid:Y}),pe&&{xExtent:pe.xExtent,yExtent:pe.yExtent}),xe&&{legend:xe,legendPosition:we}),F&&"none"!==F&&{legendHoverBehavior:he.onLegendHover,legendClickBehavior:he.onLegendClick,legendHighlightedCategory:he.highlightedCategory,legendIsolatedCategories:he.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),{tooltipContent:!1===E?()=>null:!0===E||void 0===E?Oe:no(E)||Oe}),(B||L||N||T)&&{customHoverBehavior:re}),(L||N||B)&&{customClickBehavior:ie}),C&&{pointIdAccessor:C}),M&&M.length>0&&{annotations:M}),{canvasPreRenderers:Ce}),ae),P),Ce.length>0&&{canvasPreRenderers:Ce}),{svgPreRenderers:Me});return Z||ee||(Se?e.createElement(ao,{componentName:"QuadrantChart",message:Se,width:D,height:R}):e.createElement(Lo,{componentName:"QuadrantChart",width:D,height:R},e.createElement(wn,Object.assign({ref:i},Pe))))});cr.displayName="QuadrantChart";const ur="__ma_unitized",dr="__ma_series";function hr(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function gr(e,t){return t[0]+e*(t[1]-t[0])}const pr=c(function(o,r){var i,s;const a=t(null),l=t([]);u(r,()=>({push:e=>{if(!a.current)return;const t=e;for(let e=0;o.series.length>e&&2>e;e++){const n=o.series[e],r=n.extent||l.current[e];if(!r)continue;const i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(t);null!=i&&isFinite(i)&&a.current.push(Object.assign(Object.assign({},t),{[ur]:hr(i,r),[dr]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!a.current)return;const t=[];for(const n of e)for(let e=0;o.series.length>e&&2>e;e++){const r=o.series[e],i=r.extent||l.current[e];if(!i)continue;const s=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=s&&isFinite(s)&&t.push(Object.assign(Object.assign({},n),{[ur]:hr(s,i),[dr]:r.label||"Series "+(e+1)}))}a.current.pushMany(t)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const c=Qn(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,accessibleTable:o.accessibleTable},{width:800,height:400}),{data:d,margin:h,className:g,xFormat:p,xAccessor:y="x",series:f,colorScheme:m,curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:E,chartId:C,loading:M,emptyContent:P,legendInteraction:_,legendPosition:B}=o,L=c.width,N=c.height,T=c.enableHover,H=c.showGrid,I=null===(i=c.showLegend)||void 0===i||i,z=c.title,F=c.description,$=c.summary,W=c.accessibleTable,D=c.xLabel,R=2===f.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||R||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${f.length}. Rendering as a standard multi-line chart.`);const G=Io(M,L,N),Y=G?null:Ho(d,L,N,P),q=d||[],X=Dn(),V=n(()=>{let e;if(Array.isArray(m))e=m;else if(X&&X.length>0)e=X;else{const t=re[m];e=Array.isArray(t)?t:ie}return f.map((t,n)=>t.color||e[n%e.length])},[f,m,X]),U=n(()=>f.map((e,t)=>e.label||"Series "+(t+1)),[f]),{unitizedData:Q,extents:K}=n(()=>{if(0===q.length){const e=f.map(e=>e.extent||null).filter(Boolean);return e.length===f.length&&(l.current=e),{unitizedData:[],extents:e.length===f.length?e:[]}}const e=f.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(q,e.yAccessor));if(l.current=e,!R){const t=[];for(const e of q)for(let n=0;f.length>n;n++){const o=f[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push(Object.assign(Object.assign({},e),{[ur]:r,[dr]:U[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of q)for(let o=0;2>o;o++){const r=f[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push(Object.assign(Object.assign({},n),{[ur]:hr(i,e[o]),[dr]:U[o]}))}return{unitizedData:t,extents:e}},[q,f,R,U]),J=n(()=>{if(R&&K.length>=2)return[{orient:"left",label:U[0],tickFormat:f[0].format||(e=>{const t=gr(e,K[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:U[1],tickFormat:f[1].format||(e=>{const t=gr(e,K[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[R,K,f,U]),Z=Xo({data:n(()=>Q.length>0?Q:U.map(e=>({[dr]:e})),[Q,U]),rawData:d,colorBy:dr,colorScheme:V,legendInteraction:_,legendPosition:B,selection:A,linkedHover:O,fallbackFields:[dr],unwrapData:!1,onObservation:S,onClick:j,hoverHighlight:E,chartType:"MultiAxisLineChart",chartId:C,showLegend:I,userMargin:h,marginDefaults:R?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:M,emptyContent:P,width:L,height:N});if(Z.earlyReturn)return Z.earlyReturn;const ee=n(()=>{const e=new Map;return U.forEach((t,n)=>e.set(t,V[n])),t=>({stroke:e.get(t[dr])||V[0],strokeWidth:b,fill:"none"})},[U,V,b]),te=n(()=>$n(ee,Z.effectiveSelectionHook,A),[ee,Z.effectiveSelectionHook,A]),ne=n(()=>{if(!1===x)return()=>null;return no(x)||(t=>{var n;const o=t.data||t,r=o[dr],i=U.indexOf(r),s=o[ur],a=R&&i>=0&&K[i]?gr(s,K[i]):s,l=i>=0&&(null===(n=f[i])||void 0===n?void 0:n.format)?f[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof y?y(o):o[y];return e.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},e.createElement("div",{style:{fontWeight:600,marginBottom:4,color:V[i]||"inherit"}},r),e.createElement("div",null,`${"string"==typeof y?y:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(a)}`))})},[x,U,V,K,R,f,y]),oe=po({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:y}}),se=R?[0,1]:void 0,ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:Q}),{xAccessor:y,yAccessor:ur,groupAccessor:dr,lineStyle:te,colorScheme:V,size:[L,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,showAxes:c.showAxes}),J&&{axes:J}),{xLabel:D}),R?{}:{yLabel:U[0]}),{xFormat:p}),R&&se&&{yExtent:se}),{enableHover:T}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:H,curve:v}),Z.legendBehaviorProps),z&&{title:z}),F&&{description:F}),$&&{summary:$}),void 0!==W&&{accessibleTable:W}),g&&{className:g}),{tooltipContent:ne}),k&&{annotations:k}),(O||S||j||E)&&{customHoverBehavior:Z.customHoverBehavior}),(S||j||O)&&{customClickBehavior:Z.customClickBehavior}),Z.crosshairProps),w);return G||Y||(oe?e.createElement(ao,{componentName:"MultiAxisLineChart",message:oe,width:L,height:N}):e.createElement(Lo,{componentName:"MultiAxisLineChart",width:L,height:N},e.createElement(wn,Object.assign({ref:a},ae))))});pr.displayName="MultiAxisLineChart";export{Go as AreaChart,Ko as BubbleChart,Qo as ConnectedScatterplot,Jo as Heatmap,Ro as LineChart,lr as MinimapChart,pr as MultiAxisLineChart,cr as QuadrantChart,Vo as Scatterplot,sr as ScatterplotMatrix,qo as StackedAreaChart,wn as StreamXYFrame};
1
+ import*as e from"react";import{useRef as t,useMemo as n,useEffect as o,useSyncExternalStore as r,createContext as i,useContext as s,useCallback as a,useState as l,forwardRef as c,useImperativeHandle as u,useId as d}from"react";import{select as h}from"d3-selection";import{brushX as g,brushY as p,brush as f}from"d3-brush";import{scaleOrdinal as y,scaleLinear as m,scaleLog as v,scaleTime as b,scaleSequential as x}from"d3-scale";import{quadtree as k}from"d3-quadtree";import{schemeCategory10 as w,interpolatePlasma as A,interpolateViridis as O,interpolatePurples as S,interpolateOranges as j,interpolateGreens as E,interpolateReds as C,interpolateBlues as M,schemeSet3 as P,schemeTableau10 as _}from"d3-scale-chromatic";import{bin as B}from"d3-array";import{packEnclose as L}from"d3-hierarchy";import{area as N,curveCatmullRom as T,curveCardinal as H,curveBasis as I,curveStepBefore as F,curveStepAfter as z,curveStep as $,curveMonotoneY as D,curveMonotoneX as W,curveLinear as R,line as G,curveNatural as Y}from"d3-shape";import q from"regression";function X(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function V(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function U({width:r,height:i,totalWidth:s,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:y,snap:m,binBoundaries:v,snapDuring:b,streaming:x}){const k=t(null),w=t(null),A=t(d);A.current=d;const O=t(u);O.current=u;const S=n(()=>v?[...v].sort((e,t)=>e-t):void 0,[v]),j=t(S);j.current=S;const E=t(!1),C=t(null);return o(()=>{if(!k.current)return;const e=h(k.current).select(".brush-g"),t="x"===c?g():"y"===c?p():f();return t.extent([[0,0],[r,i]]),t.on("brush end",n=>{if(E.current)return;const o=O.current;if(!o)return;if(!n.selection)return C.current=null,void A.current(null);let s,a;if("x"===c){const[e,t]=n.selection;s=[o.x.invert(e),o.x.invert(t)],a=[o.y.invert(i),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;s=[o.x.invert(0),o.x.invert(r)],a=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[r,i]]=n.selection;s=[o.x.invert(e),o.x.invert(r)],a=[o.y.invert(i),o.y.invert(t)]}if("bin"===m&&"y"!==c&&("end"===n.type||"brush"===n.type&&b)){const r=j.current;r&&r.length>0?s=function(e,t){return 0===t.length?e:[X(e[0],t),V(e[1],t)]}(s,r):y&&y>0&&(s=[Math.floor(s[0]/y)*y,Math.ceil(s[1]/y)*y]);const i=o.x(s[0]),a=o.x(s[1]);if(E.current=!0,"x"===c)e.call(t.move,[i,a]);else if("xy"===c){const o=n.selection;e.call(t.move,[[i,o[0][1]],[a,o[1][1]]])}E.current=!1}const l={x:s,y:a};C.current=l,A.current(l)}),e.call(t),w.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),w.current=null}},[r,i,c,m,y,b]),o(()=>{if(!(x&&u&&w.current&&C.current))return;if(!k.current)return;if("y"===c)return;const e=C.current,t=u.x.domain()[0],n=h(k.current).select(".brush-g");if(t>=e.x[1])return E.current=!0,n.call(w.current.move,null),E.current=!1,C.current=null,void A.current(null);let o=e.x[0],r=!1;if(t>e.x[0]){if(o=t,"bin"===m){const e=j.current;e&&e.length>0?o=V(t,e):y&&y>0&&(o=Math.ceil(t/y)*y)}if(o>=e.x[1])return E.current=!0,n.call(w.current.move,null),E.current=!1,C.current=null,void A.current(null);r=!0}const i=u.x(o),s=u.x(e.x[1]);if(E.current=!0,"x"===c)n.call(w.current.move,[i,s]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[i,t],[s,o]])}if(E.current=!1,r){const t={x:[o,e.x[1]],y:e.y};C.current=t,A.current(t)}},[u,x,c,m,y]),e.createElement("svg",{ref:k,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`}))}class Q{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){this.pushBuffer.push(e),this.scheduleFlush()}pushMany(e){if(0!==e.length){for(let t=0;e.length>t;t++)this.pushBuffer.push(e[t]);this.scheduleFlush()}}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class K{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class J{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function Z(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function ee(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function te(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function ne(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function oe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}const re={category10:w,tableau10:_,set3:P,blues:M,reds:C,greens:E,oranges:j,purples:S,viridis:O,plasma:A},ie=w,se=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ae=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 le(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")||ae.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):ie[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+""))%ie.length]}function ce(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const i=re[n]||re.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:ie;return y().domain(o).range(e).unknown("#999")}}function ue(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):null==e?void 0:e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}function de(e,t,n){var o,r,i;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>a?1:s;default:return 1}}function he(e,t,n){var o;const r=null!==(o=e.duration)&&void 0!==o?o:500,i=n-t;return r>i?1-i/r:0}function ge(e,t,n){return e+(t-e)*n}function pe(e,t,n){var o,r,i,s;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(s=null!==(r=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==r?r:null===(i=t.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function fe(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function ye(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function me(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(null==a||null==l||Number.isNaN(a)||Number.isNaN(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function ve(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function be(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function xe(e,t,n){if(!e.getBounds||!e.scales)return null;const o=[],r=[];for(const n of t){const t=e.getX(n),i=e.getY(n);if(null==t||null==i||Number.isNaN(t)||Number.isNaN(i))continue;const s=e.getBounds(n),a=e.scales.x(t);if(s&&0!==s)o.push([a,e.scales.y(i+s)]),r.push([a,e.scales.y(i-s)]);else{const t=e.scales.y(i);o.push([a,t]),r.push([a,t])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:r,style:e.resolveBoundsStyle(n,t[0]),datum:t,group:n,interactive:!1}}function ke(e,t,n,o){var r;if(!e.config.pointStyle)return;const i=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const a=null!==(r=o.r)&&void 0!==r?r:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=me(s,e.scales,e.getX,i,a,o,l);c&&n.push(c)}}}const we={blues:M,reds:C,greens:E,viridis:O},Ae=new Map;class Oe{constructor(e){if(this.xExtent=new J,this.yExtent=new J,this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this.config=e,this.buffer=new K(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=te(e.timeAccessor||e.xAccessor,"time"),this.getY=te(e.valueAccessor||e.yAccessor,"value")):(this.getX=te(e.xAccessor,"x"),this.getY=te(e.yAccessor,"y")),this.getGroup=oe(e.groupAccessor),this.getCategory=oe(e.categoryAccessor),this.getSize=e.sizeAccessor?te(e.sizeAccessor,"size"):void 0,this.getColor=oe(e.colorAccessor),this.getBounds=e.boundsAccessor?te(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?te(e.y0Accessor,"y0"):void 0,this.getPointId=oe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?te(e.openAccessor,"open"):void 0,this.getHigh=te(e.highAccessor,"high"),this.getLow=te(e.lowAccessor,"low"),this.getClose=n?te(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new K(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?te(this.config.timeAccessor||this.config.xAccessor,"time"):te(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}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.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n)))}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):(this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n))),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,s,a;const{config:l,buffer:c}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.getBufferArray(),d=this.xExtent.extent,h=this.yExtent.extent;let g=l.xExtent?[null!==(n=l.xExtent[0])&&void 0!==n?n:d[0],null!==(o=l.xExtent[1])&&void 0!==o?o:d[1]]:d,p=l.yExtent?[null!==(r=l.yExtent[0])&&void 0!==r?r:h[0],null!==(i=l.yExtent[1])&&void 0!==i?i:h[1]]:h;const f=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!f&&c.size>0)if(l.normalize)p=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)p=this._stackExtentCache.yDomain;else{const t=this.groupData(u),n=new Map;let o=0;for(const e of t)for(const t of e.data){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=(n.get(e)||0)+r;n.set(e,i),i>o&&(o=i)}p=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:p}}}else if("bar"===l.chartType&&l.binSize&&!f&&c.size>0){const[,e]=function(e,t,n,o,r){const i=Z(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(c,this.getX,this.getY,l.binSize,this.getCategory);p=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!f&&c.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(c,this.getY),n=t-e,o=n>0?n*l.extentPadding:1;p=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!f&&p[0]!==1/0){if(this.getBounds)for(const e of u){const t=this.getY(e),n=this.getBounds(e);null!=t&&!Number.isNaN(t)&&n&&(t+n>p[1]&&(p[1]=t+n),p[0]>t-n&&(p[0]=t-n))}const e=p[1]-p[0],t=e>0?e*l.extentPadding:1,n=null===(s=l.yExtent)||void 0===s?void 0:s[0],o=null===(a=l.yExtent)||void 0===a?void 0:a[1];p=[null!=n?p[0]:p[0]-t,null!=o?p[1]:p[1]+t],"log"===l.yScaleType&&0>=p[0]&&h[0]>0&&(p[0]=null!=n?p[0]:h[0]/(1+l.extentPadding))}if(g[0]===1/0||g[1]===-1/0)if("time"===l.xScaleType){const e=Date.now();g=[e-864e5,e]}else g=[0,1];p[0]!==1/0&&p[1]!==-1/0||(p=[0,1]);const y="streaming"===l.runtimeMode,x=Math.max(0,Math.min(l.scalePadding||0,Math.min(e.width,e.height)/2-1));if(y)if("x"==("up"===(k=l.arrowOfTime)||"down"===k?"y":"x")){const t="right"===l.arrowOfTime?[x,e.width-x]:[e.width-x,x];this.scales={x:m().domain(g).range(t),y:m().domain(p).range([e.height-x,x])}}else{const t="down"===l.arrowOfTime?[x,e.height-x]:[e.height-x,x];this.scales={x:m().domain(p).range([x,e.width-x]),y:m().domain(g).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)};this.scales={x:t(l.xScaleType,g,[x,e.width-x]),y:t(l.yScaleType,p,[e.height-x,x])}}var k;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,u),this.config.decay&&this.applyDecay(this.scene,u),this.config.pulse&&this.applyPulse(this.scene,u),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.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,Oe.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let r=0;for(const e of this.scene)"point"===e.type&&(o[r++]=e);this._quadtree=k().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return v().domain(e).range(n).clamp(!0)}return"time"===e?b().domain([new Date(t[0]),new Date(t[1])]).range(n):m().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n;const{config:o,scales:r}=this;if(!r||0===t.length)return[];const i={scales:r,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,getBounds:this.getBounds,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),r=[],i=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.getBounds)for(const t of o){const n=xe(e,t.data,t.key);n&&r.push(n)}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=fe(t.data,e.scales,e.getX,e.getY,n,t.key);i&&i.length>0&&(o.colorThresholds=i),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),r.push(o)}return ke(e,o,r),r}(i,t);case"area":return function(e,t){const n=e.groupData(t),o=[],r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=ye(t.data,e.scales,e.getX,e.getY,r,n,t.key,i);e.config.gradientFill&&(s.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return ke(e,n,o),o}(i,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set,i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=ye(t.data,e.scales,e.getX,e.getY,i,n,t.key,s);e.config.gradientFill&&(r.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=fe(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return ke(e,n,o),o}(i,t);case"stackedarea":return function(e,t){const n=e.groupData(t);n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,{nodes:r,stackedTops:i}=function(e,t,n,o,r,i,s){var a;const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let n=0;for(const o of e)n+=(null===(a=u.get(o.key))||void 0===a?void 0:a.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,p=new Map;for(const e of c)p.set(e,0);for(const n of e){const e=u.get(n.key),o=[],a=[],l=new Map;for(const n of c){let r=e.get(n)||0;const s=p.get(n);i&&(r/=d.get(n));const c=s+r,u=t.x(n);a.push([u,t.y(s)]),o.push([u,t.y(c)]),p.set(n,c),l.set(n,c)}g.set(n.key,l);const f={type:"area",topPath:o,bottomPath:a,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(f.curve=s),h.push(f)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),s=r;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=i.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};ke(e,n,s,o)}return s}(i,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:"#4e79a7",opacity:.8},a=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(a=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t=Object.assign(Object.assign({},t),{fill:s.get(n)}))}const l=e.getPointId?e.getPointId(r)+"":void 0,c=me(r,e.scales,e.getX,e.getY,a,t,l);c&&n.push(c)}return n}(i,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,r,i;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),a=Math.max(1,Math.floor(null!==(r=e.config.heatmapYBins)&&void 0!==r?r:20)),l=null!==(i=e.config.heatmapAggregation)&&void 0!==i?i:"count",c=te(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),p=(d-u||1)/s,f=(g-h||1)/a,y=s*a;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],r=e.getX(o),i=e.getY(o);if(!isFinite(r)||!isFinite(i))continue;const l=Math.min(Math.floor((r-u)/p),s-1),d=Math.min(Math.floor((i-h)/f),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const y=c(o);v[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/s,A=n.height/a,O=e.config.showValues,S=e.config.heatmapValueFormat,j=[];for(let e=0;a>e;e++){const t=e*s;for(let n=0;s>n;n++){const o=t+n;if(0===m[o])continue;let r;switch(l){case"sum":r=v[o];break;case"mean":r=v[o]/m[o];break;default:r=m[o]}const i=(r-b)/k;j.push(be(n*w,(a-1-e)*A,w,A,`rgb(${220-(180*i+.5)|0},${220-(100*i+.5)|0},${255-(50*i+.5)|0})`,{xi:n,yi:e,value:r,count:m[o],sum:v[o]},O?{value:r,showValues:!0,valueFormat:S}:void 0))}}return j}(e,t,n);if(0===t.length)return[];const o=te(e.config.valueAccessor,"value"),r=ne(e.config.xAccessor,"x"),i=ne(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),p=h.every(e=>"number"==typeof e&&!isNaN(e)),f=g.every(e=>"number"==typeof e&&!isNaN(e));if(p){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(f){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const d=o(n),h=i*u+r,g=b.get(h);let p;void 0!==g?p=g:(p=x++,b.set(h,p)),y[p]=h,m[p]=d,v[p]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in we?e:"blues";let n=Ae.get(t);if(n)return n;n=Array(256);const o=we[t]||M;for(let e=0;256>e;e++)n[e]=o(e/255);return Ae.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:"blues"),O=255/(w-k||1),S=n.width/u,j=n.height/d,E=e.config.showValues,C=e.config.heatmapValueFormat,P=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;P.push(be(o*S,(d-1-(n-o)/u)*j,S,j,A[Math.min((t-k)*O+.5|0,255)],v[e],E?{value:t,showValues:!0,valueFormat:C}:void 0))}return P}(i,t,e);case"bar":{const e=function(e,t){var n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Z(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(n),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const i=[],s=e.scales,[a,l]=s.x.domain();for(const t of o.values()){const o=Math.max(t.start,a),c=Math.min(t.end,l);if(o>=c)continue;const u=s.x(o),d=s.x(c),h=Math.abs(d-u),g=h>2?1:0,p=Math.min(u,d)+g/2,f=Math.max(h-g,1);if(f>0)if(r&&t.categories.size>0){let o=0;for(const a of r){const r=t.categories.get(a)||0;if(0===r)continue;const l=s.y(o),c=s.y(o+r);i.push(ve(p,Math.min(l,c),f,Math.abs(l-c),{fill:(null===(n=e.config.barColors)||void 0===n?void 0:n[a])||"#4e79a7"},{binStart:t.start,binEnd:t.end,total:t.total,category:a,categoryValue:r},a)),o+=r}}else{const e=s.y(0),n=s.y(t.total);i.push(ve(p,Math.min(e,n),f,Math.abs(e-n),{fill:"#007bff"},{binStart:t.start,binEnd:t.end,total:t.total}))}}const c=new Set;for(const e of o.values())c.add(e.start),c.add(e.end);return{nodes:i,binBoundaries:Array.from(c).sort((e,t)=>e-t)}}(i,t);return this._barCategoryCache=null!==(n=i.barCategoryCache)&&void 0!==n?n:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,r,i;const s=[],a=e.config.swarmStyle||{},l=null!==(n=a.radius)&&void 0!==n?n:3,c=null!==(o=a.fill)&&void 0!==o?o:"#007bff",u=null!==(r=a.opacity)&&void 0!==r?r:.7,d=a.stroke,h=a.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const r=e.scales.x(t),a=e.scales.y(o);let g=c;if(e.getCategory){const t=e.getCategory(n);g=(null===(i=e.config.barColors)||void 0===i?void 0:i[t])||g}const p={type:"point",x:r,y:a,r:l,style:{fill:g,opacity:u,stroke:d,strokeWidth:h},datum:n};e.getPointId&&(p.pointId=e.getPointId(n)+""),s.push(p)}return s}(i,t);case"waterfall":return function(e,t,n){var o,r,i;const s=[],a=e.scales,l=e.config.waterfallStyle,c=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===c.length)return s;const u=null!==(o=null==l?void 0:l.positiveColor)&&void 0!==o?o:"#28a745",d=null!==(r=null==l?void 0:l.negativeColor)&&void 0!==r?r:"#dc3545",h=null!==(i=null==l?void 0:l.gap)&&void 0!==i?i:1,g=null==l?void 0:l.stroke,p=null==l?void 0:l.strokeWidth;let f=0;for(let t=0;c.length>t;t++){const o=c[t],r=e.getX(o),i=e.getY(o),y=f+i;let m;m=c.length-1>t?e.getX(c[t+1])-r:t>0?r-e.getX(c[t-1]):0;const v=a.x(r),b=0!==m?a.x(r+m):v+n.width/10,x=Math.min(v,b)+h/2,k=Math.max(v,b)-h/2-x;if(0>=k){f=y;continue}const w=a.y(f),A=a.y(y);s.push(ve(x,Math.min(w,A),k,Math.abs(w-A),{fill:0>i?d:u,stroke:g,strokeWidth:p},Object.assign(Object.assign({},o),{baseline:f,cumEnd:y,delta:i,_connectorStroke:null==l?void 0:l.connectorStroke,_connectorWidth:null==l?void 0:l.connectorWidth}))),f=y}return s}(i,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const r=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(r||e.getOpen&&e.getClose))return[];const i=[],s=e.config.candlestickStyle||{},a=s.rangeColor||"#6366f1",l=r?a:s.upColor||"#28a745",c=r?a:s.downColor||"#dc3545",u=r?a:s.wickColor||"#333",d=s.wickWidth||(r?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=r?0:null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(!r&&null==s.bodyWidth&&h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else r||null!=s.bodyWidth||(g=6);for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const a=r?o:e.getOpen(n),h=r?s:e.getClose(n);if(!r&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const p=h>=a,f={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:p,datum:n};r&&(f.isRange=!0),i.push(f)}return i}(i,t);default:return[]}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?de(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,r;const i=n.length;if(1>=i)return;const s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let r=!1;for(let n=0;t.length>n;n++){const a=s.get(t[n]);null!=a?(o[n]=de(e,a,i),1>o[n]&&(r=!0)):o[n]=1}r&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const r=Array(o);let a=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(r[n]=de(e,o,i),1>r[n]&&(a=!0)):r[n]=1}a&&(n._decayOpacities=r)}else{let r=1;for(const n of t){const t=s.get(n);if(null!=t){const n=de(e,t,i);r>n&&(r=n)}}if(1>r){const e=Array(o);e.fill(r),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const a=de(e,t,i);if("heatcell"===n.type)n.style={opacity:a};else if("candlestick"===n.type)n._decayOpacity=a;else{const e=null!==(r=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var r,i;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(r=e.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",l=null!==(i=e.glowRadius)&&void 0!==i?i:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0;for(const n of t){const t=c.get(n);if(null==t)continue;const i=o.get(t);if(null==i)continue;const a=he(e,i,s);a>r&&(r=a)}r>0&&(n._pulseIntensity=r,n._pulseColor=a);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);if(null==r)continue;const i=he(e,r,s);i>0&&(n._pulseIntensity=i,n._pulseColor=a,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=e.duration)&&void 0!==n?n:500,i=t.peek();return null!=i&&r>o-i}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var r,i,s;n.clear(),o.clear();for(let a=0;t.length>a;a++){const l=t[a],c=pe(e,l,a);c&&("point"===l.type?n.set(c,{x:l.x,y:l.y,r:l.r,opacity:l.style.opacity}):"rect"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:l.style.opacity}):"heatcell"===l.type?n.set(c,{x:l.x,y:l.y,w:l.w,h:l.h,opacity:null===(r=l.style)||void 0===r?void 0:r.opacity}):"candlestick"===l.type?n.set(c,{x:l.x,y:l.openY}):"line"===l.type?o.set(c,{path:l.path.map(e=>[e[0],e[1]]),opacity:null===(i=l.style)||void 0===i?void 0:i.opacity}):"area"===l.type&&o.set(c,{topPath:l.topPath.map(e=>[e[0],e[1]]),bottomPath:l.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(s=l.style)||void 0===s?void 0:s.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],r=pe(this.transitionContext,t,e);r&&("point"===t.type?this.prevPositionMap.set(r,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(r,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(r,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(r,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(r,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r){var i,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S,j,E,C,M,P,_,B;if(0===o.size&&0===r.size)return n;const L=null!==(i=t.duration)&&void 0!==i?i:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let N=!1;const T=new Set,H=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],A=pe(e,i,t);if(!A)continue;if(i._transitionKey=A,"line"===i.type||"area"===i.type){const e=r.get(A);if(e){if(H.add(A),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];N=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];N=!0}i._targetOpacity=null!==(s=i.style.opacity)&&void 0!==s?s:1,i._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:i.style.opacity)&&void 0!==l?l:1}else i._targetOpacity=null!==(c=i.style.opacity)&&void 0!==c?c:1,i._startOpacity=0,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;continue}const O=o.get(A);if("point"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=null!==(u=i.style.opacity)&&void 0!==u?u:1,O.x===e.x&&O.y===e.y&&O.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=O.x,i.y=O.y,i.r=null!==(d=O.r)&&void 0!==d?d:i.r,N=!0)}else i._targetOpacity=null!==(h=i.style.opacity)&&void 0!==h?h:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;else if("rect"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(g=i.style.opacity)&&void 0!==g?g:1,O.x===e.x&&O.y===e.y&&O.w===e.w&&O.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=O.x,i.y=O.y,i.w=null!==(p=O.w)&&void 0!==p?p:i.w,i.h=null!==(f=O.h)&&void 0!==f?f:i.h,N=!0)}else i._targetOpacity=null!==(y=i.style.opacity)&&void 0!==y?y:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),N=!0;else if("heatcell"===i.type)if(O){T.add(A);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=null!==(v=null===(m=i.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,O.x===e.x&&O.y===e.y&&O.w===e.w&&O.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=O.x,i.y=O.y,i.w=null!==(b=O.w)&&void 0!==b?b:i.w,i.h=null!==(x=O.h)&&void 0!==x?x:i.h,N=!0)}else i._targetOpacity=null!==(w=null===(k=i.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,i.style=Object.assign(Object.assign({},i.style||{}),{opacity:0}),N=!0}for(const[e,t]of r)if(!H.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(A=t.opacity)&&void 0!==A?A:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),N=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(O=t.opacity)&&void 0!==O?O:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),N=!0}for(const[e,t]of o)if(!T.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(S=t.r)&&void 0!==S?S:3,style:{opacity:null!==(j=t.opacity)&&void 0!==j?j:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(E=t.w)&&void 0!==E?E:0,h:null!==(C=t.h)&&void 0!==C?C:0,style:{opacity:null!==(M=t.opacity)&&void 0!==M?M:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(P=t.w)&&void 0!==P?P:0,h:null!==(_=t.h)&&void 0!==_?_:0,fill:"#999",datum:null,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}N=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),N&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:L}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var r,i,s,a,l;if(!n.activeTransition)return!1;const c=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),u=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(c,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=ge(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ge(n.x,e._targetX,u),e.y=ge(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=ge(n.r,e._targetR,u))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=ge(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ge(n.x,e._targetX,u),e.y=ge(n.y,e._targetY,u),void 0!==n.w&&(e.w=ge(n.w,e._targetW,u)),void 0!==n.h&&(e.h=ge(n.h,e._targetH,u))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:ge(r,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ge(n.x,e._targetX,u),e.y=ge(n.y,e._targetY,u),void 0!==n.w&&(e.w=ge(n.w,e._targetW,u)),void 0!==n.h&&(e.h=ge(n.h,e._targetH,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(a=e._startOpacity)&&void 0!==a?a:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ge(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=ge(t[o][0],n[o][0],u),e.path[o][1]=ge(t[o][1],n[o][1],u)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ge(t,e._targetOpacity,u)})}void 0!==e._introClipFraction&&(e._introClipFraction=u);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=ge(t[n][0],o[n][0],u),e.topPath[n][1]=ge(t[n][1],o[n][1],u);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=ge(n[t][0],r[t][0],u),e.bottomPath[t][1]=ge(n[t][1],r[t][1],u)}}if(c>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;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 if("heatcell"===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 if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const r=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||se,i=new Map;for(let e=0;n.length>e;e++)i.set(n[e],r[e%r.length]);return this._colorMapCache={key:o,map:i,version:this._ingestVersion},i}resolveLineStyle(e,t){const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}return n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}if(o&&"object"==typeof o)return{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2};const r=this.resolveGroupColor(e)||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||se,o=n[this._groupColorMap.size%n.length];return this._groupColorMap.set(e,o),o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupColorMap=new Map,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){var t,n,o,r;const i=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const l=a||!ee(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=a||!ee(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(r=i.yAccessor)&&void 0!==r?r:i.valueAccessor);(l||c)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=te(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=te(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=te(this.config.xAccessor,"x"),this.getY=te(this.config.yAccessor,"y")),s=!0)}if("groupAccessor"in e&&!ee(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?oe(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!ee(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?oe(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!ee(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?te(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!ee(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?oe(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!ee(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?te(this.config.y0Accessor,"y0"):void 0,s=!0),"pointIdAccessor"in e&&!ee(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?oe(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&("openAccessor"in e&&!ee(e.openAccessor,i.openAccessor)||"closeAccessor"in e&&!ee(e.closeAccessor,i.closeAccessor)||"highAccessor"in e&&!ee(e.highAccessor,i.highAccessor)||"lowAccessor"in e&&!ee(e.lowAccessor,i.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?te(this.config.openAccessor,"open"):void 0,this.getHigh=te(this.config.highAccessor,"high"),this.getLow=te(this.config.lowAccessor,"low"),this.getClose=t?te(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){s=!0;break}}s&&(this.needsFullRebuild=!0)}}function Se(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}}function je(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Ee(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ce(e,t){const n=Ee(e);if(!n)return!1;const o=Ee(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function Me(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r){const i=Math.max(o,r+5,12),s=t-i,a=t+i,l=n-i,c=n+i;let u=null,d=1/0;return e.visit((e,r,i,h,g)=>{if(r>a||s>h||i>c||l>g)return!0;if(!e.length){let r=e;do{const e=r.data,i=e.x-t,s=e.y-n,a=Math.sqrt(i*i+s*s);je(e.r,o)>=a&&d>a&&(u=e,d=a),r=r.next}while(r)}return!1}),u?{node:u,distance:d}:null}(r,t,n,o,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=_e(i,t,n,o);break;case"line":e=Be(i,t,n,o);break;case"rect":e=Ne(i,t,n);break;case"heatcell":e=Te(i,t,n);break;case"area":if(!1===i.interactive)break;e=Ie(i,t,n);break;case"candlestick":e=He(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Pe(e,t,n){if(0===e.length)return null;const o=Fe(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function _e(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>je(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Be(e,t,n,o=30){var r,i,s,a;if(0===e.path.length)return null;const l=Fe(e.path,t);if(0>l)return null;const[c,u]=e.path[l];let d;if(e.path.length>1){let o=1/0;const r=Math.max(0,l-1),i=Math.min(e.path.length-2,l);for(let s=r;i>=s;s++){const[r,i]=e.path[s],[a,l]=e.path[s+1],c=Le(t,n,r,i,a,l);o>c&&(o=c)}d=o}else{const e=t-c,o=n-u;d=Math.sqrt(e*e+o*o)}const h=null!==(a=null!==(i=null===(r=e.style)||void 0===r?void 0:r.strokeWidth)&&void 0!==i?i:null===(s=e.style)||void 0===s?void 0:s.lineWidth)&&void 0!==a?a:1;return d>Math.max(5,h/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[l]?e.datum[l]:e.datum,x:c,y:u,distance:d}}function Le(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Ne(e,t,n){const o=Se(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Te(e,t,n){const o=Se(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function He(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function Ie(e,t,n){if(0===e.topPath.length)return null;const o=Fe(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function Fe(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function ze(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function $e(e){const t=e.datum||{};return Object.assign(Object.assign({},"object"!=typeof t||null===t||Array.isArray(t)?{}:t),{data:t,x:e.x,y:e.y,time:e.x,value:e.y})}Oe.QUADTREE_THRESHOLD=500;const De={fill:t=>e.createElement("rect",{style:t,width:16,height:16}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:16,y2:16})};function We(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,De[n])(o(e,t)),r}function Re(){return e.createElement("path",{d:"M4,8.8 L7.2,12 L12.8,4.8",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ge(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function Ye({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[0]+n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),s&&e.createElement("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])))}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.createElement("stop",{key:t,offset:100*n+"%",stopColor:r(i[1]-n*(i[1]-i[0]))}))}return e.createElement("g",{"aria-label":s||"Gradient legend"},s&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},s),e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u)),e.createElement("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[1])),e.createElement("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])))}function qe(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[p,f]=e.useState(0),y=e.useCallback((e,t)=>{g(e),f(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u})=>{let d=24;const h=[];return t.forEach((t,g)=>{d+=5,h.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+g,stroke:"gray",x1:0,y1:d,x2:n,y2:d})),d+=8,t.label&&(d+=16,h.push(e.createElement("text",{key:"legend-text-"+g,y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label)),d+=8),h.push(e.createElement("g",{key:"legend-group-"+g,className:"legend-item",transform:`translate(0,${d})`},((t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,p=[];let f=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=We(t,u,d,h),b=Ge(t,r,i),x=i&&i.size>0&&i.has(t.label);p.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${f})`,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&&m?x||!1:void 0,"aria-current":y&&!m&&null!=r&&t.label===r||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)+g.length)%g.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus: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:b,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},y&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,x&&e.createElement(Re,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),f+=22}),p})(t,o,r,i,s,a,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:a}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let p=0;t.label&&(p+=16);const f=((t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:p}=t,f=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;p.forEach((t,u)=>{const x=We(t,u,h,g),k=Ge(t,r,i),w=i&&i.size>0&&i.has(t.label),A=26+7*t.label.length;d&&d>0&&y>0&&y+A>d&&(m++,y=0),f.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(${y},${22*m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:v?l===s&&u===a?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?w||!1:void 0,"aria-current":v&&!b&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:v?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:v?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"}},v&&e.createElement("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*t.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,w&&e.createElement(Re,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},t.label))),y+=A});let x=0,k=0;for(const e of p){const t=26+7*e.label.length;d&&d>0&&k>0&&k+t>d?(x=Math.max(x,k),k=t):k+=t}x=Math.max(x,k);const w=m+1;return{items:f,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,s,a,l,c,n,u,d,o);p+=f.offset+5,g.push(Object.assign(Object.assign({label:t.label},f),{offset:p,totalRows:f.totalRows,totalHeight:f.totalHeight})),h+=p+12});let p=h>o?0:Math.max(0,(o-h)/2);const f=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(f.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},i.label)),p+=16),f.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${p},0)`},o.items)),p+=o.offset+5,t[r+1]&&f.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||n)+0+8})),p+=12}),e.createElement("g",null,f)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:h,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:a}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},void 0!==l&&""!==l&&"vertical"===d&&e.createElement("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)"},l),m)}function Xe(e){return"string"==typeof e?{type:e}:e}function Ve({orient:t,config:o,values:r,scale:i,size:s,length:a}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===t||"bottom"===t,u=n(()=>{if(0===r.length)return null;const n=i.domain(),o=s-8;if("boxplot"===l.type){const n=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(r);if(!n)return null;const{q1:s,median:a,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*o,20),p=(o-g)/2+4;if(c){const n=i(s),o=i(u),r=i(a),c=i(d),f=i(h),y="top"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:c,y1:m+y*(p+g/2),x2:f,y2:m+y*(p+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+y*p,x2:c,y2:m+y*(p+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:f,y1:m+y*p,x2:f,y2:m+y*(p+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-p-g:m+p,width:Math.abs(o-n),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===t?m-p-g:m+p,x2:r,y2:"top"===t?m-p:m+p+g,stroke:l.fill,strokeWidth:2}))}{const n=i(s),o=i(u),r=i(a),c=i(d),f=i(h),y="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+y*(p+g/2),y1:c,x2:m+y*(p+g/2),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*p,y1:c,x2:m+y*(p+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*p,y1:f,x2:m+y*(p+g),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-p-g:m+p,y:Math.min(n,o),width:g,height:Math.abs(o-n),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===t?m-p-g:m+p,y1:r,x2:"left"===t?m-p:m+p+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=B().domain(n).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((n,r)=>{if(null==n.x0||null==n.x1)return null;const s=n.length/d*o;if(c){const o=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-s:4,width:Math.max(a,.5),height:s,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),a=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-s:4,y:Math.min(o,o+a),width:s,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const n=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const s=e.length/d*(o/2),a=i((e.x0+e.x1)/2);r.push(c?`${a},${"top"===t?-(n-s):n-s}`:`${"left"===t?-(n-s):n-s},${a}`)}for(let e=u.length-1;e>=0;e--){const s=u[e];if(null==s.x0||null==s.x1)continue;const a=s.length/d*(o/2),l=i((s.x0+s.x1)/2);r.push(c?`${l},${"top"===t?-(n+a):n+a}`:`${"left"===t?-(n+a):n+a},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+t},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const n=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);n.push(`L${s},${"top"===t?-r-4:r+4}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${s},${e}`),n.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;n.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${s}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;n.push(`L${e},${s}`),n.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+t},e.createElement("path",{d:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,s,a,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function Ue(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Qe(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 Ke(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:s,ny:a,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:p,events:f={},"data-testid":y}=t,m=new Set(Array.isArray(p)?p:[]);let v=r||0,b=i||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof d?d:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},f),!m.has("connector")&&function(t,n,o,r,i,s){const a=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==s?void 0:s.radius)){if("callout-rect"===i&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const r=e/2,i=o/2,s=t-r,a=n-i;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+s*h,c=i+a*h}}}else if("bracket"===i&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(a.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,s=Math.atan2(n-c,t-l);a.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(s+i)},${c+o*Math.sin(s+i)}L${l+o*Math.cos(s-i)},${c+o*Math.sin(s-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},a)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&a.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,s=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;a.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-s,x2:r,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-s;a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.createElement("path",{key:"bracket-path",d:Qe((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"}));break}}return e.createElement("g",{className:"annotation-subject"},a)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!s)return e.createElement("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const p=16,f=s?u?[s]:Ue(s,c):[],y=i?u?[i]:Ue(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";f.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t)))),v=f.length*p),y.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:x,textAnchor:g,y:v},y.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:p},t))));let k=null;if((s||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(f.length+y.length)*p+(y.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,f.length+y.length-1)*p;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+p+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0},b),k)}(l,v,b,h))}function Je(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,s="string"==typeof r.type?r.type:"label",a=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),a=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.createElement(Ke,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:s}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Ke,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:a},r,{type:s}))}function Ze(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function et(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function tt(e,t,n){var o,r,i,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Ze(e,n),c=et(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function nt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const ot={linear:R,monotoneX:W,monotoneY:D,step:$,stepAfter:z,stepBefore:F,basis:I,cardinal:H,catmullRom:T};let rt={positions:new Map};const it=new Set;function st(){for(const e of it)e()}function at(e,t){const n=rt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(rt.positions);o.delete(e),rt={positions:o},st()}function lt(e,t){const n=rt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(rt.positions);o.delete(e),rt={positions:o},st()}function ct(){return rt}function ut(e){return it.add(e),()=>it.delete(e)}const dt={positions:new Map};function ht(){return()=>{}}function gt(){return dt}function pt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function ft(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function yt(t){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,p=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||h||mt,r=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,i=l.x.ticks(Math.min(r,Math.max(2,Math.floor(o/70)))),s=i.map(e=>e.valueOf()),a=i.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,s)})),c=a.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return vt(a,Math.max(55,c+8))},[l,u,h,o]),f=n(()=>{var e;if(!l)return[];const t=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||g||mt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return vt(l.y.ticks(Math.min(o,Math.max(2,Math.floor(r/30)))).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,r]),y=d&&l,m=c&&l;if(!y&&!m)return null;const v=null==u?void 0:u.find(e=>"bottom"===e.orient),b=null==u?void 0:u.find(e=>"left"===e.orient),x=m&&(!v||!1!==v.baseline),k=m&&(!b||!1!==b.baseline),w=(null==v?void 0:v.jaggedBase)||!1,A=(null==b?void 0:b.jaggedBase)||!1,O="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},y&&(()=>{var t,n;const i=pt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=pt(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},p.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i})),f.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s})))})(),x&&!w&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:O,strokeWidth:1}),w&&e.createElement("path",{d:ft("bottom",o,r),fill:"none",stroke:O,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:O,strokeWidth:1}),A&&e.createElement("path",{d:ft("left",o,r),fill:"none",stroke:O,strokeWidth:1})))}function mt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function vt(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function bt(i){var s,a;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:p,axes:f,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:O,legendClickBehavior:S,legendHighlightedCategory:j,legendIsolatedCategories:E,legendPosition:C="right",foregroundGraphics:M,marginalGraphics:P,xValues:_,yValues:B,annotations:T,svgAnnotationRules:H,xAccessor:I,yAccessor:F,annotationData:z,pointNodes:$,curve:D,underlayRendered:W,linkedCrosshairName:G,linkedCrosshairSourceId:Y,children:X}=i,V=n(()=>{var e;if(!p||!g)return[];const t=null==f?void 0:f.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||mt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5,r=g.x.ticks(Math.min(o,Math.max(2,Math.floor(l/70)))),i=r.map(e=>e.valueOf()),s=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),a=s.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(a+8,55)):Math.max(55,a+8);let u=vt(s,c);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),(null==t?void 0:t.includeMax)&&u.length>0){const e=g.x.domain()[1],t=g.x(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,u.length,i);c>t-o&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[p,g,f,b,l]),U=n(()=>{var e;if(!p||!g)return[];const t=null==f?void 0:f.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||mt,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=vt(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==t?void 0:t.includeMax)&&r.length>0){const e=g.y.domain()[1],t=g.y(e),o=r[r.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[p,g,f,x,c]),Q=n(()=>{var e;if(!p||!g)return[];const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||mt,o=null!==(e=t.ticks)&&void 0!==e?e:5;return vt(g.y.ticks(Math.min(o,Math.max(2,Math.floor(c/30)))).map(e=>({value:e,pixel:g.y(e),label:n(e)})),22)},[p,g,f,x,c]),K=t(new Map),J=t(null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0),Z=null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0;J.current!==Z&&(J.current=Z,K.current=new Map);const ee=n(()=>{if(!T||0===T.length)return null;const t=function(t,n,o){var r,i,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S,j,E,C,M,P,_,B,T,H,I,F,z,$,D,W,G,Y,X,V,U,Q,K,J,Z,ee,te;switch(t.type){case"label":{const r=tt(t,n,o);if(!r)return null;const{x:i,y:s}=r;return nt(i,s,o)?e.createElement(Je,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{const r=tt(t,n,o);if(!r)return null;const{x:i,y:s}=r;return nt(i,s,o)?e.createElement(Je,{key:"ann-"+n,noteData:{x:i,y:s,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Ze(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:a,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=et(t,o);if(null==r)return null;const i=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:a,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Ze(Object.assign(Object.assign({},e),{type:"point"}),o),y:et(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=L(r),s=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Ze(Object.assign(Object.assign({},e),{type:"point"}),o),y:et(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,s=r.map(e=>e.x),a=r.map(e=>e.y),l=Math.min(...s)-i,c=Math.max(...s)+i,u=Math.min(...a)-i,d=Math.max(...a)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Ze(n,o),a=et(n,o);if(null==i||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:a,r:l},c))}))}case"bracket":{const r=Ze(t,o),i=et(t,o);return e.createElement(Je,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",p=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>p.length)return null;const f=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(s=o.scales)||void 0===s?void 0:s.time,y=null!==(l=null===(a=o.scales)||void 0===a?void 0:a.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!f||!y)return null;const m=t.method||"linear";let v;v="loess"===m?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))a.push([t,h/u]);else{const e=(u*p-d*h)/f;a.push([t,(h-e*d)/u+e*t])}}return a}(p,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?q.polynomial(p,{order:t.order||2}):q.linear(p)).points;const b=v.map(([e,t])=>`${f(e)},${y(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:f(v[v.length-1][0])+4,y:y(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(p=null==r?void 0:r(t.y0))&&void 0!==p?p:0,s=null!==(f=null==r?void 0:r(t.y1))&&void 0!==f?f:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,s),width:o.width||0,height:Math.abs(s-i),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11},t.label))}case"envelope":{const r=o.data||[];if(2>r.length)return null;const i=o.xAccessor||"x",s=null!==(m=null===(y=o.scales)||void 0===y?void 0:y.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,a=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(k=o.scales)||void 0===k?void 0:k.value;if(!s||!a)return null;const l=t.upperAccessor||"upperBounds",c=t.lowerAccessor||"lowerBounds",u=t.filter,d=r.filter(e=>null!=e[l]&&null!=e[c]&&!(u&&!u(e))).sort((e,t)=>e[i]-t[i]);if(2>d.length)return null;const h=ot[o.curve||"linear"]||R,g=N().x(e=>s(e[i])).y0(e=>a(e[c])).y1(e=>a(e[l])).curve(h)(d);if(!g)return null;const p=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:p,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:s(d[d.length-1][i])+4,y:a(d[d.length-1][l])-4,fill:p,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",s=null!==(O=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==O?O:null===(S=o.scales)||void 0===S?void 0:S.time,a=null!==(E=null===(j=o.scales)||void 0===j?void 0:j.y)&&void 0!==E?E:null===(C=o.scales)||void 0===C?void 0:C.value;if(!s||!a)return null;const l=r.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(M=t.threshold)&&void 0!==M?M:2,g=c-h*d,p=!1!==t.showBand,f=t.fill||"#6366f1",y=null!==(P=t.fillOpacity)&&void 0!==P?P:.1,m=t.anomalyColor||"#ef4444",v=null!==(_=t.anomalyRadius)&&void 0!==_?_:6,b=a(c+h*d),x=a(g),k=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},p&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:f,fillOpacity:y}),k.map((t,n)=>{const r=Ze(t,o),i=et(t,o);return null==r||null==i?null:e.createElement("circle",{key:"anomaly-"+n,cx:r,cy:i,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:f,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(T=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==T?T:null===(H=o.scales)||void 0===H?void 0:H.time,l=null!==(F=null===(I=o.scales)||void 0===I?void 0:I.y)&&void 0!==F?F:null===(z=o.scales)||void 0===z?void 0:z.value;if(!a||!l)return null;const c=r.map(e=>[e[i],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=q.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),p=c.reduce((e,t)=>e+t[0],0)/d,f=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),y=null!==($=t.confidence)&&void 0!==$?$:.95,m=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,v=null!==(D=t.steps)&&void 0!==D?D:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;v>=e;e++)k.push(b+e*x);const w=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/d+(f>0?Math.pow(e-p,2)/f:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(b)},${l(u(b))}`,j=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(W=t.fillOpacity)&&void 0!==W?W:.15,stroke:"none"}),e.createElement("polyline",{points:`${S} ${O}`,fill:"none",stroke:j,strokeWidth:null!==(G=t.strokeWidth)&&void 0!==G?G:2,strokeDasharray:null!==(Y=t.strokeDasharray)&&void 0!==Y?Y:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:a(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:j,fontSize:11},t.label))}case"widget":{let r=null,i=null;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=tt(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!nt(r,i,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,a=null!==(V=t.dy)&&void 0!==V?V:0,l=null!==(U=t.width)&&void 0!==U?U:32,c=null!==(Q=t.height)&&void 0!==Q?Q:32,u=null!==(K=t.content)&&void 0!==K?K:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"}},e.createElement("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"}},u))}case"text":{const r=tt(t,n,o);if(!r)return null;const{x:i,y:s}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:s+(t.dy||0),fill:t.color||"var(--semiotic-text, #333)",fontSize:t.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"}},t.label)}case"category-highlight":{const r=t.category;if(null==r)return null;const i=null===(J=o.scales)||void 0===J?void 0:J.o,s=null===(Z=o.scales)||void 0===Z?void 0:Z.x,a=null===(ee=o.scales)||void 0===ee?void 0:ee.y,l=(null==i?void 0:i.bandwidth)?i:(null==s?void 0:s.bandwidth)?s:(null==a?void 0:a.bandwidth)?a:null;if(!l)return null;const c=l(r);if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=null!==(te=t.opacity)&&void 0!==te?te:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===s)?e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold"},g)):e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),g&&e.createElement("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold"},g))}default:return null}},n={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:I,yAccessor:F,width:l,height:c,data:z,frameType:"xy",pointNodes:$,curve:D,stickyPositionCache:K.current};return T.map((e,o)=>{if(H){const r=H(e,o,n);return null!=r?r:t(e,o,n)}return t(e,o,n)}).filter(Boolean)},[T,H,l,c,I,F,z,g,$,D]),te=function(e){var t;const n=r(e?ut:ht,e?ct:gt,e?ct:gt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(G);return o(()=>{if(!(null==te?void 0:te.locked)||!G)return;const e=e=>{"Escape"===e.key&&lt(G)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==te?void 0:te.locked,G]),p||w||A||M||P||ee&&ee.length>0||k||X||te?e.createElement("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof w?w:"XY Chart"),e.createElement("desc",null,"string"==typeof w?w+" — XY data visualization":"XY data visualization"),e.createElement("g",{transform:`translate(${h.left},${h.top})`},k&&g&&!W&&(()=>{var t,n;const o=pt(null===(t=null==f?void 0:f.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=pt(null===(n=null==f?void 0:f.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},V.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:c,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o})),U.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:l,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r})))})(),p&&g&&(()=>{const t=null==f?void 0:f.find(e=>"left"===e.orient),n=null==f?void 0:f.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,i=(null==t?void 0:t.jaggedBase)||!1,s=(null==n?void 0:n.jaggedBase)||!1,a=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,d="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&V.length>1&&(()=>{const e=l/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})();return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!W&&r&&!s&&e.createElement("line",{x1:0,y1:c,x2:l,y2:c,stroke:d,strokeWidth:1}),!W&&s&&e.createElement("path",{d:ft("bottom",l,c),fill:"none",stroke:d,strokeWidth:1}),V.map((t,n)=>{const o=!!a&&("function"==typeof a?a(t.value,n):Ce(t.value,n>0?V[n-1].value:void 0));return e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${c})`},e.createElement("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:b?10:18,textAnchor:b?"end":"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"},transform:b?"rotate(-45)":void 0},t.label):e.createElement("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"center",fontSize:10,userSelect:"none"}},t.label)))}),y&&e.createElement("text",{x:l/2,y:c+40,textAnchor:"middle",fontSize:12,fill:p,style:{userSelect:"none"}},y),!W&&o&&!i&&e.createElement("line",{x1:0,y1:0,x2:0,y2:c,stroke:d,strokeWidth:1}),!W&&i&&e.createElement("path",{d:ft("left",l,c),fill:"none",stroke:d,strokeWidth:1}),U.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):Ce(t.value,n>0?U[n-1].value:void 0));return e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:o?11:10,fontWeight:o?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"right",fontSize:10,userSelect:"none"}},t.label)))}),(()=>{const n=(null==t?void 0:t.label)||m;return n?e.createElement("text",{x:15-h.left,y:c/2,textAnchor:"middle",fontSize:12,fill:p,transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==f?void 0:f.find(e=>"right"===e.orient);if(!t||0===Q.length)return null;const n=t.landmarkTicks,o=t.label||v;return e.createElement(e.Fragment,null,!1!==t.baseline&&e.createElement("line",{x1:l,y1:0,x2:l,y2:c,stroke:d,strokeWidth:1}),Q.map((t,o)=>{const r=!!n&&("function"==typeof n?n(t.value,o):Ce(t.value,o>0?Q[o-1].value:void 0));return e.createElement("g",{key:"ytick-r-"+o,transform:`translate(${l},${t.pixel})`},e.createElement("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:8,textAnchor:"start",dominantBaseline:"middle",fontSize:r?11:10,fontWeight:r?600:400,fill:g,style:{userSelect:"none"}},t.label):e.createElement("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"}},e.createElement("div",{style:{textAlign:"left",fontSize:10,userSelect:"none"}},t.label)))}),o&&e.createElement("text",{x:l+h.right-15,y:c/2,textAnchor:"middle",fontSize:12,fill:p,transform:`rotate(90, ${l+h.right-15}, ${c/2})`,style:{userSelect:"none"}},o))})())})(),ee,P&&g&&_&&B&&e.createElement(e.Fragment,null,P.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ve,{orient:"top",config:Xe(P.top),values:_,scale:g.x,size:h.top,length:l})),P.bottom&&e.createElement("g",{transform:`translate(0, ${c})`},e.createElement(Ve,{orient:"bottom",config:Xe(P.bottom),values:_,scale:g.x,size:h.bottom,length:l})),P.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ve,{orient:"left",config:Xe(P.left),values:B,scale:g.y,size:h.left,length:c})),P.right&&e.createElement("g",{transform:`translate(${l}, 0)`},e.createElement(Ve,{orient:"right",config:Xe(P.right),values:B,scale:g.y,size:h.right,length:c}))),M,te&&te.sourceId!==Y&&(null==g?void 0:g.x)&&(()=>{const t=g.x(te.xValue);if(null==t||0>t||t>l)return null;const n=te.locked;return e.createElement("line",{x1:t,y1:0,x2:t,y2:c,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),X),w&&e.createElement("text",{x:u/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof w?w:null),function(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===s||"bottom"===s;let p,f;return"left"===s?(p=4,f=i.top):"top"===s?(p=0,f=a?32:8):"bottom"===s?(p=0,f=r-i.bottom+50):(p=o-i.right+10,f=i.top),e.createElement("g",{transform:`translate(${p}, ${f})`},"object"==typeof(y=n)&&null!==y&&"gradient"in y?e.createElement(Ye,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):function(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}(n)?e.createElement(qe,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n);var y}({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:w,legendHoverBehavior:O,legendClickBehavior:S,legendHighlightedCategory:j,legendIsolatedCategories:E})):null}function xt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const kt="undefined"==typeof window||"undefined"==typeof document,wt=e.createContext(null),At={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ot(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e)n[t.type]=(n[t.type]||0)+1;const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}const St=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},jt={position:"absolute",top:0,left:0,right:0,zIndex:5,padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-text, #333)",background:"var(--semiotic-bg, #fff)",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Et={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Ct={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-bg, #fff)",cursor:"pointer",color:"var(--semiotic-text-secondary, #666)",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Mt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Pt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-border, #e0e0e0)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-text-secondary, #666)"},_t={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Bt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Lt({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[s,a]=e.useState(!1),l=e.useContext(wt),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=s||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{s||c||a(!0)},[s,c]),p=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:At}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:At,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>a(!0)},"View data summary (",t.length," elements)"));const f=function(e){var t,n,o,r,i,s,a,l,c,u,d,h,g,p,f,y,m,v,b,x,k,w,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const E of e)if(E&&"object"==typeof E)try{switch(E.type){case"point":j.push({label:"Point",values:{x:E.x,y:E.y}});break;case"line":{const e=E.path,t=Array.isArray(E.datum)?E.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=E.topPath,t=Array.isArray(E.datum)?E.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&j.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=E.datum&&"object"==typeof E.datum?E.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:E.group)&&void 0!==n?n:"",s=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;j.push({label:"Bar",values:{category:i,value:null!=s?s:""}});break}case"heatcell":j.push({label:"Cell",values:{x:E.x,y:E.y,value:E.value}});break;case"wedge":j.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(i=E.datum)||void 0===i?void 0:i.category)&&void 0!==s?s:null===(a=E.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=E.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":j.push({label:"Node",values:{id:null!==(h=null===(d=E.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=E.cx)&&void 0!==g?g:E.x,y:null!==(p=E.cy)&&void 0!==p?p:E.y}});break;case"arc":j.push({label:"Arc",values:{id:null!==(y=null===(f=E.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:"",x:null!==(m=E.cx)&&void 0!==m?m:E.x,y:null!==(v=E.cy)&&void 0!==v?v:E.y}});break;case"candlestick":j.push({label:"Candlestick",values:{x:E.x,open:E.open,high:E.high,low:E.low,close:E.close}});break;case"geoarea":j.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=E.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=E.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(S=null===(O=E.datum)||void 0===O?void 0:O.value)&&void 0!==S?S:""}})}}catch(e){}return j}(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=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(f),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${St(e.min)} to ${St(e.max)}, mean ${St(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(" ")}(f.length,y),v=f.slice(0,5),b=new Set;for(const e of v)for(const t of Object.keys(e.values))b.add(t);const x=Array.from(b);return e.createElement("div",{ref:d,id:o,tabIndex:-1,onBlur:p,style:jt,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Ct},"×"),e.createElement("div",{role:"note",style:Et},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:Mt},e.createElement("caption",{style:Bt},"First ",v.length," of ",f.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:Pt},"type"),x.map(t=>e.createElement("th",{key:t,style:Pt},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:_t},t.label),x.map(n=>{return e.createElement("td",{key:n,style:_t},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":St(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function Nt({summary:t}){return t?e.createElement("div",{role:"note",style:At},t):null}function Tt({tableId:t}){return e.createElement("a",{href:"#"+t,style:At,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,At)}},"Skip to data table")}function Ht({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Focused on data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Focused on data point: "+e}return e.createElement("div",{"aria-live":"polite","aria-atomic":"true",style:At},n)}const It="var(--semiotic-focus, #005fcc)";function Ft({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.createElement("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:It,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:It,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:It,strokeWidth:2,strokeDasharray:"4,2"});return e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true"},u)}function zt({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=e.useRef(null),[u,d]=e.useState(null);e.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,r]);let h;return h=u?`translate(${u.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`,e.createElement("div",{ref:c,className:a,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},s)}function $t(o){const l=i(null),c=Dt(o);return[function({children:t}){const r=n(()=>Dt(o),[]);return e.createElement(l.Provider,{value:r,children:t})},e=>{var n;const o=null!==(n=s(l))&&void 0!==n?n:c,i=t(e);i.current=e;const u=a(()=>i.current(o.getState()),[o]),d=a(()=>i.current(o.getState()),[o]);return r(o.subscribe,u,d)}]}function Dt(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Wt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:Rt})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const Rt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Gt={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Yt={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},qt={mode:"light",colors:{primary:"#0000cc",categorical:Rt,sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[Xt,Vt]=$t(e=>({theme:Gt,setTheme(t){e(e=>{if("light"===t)return{theme:Gt};if("dark"===t)return{theme:Yt};if("high-contrast"===t)return{theme:qt};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Yt:Gt;return{theme:Wt(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}}return{theme:Wt(Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})}))}})}}));function Ut(e,n,r){const i=t(null),[s,a]=l(null);return o(()=>{if(!n&&!r)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,r]),[i,[n&&s?s.w:e[0],r&&s?s.h:e[1]]]}const Qt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Kt=new WeakMap;let Jt=0,Zt=!1,en=null,tn=null,nn=null;function on(e,t){var n,o;if(!t)return t;const r=Qt.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(Zt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Zt=!0;const e=()=>{Jt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(en=new MutationObserver(e),en.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{tn=window.matchMedia("(prefers-color-scheme: dark)"),nn=e,"function"==typeof tn.addEventListener?tn.addEventListener("change",nn):"function"==typeof tn.addListener&&tn.addListener(nn)}catch(e){}}();let s=Kt.get(i);s&&s.version===Jt||(s={version:Jt,map:new Map},Kt.set(i,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function rn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function sn(r){const i=function(){const[e,t]=l(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return o(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}(e,e=>t(e.matches))},[]),e}(),s=t(i);s.current=i;const[c,u]=Ut(r.sizeProp,r.responsiveWidth,r.responsiveHeight),d=n(()=>Object.assign(Object.assign({},r.marginDefault),r.userMargin),[r.marginDefault,r.userMargin]),h=u[0]-d.left-d.right,g=u[1]-d.top-d.bottom,p=rn(r.foregroundGraphics,u,d),f=rn(r.backgroundGraphics,u,d),y=Vt(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(r||!e||!0!==e&&!1===e.intro)}}(r.animate,r.transitionProp),b="semiotic-table-"+e.useId(),x=t(0),k=t(()=>{}),w=a(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);o(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=t(()=>{}),O=t(()=>{}),S=t(null),j=t(0),E=a(()=>{j.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),C=a(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(E))},[E]),M=a(()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),O.current()},[]);o(()=>()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const P=r.themeDirtyRef;return o(()=>{P&&(Jt++,P.current=!0,w())},[y,w,P]),{reducedMotion:i,reducedMotionRef:s,responsiveRef:c,size:u,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:p,resolvedBackground:f,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:M}}function an(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function ln(e){switch(e){case"monotoneX":return W;case"monotoneY":return D;case"cardinal":return H;case"catmullRom":return T;case"step":return $;case"stepBefore":return F;case"stepAfter":return z;case"basis":return I;case"natural":return Y;default:return null}}function cn(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function un(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const dn=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const l=a._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=a.style.stroke||"#007bff",u=a.style.strokeWidth||2,d=a.colorThresholds,h=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=u,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const y=null!==(r=a.style.opacity)&&void 0!==r?r:1;un(e,a.path,c,u,y,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=ln(a.curve),p=d&&d.length>0&&h&&h.length===a.path.length,f=a._decayOpacities;if(f&&f.length===a.path.length&&!p){e.strokeStyle=c;const m=null!==(i=a.style.opacity)&&void 0!==i?i:1;for(let v=0;a.path.length-1>v;v++)e.globalAlpha=.5*(f[v]+f[v+1])*m,e.beginPath(),e.moveTo(a.path[v][0],a.path[v][1]),e.lineTo(a.path[v+1][0],a.path[v+1][1]),e.stroke()}else if(p){let b=null,x=null,k=null,w=null,A=!1;function O(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),A=!0}function S(){A&&(e.stroke(),A=!1)}for(let j=0;a.path.length>j;j++){const[E,C]=a.path[j],M=h[j],P=cn(M,d,c);if(null!==b&&null!==w&&null!==k){if(P===w)e.lineTo(E,C);else{const _=[];for(const B of d){const L=B.value;(k>L||L>M)&&(L>k||M>L)||k===L||M===L||_.push({t:(L-k)/(M-k)})}_.sort((e,t)=>e.t-t.t);for(const N of _){const T=b+(E-b)*N.t,H=x+(C-x)*N.t,I=cn(k+(M-k)*Math.min(N.t+1e-4,1),d,c);e.lineTo(T,H),S(),O(I,T,H)}e.lineTo(E,C)}b=E,x=C,k=M,w=P}else O(P,E,C),b=E,x=C,k=M,w=P}S()}else{if(e.beginPath(),!a.strokeGradient||2>a.strokeGradient.colorStops.length||2>a.path.length)e.strokeStyle=c;else{const F=e.createLinearGradient(a.path[0][0],0,a.path[a.path.length-1][0],0);for(const z of a.strokeGradient.colorStops)F.addColorStop(Math.max(0,Math.min(1,z.offset)),z.color);e.strokeStyle=F}if(g)G().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[$,D]=a.path[0];e.moveTo($,D);for(let W=1;a.path.length>W;W++)e.lineTo(a.path[W][0],a.path[W][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=("string"==typeof a.style.fill?on(e,a.style.fill):a.style.fill)||a.style.fill,g&&!p)G().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[Y,q]=a.path[0];e.moveTo(Y,q);for(let X=1;a.path.length>X;X++)e.lineTo(a.path[X][0],a.path[X][1])}const R=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(R,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function hn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function gn(e,t,n=.3){hn(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 pn(e,t,n=.6){var o,r,i,s,a;if(!hn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function fn(e,t,n,o=.35){hn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function yn(e){switch(e){case"monotoneX":return W;case"monotoneY":return D;case"cardinal":return H;case"catmullRom":return T;case"step":return $;case"stepBefore":return F;case"stepAfter":return z;case"basis":return I;case"natural":return Y;default:return null}}function mn(e){if(e.startsWith("#")){const t=4===e.length?e[1]+e[1]+e[2]+e[2]+e[3]+e[3]:e.slice(1,7);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[78,121,167]}function vn(e,t){const n=yn(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=N().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const bn=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const a=t.style.fill||"#4e79a7",l=t._decayOpacities;if(l&&l.length===t.topPath.length){const n=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;e.fillStyle=a;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(l[o]+l[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(l[n]+l[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const c=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(vn(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=e.createLinearGradient(0,n,0,o);if("colorStops"in t.fillGradient)for(const e of t.fillGradient.colorStops){const t=Math.max(0,Math.min(1,e.offset));isNaN(t)||r.addColorStop(t,e.color)}else if("topOpacity"in t.fillGradient){const e=mn("string"==typeof a?a:"#4e79a7");r.addColorStop(0,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.topOpacity})`),r.addColorStop(1,`rgba(${e[0]},${e[1]},${e[2]},${t.fillGradient.bottomOpacity})`)}e.fillStyle=r,e.globalAlpha=c}else{const n=null!==(s=t.style.fillOpacity)&&void 0!==s?s:.7;e.globalAlpha=n*c,e.fillStyle=a}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(vn(e,t),fn(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=c,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=on(e,t.style.stroke)||t.style.stroke;else{const n=e.createLinearGradient(t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);for(const e of t.strokeGradient.colorStops)n.addColorStop(Math.max(0,Math.min(1,e.offset)),e.color);e.strokeStyle=n}e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=yn(t.curve);if(e.beginPath(),n)G().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1}},xn=(e,t,n,o)=>{var r;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=("string"==typeof t.style.fill?on(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?on(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),pn(e,t),e.globalAlpha=1}}finally{e.restore()}}},kn=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)wn(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?on(e,t.style.fill):t.style.fill)||"#007bff";const n=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:o,y:r,w:i,h:s}=t;switch(t.roundedEdge){case"right":e.moveTo(o,r),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o,r+s);break;case"left":e.moveTo(o+i,r),e.lineTo(o+n,r),e.arcTo(o,r,o,r+n,n),e.lineTo(o,r+s-n),e.arcTo(o,r+s,o+n,r+s,n),e.lineTo(o+i,r+s);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+s-n),e.arcTo(o+i,r+s,o+i-n,r+s,n),e.lineTo(o+n,r+s),e.arcTo(o,r+s,o,r+s-n,n);break;default:e.moveTo(o,r+s),e.lineTo(o,r+n),e.arcTo(o,r,o+n,r,n),e.lineTo(o+i-n,r),e.arcTo(o+i,r,o+i,r+n,n),e.lineTo(o+i,r+s)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?on(e,t.style.fill):t.style.fill)||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));gn(e,t),e.globalAlpha=1}};function wn(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function An(e,t,n,o){return Object.assign(Object.assign(Object.assign({},function(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}(e)),{data:e,x:t,y:n,time:t,value:n}),o)}function On(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Sn(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const jn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function En(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${jn[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${jn[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Cn={line:[bn,dn,xn],area:[bn,xn],stackedarea:[bn,xn],scatter:[xn],bubble:[xn],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),gn(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Sn(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=On(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[kn],swarm:[xn],waterfall:[(e,t,n,o)=>{var r,i,s;kn(e,t);const a=t.filter(e=>"rect"===e.type);if(2>a.length)return;const l=a[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;a.length-1>t;t++){const o=a[t],r=a[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(s=r.datum)||void 0===s?void 0:s.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const o=t._decayOpacity;if(null!=o&&1!==o&&(e.globalAlpha=o),e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke(),t.isRange){const n=Math.max(2*t.wickWidth,4);e.fillStyle=t.wickColor,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}e.restore()}}],mixed:[bn,dn,xn]},Mn={top:20,right:20,bottom:30,left:40},Pn={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white"};function _n(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const Bn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Ln({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:Bn},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}const Nn=c(function(r,i){var s,c,d,h,g,p,f,y,m,v,b;const{chartType:x,runtimeMode:k,data:w,chunkThreshold:A,chunkSize:O,xAccessor:S,yAccessor:j,colorAccessor:E,sizeAccessor:C,groupAccessor:M,lineDataAccessor:P,curve:_,normalize:B,binSize:L,valueAccessor:N,arrowOfTime:T="right",windowMode:H="sliding",windowSize:I=200,timeAccessor:F,xExtent:z,yExtent:$,extentPadding:D=.1,scalePadding:W,sizeRange:R,size:G=[500,300],responsiveWidth:Y,responsiveHeight:q,margin:X,className:V,background:K,lineStyle:J,pointStyle:Z,areaStyle:ee,waterfallStyle:te,swarmStyle:ne,barColors:oe,colorScheme:re,boundsAccessor:ie,boundsStyle:se,y0Accessor:ae,gradientFill:le,lineGradient:ce,areaGroups:ue,openAccessor:de,highAccessor:he,lowAccessor:ge,closeAccessor:pe,candlestickStyle:fe,showAxes:ye=!0,axes:me,xLabel:ve,yLabel:be,yLabelRight:xe,xFormat:ke,yFormat:we,tickFormatTime:Ae,tickFormatValue:Se,hoverAnnotation:je,tooltipContent:Ee,customHoverBehavior:Ce,customClickBehavior:_e,enableHover:Be,hoverRadius:Le=30,tooltipMode:Ne,annotations:Te,svgAnnotationRules:He,showGrid:Ie,legend:De,legendHoverBehavior:We,legendClickBehavior:Re,legendHighlightedCategory:Ge,legendIsolatedCategories:Ye,legendPosition:qe,backgroundGraphics:Xe,foregroundGraphics:Ve,canvasPreRenderers:Ue,svgPreRenderers:Qe,title:Ke,categoryAccessor:Je,brush:Ze,onBrush:et,decay:tt,pulse:nt,transition:ot,animate:rt,staleness:it,heatmapAggregation:st,heatmapXBins:at,heatmapYBins:lt,showValues:ct,heatmapValueFormat:ut,marginalGraphics:dt,pointIdAccessor:ht,xScaleType:gt,yScaleType:pt,accessibleTable:ft=!0,description:mt,summary:vt,linkedCrosshairName:wt,linkedCrosshairSourceId:At}=r,St=t(!1),jt=sn({sizeProp:G,responsiveWidth:Y,responsiveHeight:q,userMargin:X,marginDefault:Mn,animate:rt,transitionProp:ot,themeDirtyRef:St}),{reducedMotionRef:Et,responsiveRef:Ct,size:Mt,currentTheme:Pt,transition:_t,introEnabled:Bt,tableId:It,rafRef:$t,renderFnRef:Dt,scheduleRender:Wt}=jt;let Rt=jt.margin;if(dt){const e=60,t=Object.assign({},jt.margin);dt.top&&e>t.top&&(t.top=e),dt.bottom&&e>t.bottom&&(t.bottom=e),dt.left&&e>t.left&&(t.left=e),dt.right&&e>t.right&&(t.right=e),Rt=t}const Gt="function"==typeof Ve?Ve({size:Mt,margin:Rt}):Ve,Yt="function"==typeof Xe?Xe({size:Mt,margin:Rt}):Xe,qt=Mt[0]-Rt.left-Rt.right,Xt=Mt[1]-Rt.top-Rt.bottom,Vt=null!=je?je:Be,Ut=t(null),Qt=t(null),[Kt,Jt]=l(0),[Zt,en]=l(null),tn=t(null),nn=t(null),[on,rn]=l(null),[ln,cn]=l(!1),[un,dn]=l([]),[hn,gn]=l([]),pn="streaming"===k||["bar","swarm","waterfall"].includes(x),fn=n(()=>{var e;return{chartType:x,runtimeMode:pn?"streaming":"bounded",windowSize:I,windowMode:H,arrowOfTime:pn?T:"right",extentPadding:D,scalePadding:W,xAccessor:pn?void 0:S,yAccessor:pn?void 0:j,timeAccessor:pn?F:void 0,valueAccessor:N,colorAccessor:E,sizeAccessor:C,groupAccessor:M||(P?"_lineGroup":void 0),categoryAccessor:Je,lineDataAccessor:P,xScaleType:gt,yScaleType:pt,xExtent:z,yExtent:$,sizeRange:R,binSize:L,normalize:B,boundsAccessor:ie,boundsStyle:se,y0Accessor:ae,gradientFill:!0===le?{topOpacity:.8,bottomOpacity:.05}:!1===le?void 0:le,areaGroups:ue?new Set(ue):void 0,lineGradient:ce,openAccessor:de,highAccessor:he,lowAccessor:ge,closeAccessor:pe,candlestickStyle:fe,lineStyle:J,pointStyle:Z,areaStyle:ee,swarmStyle:ne,waterfallStyle:te,colorScheme:re,barColors:oe,annotations:Te,decay:tt,pulse:nt,transition:_t,introAnimation:Bt,staleness:it,heatmapAggregation:st,heatmapXBins:at,heatmapYBins:lt,showValues:ct,heatmapValueFormat:ut,pointIdAccessor:ht,curve:_,themeCategorical:null===(e=null==Pt?void 0:Pt.colors)||void 0===e?void 0:e.categorical}},[x,I,H,T,D,W,S,j,F,N,gt,pt,E,C,M,Je,P,z,$,R,L,B,ie,se,ae,le,ce,ue,de,he,ge,pe,fe,J,Z,ee,ne,te,re,oe,Te,tt,nt,null==_t?void 0:_t.duration,null==_t?void 0:_t.easing,Bt,it,st,at,lt,ct,ut,pn,ht,_,Pt]),yn=t(null);yn.current||(yn.current=new Oe(fn)),o(()=>{var e;null===(e=yn.current)||void 0===e||e.updateConfig(fn),St.current=!0,Wt()},[fn,Wt]);const mn=t(null);mn.current||(mn.current=new Q(e=>{const t=yn.current;t&&t.ingest(e)&&(St.current=!0,Wt())},{chunkThreshold:A,chunkSize:O})),o(()=>{var e;null===(e=mn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:O})},[A,O]);const vn=a(e=>{var t;null===(t=mn.current)||void 0===t||t.push(e)},[]),bn=a(e=>{var t;null===(t=mn.current)||void 0===t||t.pushMany(e)},[]),xn=a(()=>{var e,t;null===(e=mn.current)||void 0===e||e.clear(),null===(t=yn.current)||void 0===t||t.clear(),St.current=!0,Wt()},[Wt]);u(i,()=>({push:vn,pushMany:bn,remove:e=>{var t,n,o;null===(t=mn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=yn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return r.length>0&&(tn.current&&r.some(e=>{var t;return e===(null===(t=tn.current)||void 0===t?void 0:t.data)})&&(tn.current=null,rn(null)),St.current=!0,Wt()),r},update:(e,t)=>{var n,o,r;null===(n=mn.current)||void 0===n||n.flush();const i=null!==(r=null===(o=yn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(St.current=!0,Wt()),i},clear:xn,getData:()=>{var e,t,n;return null===(e=mn.current)||void 0===e||e.flush(),null!==(n=null===(t=yn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=yn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=yn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[vn,bn,xn,Wt]),o(()=>{var e,t;if(w){if(P&&w.length>0&&"object"==typeof w[0]&&null!==w[0]){const t="string"==typeof P?P:"coordinates";if(Array.isArray(w[0][t])){const n=[];for(const e of w){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=mn.current)||void 0===e||e.setBoundedData(n))}}null===(t=mn.current)||void 0===t||t.setBoundedData(w)}},[w,P]);const{hoverHandlerRef:kn,hoverLeaveRef:wn,onPointerMove:On,onPointerLeave:Sn}=jt;kn.current=e=>{if(!Vt)return;const t=Ut.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Rt.left,r=e.clientY-n.top-Rt.top;if(0>o||o>qt||0>r||r>Xt)return void(tn.current&&(tn.current=null,nn.current=null,rn(null),Ce&&(Ce(null),St.current=!0),Wt()));const i=yn.current;if(!i||0===i.scene.length)return;const s=Me(i.scene,o,r,Le,i.quadtree,i.maxPointRadius);if(!s)return void(tn.current&&(tn.current=null,nn.current=null,rn(null),Ce&&Ce(null),Wt()));const a=An(s.datum||{},s.x,s.y);if("multi"===Ne&&i.scene.length>0&&i.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=Pe(e.path,t,n);if(null===i)continue;const s=Fe(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=Pe(e.topPath,t,n);if(null===i)continue;const s=Fe(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.topPath[s][0],y:i,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(i.scene,s.x,Le),t=i.scales.y.invert,n=i.scales.x.invert;if(e.length>0){const o=n?n(s.x):s.x;a.xValue=o,a.xPx=s.x,a.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||"#007bff",datum:e.datum}))}}tn.current=a,nn.current=s.node,rn(a),Ce&&(Ce(a),St.current=!0),Wt()},wn.current=()=>{tn.current&&(tn.current=null,nn.current=null,rn(null),Ce&&(Ce(null),St.current=!0),Wt())};const jn=t(()=>{});jn.current=e=>{if(!_e)return;const t=Ut.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Rt.left,r=e.clientY-n.top-Rt.top;if(0>o||o>qt||0>r||r>Xt)return void _e(null);const i=yn.current;if(!i||0===i.scene.length)return void _e(null);const s=Me(i.scene,o,r,Le,i.quadtree,i.maxPointRadius);_e(s?An(s.datum||{},s.x,s.y):null)};const Bn=a(e=>jn.current(e),[]),Nn=t(-1),Tn=t(null),Hn=t(null),In=a(e=>{const t=yn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Hn.current&&Hn.current.version===n)o=Hn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const s of e)switch(s.type){case"point":i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:null!==(t=s.group)&&void 0!==t?t:"_default"});break;case"line":{const e=s,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.path.length>n&&t.length>n;n++)i.push({x:e.path[n][0],y:e.path[n][1],datum:t[n],shape:"circle",group:o});break}case"area":{const e=s,t=Array.isArray(e.datum)?e.datum:[],n=null!==(o=e.group)&&void 0!==o?o:"_default";for(let o=0;e.topPath.length>o&&t.length>o;o++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});break}case"rect":i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(r=s.group)&&void 0!==r?r:"_default"});break;case"heatcell":i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let r=o.get(e);r||(r=[],o.set(e,r)),r.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:s}}(e),Hn.current={version:n,graph:o}}const r=Nn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Nn.current=0;const t=o.flat[0];Tn.current={shape:t.shape,w:t.w,h:t.h};const n=$e(t);return tn.current=n,rn(n),Ce&&Ce(n),void Wt()}const i=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?ze(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?ze(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return Nn.current=-1,Tn.current=null,tn.current=null,nn.current=null,rn(null),Ce&&Ce(null),void Wt();Nn.current=s;const a=o.flat[s];Tn.current={shape:a.shape,w:a.w,h:a.h};const l=$e(a);tn.current=l,rn(l),Ce&&Ce(l),Wt()},[Ce,Wt]),Fn=a(e=>{Nn.current=-1,Tn.current=null,On(e)},[On]);Dt.current=()=>{var e,t;$t.current=0;const n=Ut.current,o=Qt.current;if(!n||!o)return;const r=yn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(Et.current?i+1e6:i),a=!Et.current&&s,l=St.current||s;l&&!a&&r.computeScene({width:qt,height:Xt});const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return Pn;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||s||n?{axisStroke:a||Pn.axisStroke,tickText:i||Pn.tickText,crosshair:i?_n(i,"66"):Pn.crosshair,hoverFill:l?_n(l,"4D"):Pn.hoverFill,hoverStroke:i?_n(i,"99"):Pn.hoverStroke,pointRing:l||Pn.pointRing}:Pn}(n),d=null!==(e=null==it?void 0:it.threshold)&&void 0!==e?e:5e3,h=it&&r.lastIngestTime>0&&i-r.lastIngestTime>d;if(l){const e=an(n,Mt,Rt,c);if(e){if(e.clearRect(-Rt.left,-Rt.top,Mt[0],Mt[1]),h&&(e.globalAlpha=null!==(t=null==it?void 0:it.dimOpacity)&&void 0!==t?t:.5),"transparent"!==K&&!Xe){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=K||(t&&"transparent"!==t?t:null);o&&(e.fillStyle=o,e.fillRect(-Rt.left,-Rt.top,Mt[0],Mt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,qt,Xt),e.clip()),Ue&&r.scales)for(const t of Ue)e.save(),t(e,r.scene,r.scales,{width:qt,height:Xt}),e.restore();const o=Cn[x];if(o&&r.scales)for(const t of o)t(e,r.scene,r.scales,{width:qt,height:Xt});e.restore(),h&&(e.globalAlpha=1)}}{const e=an(o,Mt,Rt,c);if(e&&(e.clearRect(-Rt.left,-Rt.top,Mt[0],Mt[1]),Vt&&tn.current&&r.scales&&function(e,t,n,o,r,i,s){var a,l;if(!1===r.crosshair)return;const c=t.allSeries,u=c&&c.length>0,d=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const h="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=h.stroke||s.crosshair,e.lineWidth=h.strokeWidth||1,e.setLineDash(h.strokeDasharray?h.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(u?d:t.x,0),e.lineTo(u?d:t.x,o),e.stroke(),u||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),u){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of c)null!=t.valuePx&&(e.beginPath(),e.arc(d,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||"#007bff",e.fill(),e.stroke())}else{let n="";try{(null===(l=e.canvas)||void 0===l?void 0:l.parentElement)&&(n=getComputedStyle(e.canvas).getPropertyValue("--semiotic-primary").trim())}catch(e){}const o=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||n||"#007bff";e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,tn.current,qt,Xt,"object"==typeof Vt?Vt:{},nn.current,u),nn.current&&Array.isArray(je))){const t=je.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,r.scene,nn.current,t)}}l&&n&&n.setAttribute("aria-label",Ot(r.scene,x+" chart"));const g=St.current;if(St.current=!1,g&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Zt||e(Zt.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Zt.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Zt.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Zt.y.domain()[1])!==e(r.scales.y.domain()[1])||Zt.x.range()[0]!==r.scales.x.range()[0]||Zt.x.range()[1]!==r.scales.x.range()[1]||Zt.y.range()[0]!==r.scales.y.range()[0]||Zt.y.range()[1]!==r.scales.y.range()[1])&&en(r.scales),dt){const e=r.getData(),t="function"==typeof S?S:e=>e[S||"x"],n="function"==typeof j?j:e=>e[j||"y"];dn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),gn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Te&&Te.length>0&&Jt(e=>e+1),(null==it?void 0:it.showBadge)&&cn(!!h),(a||null!=r.activeTransition||r.hasActivePulses)&&($t.current=requestAnimationFrame(()=>Dt.current()))},o(()=>(Wt(),()=>{var e;null===(e=mn.current)||void 0===e||e.clear()}),[Wt]),o(()=>{St.current=!0,Wt()},[x,qt,Xt,ye,K,J,Ue,Wt]),function(e,t,n,r,i,s){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-a.lastIngestTime>c;u!==i&&(s(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}(it,yn,St,Wt,ln,cn);const zn=n(()=>{if(ke||Ae)return;const e=yn.current;return(null==e?void 0:e.xIsDate)&&Zt?En(Zt.x.domain()):void 0},[ke,Ae,Zt]),$n=ke||Ae||zn,Dn=Vt&&on?Ee?Ee(on):e.createElement(Ln,{hover:on}):null,Wn=Dn?e.createElement(zt,{x:on.x,y:on.y,containerWidth:qt,containerHeight:Xt,margin:Rt,className:"stream-frame-tooltip"},Dn):null,Rn=Tn.current,Gn=e.createElement(Ft,{active:Nn.current>=0,hoverPoint:on,margin:Rt,size:Mt,shape:null==Rn?void 0:Rn.shape,width:null==Rn?void 0:Rn.w,height:null==Rn?void 0:Rn.h}),Yn=(e,t,n,o)=>"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null},qn=Yn(S,F,"__semiotic_resolvedX","__semiotic_resolvedTime"),Xn=Yn(j,N,"__semiotic_resolvedY","__semiotic_resolvedValue"),Vn=qn.key,Un=Xn.key,Qn=Te&&Te.length>0,Kn=e=>{if(!e||!Qn||!qn.fn&&!Xn.fn)return e;let t=!1;const n=e.map(e=>{const n=qn.fn&&qn.key&&!(qn.key in e),o=Xn.fn&&Xn.key&&!(Xn.key in e);if(!n&&!o)return e;t=!0;const r=Object.assign({},e);return n&&(r[qn.key]=qn.fn(e)),o&&(r[Xn.key]=Xn.fn(e)),r});return t?n:e};if(kt){const t=yn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:qt,height:Xt}));const n=null!==(s=null==t?void 0:t.scene)&&void 0!==s?s:[],o=null!==(c=null==t?void 0:t.scales)&&void 0!==c?c:null,r=$n||(()=>{if((null==t?void 0:t.xIsDate)&&o)return En(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(V?" "+V:""),role:"img","aria-label":mt||("string"==typeof Ke?Ke:"XY chart"),style:{position:"relative",width:Mt[0],height:Mt[1]}},e.createElement(Nt,{summary:vt}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Mt[0],height:Mt[1],style:{position:"absolute",left:0,top:0}},e.createElement("g",{transform:`translate(${Rt.left},${Rt.top})`},Yt),e.createElement("g",{transform:`translate(${Rt.left},${Rt.top})`},K&&e.createElement("rect",{x:0,y:0,width:qt,height:Xt,fill:K}),Qe&&o&&Qe.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:qt,height:Xt}))),n.map((t,n)=>function(t,n){var o,r,i;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"line-"+n,d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})}case"area":{const i=t;if(0===i.topPath.length)return null;const s=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),a=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${s}L${a}Z`,fill:xt(i.style.fill),fillOpacity:null!==(r=null!==(o=i.style.fillOpacity)&&void 0!==o?o:i.style.opacity)&&void 0!==r?r:.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})}case"point":{const o=t;return e.createElement("circle",{key:"point-"+n,cx:o.x,cy:o.y,r:o.r,fill:xt(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"rect":{const o=t;return e.createElement("rect",{key:"rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:xt(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,i,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),a=.299*r+.587*i+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.createElement("g",{key:"heatcell-"+n},e.createElement("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.createElement("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px"},t))}return e.createElement("rect",{key:"heatcell-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill})}case"candlestick":{const o=t,r=Math.min(o.openY,o.closeY),i=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e.createElement("g",{key:"candle-"+n},e.createElement("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.createElement("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:i,fill:s,stroke:s,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(bt,{width:qt,height:Xt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Rt,scales:o,showAxes:ye,axes:me,xLabel:ve,yLabel:be,yLabelRight:xe,xFormat:r,yFormat:we||Se,showGrid:Ie,title:Ke,legend:De,legendHoverBehavior:We,legendClickBehavior:Re,legendHighlightedCategory:Ge,legendIsolatedCategories:Ye,legendPosition:qe,foregroundGraphics:Gt,marginalGraphics:dt,xValues:[],yValues:[],annotations:Te,svgAnnotationRules:He,annotationFrame:0,xAccessor:Vn,yAccessor:Un,annotationData:Kn(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof _?_:void 0,linkedCrosshairName:wt,linkedCrosshairSourceId:At}))}return e.createElement("div",{ref:Ct,className:"stream-xy-frame"+(V?" "+V:""),role:"group","aria-label":mt||("string"==typeof Ke?Ke:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":Mt[0],height:q?"100%":Mt[1],overflow:"visible"},onKeyDown:In},ft&&e.createElement(Tt,{tableId:It}),ft&&e.createElement(Lt,{scene:null!==(h=null===(d=yn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:x+" chart",tableId:It,chartTitle:"string"==typeof Ke?Ke:void 0}),e.createElement(Nt,{summary:vt}),e.createElement("div",{role:"img","aria-label":mt||("string"==typeof Ke?Ke:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Vt?Fn:void 0,onMouseLeave:Vt?Sn:void 0,onClick:_e?Bn:void 0},Yt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Mt[0],height:Mt[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Rt.left},${Rt.top})`},Yt)),e.createElement(yt,{width:qt,height:Xt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Rt,scales:Zt,showAxes:ye,axes:me,showGrid:Ie,xFormat:$n,yFormat:we||Se}),e.createElement("canvas",{ref:Ut,"aria-label":Ot(null!==(p=null===(g=yn.current)||void 0===g?void 0:g.scene)&&void 0!==p?p:[],x+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Qt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(Ht,{hoverPoint:on}),e.createElement(bt,{width:qt,height:Xt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Rt,scales:Zt,showAxes:ye,axes:me,xLabel:ve,yLabel:be,yLabelRight:xe,xFormat:$n,yFormat:we||Se,showGrid:Ie,title:Ke,legend:De,legendHoverBehavior:We,legendClickBehavior:Re,legendHighlightedCategory:Ge,legendIsolatedCategories:Ye,legendPosition:qe,foregroundGraphics:Gt,marginalGraphics:dt,xValues:un,yValues:hn,annotations:Te,svgAnnotationRules:He,annotationFrame:Kt,xAccessor:Vn,yAccessor:Un,annotationData:Kn(null===(f=yn.current)||void 0===f?void 0:f.getData()),pointNodes:null===(y=yn.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type),curve:"string"==typeof _?_:void 0,underlayRendered:!0,linkedCrosshairName:wt,linkedCrosshairSourceId:At}),(Ze||et)&&e.createElement(U,{width:qt,height:Xt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Rt,dimension:null!==(m=null==Ze?void 0:Ze.dimension)&&void 0!==m?m:"xy",scales:Zt,onBrush:null!=et?et:()=>{},binSize:L,snap:null==Ze?void 0:Ze.snap,binBoundaries:null!==(v=null==Ze?void 0:Ze.binBoundaries)&&void 0!==v?v:"bar"===x?null===(b=yn.current)||void 0===b?void 0:b.getBinBoundaries():void 0,snapDuring:null==Ze?void 0:Ze.snapDuring,streaming:"streaming"===k}),(null==it?void 0:it.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===it.badgePosition?{top:4,left:4}:"bottom-left"===it.badgePosition?{bottom:4,left:4}:"bottom-right"===it.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:ln?"#dc3545":"#28a745",color:"white"})},ln?"STALE":"LIVE"),Gn,Wn))});Nn.displayName="StreamXYFrame";const Tn=i(null);function Hn(){return s(Tn)}function In(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Fn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[zn,$n]=$t(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Fn(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Fn(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Dn,Wn]=$t(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Rn(e){const t=d(),o=e.clientId||t,{name:r}=e,i=$n(e=>e.selections.get(r)),s=$n(e=>e.setClause),l=$n(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(In(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,o):()=>!0,[i,o]),isActive:c,selectPoints:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(r,{clientId:o,type:"point",fields:t})},[o,r,s]),selectInterval:a(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(r,{clientId:o,type:"interval",fields:t})},[o,r,s]),clear:a(()=>{l(r,o)},[l,r,o]),clientId:o}}function Gn(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Rn({name:t});return{onHover:a(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}function Yn(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:s,selectInterval:l,clear:c}=Rn({name:t}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=a(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,o,r,l,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:s,clear:c}}const qn=i(!1);function Xn({selections:e}){const t=$n(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Vn({categoryColors:r,interaction:i,selectionName:s,field:c}){const u=Object.entries(r);if(0===u.length)return null;const d=u.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:u.map(([e,t])=>({label:e,color:t})),label:""}],g=Gn({name:s,fields:[c]}),p=Rn({name:s,clientId:"__linked-legend-isolate__"}),[f,y]=l(new Set),[m,v]=l(null),b=t(p.selectPoints);b.current=p.selectPoints;const x=t(p.clear);x.current=p.clear,o(()=>{"isolate"===i&&(f.size>0?b.current({[c]:Array.from(f)}):x.current())},[i,f,c]);const k=a(e=>{"highlight"===i&&(e?(v(e.label),g.onHover({[c]:e.label})):(v(null),g.onHover(null)))},[i,c,g]),w=a(e=>{"isolate"===i&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===d.length?new Set:n})},[i,d.length]),[A,[O]]=Ut([0,0],!0,!1),S=n(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(u.map(([e])=>e),O),[u,O]);return e.createElement("div",{ref:A,style:{width:"100%",display:"block"}},e.createElement("svg",{width:"100%",height:Math.max(30,22*S+8),style:{display:"block",overflow:"visible"}},e.createElement(qe,{legendGroups:h,title:!1,orientation:"horizontal",width:O,height:20,customHoverBehavior:"highlight"===i?k:void 0,customClickBehavior:"isolate"===i?w:void 0,highlightedCategory:m,isolatedCategories:f})))}function Un({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:s="legend",legendField:a="category"}){const l=Hn(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(zn,null,e.createElement(Dn,null,n&&e.createElement(Xn,{selections:n}),e.createElement(qn.Provider,{value:c},c&&"top"===r&&l&&e.createElement(Vn,{categoryColors:l,interaction:i,selectionName:s,field:a}),t,c&&"bottom"===r&&l&&e.createElement(Vn,{categoryColors:l,interaction:i,selectionName:s,field:a}))))}function Qn({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):se[i%se.length];return{label:r+"",color:a}}),label:""}]}}function Kn(e){return e?"string"==typeof e?{name:e}:e:null}function Jn(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}e.createContext(void 0);const Zn="#007bff";function eo(){var e;const t=Vt(e=>e.theme),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function to(e){return"function"==typeof e?e:t=>t[e]}function no(e,t,o){const r=Hn(),i=eo();return n(()=>{var n;if(!t)return;const s=null!==(n=null!=o?o:i&&i.length>0?i:void 0)&&void 0!==n?n:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(r&&Object.keys(r).length>0){const e=ce(n.map(e=>({_cat:e})),"_cat",s);return t=>r[t]||e(t)}return ce(n.map(e=>({_cat:e})),"_cat",s)}if(r&&Object.keys(r).length>0){const n=ce(e,t,s);return e=>r[e]||n(e)}return ce(e,t,s)}if(r&&Object.keys(r).length>0){const e=ce([{_:"a"}],"_",s);return t=>r[t]||e(t)}},[e,t,o,r,i])}function oo({selection:e,linkedHover:t,fallbackFields:r=[],unwrapData:i=!1,onObservation:s,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:p}){const f=d(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField}:null}(t,r),m=Rn({name:(null==e?void 0:e.name)||"__unused__"}),v=Gn({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||r||[]}),b=Wn(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=l(null),A=p||r[0],O=n(()=>{if(!g||null==k||!A)return null;const e=k,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[g,k,A]),S=a(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const e=null==t?void 0:t[y.xField];null!=e&&Number.isFinite(Number(e))&&function(e,t,n){const o=rt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(rt={positions:new Map(rt.positions).set(e,{xValue:t,sourceId:n})},st())}(y.name||"hover",Number(e),f)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&at(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(g&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];w(null!=n?n+"":null)}else w(null);if(s||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let r=e.data||e.datum||e;Array.isArray(r)&&(r=r[0]);const i=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,y,f,s,c,u,b,g,A]),j=a(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[y.xField];null!=n&&Number.isFinite(Number(n))&&function(e,t,n){const o=rt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(rt.positions);return t.delete(e),rt={positions:t},st(),!1}rt={positions:new Map(rt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},st()}(y.name||"hover",Number(n),f)}if(e&&h){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),h(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:c||"unknown",chartId:u};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const i=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});s&&s(i),b&&b(i)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),b&&b(e)}}},[h,s,b,c,u,y,f]);return o(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{lt(e,f),at(e,f)}},[null==y?void 0:y.mode,null==y?void 0:y.name,f]),{activeSelectionHook:x,hoverSelectionHook:O,customHoverBehavior:S,customClickBehavior:j,crosshairSourceId:f}}function ro(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}}function io({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(qn),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return Qn({data:e,colorBy:t,colorScale:o,getColor:le,categories:c})},[d,t,e,o,c]),g=n(()=>{const e=Object.assign(Object.assign({},l),a);return h&&("right"===i&&110>e.right?e.right=110:"left"===i&&110>e.left?e.left=110:"top"===i&&50>e.top?e.top=50:"bottom"===i&&80>e.bottom&&(e.bottom=80)),e},[l,a,h,i]);return{legend:h,margin:g,legendPosition:i}}function so(e,t,o){const[r,i]=l(null),[s,c]=l(new Set),u=a(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=a(t=>{"isolate"===e&&c(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),h=n(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,r,s]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const ao={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 lo(e,t,n){var o,r,i,s,a,l,c;const u=ao[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!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:co(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function co(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}const uo={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 ho(e,t){return"function"==typeof t?t(e):e[t]}function go(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 po(t={}){const{fields:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=ho(t,o);a=go(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=ho(t,o);l.push({label:n,value:go(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=go(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=go(t[e[0]],r))}}const c=Object.assign(Object.assign({},uo),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function fo(t){if(!0===t)return po();if("function"==typeof t){const n=t;return t=>{const o=n(!t||"object"!=typeof t.data||null===t.data||"node"!==t.type&&"edge"!==t.type?t:t.data);return null==o?null:e.createElement("div",{className:"semiotic-tooltip",style:uo},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?po(t):po())}function yo(e){return"string"==typeof e?e:"value"}function mo(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function vo(e,t){if(!t)return mo(e);try{const n=t(e);return null==n?mo(e):n}catch(t){return mo(e)}}function bo(e,t){return"function"==typeof t?t(e):e[t]}function xo(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const r=t.data;if(!r)return null;const i=n?vo(bo(r,n.accessor),n.format):null;return e.createElement("div",{className:"semiotic-tooltip",style:uo},null!=i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=vo(bo(r,t.accessor),t.format);return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.7}},t.label,": "),e.createElement("span",null,o))}))}}function ko({componentName:t,message:n,diagnosticHint:o,width:r,height:i}){return e.createElement("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n),o&&e.createElement("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6}},o)))}class wo extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(ko,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function Ao(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Oo(e,t,n=3){let o,r=n+1;for(const n of t){const t=Ao(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function So(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function jo(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=Oo(e,t,3))&&void 0!==n?n:null)}function Eo({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=So(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=jo(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}const Co={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},frameProps:{type:"object"},onClick:{type:"function"}},Mo={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Po={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},_o=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Bo=["vertical","horizontal"],Lo={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:_o},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:_o},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:_o},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:["quadrants"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bo},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:Bo},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bo},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bo},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bo},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bo},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Bo},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Co),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Co),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Co),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},arcWidth:{type:"number"},sweep:{type:"number"},showNeedle:{type:"boolean"},needleColor:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Co),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Co),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Co),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Bo},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Co),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Co),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Co),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Co),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Co),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Co),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Co),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Co),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},Co),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Co),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Co),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function No(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}const To=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Ho=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Io=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Fo=new Set(["LineChart","AreaChart","StackedAreaChart"]),zo=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function $o(e){const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!t)return null;const[n,o,r]=[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255],i=e=>e>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92;return.2126*i(n)+.7152*i(o)+.0722*i(r)}function Do(e,t){const n=$o(e),o=$o(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Wo=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Ro(e,t){const n=[],o=function(e,t){const n=[],o=Lo[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Lo).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!No(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=Object.keys(o.props),i=new Set(r);for(const o of Object.keys(t))if(void 0!==t[o]&&!i.has(o)){const t=Oo(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const s=Eo({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=function({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=function({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const n=So(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=jo(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Lo[e]?(function(e,t,n){const o=Lo[e];if(o){if("array"===o.dataShape){const e=t.data;e&&Array.isArray(e)&&0===e.length&&n.push({severity:"error",code:"EMPTY_DATA",message:"data is an empty array — chart will render blank.",fix:"Provide at least one data point: data={[{ x: 1, y: 2 }]}."})}"network"===o.dataShape&&t.edges&&Array.isArray(t.edges)&&0===t.edges.length&&n.push({severity:"error",code:"EMPTY_EDGES",message:"edges is an empty array — network chart will render blank.",fix:'Provide at least one edge: edges={[{ source: "A", target: "B" }]}.'})}}(e,t,n),function(e,t,n){const o=t.width,r=t.height;if(void 0===o||"number"==typeof o&&o>0||n.push({severity:"error",code:"BAD_WIDTH",message:`width=${JSON.stringify(o)} — chart needs a positive number.`,fix:"Set width={600} or use responsiveWidth={true}."}),void 0===r||"number"==typeof r&&r>0||n.push({severity:"error",code:"BAD_HEIGHT",message:`height=${JSON.stringify(r)} — chart needs a positive number.`,fix:"Set height={400} or use responsiveHeight={true}."}),t.size&&Array.isArray(t.size)){const[e,o]=t.size;(null!=e&&0>=e||null!=o&&0>=o)&&n.push({severity:"error",code:"BAD_SIZE",message:`size=[${e}, ${o}] — both dimensions must be positive.`,fix:"Set size={[600, 400]}."})}}(0,t,n),function(e,t,n){const o=Lo[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${s.join(", ")}.`,fix:`Change ${e} to one of: ${s.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){To.has(e)&&Array.isArray(t.data)&&n.push({severity:"error",code:"HIERARCHY_FLAT_ARRAY",message:e+" expects hierarchical data but received a flat array.",fix:'Pass a root object: data={{ name: "root", children: [...] }}. For flat data, use BarChart or LineChart.'})}(e,t,n),function(e,t,n){Ho.has(e)&&(t.edges||t.data||n.push({severity:"error",code:"NETWORK_NO_EDGES",message:e+" requires an edges prop.",fix:'Provide edges={[{ source: "A", target: "B", value: 10 }]}.'}))}(e,t,n),function(e,t,n){const o=Lo[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const s=t.xAccessor;"string"==typeof s&&i[s]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${s}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Io.has(e))return;const r=t.rExtent||t.yExtent;r&&Array.isArray(r)&&r.length>=1&&null!=r[0]&&0!==r[0]&&n.push({severity:"warning",code:"NON_ZERO_BASELINE",message:`${e} has a non-zero baseline (${r[0]}). Bar and area charts should start at zero to avoid exaggerating differences.`,fix:`Remove the custom extent minimum or set it to 0: rExtent={[0, ${null!==(o=r[1])&&void 0!==o?o:"auto"}]}. For trend-focused charts, use LineChart instead.`})}(e,t,n),function(e,t,n){if(!Fo.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,s=null!==(r=t.height)&&void 0!==r?r:400,a=t.margin;if(!a||"object"!=typeof a)return;const l=(a.left||0)+(a.right||0),c=(a.top||0)+(a.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),s>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${s}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=Lo[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const s=[];t.xAccessor&&"string"==typeof t.xAccessor&&s.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&s.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&s.push({prop:"valueAccessor",name:t.valueAccessor});const a=Math.min(i.length,5);for(const e of s){let t=!0;for(let n=0;a>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!zo.has(e))return;const o=t.barPadding;"number"==typeof o&&10>o&&n.push({severity:"warning",code:"BAR_PADDING_INVISIBLE",message:`barPadding=${o} is very small — bars may appear to have no spacing between them.`,fix:"Increase barPadding to at least 10 for visible gaps, e.g. barPadding={12}."})}(e,t,n),function(e,t,n){if("bottom"!==t.legendPosition)return;const o=t.margin;if(!o||"object"!=typeof o)return;const r=o.bottom;"number"==typeof r&&70>r&&n.push({severity:"warning",code:"BOTTOM_MARGIN_WITH_LEGEND",message:`legendPosition="bottom" with margin.bottom=${r}px — legend may overlap axis labels.`,fix:"Increase margin.bottom to at least 70, e.g. margin={{ ...margin, bottom: 80 }}."})}(0,t,n),function(e,t,n){var o;if(!t.showLegend)return;if("right"!==(null!==(o=t.legendPosition)&&void 0!==o?o:"right"))return;const r=t.margin;if(!r||"object"!=typeof r)return;const i=r.right;"number"==typeof i&&100>i&&n.push({severity:"warning",code:"LEGEND_MARGIN_TIGHT",message:`showLegend is true with legendPosition="right" but margin.right=${i}px — legend may be clipped or overlap the chart.`,fix:"Increase margin.right to at least 100, e.g. margin={{ ...margin, right: 120 }}."})}(0,t,n),function(e,t,n){if("Heatmap"!==e)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=o[0];if(r&&"object"==typeof r)for(const e of["xAccessor","yAccessor"]){const o=t[e];if("string"!=typeof o)continue;const i=r[o];"string"==typeof i&&n.push({severity:"warning",code:"HEATMAP_STRING_ACCESSOR",message:`${e}="${o}" resolves to string values (e.g. "${i}"). Heatmap will use categorical axis handling which may produce unexpected cell layout.`,fix:"If you intend categorical axes this is fine. Otherwise, convert values to numbers before passing data."})}}(e,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o))return;const r="string"==typeof t.background?t.background:"#ffffff";if(!r.startsWith("#"))return;const i=[];for(const e of o){if("string"!=typeof e||!e.startsWith("#"))continue;const t=Do(e,r);null!==t&&3>t&&i.push(`${e} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_COLOR_CONTRAST",message:`${i.length} color(s) in colorScheme have < 3:1 contrast against background "${r}": ${i.join(", ")}. Data marks may be hard to see.`,fix:'Use darker colors on light backgrounds or lighter colors on dark backgrounds. Import COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for an accessible preset.'})}(0,t,n),function(e,t,n){const o=t.colorScheme;if(!o||!Array.isArray(o)||2>o.length)return;const r=o.filter(e=>"string"==typeof e&&e.startsWith("#"));if(2>r.length)return;const i=[];for(let e=0;r.length-1>e;e++){const t=Do(r[e],r[e+1]);null!==t&&1.5>t&&i.push(`${r[e]} / ${r[e+1]} (${t.toFixed(1)}:1)`)}i.length>0&&n.push({severity:"warning",code:"LOW_ADJACENT_CONTRAST",message:`${i.length} adjacent color pair(s) in colorScheme have very similar luminance: ${i.join("; ")}. Categories may be hard to distinguish.`,fix:'Alternate light and dark colors in the scheme, or use COLOR_BLIND_SAFE_CATEGORICAL from "semiotic" for a pre-tested palette.'})}(0,t,n),function(e,t,n){const o="string"==typeof t.title&&t.title.trim().length>0,r="string"==typeof t.description&&t.description.trim().length>0,i="string"==typeof t.summary&&t.summary.trim().length>0;o||r||i||n.push({severity:"warning",code:"MISSING_DESCRIPTION",message:'No title, description, or summary provided. Screen readers will use a generic label like "XY chart".',fix:'Add a title="..." prop for a brief label, or description="..." for a detailed aria-label, or summary="..." for a screen-reader-only note describing the chart\'s purpose.'})}(0,t,n),function(e,t,n){const o=[];for(const e of Wo)"function"==typeof t[e]&&o.push(e);o.length>0&&n.push({severity:"warning",code:"FUNCTION_ACCESSOR",message:`Function accessor${o.length>1?"s":""} detected: ${o.join(", ")}. If defined inline (e.g. \`xAccessor={d => d.value}\`), every parent re-render creates a new reference which may trigger unnecessary scene rebuilds.`,fix:'Use string accessors when possible (e.g. xAccessor="value"), or memoize with useCallback / define outside the component.'})}(0,t,n),{ok:n.every(e=>"warning"===e.severity),diagnoses:n}):{ok:0===n.length,diagnoses:n}}var Go;const Yo="undefined"!=typeof process&&"production"!==(null===(Go=process.env)||void 0===Go?void 0:Go.NODE_ENV);function qo({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(wo,{fallback:i=>{let s="";if(Yo&&r)try{const e=Ro(t,r);e.ok||(s=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(ko,{componentName:t,message:i.message,diagnosticHint:s,width:n,height:o})}},i)}const Xo={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"},Vo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Uo(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.createElement("div",{style:Object.assign(Object.assign({},Xo),{width:n,height:o})},r||"No data available"):null}function Qo(t,n,o){if(!t)return null;const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return e.createElement("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"}},Array.from({length:r},(t,o)=>e.createElement("div",{key:o,className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Vo),{position:"absolute",top:a+o*(i+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function Ko(e,t,n,o){if(!Yo)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Jo(e){const t=Vt(e=>e.theme.colors.selectionOpacity);return n(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Zo(e,t,n,o){return new(n||(n=Promise))(function(r,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function a(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const er="__forecastSegment";let tr=null;function nr(){return Zo(this,void 0,void 0,function*(){return tr||(tr=yield import("./xy-statisticalOverlays-C2PPlmXv.js")),tr})}const or=c(function(r,i){var s,c;const d=t(null);u(i,()=>({push:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=d.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=d.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=d.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=d.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=d.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=d.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const h=lo(r.mode,{width:r.width,height:r.height,showGrid:r.showGrid,enableHover:r.enableHover,showLegend:r.showLegend,title:r.title,description:r.description,summary:r.summary,accessibleTable:r.accessibleTable,xLabel:r.xLabel,yLabel:r.yLabel}),{data:g,margin:p,className:f,xFormat:y,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:O="linear",showPoints:S=!1,pointRadius:j=3,fillArea:E=!1,areaOpacity:C=.3,lineWidth:M=2,lineGradient:P,tooltip:_,pointIdAccessor:B,annotations:L,directLabel:N,gapStrategy:T="break",anomaly:H,forecast:I,frameProps:F={},selection:z,linkedHover:$,onObservation:D,onClick:W,hoverHighlight:R,hoverRadius:G,chartId:Y,loading:q,emptyContent:X,legendInteraction:V,legendPosition:U,xScaleType:Q,yScaleType:K,color:J}=r,Z=h.width,ee=h.height,te=h.enableHover,ne=h.showGrid,oe=h.showLegend,re=h.title,ie=h.description,se=h.summary,ae=h.accessibleTable,ce=h.xLabel,ue=h.yLabel,de=Qo(q,Z,ee),he=de?null:Uo(g,Z,ee,X),ge=g||[];Ko("LineChart",ge,"xAccessor",v),Ko("LineChart",ge,"yAccessor",b);const pe="string"==typeof v?v:"__semiotic_resolvedX",fe="string"==typeof b?b:"__semiotic_resolvedY",[ye,me]=l(null),[ve,be]=l([]),xe=n(()=>{if(!I&&!H)return ge;const e="function"==typeof v,t="function"==typeof b;return e||t?ge.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):ge},[ge,I,H,v,b]),ke=t(I),we=t(H);o(()=>{if(!I&&!H)return void((ke.current||we.current)&&(me(null),be([]),ke.current=I,we.current=H));let e=!1;const t=I!==ke.current||H!==we.current;if(ke.current=I,we.current=H,t&&(me(null),be([])),I){const t=x&&"string"==typeof x&&"object"==typeof I?Object.assign(Object.assign({},I),{_groupBy:x}):I;(function(...e){return Zo(this,void 0,void 0,function*(){return(yield nr()).buildForecast(...e)})})(xe,pe,fe,t,H).then(t=>{e||(me(t),be(t.annotations))}).catch(()=>{e||(me(null),be([]))})}else H&&function(...e){return Zo(this,void 0,void 0,function*(){return(yield nr()).buildAnomalyAnnotations(...e)})}(H).then(t=>{e||(me(null),be(t))}).catch(()=>{e||be([])});return()=>{e=!0}},[xe,I,H,pe,fe]);const Ae=ye?ye.processedData:ge,Oe="__compoundGroup",Se=!(!I||!x),je=Se?Oe:I?er:x,Ee=n(()=>{if(!Se)return Ae;const e="function"==typeof x?x:e=>e[x];return Ae.map(t=>{const n=Object.assign({},t);return n[Oe]=`${e(t)}__${t[er]||"observed"}`,n})},[Ae,Se,x]),Ce=Se?Ee:Ae,Me=n(()=>{if(!I)return;const e=I.upperBounds,t=I.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=ye?ye.processedData:ge;for(const e of s){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[I,ye,ge,b]),{activeSelectionHook:Pe,hoverSelectionHook:_e,customHoverBehavior:Be,customClickBehavior:Le,crosshairSourceId:Ne}=oo({selection:z,linkedHover:$,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:D,onClick:W,chartType:"LineChart",chartId:Y,hoverHighlight:R,colorByField:"string"==typeof w?w:void 0}),Te=Jo(z),He=ro($,Ne),Ie=a(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),Fe=void 0!==(null===(s=Ce[0])||void 0===s?void 0:s[k]),ze=n(()=>{if(Fe)return Ce;if(je){const e=Ce.reduce((e,t)=>{const n="function"==typeof je?je(t):t[je];if(!e[n]){const o={[k]:[]};"string"==typeof je&&(o[je]=n),Se&&(o[er]=t[er],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Ce}]},[Ce,je,k,Fe]),{gapProcessedLineData:$e,hasGaps:De}=n(()=>{if("interpolate"===T){let e=!1;const t=[];for(const n of ze){const o=(n[k]||[]).filter(t=>!Ie(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const n of ze){const o=n[k]||[];let r=[],i=0;const s=je&&"string"==typeof je?n[je]:void 0;for(const a of o)if(Ie(a))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of ze){const r=o[k]||[],i=[];for(const n of r)Ie(n)?(e=!0,i.push(Object.assign(Object.assign({},n),{[t]:0}))):i.push(n);n.push(Object.assign(Object.assign({},o),{[k]:i}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:ze,hasGaps:!1}},[ze,T,k,Ie,je,b]),We=no(Ae,w,A),Re=n(()=>{if(!w)return[];const e=new Set;for(const t of Ae){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[Ae,w]),Ge=so(V,w,Re),Ye=n(()=>_e||(Ge.legendSelectionHook?Ge.legendSelectionHook:Pe),[_e,Ge.legendSelectionHook,Pe]),qe=n(()=>(e,t)=>{const n={strokeWidth:M},o=!0===E||Array.isArray(E)&&null!=t&&E.includes(t);return w?We&&(n.stroke=le(e,w,We),o&&(n.fill=n.stroke,n.fillOpacity=C)):(n.stroke=J||Zn,o&&(n.fill=J||Zn,n.fillOpacity=C)),n},[w,We,M,E,C,J]),[Xe,Ve]=l(null);o(()=>{if(!I)return void Ve(null);let e=!1;return function(...e){return Zo(this,void 0,void 0,function*(){return(yield nr()).createSegmentLineStyle(...e)})}(qe,I).then(t=>{e||Ve(()=>t)}).catch(()=>{e||Ve(null)}),()=>{e=!0}},[qe,I]);const Ue=Xe||qe,Qe=n(()=>Jn(Ue,Ye,Te),[Ue,Ye,Te]),Ke=n(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return w?We&&(t.fill=le(e.parentLine||e,w,We)):t.fill=J||Zn,t}},[S,j,w,We,J]),Je=Array.isArray(E)?"mixed":E?"area":"line",Ze="object"==typeof N?N:{},et=Ze.position||"end",tt=Ze.fontSize||11,nt=n(()=>{var e,t;if(!N||!w)return[];const n="function"==typeof v?v:e=>e[v],o="function"==typeof b?b:e=>e[b],r="function"==typeof w?w:e=>e[w],i=new Map;for(const n of $e){const o=n[k]||[];if(0===o.length)continue;const s="end"===et?o[o.length-1]:o[0],a=null!==(t=null!==(e=r(s))&&void 0!==e?e:r(n))&&void 0!==t?t:"";a&&!i.has(a+"")&&i.set(a+"",s)}const s=Array.from(i.entries()).map(([e,t])=>({type:"text",label:e,["string"==typeof v?v:"x"]:n(t),["string"==typeof b?b:"y"]:o(t),dx:"end"===et?6:-6,dy:0,color:We?We(e):Zn,fontSize:tt}));s.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof b?b:"y",n=s[e-1],o=s[e];tt+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=tt+2)}return s},[N,w,We,$e,k,v,b,et,tt]),ot=(!N||void 0!==oe)&&oe,rt=n(()=>{if(!N)return h.marginDefaults;const e=nt.reduce((e,t)=>{var n;const o=((null===(n=t.label)||void 0===n?void 0:n.length)||0)*(.6*tt);return Math.max(e,o)},0),t=e+10,n="end"===et?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[N,nt,tt,et,h.marginDefaults]),{legend:it,margin:st,legendPosition:at}=io({data:$e,colorBy:w,colorScale:We,showLegend:ot,legendPosition:U,userMargin:p,defaults:rt}),lt=x||w,ct=n(()=>xo([{label:ce||yo(v),accessor:v,role:"x",format:y},{label:ue||yo(b),accessor:b,role:"y",format:m},...lt?[{label:yo(lt),accessor:lt,role:"group"}]:[]]),[v,b,ce,ue,lt,y,m]),ut=Eo({componentName:"LineChart",data:Fe?(null===(c=Ae[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),dt=n(()=>Fe||je||De?$e.flatMap(e=>{const t=e[k]||[];return je&&"string"==typeof je?t.map(t=>Object.assign(Object.assign({},t),{[je]:e[je]})):t}):Ce,[$e,k,Fe,je,Ce,De]),ht=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:Je},Array.isArray(E)&&{areaGroups:E}),P&&{lineGradient:P}),null!=G&&{hoverRadius:G}),null!=g&&{data:dt}),{xAccessor:v,yAccessor:b,xScaleType:Q,yScaleType:K}),Me&&{yExtent:Me}),{groupAccessor:"break"===T&&De?"_gapSegment":je||void 0,curve:O,lineStyle:Qe}),S&&{pointStyle:Ke}),{size:[Z,ee],responsiveWidth:r.responsiveWidth,responsiveHeight:r.responsiveHeight,margin:st,showAxes:h.showAxes,xLabel:ce,yLabel:ue,xFormat:y,yFormat:m,enableHover:te,showGrid:ne}),it&&{legend:it,legendPosition:at}),V&&"none"!==V&&{legendHoverBehavior:Ge.onLegendHover,legendClickBehavior:Ge.onLegendClick,legendHighlightedCategory:Ge.highlightedCategory,legendIsolatedCategories:Ge.isolatedCategories}),re&&{title:re}),ie&&{description:ie}),se&&{summary:se}),void 0!==ae&&{accessibleTable:ae}),f&&{className:f}),null!=r.animate&&{animate:r.animate}),{tooltipContent:!1===_?()=>null:"multi"===_?t=>{var n,o,r,i,s,a,l,c,u,d;const h=t.allSeries;if(!h||0===h.length){const a=null!==(s=null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(r=t.data)||void 0===r?void 0:r.y)&&void 0!==i?i:t.value)&&void 0!==s?s:t.y;return e.createElement("div",{className:"semiotic-tooltip",style:uo},e.createElement("div",null,go(a)))}const g=null!==(d=null!==(c=null!==(a=t.xValue)&&void 0!==a?a:null===(l=t.data)||void 0===l?void 0:l.time)&&void 0!==c?c:null===(u=t.data)||void 0===u?void 0:u.x)&&void 0!==d?d:t.time;return e.createElement("div",{className:"semiotic-tooltip",style:uo},null!=g&&e.createElement("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4}},go(g)),h.map((t,n)=>e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"}},e.createElement("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.createElement("span",{style:{flex:1,fontSize:"0.85em"}},t.group),e.createElement("span",{style:{fontWeight:500,fontSize:"0.85em"}},go(t.value)))))}:fo(_)||ct}),"multi"===_&&{tooltipMode:"multi"}),($||D||W||R)&&{customHoverBehavior:Be}),(D||W||$)&&{customClickBehavior:Le}),B&&{pointIdAccessor:B}),((null==L?void 0:L.length)||ve.length||nt.length)&&{annotations:[...L||[],...ve,...nt]}),He),F);return de||he||(ut?e.createElement(ko,{componentName:"LineChart",message:ut,width:Z,height:ee}):e.createElement(qo,{componentName:"LineChart",width:Z,height:ee},e.createElement(Nn,Object.assign({ref:d},ht))))});or.displayName="LineChart";const rr=c(function(o,r){var i;const s=t(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=lo(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:p="x",yAccessor:f="y",areaBy:y,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:O,showLine:S=!0,lineWidth:j=2,showPoints:E=!1,pointRadius:C=3,tooltip:M,annotations:P,frameProps:_={},selection:B,linkedHover:L,onObservation:N,onClick:T,hoverHighlight:H,chartId:I,loading:F,emptyContent:z,legendInteraction:$,legendPosition:D,color:W}=o,R=a.width,G=a.height,Y=a.enableHover,q=a.showGrid,X=a.showLegend,V=a.title,U=a.description,Q=a.summary,K=a.accessibleTable,J=a.xLabel,Z=a.yLabel,ee=Qo(F,R,G),te=ee?null:Uo(l,R,G,z),ne=l||[];Ko("AreaChart",ne,"xAccessor",p),Ko("AreaChart",ne,"yAccessor",f);const{activeSelectionHook:oe,hoverSelectionHook:re,customHoverBehavior:ie,customClickBehavior:se,crosshairSourceId:ae}=oo({selection:B,linkedHover:L,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:N,onClick:T,chartType:"AreaChart",chartId:I,hoverHighlight:H,colorByField:"string"==typeof x?x:void 0}),ce=Jo(B),ue=ro(L,ae),de=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[b]),he=n(()=>{if(de)return ne;if(y){const e=ne.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[b]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][b].push(t),e},{});return Object.values(e)}return[{[b]:ne}]},[ne,y,b,de]),ge=no(ne,x,k),pe=n(()=>{if(!x)return[];const e=new Set;for(const t of ne){const n="function"==typeof x?x(t):t[x];null!=n&&e.add(n+"")}return Array.from(e)},[ne,x]),fe=so($,x,pe),ye=n(()=>re||(fe.legendSelectionHook?fe.legendSelectionHook:oe),[re,fe.legendSelectionHook,oe]),me=n(()=>e=>{const t={};if(x){if(ge){const n=le(e,x,ge);t.fill=n,S?(t.stroke=n,t.strokeWidth=j):t.stroke="none"}}else{const e=W||Zn;t.fill=e,S?(t.stroke=e,t.strokeWidth=j):t.stroke="none"}return t.fillOpacity=A,t},[x,ge,W,A,S,j]),ve=n(()=>Jn(me,ye,ce),[me,ye,ce]),be=n(()=>{if(E)return e=>{const t={r:C,fillOpacity:1};return x?ge&&(t.fill=le(e.parentLine||e,x,ge)):t.fill=Zn,t}},[E,C,x,ge]),{legend:xe,margin:ke,legendPosition:we}=io({data:he,colorBy:x,colorScale:ge,showLegend:X,legendPosition:D,userMargin:c,defaults:a.marginDefaults}),Ae=y||x,Oe=n(()=>xo([{label:J||yo(p),accessor:p,role:"x",format:h},{label:Z||yo(f),accessor:f,role:"y",format:g},...Ae?[{label:yo(Ae),accessor:Ae,role:"group"}]:[]]),[p,f,J,Z,Ae,h,g]),Se=Eo({componentName:"AreaChart",data:l,accessors:{xAccessor:p,yAccessor:f}}),je=n(()=>de||y?he.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):ne,[he,b,de,y,ne]),Ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:je}),{xAccessor:p,yAccessor:f,groupAccessor:y||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),O&&{lineGradient:O}),{curve:w,lineStyle:ve}),E&&be&&{pointStyle:be}),{size:[R,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ke,showAxes:a.showAxes,xLabel:J,yLabel:Z,xFormat:h,yFormat:g,enableHover:Y}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:q}),xe&&{legend:xe,legendPosition:we}),$&&"none"!==$&&{legendHoverBehavior:fe.onLegendHover,legendClickBehavior:fe.onLegendClick,legendHighlightedCategory:fe.highlightedCategory,legendIsolatedCategories:fe.isolatedCategories}),V&&{title:V}),U&&{description:U}),Q&&{summary:Q}),void 0!==K&&{accessibleTable:K}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===M?()=>null:fo(M)||Oe}),(L||N||T||H)&&{customHoverBehavior:ie}),(N||T||L)&&{customClickBehavior:se}),P&&P.length>0&&{annotations:P}),ue),_);return ee||te||(Se?e.createElement(ko,{componentName:"AreaChart",message:Se,width:R,height:G}):e.createElement(qo,{componentName:"AreaChart",width:R,height:G},e.createElement(Nn,Object.assign({ref:s},Ee))))});function ir({isPushMode:e,colorBy:o,colorScheme:r,showLegend:i,legendPosition:s="right"}){const c=t(new Set),u=t([]),[d,h]=l(0),g=a(e=>{if(!o)return null;const t="function"==typeof o?o(e):e[o];return null!=t?t+"":null},[o]),p=a(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=g(e);null==t||c.current.has(t)||(c.current.add(t),u.current.push(t),n=!0)}n&&h(e=>e+1)},[e,o,g]),f=a(e=>t=>{p([t]),e(t)},[p]),y=a(e=>t=>{p(t),e(t)},[p]),m=a(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!o||!1===i)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(r)?r:se,s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],n[e%n.length]);const a="string"==typeof o?o:"__streamCat";return Qn({data:t.map(e=>({[a]:e})),colorBy:a,colorScale:e=>s.get(e)||"#999",getColor:le})},[e,o,i,r,d]),b=n(()=>{if(v)return"right"===s?{right:110}:"left"===s?{left:110}:"top"===s?{top:50}:"bottom"===s?{bottom:80}:{right:110}},[v,s]);return{wrapPush:f,wrapPushMany:y,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}rr.displayName="AreaChart";const sr=c(function(o,r){var i;const s=t(null),l=lo(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:p,xAccessor:f="x",yAccessor:y="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:O=2,showPoints:S=!1,pointRadius:j=3,normalize:E=!1,tooltip:C,annotations:M,frameProps:P={},selection:_,linkedHover:B,onObservation:L,onClick:N,hoverHighlight:T,chartId:H,loading:I,emptyContent:F,legendInteraction:z,legendPosition:$,color:D}=o,W=l.width,R=l.height,G=l.enableHover,Y=l.showGrid,q=l.showLegend,X=l.title,V=l.description,U=l.summary,Q=l.accessibleTable,K=l.xLabel,J=l.yLabel,Z=Qo(I,W,R),ee=Z?null:Uo(c,W,R,F),te=c||[],ne=ir({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:q,legendPosition:$}),oe=a(ne.wrapPush(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)}),[ne.wrapPush]),re=a(ne.wrapPushMany(e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)}),[ne.wrapPushMany]);u(r,()=>({push:oe,pushMany:re,remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ne.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[oe,re,ne.resetCategories]);const{activeSelectionHook:ie,hoverSelectionHook:se,customHoverBehavior:ae,customClickBehavior:ce,crosshairSourceId:ue}=oo({selection:_,linkedHover:B,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:L,onClick:N,chartType:"StackedAreaChart",chartId:H,hoverHighlight:T,colorByField:"string"==typeof b?b:void 0}),de=Jo(_),he=ro(B,ue),ge=void 0!==(null===(i=te[0])||void 0===i?void 0:i[v]),pe=n(()=>{if(ge)return te;if(m){const e=te.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:te}]},[te,m,v,ge]),fe=no(te,b,x),ye=n(()=>{if(!b)return[];const e=new Set;for(const t of te){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[te,b]),me=so(z,b,ye),ve=n(()=>se||(me.legendSelectionHook?me.legendSelectionHook:ie),[se,me.legendSelectionHook,ie]),be=n(()=>e=>{const t={};if(b&&fe){const n=le(e,b,fe);t.fill=n,A?(t.stroke=n,t.strokeWidth=O):t.stroke="none"}else if(!b){const e=D||Zn;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=O)}return t.fillOpacity=w,t},[b,fe,w,A,O,D]),xe=n(()=>Jn(be,ve,de),[be,ve,de]),ke=n(()=>{if(S)return e=>{const t={r:j,fillOpacity:1};return b?fe&&(t.fill=le(e.parentLine||e,b,fe)):t.fill=D||Zn,t}},[S,j,b,fe,D]),{legend:we,margin:Ae,legendPosition:Oe}=io({data:pe,colorBy:b,colorScale:fe,showLegend:q,legendPosition:$,userMargin:d,defaults:l.marginDefaults}),Se=ne.streamingLegend||we,je=$||Oe,Ee=n(()=>{if(ne.streamingMarginAdjust){const e=Object.assign({},Ae);for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Ae},[Ae,ne.streamingMarginAdjust]),Ce=m||b,Me=n(()=>xo([{label:K||yo(f),accessor:f,role:"x",format:g},{label:J||yo(y),accessor:y,role:"y",format:p},...Ce?[{label:yo(Ce),accessor:Ce,role:"group"}]:[]]),[f,y,K,J,Ce,g,p]),Pe=Eo({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:f,yAccessor:y}}),_e=n(()=>ge||m?pe.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):te,[pe,v,ge,m,te]),Be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"stackedarea"},null!=c&&{data:_e}),{xAccessor:f,yAccessor:y,groupAccessor:m||void 0,curve:k,normalize:E,lineStyle:xe}),S&&ke&&{pointStyle:ke}),{size:[W,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ee,showAxes:l.showAxes,xLabel:K,yLabel:J,xFormat:g,yFormat:p,enableHover:G}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:Y}),Se&&{legend:Se,legendPosition:je}),z&&"none"!==z&&{legendHoverBehavior:me.onLegendHover,legendClickBehavior:me.onLegendClick,legendHighlightedCategory:me.highlightedCategory,legendIsolatedCategories:me.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==Q&&{accessibleTable:Q}),h&&{className:h}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===C?()=>null:fo(C)||Me}),(B||L||N||T)&&{customHoverBehavior:ae}),(L||N||B)&&{customClickBehavior:ce}),M&&M.length>0&&{annotations:M}),he),P);return Z||ee||(Pe?e.createElement(ko,{componentName:"StackedAreaChart",message:Pe,width:W,height:R}):e.createElement(qo,{componentName:"StackedAreaChart",width:W,height:R},e.createElement(Nn,Object.assign({ref:s},Be))))});function ar(e){const{data:t,rawData:o,colorBy:r,colorScheme:i,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:p,showLegend:f,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,O="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:S,hoverSelectionHook:j,customHoverBehavior:E,customClickBehavior:C,crosshairSourceId:M}=oo({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:p,onClick:v,hoverHighlight:b,colorByField:O}),P=ro(c,M),_=no(t,r,i),B=n(()=>{if(!r)return[];const e=new Set;for(const n of t){const t="function"==typeof r?r(n):n[r];null!=t&&e.add(t+"")}return Array.from(e)},[t,r]),L=so(s,r,B),N=n(()=>j||(L.legendSelectionHook?L.legendSelectionHook:S),[j,L.legendSelectionHook,S]),T=Jo(l),{legend:H,margin:I,legendPosition:F}=io({data:t,colorBy:r,colorScale:_,showLegend:f,legendPosition:a,userMargin:y,defaults:m}),z=n(()=>{const e={};return H&&(e.legend=H,e.legendPosition=F),s&&"none"!==s&&(e.legendHoverBehavior=L.onLegendHover,e.legendClickBehavior=L.onLegendClick,e.legendHighlightedCategory=L.highlightedCategory,e.legendIsolatedCategories=L.isolatedCategories),e},[H,F,s,L.onLegendHover,L.onLegendClick,L.highlightedCategory,L.isolatedCategories]),$=Qo(x,w,A),D=$?null:Uo(o,w,A,k);return{colorScale:_,allCategories:B,legendState:L,effectiveSelectionHook:N,activeSelectionHook:S,customHoverBehavior:E,customClickBehavior:C,legend:H,margin:I,legendPosition:F,earlyReturn:$||D||null,legendBehaviorProps:z,crosshairProps:P,resolvedSelection:T}}sr.displayName="StackedAreaChart";const lr=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=lo(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:p="x",yAccessor:f="y",colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:O,annotations:S,frameProps:j={},selection:E,linkedHover:C,linkedBrush:M,onObservation:P,onClick:_,hoverHighlight:B,chartId:L,loading:N,emptyContent:T,legendInteraction:H,legendPosition:I,color:F}=o,z=s.width,$=s.height,D=s.enableHover,W=s.showGrid,R=s.title,G=s.description,Y=s.summary,q=s.accessibleTable,X=s.xLabel,V=s.yLabel,U=l||[],Q=ar({data:U,rawData:l,colorBy:y,colorScheme:m,legendInteraction:H,legendPosition:I,selection:E,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:P,onClick:_,hoverHighlight:B,chartType:"Scatterplot",chartId:L,showLegend:s.showLegend,userMargin:c,marginDefaults:s.marginDefaults,loading:N,emptyContent:T,width:z,height:$}),K=Kn(M),J=Yn({name:(null==K?void 0:K.name)||"__unused_brush__",xField:(null==K?void 0:K.xField)||("string"==typeof p?p:void 0),yField:(null==K?void 0:K.yField)||("string"==typeof f?f:void 0)}),Z=K?"xyBrush"===J.brushInteraction.brush?"xy":"xBrush"===J.brushInteraction.brush?"x":"y":void 0,ee=e.useRef(J.brushInteraction);ee.current=J.brushInteraction;const te=a(e=>{const t=ee.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);if(Q.earlyReturn)return Q.earlyReturn;Ko("Scatterplot",U,"xAccessor",p),Ko("Scatterplot",U,"yAccessor",f);const ne=n(()=>{if(!v||0===U.length)return;const e=U.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[U,v]),oe=n(()=>e=>{const t={fillOpacity:k};return y?Q.colorScale&&(t.fill=le(e,y,Q.colorScale)):t.fill=F||Zn,t.r=v?ue(e,v,b,ne):x,t},[y,Q.colorScale,v,b,ne,x,k,F]),re=n(()=>Jn(oe,Q.effectiveSelectionHook,Q.resolvedSelection),[oe,Q.effectiveSelectionHook,Q.resolvedSelection]),ie=n(()=>xo([{label:X||yo(p),accessor:p,role:"x",format:h},{label:V||yo(f),accessor:f,role:"y",format:g},...y?[{label:yo(y),accessor:y,role:"color"}]:[],...v?[{label:yo(v),accessor:v,role:"size"}]:[]]),[p,f,X,V,y,v,h,g]),se=Eo({componentName:"Scatterplot",data:l,accessors:{xAccessor:p,yAccessor:f}});if(se)return e.createElement(ko,{componentName:"Scatterplot",message:se,width:z,height:$});const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:U}),{xAccessor:p,yAccessor:f,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:re,colorScheme:m,size:[z,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q.margin,showAxes:s.showAxes,xLabel:X,yLabel:V,xFormat:h,yFormat:g,enableHover:D,showGrid:W}),Q.legendBehaviorProps),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===w?()=>null:fo(w)||ie}),(C||P||_||B)&&{customHoverBehavior:Q.customHoverBehavior}),(P||_||C)&&{customClickBehavior:Q.customClickBehavior}),A&&{marginalGraphics:A}),O&&{pointIdAccessor:O}),S&&S.length>0&&{annotations:S}),K&&{brush:{dimension:Z},onBrush:te}),Q.crosshairProps),j);return e.createElement(qo,{componentName:"Scatterplot",width:z,height:$},e.createElement(Nn,Object.assign({ref:i},ae)))});function cr(e,t){return O(1===t?.5:e/(t-1))}lr.displayName="Scatterplot";const ur=c(function(o,r){var i;const s=t(null);u(r,()=>({push:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=s.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const a=lo(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:p="y",orderAccessor:f,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:E,loading:C,emptyContent:M,legendInteraction:P}=o,_=a.width,B=a.height,L=a.enableHover,N=a.showGrid,T=a.title,H=a.description,I=a.summary,F=a.accessibleTable,z=a.xLabel,$=a.yLabel,D=l||[],{safeData:W,orderMap:R}=n(()=>{const e="function"==typeof g?g:e=>e[g],t="function"==typeof p?p:e=>e[p];let n=D;if(f&&D.length>0){const e="function"==typeof f?f:e=>e[f];n=[...D].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const o=new WeakMap;let r=0;for(const o of n){const n=e(o),i=t(o);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let i=0;for(const s of n){const n=e(s),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[D,f,g,p]);Ko("ConnectedScatterplot",W,"xAccessor",g),Ko("ConnectedScatterplot",W,"yAccessor",p);const{activeSelectionHook:G,hoverSelectionHook:Y,customHoverBehavior:q,customClickBehavior:X,crosshairSourceId:V}=oo({selection:w,linkedHover:A,fallbackFields:[],onObservation:O,onClick:S,chartType:"ConnectedScatterplot",chartId:E,hoverHighlight:j,colorByField:void 0}),U=Jo(w),Q=ro(A,V),K=so(P,void 0,[]),J=n(()=>Y||(K.legendSelectionHook?K.legendSelectionHook:G),[Y,K.legendSelectionHook,G]),Z=null!==(i=null==U?void 0:U.unselectedOpacity)&&void 0!==i?i:.5,ee=n(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==J?void 0:J.isActive,s=null==J?void 0:J.predicate,a=100>r.length,l=r.length;e.lineCap="round";for(let t=0;l-1>t;t++){const c=r[t],u=r[t+1],d=cr(t,l),h=!i||!s||s(null!==(n=c.datum)&&void 0!==n?n:c)||s(null!==(o=u.datum)&&void 0!==o?o:u),g=i?h?1:Z:1;a&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle=d,e.lineWidth=m,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[m,J,Z]),te=n(()=>[ee],[ee]),ne=n(()=>(t,n,o)=>{var r,i;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const a=s.length,l=100>a,c=[];for(let t=0;a-1>t;t++){const n=s[t],o=s[t+1],u=cr(t,a),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,g=Math.min(d,h);l&&c.push(e.createElement("line",{key:"halo-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*g})),c.push(e.createElement("line",{key:"seg-"+t,x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[m]),oe=n(()=>[ne],[ne]),re=n(()=>e=>{var t,n;const o=R.get(e),r=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,i=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:i>0?cr(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,R]),ie=n(()=>Jn(re,J,U),[re,J,U]),se=Object.assign({top:50,right:40,bottom:60,left:70},o.margin),ae=y||("string"==typeof f?f:"Order"),le=n(()=>xo([{label:z||yo(g),accessor:g,role:"x",format:d},{label:$||yo(p),accessor:p,role:"y",format:h},...f?[{label:ae,accessor:f,role:"group"}]:[]]),[g,p,z,$,f,ae,d,h]),ce=Eo({componentName:"ConnectedScatterplot",data:l,accessors:{xAccessor:g,yAccessor:p}}),ue=Qo(C,_,B),de=ue?null:Uo(l,_,B,M),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:W}),{xAccessor:g,yAccessor:p,pointStyle:ie,size:[_,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:se,showAxes:a.showAxes,xLabel:z,yLabel:$,xFormat:d,yFormat:h,enableHover:L,showGrid:N}),T&&{title:T}),H&&{description:H}),I&&{summary:I}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===v?()=>null:fo(v)||le}),(A||O||S||j)&&{customHoverBehavior:q}),(O||S||A)&&{customClickBehavior:X}),b&&{pointIdAccessor:b}),{canvasPreRenderers:te,svgPreRenderers:oe}),x&&x.length>0&&{annotations:x}),Q),k);return ue||de||(ce?e.createElement(ko,{componentName:"ConnectedScatterplot",message:ce,width:_,height:B}):e.createElement(qo,{componentName:"ConnectedScatterplot",width:_,height:B},e.createElement(Nn,Object.assign({ref:s},he))))});ur.displayName="ConnectedScatterplot";const dr=c(function(o,r){const i=t(null),s=lo(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:c,margin:d,className:h,xFormat:g,yFormat:p,xAccessor:f="x",yAccessor:y="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:O,marginalGraphics:S,pointIdAccessor:j,annotations:E,frameProps:C={},selection:M,linkedHover:P,linkedBrush:_,onObservation:B,onClick:L,hoverHighlight:N,chartId:T,loading:H,emptyContent:I,legendInteraction:F,legendPosition:z,color:$}=o,D=s.width,W=s.height,R=s.enableHover,G=s.showGrid,Y=s.showLegend,q=s.title,X=s.description,V=s.summary,U=s.accessibleTable,Q=s.xLabel,K=s.yLabel,J=Qo(H,D,W),Z=J?null:Uo(c,D,W,I),ee=c||[],te=void 0===c,ne=t(null),[oe,re]=l(0),ie=a(e=>{if(!te)return;let t=!1;for(const n of e){const e="function"==typeof m?m(n):n[m];null!=e&&isFinite(e)&&(ne.current?(ne.current[0]>e&&(ne.current[0]=e,t=!0),e>ne.current[1]&&(ne.current[1]=e,t=!0)):(ne.current=[e,e],t=!0))}t&&re(e=>e+1)},[te,m]),se=ir({isPushMode:te,colorBy:b,colorScheme:x,showLegend:Y,legendPosition:z}),ae=a(se.wrapPush(e=>{var t;ie([e]),null===(t=i.current)||void 0===t||t.push(e)}),[se.wrapPush,ie]),ce=a(se.wrapPushMany(e=>{var t;ie(e),null===(t=i.current)||void 0===t||t.pushMany(e)}),[se.wrapPushMany,ie]);u(r,()=>({push:ae,pushMany:ce,remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;se.resetCategories(),ne.current=null,re(e=>e+1),null===(e=i.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ae,ce,se.resetCategories]);const{activeSelectionHook:de,hoverSelectionHook:he,customHoverBehavior:ge,customClickBehavior:pe,crosshairSourceId:fe}=oo({selection:M,linkedHover:P,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:B,onClick:L,chartType:"BubbleChart",chartId:T,hoverHighlight:N,colorByField:"string"==typeof b?b:void 0}),ye=Jo(M),me=ro(P,fe),ve=Kn(_);Yn({name:(null==ve?void 0:ve.name)||"__unused_brush__",xField:(null==ve?void 0:ve.xField)||("string"==typeof f?f:void 0),yField:(null==ve?void 0:ve.yField)||("string"==typeof y?y:void 0)});const be=no(ee,b,x),xe=n(()=>{if(!b)return[];const e=new Set;for(const t of ee){const n="function"==typeof b?b(t):t[b];null!=n&&e.add(n+"")}return Array.from(e)},[ee,b]),ke=so(F,b,xe),we=n(()=>he||(ke.legendSelectionHook?ke.legendSelectionHook:de),[he,ke.legendSelectionHook,de]),Ae=n(()=>{if(te)return ne.current||[0,1];const e=ee.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[ee,m,te,oe]),Oe=n(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?be&&(t.fill=le(e,b,be)):t.fill=$||Zn,t.r=ue(e,m,v,Ae),t},[b,be,m,v,Ae,k,w,A,$]),Se=n(()=>Jn(Oe,we,ye),[Oe,we,ye]),{legend:je,margin:Ee,legendPosition:Ce}=io({data:ee,colorBy:b,colorScale:be,showLegend:Y,legendPosition:z,userMargin:d,defaults:s.marginDefaults}),Me=se.streamingLegend||je,Pe=z||Ce,_e=n(()=>{if(se.streamingMarginAdjust){const e=Object.assign({},Ee);for(const[t,n]of Object.entries(se.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Ee},[Ee,se.streamingMarginAdjust]),Be=n(()=>xo([{label:Q||yo(f),accessor:f,role:"x",format:g},{label:K||yo(y),accessor:y,role:"y",format:p},{label:yo(m),accessor:m,role:"size"},...b?[{label:yo(b),accessor:b,role:"color"}]:[]]),[f,y,Q,K,m,b,g,p]),Le=Eo({componentName:"BubbleChart",data:c,accessors:{xAccessor:f,yAccessor:y},requiredProps:{sizeBy:m}});if(Le)return e.createElement(ko,{componentName:"BubbleChart",message:Le,width:D,height:W});const Ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=c&&{data:ee}),{xAccessor:f,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:Se,colorScheme:x,size:[D,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:_e,showAxes:s.showAxes,xLabel:Q,yLabel:K,xFormat:g,yFormat:p,enableHover:R,showGrid:G}),Me&&{legend:Me,legendPosition:Pe}),F&&"none"!==F&&{legendHoverBehavior:ke.onLegendHover,legendClickBehavior:ke.onLegendClick,legendHighlightedCategory:ke.highlightedCategory,legendIsolatedCategories:ke.isolatedCategories}),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===O?()=>null:fo(O)||Be}),(P||B||L||N)&&{customHoverBehavior:ge}),(B||L||P)&&{customClickBehavior:pe}),S&&{marginalGraphics:S}),j&&{pointIdAccessor:j}),E&&E.length>0&&{annotations:E}),me),C);return J||Z||e.createElement(qo,{componentName:"BubbleChart",width:D,height:W},e.createElement(Nn,Object.assign({ref:i},Ne)))});dr.displayName="BubbleChart";const hr=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=lo(o.mode,{width:o.width,height:o.height,showGrid:void 0,enableHover:o.enableHover,showLegend:void 0,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:a,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:p,yFormat:f,colorScheme:y="blues",customColorScale:m,showValues:v=!1,valueFormat:b,cellBorderColor:k="#fff",cellBorderWidth:w=1,tooltip:A,annotations:S,frameProps:j={},selection:P,linkedHover:_,onObservation:B,onClick:L,hoverHighlight:N,chartId:T,loading:H,emptyContent:I,showLegend:F,legendPosition:z,legendInteraction:$}=o,D=s.width,W=s.height,R=s.enableHover,G=s.title,Y=s.description,q=s.summary,X=s.accessibleTable,V=s.xLabel,U=s.yLabel,Q=Qo(H,D,W),K=Q?null:Uo(a,D,W,I),J=a||[],Z=null!=F&&F,ee=null!=z?z:"right",{margin:te}=io({data:J,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:ee,userMargin:l,defaults:s.marginDefaults}),{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:se}=oo({selection:P,linkedHover:_,fallbackFields:[],onObservation:B,onClick:L,chartType:"Heatmap",chartId:T,hoverHighlight:N,colorByField:void 0}),ae=Jo(P),le=ro(_,se),ce=so($,void 0,[]),ue=n(()=>oe||(ce.legendSelectionHook?ce.legendSelectionHook:ne),[oe,ce.legendSelectionHook,ne]),de=n(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),he=n(()=>{const e=J.map(de);return[Math.min(...e),Math.max(...e)]},[J,de]),ge=n(()=>"custom"===y&&m?m:x({blues:M,reds:C,greens:E,viridis:O}[y]||M).domain(he),[y,m,he]);n(()=>{const e=to(d),t=to(h);return{xBinCount:new Set(J.map(e)).size,yBinCount:new Set(J.map(t)).size}},[J,d,h]),n(()=>({coordinates:J}),[J]);const pe=n(()=>e=>{const t=de(e);return{fill:ge(t),stroke:k,strokeWidth:w}},[de,ge,k,w]);n(()=>Jn(pe,ue,ae),[pe,ue,ae]);const fe=n(()=>xo([{label:V||yo(d),accessor:d,role:"x",format:p},{label:U||yo(h),accessor:h,role:"y",format:f},{label:yo(g),accessor:g,role:"value",format:b}]),[d,h,V,U,g,p,f,b]),ye=Eo({componentName:"Heatmap",data:a,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),me=n(()=>{if(Z)return{gradient:{colorFn:e=>ge(e),domain:he,label:"string"==typeof g?g:"value",format:b}}},[Z,ge,he,g,b]),ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=a&&{data:J}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==y?y:void 0,showValues:v,heatmapValueFormat:b,size:[D,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,showAxes:s.showAxes,xLabel:V,yLabel:U,xFormat:p,yFormat:f,enableHover:R}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),me&&{legend:me,legendPosition:ee}),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===A?()=>null:fo(A)||fe}),(_||B||L||N)&&{customHoverBehavior:re}),(B||L||_)&&{customClickBehavior:ie}),S&&S.length>0&&{annotations:S}),le),j);return Q||K||(ye?e.createElement(ko,{componentName:"Heatmap",message:ye,width:D,height:W}):e.createElement(qo,{componentName:"Heatmap",width:D,height:W},e.createElement(Nn,Object.assign({ref:i},ve))))});hr.displayName="Heatmap";const gr="__splomIdx",pr={top:4,bottom:4,left:4,right:4};function fr({frameRef:n,cellSize:r,onBrush:i}){const s=t(null),a=r-pr.left-pr.right,l=r-pr.top-pr.bottom;return o(()=>{if(!s.current)return;const e=h(s.current).select(".brush-g"),t=f().extent([[0,0],[a,l]]).on("brush end",e=>{var t;const o=null===(t=n.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void i(null);const[[r,s],[a,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];i(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,l,n,i]),e.createElement("svg",{ref:s,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${pr.left},${pr.top})`}))}function yr({data:n,xField:o,yField:r,cellSize:i,pointRadius:s,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:p,onPointHover:f}){const y=t(null),m=Rn({name:d,clientId:`splom-${o}-${r}`}),v=Yn({name:d,xField:o,yField:r}),b=Rn({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,k=a(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=a(e=>{if(!e)return void(null==f||f(null));const t=e.data,n=null==t?void 0:t[gr];void 0!==n&&(x({[gr]:[n]}),null==f||f(t,e.x+pr.left,e.y+pr.top))},[x,f]),A=a(e=>{const t={opacity:l,r:s};return t.fill=c?le(e,c,u):Zn,"hover"===p?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*l):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,l,s,p,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(Nn,{ref:y,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:pr,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?w:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e.createElement(fr,{frameRef:y,cellSize:i,xField:o,yField:r,onBrush:k}))}function mr({data:t,field:o,label:r,cellSize:i,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=Rn({name:c,clientId:"splom-diag-"+o}),g=Rn({name:u,clientId:`splom-diag-${o}-hover`}),p="hover"===d?g:h,f=p.isActive,y=p.predicate,m=n(()=>{const e=t.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const n=Math.min(...e),r=(Math.max(...e)-n)/s||1,l="string"==typeof a?a:null,c=l?[...new Set(t.map(e=>e[l]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(s).fill(0),h=Array(s).fill(0),g=Array.from({length:s},()=>Array(c.length).fill(0)),p=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of t){const t=e[o];if(null==t||isNaN(t))continue;const i=Math.min(Math.floor((t-n)/r),s-1);if(d[i]++,f&&!y(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,f&&!y(e)||p[i][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),a={x:t/s*i,w:i/s-1,h:r,y0:n,category:c[o]};return n+=r,a})}),b=p.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),a={x:t/s*i,w:i/s-1,h:r,y0:n,category:c[o]};return n+=r,a})});return{bars:d.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/m*(i-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,o,s,i,f,y,a]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`bg-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Zn,opacity:f?.3:.6}))):m.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Zn,opacity:f?.3:.6})),f&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.createElement("rect",{key:`sel-${n}-${o}`,x:t.x,y:i-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Zn,opacity:.7}))):m.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:Zn,opacity:.7}))))}function vr({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function br(t){const{data:o,fields:r,fieldLabels:i={},colorBy:s,colorScheme:c,cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:p="histogram",histogramBins:f=20,brushMode:y="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:O,chartId:S}=t,j="splom",E="splom-hover",C=m?"hover":y?"brush":"hover",M=$n(e=>e.clearSelection),[P,_]=l(null),B=a(()=>{M(E),_(null)},[M,E]),L=n(()=>(o||[]).map((e,t)=>void 0!==e[gr]?e:Object.assign(Object.assign({},e),{[gr]:t})),[o]),N=no(L,s,c),T=void 0!==k?k:!!s,H=n(()=>{if(!T||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(L.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):Zn})):null},[T,s,L,N]),I=n(()=>({display:"grid",gridTemplateColumns:"40px "+r.map(()=>u+"px").join(" "),gridTemplateRows:r.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[r,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},H&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},H.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:I,onMouseLeave:"hover"===C?B:void 0},r.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},i[t]||t),r.map((o,r)=>n===r?"label"===p?e.createElement(vr,{key:"diag-"+t,label:i[t]||t,cellSize:u}):e.createElement(mr,{key:"diag-"+t,data:L,field:t,label:i[t]||t,cellSize:u,bins:f,colorBy:s,colorScale:N,brushSelectionName:j,hoverSelectionName:E,unselectedOpacity:v,mode:C}):e.createElement(yr,{key:`cell-${t}-${o}`,data:L,xField:o,yField:t,fieldLabels:i,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:s,colorScale:N,brushSelectionName:j,hoverSelectionName:E,unselectedOpacity:v,showGrid:b,tooltip:x,mode:C,onPointHover:"hover"===C?(e,i,s)=>{e?(_({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=s?s:0}),O&&O({type:"hover",datum:e,x:null!=i?i:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})):(_(null),O&&O({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S}))}:void 0})))),e.createElement("div",null)," ",r.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},i[t]||t))),P&&"hover"===C&&(()=>{const t=P.datum,n=i[P.xField]||P.xField,o=i[P.yField]||P.yField,r=s?"function"==typeof s?s(t):t[s]:null,a=w?"function"==typeof w?w(t):t[w]:"Row "+t[gr];return e.createElement("div",{style:{position:"absolute",left:40+P.colIndex*(u+d)+P.px,top:P.rowIndex*(u+d)+P.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},a+""),e.createElement("div",null,n,": ",null!=t[P.xField]?Number(t[P.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[P.yField]?Number(t[P.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof s?s:"group",": ",r+""))})())}function xr(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(Un,{selections:r},e.createElement(br,Object.assign({},t)))}function kr({width:n,height:r,margin:i,scales:s,brushDirection:a,extent:l,onBrush:c}){const u=t(null),d=t(null),f=t(!1),y=n+i.left+i.right,m=r+i.top+i.bottom;return o(()=>{if(!u.current||!s)return;const e=h(u.current).select(".brush-group"),t="x"===a?g().extent([[0,0],[n,r]]):p().extent([[0,0],[n,r]]);return t.on("brush end",e=>{if(f.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===a?s.x:s.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[s,n,r,a,c]),o(()=>{if(!d.current||!s||!u.current)return;const e=h(u.current).select(".brush-group"),t="x"===a?s.x:s.y;if(f.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);f.current=!1},[l,s,a]),e.createElement("svg",{ref:u,width:y,height:m,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-group",transform:`translate(${i.left},${i.top})`}))}function wr(r){var i,s;const{data:c,width:u=600,height:d=400,margin:h,className:g,title:p,description:f,summary:y,xLabel:m,yLabel:v,xFormat:b,yFormat:x,xAccessor:k="x",yAccessor:w="y",lineBy:A,lineDataAccessor:O="coordinates",colorBy:S,colorScheme:j,curve:E="linear",lineWidth:C=2,fillArea:M=!1,areaOpacity:P=.3,showPoints:_=!1,pointRadius:B=3,enableHover:L=!0,showGrid:N=!1,showLegend:T,legendPosition:H,tooltip:I,minimap:F={},renderBefore:z=!1,onBrush:$,brushExtent:D,frameProps:W={},loading:R,emptyContent:G}=r,Y=Qo(R,u,d),q=Y?null:Uo(c,u,d,G),X=c||[],[V,U]=l(null),Q=null!=D?D:V,K=a(e=>{D||U(e),null==$||$(e)},[D,$]),J=t(null),[Z,ee]=l(null);o(()=>{let e=0,t=!1;const n=()=>{var o,r;if(t)return;const i=null===(r=null===(o=J.current)||void 0===o?void 0:o.getScales)||void 0===r?void 0:r.call(o);i?ee(i):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const te=void 0!==(null===(i=X[0])||void 0===i?void 0:i[O]),ne=n(()=>{if(te)return X;if(A){const e=X.reduce((e,t)=>{const n="function"==typeof A?A(t):t[A];if(!e[n]){const t={[O]:[]};"string"==typeof A&&(t[A]=n),e[n]=t}return e[n][O].push(t),e},{});return Object.values(e)}return[{[O]:X}]},[X,A,O,te]),oe=n(()=>te||A?ne.flatMap(e=>{const t=e[O]||[];return A&&"string"==typeof A?t.map(t=>Object.assign(Object.assign({},t),{[A]:e[A]})):t}):X,[ne,O,te,A,X]),re=no(X,S,j),ie=n(()=>e=>{const t={strokeWidth:C};return t.stroke=S?le(e,S,re):Zn,M&&(t.fill=t.stroke,t.fillOpacity=P),t},[S,re,C,M,P]),se=n(()=>F.lineStyle?F.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=S?le(e,S,re):Zn,t},[S,re,F.lineStyle]),ae=n(()=>{if(_)return e=>{const t={r:B,fillOpacity:1};return t.fill=S?le(e.parentLine||e,S,re):Zn,t}},[_,B,S,re]),{legend:ce,margin:ue,legendPosition:de}=io({data:ne,colorBy:S,colorScale:re,showLegend:T,legendPosition:H,userMargin:h}),he=F.height||60,ge=n(()=>{var e,t,n,o,r,i,s,a;return{top:null!==(t=null===(e=F.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=F.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(i=null===(r=F.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:ue.left,right:null!==(a=null===(s=F.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[F.margin,ue]),pe=F.brushDirection||"x",fe=Eo({componentName:"MinimapChart",data:c,accessors:{xAccessor:k,yAccessor:w}});if(fe)return e.createElement(ko,{componentName:"MinimapChart",message:fe,width:u,height:d});const ye=M?"area":"line",me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ye,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:E,lineStyle:ie},_&&{pointStyle:ae}),{size:[u,d],responsiveWidth:r.responsiveWidth,responsiveHeight:r.responsiveHeight,margin:ue,showAxes:!0,xLabel:m,yLabel:v,xFormat:b,yFormat:x,enableHover:L,showGrid:N}),ce&&{legend:ce,legendPosition:de}),p&&{title:p}),f&&{description:f}),y&&{summary:y}),I&&{tooltipContent:fo(I)||void 0}),Q&&{xExtent:Q}),W),ve={chartType:ye,data:oe,xAccessor:k,yAccessor:w,groupAccessor:A||void 0,curve:E,lineStyle:se,size:[u,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(s=F.showAxes)&&void 0!==s&&s,background:F.background,enableHover:!1},be=e.createElement("div",{key:"minimap",style:{position:"relative",width:u,overflow:"hidden"}},e.createElement(Nn,Object.assign({ref:J},ve)),e.createElement(kr,{width:u-ge.left-ge.right,height:he,margin:ge,scales:Z,brushDirection:pe,extent:Q,onBrush:K})),xe=e.createElement("div",{key:"main",style:{overflow:"hidden"}},e.createElement(Nn,Object.assign({},me)));return Y||q||e.createElement(qo,{componentName:"MinimapChart",width:u,height:d},e.createElement("div",{className:"minimap-chart"+(g?" "+g:"")},z?be:xe,z?xe:be))}xr.displayName="ScatterplotMatrix",wr.displayName="MinimapChart";const Ar=c(function(o,r){const i=t(null);u(r,()=>({push:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=i.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=i.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const s=lo(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:a,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:p="y",xCenter:f,yCenter:y,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w,sizeBy:A,sizeRange:O=[3,15],pointRadius:S=5,pointOpacity:j=.8,tooltip:E,pointIdAccessor:C,annotations:M,frameProps:P={},selection:_,linkedHover:B,onObservation:L,onClick:N,hoverHighlight:T,chartId:H,loading:I,emptyContent:F,legendInteraction:z,legendPosition:$,color:D}=o,W=s.width,R=s.height,G=s.enableHover,Y=s.showGrid,q=s.showLegend,X=s.title,V=s.description,U=s.summary,Q=s.accessibleTable,K=s.xLabel,J=s.yLabel,Z=Qo(I,W,R),ee=Z?null:Uo(a,W,R,F),te=a||[];Ko("QuadrantChart",te,"xAccessor",g),Ko("QuadrantChart",te,"yAccessor",p);const{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:se}=oo({selection:_,linkedHover:B,fallbackFields:"string"==typeof k?[k]:[],onObservation:L,onClick:N,chartType:"QuadrantChart",chartId:H,hoverHighlight:T,colorByField:"string"==typeof k?k:void 0}),ae=Jo(_),ce=ro(B,se),de=no(te,k,w),he=n(()=>{if(!k)return[];const e=new Set;for(const t of te){const n="function"==typeof k?k(t):t[k];null!=n&&e.add(n+"")}return Array.from(e)},[te,k]),ge=so(z,k,he),pe=n(()=>oe||(ge.legendSelectionHook?ge.legendSelectionHook:ne),[oe,ge.legendSelectionHook,ne]),fe=n(()=>{if(!te.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of te){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=f&&isFinite(f)&&(n>f&&(n=f),f>o&&(o=f)),null!=y&&isFinite(y)&&(r>y&&(r=y),y>i&&(i=y)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[te,g,p,f,y]),ye=n(()=>{if(!A||0===te.length)return;const e=te.map(e=>"function"==typeof A?A(e):e[A]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[te,A]),me=n(()=>"function"==typeof g?g:e=>+e[g],[g]),ve=n(()=>"function"==typeof p?p:e=>+e[p],[p]),be=n(()=>e=>{const t={fillOpacity:j};if(k)de&&(t.fill=le(e,k,de));else{const n=me(e),o=ve(e),r=null!=f?n>=f:void 0,i=null!=y?o>=y:void 0;t.fill=void 0===i||void 0===r?D||Zn:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?ue(e,A,O,ye):S,t},[k,de,A,O,ye,S,j,me,ve,f,y,m,D]),xe=n(()=>Jn(be,pe,ae),[be,pe,ae]),{legend:ke,margin:we,legendPosition:Ae}=io({data:te,colorBy:k,colorScale:de,showLegend:q,legendPosition:$,userMargin:l,defaults:s.marginDefaults}),Oe=n(()=>{if(!te.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof p&&e.add(p),"string"==typeof k&&e.add(k),"string"==typeof A&&e.add(A);const t=te[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[te,g,p,k,A]),Se=n(()=>xo([...Oe?[{label:Oe,accessor:Oe,role:"title"}]:[],{label:K||yo(g),accessor:g,role:"x",format:d},{label:J||yo(p),accessor:p,role:"y",format:h},...k?[{label:yo(k),accessor:k,role:"color"}]:[],...A?[{label:yo(A),accessor:A,role:"size"}]:[]]),[Oe,g,p,K,J,k,A,d,h]),je=Eo({componentName:"QuadrantChart",data:a,accessors:{xAccessor:g,yAccessor:p}}),Ee=n(()=>{var e;const t={stroke:v.stroke||"#999",strokeWidth:null!==(e=v.strokeWidth)&&void 0!==e?e:1,dashArray:v.strokeDasharray||[]};return[(e,n,o,r)=>{var i;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=r.width,a=r.height,l=null!=f?o.x(f):s/2,c=null!=y?o.y(y):a/2;if(null!=f&&!isFinite(l))return;if(null!=y&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:s-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:a-d},{config:m.bottomRight,x:u,y:d,w:s-u,h:a-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(i=t.config.opacity)&&void 0!==i?i:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[f,y,m,v]),Ce=n(()=>b?[...Ee,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const r=o.width,i=o.height,s=null!=f?n.x(f):r/2,a=null!=y?n.y(y):i/2;(null==f||isFinite(s))&&(null==y||isFinite(a))&&(e.font=`600 ${x}px sans-serif`,e.globalAlpha=.5,e.fillStyle=m.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(m.topLeft.label,8,8),e.fillStyle=m.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(m.topRight.label,r-8,8),e.fillStyle=m.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(m.bottomLeft.label,8,i-8),e.fillStyle=m.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(m.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:Ee,[Ee,b,x,m,f,y]),Me=n(()=>{const e=P.canvasPreRenderers||[];return[...Ce,...e]},[Ce,P.canvasPreRenderers]),Pe=n(()=>{var t;const n={stroke:v.stroke||"#999",strokeWidth:null!==(t=v.strokeWidth)&&void 0!==t?t:1,dashArray:v.strokeDasharray?Array.isArray(v.strokeDasharray)?v.strokeDasharray.join(","):v.strokeDasharray:void 0};return[(t,o,r)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const i=r.width,s=r.height,a=null!=f?o.x(f):i/2,l=null!=y?o.y(y):s/2;if(null!=f&&!isFinite(a))return null;if(null!=y&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l));return e.createElement(e.Fragment,null,[{config:m.topLeft,x:0,y:0,w:c,h:u},{config:m.topRight,x:c,y:0,w:i-c,h:u},{config:m.bottomLeft,x:0,y:u,w:c,h:s-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:s-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.createElement("rect",{key:"qf-"+n,x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08}):null}),e.createElement("line",{x1:c,y1:0,x2:c,y2:s,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.createElement("line",{x1:0,y1:u,x2:i,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),b&&e.createElement(e.Fragment,null,e.createElement("text",{x:8,y:8+x,fill:m.topLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.topLeft.label),e.createElement("text",{x:i-8,y:8+x,fill:m.topRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.topRight.label),e.createElement("text",{x:8,y:s-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:s-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[f,y,m,v,b,x]),_e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(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:"scatter"},null!=a&&{data:te}),{xAccessor:g,yAccessor:p,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:O,pointStyle:xe,colorScheme:w,size:[W,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:we,showAxes:s.showAxes,xLabel:K,yLabel:J,xFormat:d,yFormat:h,enableHover:G,showGrid:Y}),fe&&{xExtent:fe.xExtent,yExtent:fe.yExtent}),ke&&{legend:ke,legendPosition:Ae}),z&&"none"!==z&&{legendHoverBehavior:ge.onLegendHover,legendClickBehavior:ge.onLegendClick,legendHighlightedCategory:ge.highlightedCategory,legendIsolatedCategories:ge.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==Q&&{accessibleTable:Q}),c&&{className:c}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===E?()=>null:!0===E||void 0===E?Se:fo(E)||Se}),(B||L||N||T)&&{customHoverBehavior:re}),(L||N||B)&&{customClickBehavior:ie}),C&&{pointIdAccessor:C}),M&&M.length>0&&{annotations:M}),{canvasPreRenderers:Me}),ce),P),Me.length>0&&{canvasPreRenderers:Me}),{svgPreRenderers:Pe});return Z||ee||(je?e.createElement(ko,{componentName:"QuadrantChart",message:je,width:W,height:R}):e.createElement(qo,{componentName:"QuadrantChart",width:W,height:R},e.createElement(Nn,Object.assign({ref:i},_e))))});Ar.displayName="QuadrantChart";const Or="__ma_unitized",Sr="__ma_series";function jr(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Er(e,t){return t[0]+e*(t[1]-t[0])}const Cr=c(function(o,r){var i,s;const a=t(null),l=t([]);u(r,()=>({push:e=>{if(!a.current)return;const t=e;for(let e=0;o.series.length>e&&2>e;e++){const n=o.series[e],r=n.extent||l.current[e];if(!r)continue;const i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(t);null!=i&&isFinite(i)&&a.current.push(Object.assign(Object.assign({},t),{[Or]:jr(i,r),[Sr]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!a.current)return;const t=[];for(const n of e)for(let e=0;o.series.length>e&&2>e;e++){const r=o.series[e],i=r.extent||l.current[e];if(!i)continue;const s=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=s&&isFinite(s)&&t.push(Object.assign(Object.assign({},n),{[Or]:jr(s,i),[Sr]:r.label||"Series "+(e+1)}))}a.current.pushMany(t)},remove:e=>{var t,n;return null!==(n=null===(t=a.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=a.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}));const c=lo(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,accessibleTable:o.accessibleTable},{width:800,height:400}),{data:d,margin:h,className:g,xFormat:p,xAccessor:f="x",series:y,colorScheme:m,curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:E,chartId:C,loading:M,emptyContent:P,legendInteraction:_,legendPosition:B}=o,L=c.width,N=c.height,T=c.enableHover,H=c.showGrid,I=null===(i=c.showLegend)||void 0===i||i,F=c.title,z=c.description,$=c.summary,D=c.accessibleTable,W=c.xLabel,R=2===y.length;"undefined"==typeof process||"production"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||R||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${y.length}. Rendering as a standard multi-line chart.`);const G=Qo(M,L,N),Y=G?null:Uo(d,L,N,P),q=d||[],X=eo(),V=n(()=>{let e;if(Array.isArray(m))e=m;else if(X&&X.length>0)e=X;else{const t=re[m];e=Array.isArray(t)?t:ie}return y.map((t,n)=>t.color||e[n%e.length])},[y,m,X]),U=n(()=>y.map((e,t)=>e.label||"Series "+(t+1)),[y]),{unitizedData:Q,extents:K}=n(()=>{if(0===q.length){const e=y.map(e=>e.extent||null).filter(Boolean);return e.length===y.length&&(l.current=e),{unitizedData:[],extents:e.length===y.length?e:[]}}const e=y.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(q,e.yAccessor));if(l.current=e,!R){const t=[];for(const e of q)for(let n=0;y.length>n;n++){const o=y[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push(Object.assign(Object.assign({},e),{[Or]:r,[Sr]:U[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of q)for(let o=0;2>o;o++){const r=y[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push(Object.assign(Object.assign({},n),{[Or]:jr(i,e[o]),[Sr]:U[o]}))}return{unitizedData:t,extents:e}},[q,y,R,U]),J=n(()=>{if(R&&K.length>=2)return[{orient:"left",label:U[0],tickFormat:y[0].format||(e=>{const t=Er(e,K[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:U[1],tickFormat:y[1].format||(e=>{const t=Er(e,K[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[R,K,y,U]),Z=ar({data:n(()=>Q.length>0?Q:U.map(e=>({[Sr]:e})),[Q,U]),rawData:d,colorBy:Sr,colorScheme:V,legendInteraction:_,legendPosition:B,selection:A,linkedHover:O,fallbackFields:[Sr],unwrapData:!1,onObservation:S,onClick:j,hoverHighlight:E,chartType:"MultiAxisLineChart",chartId:C,showLegend:I,userMargin:h,marginDefaults:R?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:M,emptyContent:P,width:L,height:N});if(Z.earlyReturn)return Z.earlyReturn;const ee=n(()=>{const e=new Map;return U.forEach((t,n)=>e.set(t,V[n])),t=>({stroke:e.get(t[Sr])||V[0],strokeWidth:b,fill:"none"})},[U,V,b]),te=n(()=>Jn(ee,Z.effectiveSelectionHook,Z.resolvedSelection),[ee,Z.effectiveSelectionHook,Z.resolvedSelection]),ne=n(()=>{if(!1===x)return()=>null;return fo(x)||(t=>{var n;const o=t.data||t,r=o[Sr],i=U.indexOf(r),s=o[Or],a=R&&i>=0&&K[i]?Er(s,K[i]):s,l=i>=0&&(null===(n=y[i])||void 0===n?void 0:n.format)?y[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof f?f(o):o[f];return e.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},e.createElement("div",{style:{fontWeight:600,marginBottom:4,color:V[i]||"inherit"}},r),e.createElement("div",null,`${"string"==typeof f?f:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(a)}`))})},[x,U,V,K,R,y,f]),oe=Eo({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:f}}),se=R?[0,1]:void 0,ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:Q}),{xAccessor:f,yAccessor:Or,groupAccessor:Sr,lineStyle:te,colorScheme:V,size:[L,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,showAxes:c.showAxes}),J&&{axes:J}),{xLabel:W}),R?{}:{yLabel:U[0]}),{xFormat:p}),R&&se&&{yExtent:se}),{enableHover:T}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:H,curve:v}),Z.legendBehaviorProps),F&&{title:F}),z&&{description:z}),$&&{summary:$}),void 0!==D&&{accessibleTable:D}),g&&{className:g}),null!=o.animate&&{animate:o.animate}),{tooltipContent:ne}),k&&{annotations:k}),(O||S||j||E)&&{customHoverBehavior:Z.customHoverBehavior}),(S||j||O)&&{customClickBehavior:Z.customClickBehavior}),Z.crosshairProps),w);return G||Y||(oe?e.createElement(ko,{componentName:"MultiAxisLineChart",message:oe,width:L,height:N}):e.createElement(qo,{componentName:"MultiAxisLineChart",width:L,height:N},e.createElement(Nn,Object.assign({ref:a},ae))))});Cr.displayName="MultiAxisLineChart";export{rr as AreaChart,dr as BubbleChart,ur as ConnectedScatterplot,hr as Heatmap,or as LineChart,wr as MinimapChart,Cr as MultiAxisLineChart,Ar as QuadrantChart,lr as Scatterplot,xr as ScatterplotMatrix,sr as StackedAreaChart,Nn as StreamXYFrame};