semiotic 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CLAUDE.md +7 -4
  2. package/ai/schema.json +97 -1
  3. package/dist/components/charts/ordinal/BarChart.d.ts +2 -0
  4. package/dist/components/charts/ordinal/DonutChart.d.ts +2 -0
  5. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +4 -0
  6. package/dist/components/charts/ordinal/PieChart.d.ts +2 -0
  7. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -0
  8. package/dist/components/realtime/types.d.ts +42 -3
  9. package/dist/components/server/renderToStaticSVG.d.ts +1 -0
  10. package/dist/components/server/serverChartConfigs.d.ts +17 -0
  11. package/dist/components/server/themeResolver.d.ts +4 -0
  12. package/dist/components/store/ThemeStore.d.ts +14 -0
  13. package/dist/components/stream/NetworkPipelineStore.d.ts +7 -1
  14. package/dist/components/stream/geoTypes.d.ts +4 -4
  15. package/dist/components/stream/hoverUtils.d.ts +22 -0
  16. package/dist/components/stream/networkTypes.d.ts +14 -22
  17. package/dist/components/stream/ordinalTypes.d.ts +10 -0
  18. package/dist/components/stream/pipelineDecay.d.ts +6 -5
  19. package/dist/components/stream/types.d.ts +4 -0
  20. package/dist/geo.min.js +1 -1
  21. package/dist/geo.module.min.js +1 -1
  22. package/dist/network.min.js +1 -1
  23. package/dist/network.module.min.js +1 -1
  24. package/dist/ordinal.min.js +1 -1
  25. package/dist/ordinal.module.min.js +1 -1
  26. package/dist/realtime.min.js +1 -1
  27. package/dist/realtime.module.min.js +1 -1
  28. package/dist/semiotic-ai.min.js +1 -1
  29. package/dist/semiotic-ai.module.min.js +1 -1
  30. package/dist/semiotic-themes.min.js +1 -1
  31. package/dist/semiotic-themes.module.min.js +1 -1
  32. package/dist/semiotic-utils.min.js +1 -1
  33. package/dist/semiotic-utils.module.min.js +1 -1
  34. package/dist/semiotic.min.js +1 -1
  35. package/dist/semiotic.module.min.js +1 -1
  36. package/dist/server.min.js +1 -1
  37. package/dist/server.module.min.js +1 -1
  38. package/dist/xy.min.js +1 -1
  39. package/dist/xy.module.min.js +1 -1
  40. package/package.json +1 -1
@@ -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 a,useContext as s,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 f,brush as p}from"d3-brush";import{scaleOrdinal as y,scaleLinear as m,scaleLog as v,scaleTime as b,scaleSequential as x,scaleBand as k}from"d3-scale";import{quadtree as w}from"d3-quadtree";import{interpolatePlasma as A,interpolateViridis as S,interpolatePurples as O,interpolateOranges as E,interpolateGreens as j,interpolateReds as C,interpolateBlues as P,schemeSet3 as M,schemeTableau10 as L,schemeCategory10 as _}from"d3-scale-chromatic";import{bin as T,quantile as B,min as N,groups as D,max as I,sum as H,mean as W,group as F}from"d3-array";import{packEnclose as z,hierarchy as R,partition as $,pack as G,treemap as Y,treemapBinary as q,cluster as X,tree as V}from"d3-hierarchy";import{area as U,curveCatmullRom as K,curveCardinal as Q,curveBasis as Z,curveStepBefore as J,curveStepAfter as ee,curveStep as te,curveMonotoneY as ne,curveMonotoneX as oe,curveLinear as re,arc as ie,line as ae,curveNatural as se,pie as le}from"d3-shape";import ce from"regression";import{interpolateNumber as ue}from"d3-interpolate";import{forceLink as de,forceSimulation as he,forceManyBody as ge,forceCenter as fe,forceX as pe,forceY as ye}from"d3-force";import{ribbon as me,chord as ve}from"d3-chord";function be(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 xe(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 ke({width:r,height:i,totalWidth:a,totalHeight:s,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 S=t(u);S.current=u;const O=n(()=>v?[...v].sort((e,t)=>e-t):void 0,[v]),E=t(O);E.current=O;const j=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?f():p();return t.extent([[0,0],[r,i]]),t.on("brush end",n=>{if(j.current)return;const o=S.current;if(!o)return;if(!n.selection)return C.current=null,void A.current(null);let a,s;if("x"===c){const[e,t]=n.selection;a=[o.x.invert(e),o.x.invert(t)],s=[o.y.invert(i),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;a=[o.x.invert(0),o.x.invert(r)],s=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[r,i]]=n.selection;a=[o.x.invert(e),o.x.invert(r)],s=[o.y.invert(i),o.y.invert(t)]}if("bin"===m&&"y"!==c&&("end"===n.type||"brush"===n.type&&b)){const r=E.current;r&&r.length>0?a=function(e,t){return 0===t.length?e:[be(e[0],t),xe(e[1],t)]}(a,r):y&&y>0&&(a=[Math.floor(a[0]/y)*y,Math.ceil(a[1]/y)*y]);const i=o.x(a[0]),s=o.x(a[1]);if(j.current=!0,"x"===c)e.call(t.move,[i,s]);else if("xy"===c){const o=n.selection;e.call(t.move,[[i,o[0][1]],[s,o[1][1]]])}j.current=!1}const l={x:a,y:s};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 j.current=!0,n.call(w.current.move,null),j.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=E.current;e&&e.length>0?o=xe(t,e):y&&y>0&&(o=Math.ceil(t/y)*y)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,C.current=null,void A.current(null);r=!0}const i=u.x(o),a=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[i,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[i,t],[a,o]])}if(j.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:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`}))}class we{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 Ae{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,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[i]=t(a)}}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 Se{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 Oe(e,t,n,o,r){const i=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))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+=s,r){const e=r(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function Ee(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function je(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Ce(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Pe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const Me={category10:_,tableau10:L,set3:M,blues:P,reds:C,greens:j,oranges:E,purples:O,viridis:S,plasma:A},Le=_,_e=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Te=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Be=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 Ne(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")||Be.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Le[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+""))%Le.length]}function De(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=Me[n]||Me.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:Le;return y().domain(o).range(e).unknown("#999")}}function Ie(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,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}function He(e,t,n){var o,r,i;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>s?1:a;default:return 1}}function We(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 Fe(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function ze(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Re(e,t,n){return e+(t-e)*n}function $e(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ge(e,t,n){var o,r,i,a;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!==(a=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!==a?a: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 a=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||a.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:r,datum:c,group:i}}function qe(e,t,n,o,r,i,a,s){const l=[];for(const i of e){const e=n(i),a=o(i);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const c=t.x(e),u=s?s(i):r;l.push({px:c,topY:t.y(a),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:a}}function Xe(e,t,n,o,r,i,a){const s=n(e),l=o(e);if(null==s||null==l||Number.isNaN(s)||Number.isNaN(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:r,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function Ve(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function Ue(e,t,n,o,r,i,a){const s={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==a?void 0:a.showValues)&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function Ke(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 a=e.getBounds(n),s=e.scales.x(t);if(a&&0!==a)o.push([s,e.scales.y(i+a)]),r.push([s,e.scales.y(i-a)]);else{const t=e.scales.y(i);o.push([s,t]),r.push([s,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 Qe(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 a of o.data){let o=e.config.pointStyle(a);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const s=null!==(r=o.r)&&void 0!==r?r:3,l=e.getPointId?e.getPointId(a)+"":void 0,c=Xe(a,e.scales,e.getX,i,s,o,l);c&&n.push(c)}}}const Ze={blues:P,reds:C,greens:j,viridis:S},Je=new Map;class et{constructor(e){if(this.xExtent=new Se,this.yExtent=new Se,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 Ae(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=je(e.timeAccessor||e.xAccessor,"time"),this.getY=je(e.valueAccessor||e.yAccessor,"value")):(this.getX=je(e.xAccessor,"x"),this.getY=je(e.yAccessor,"y")),this.getGroup=Pe(e.groupAccessor),this.getCategory=Pe(e.categoryAccessor),this.getSize=e.sizeAccessor?je(e.sizeAccessor,"size"):void 0,this.getColor=Pe(e.colorAccessor),this.getBounds=e.boundsAccessor?je(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?je(e.y0Accessor,"y0"):void 0,this.getPointId=Pe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?je(e.openAccessor,"open"):void 0,this.getHigh=je(e.highAccessor,"high"),this.getLow=je(e.lowAccessor,"low"),this.getClose=n?je(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Ae(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?je(this.config.timeAccessor||this.config.xAccessor,"time"):je(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,a,s;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,f=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 p=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!p&&c.size>0)if(l.normalize)f=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)f=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);f=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:f}}}else if("bar"===l.chartType&&l.binSize&&!p&&c.size>0){const[,e]=function(e,t,n,o,r){const i=Oe(e,t,n,o,r);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(c,this.getX,this.getY,l.binSize,this.getCategory);f=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!p&&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;f=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!p&&f[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>f[1]&&(f[1]=t+n),f[0]>t-n&&(f[0]=t-n))}const e=f[1]-f[0],t=e>0?e*l.extentPadding:1,n=null===(a=l.yExtent)||void 0===a?void 0:a[0],o=null===(s=l.yExtent)||void 0===s?void 0:s[1];f=[null!=n?f[0]:f[0]-t,null!=o?f[1]:f[1]+t],"log"===l.yScaleType&&0>=f[0]&&h[0]>0&&(f[0]=null!=n?f[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];f[0]!==1/0&&f[1]!==-1/0||(f=[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(f).range([e.height-x,x])}}else{const t="down"===l.arrowOfTime?[x,e.height-x]:[e.height-x,x];this.scales={x:m().domain(f).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,f,[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>et.QUADTREE_THRESHOLD?w().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(),a=this.scales.y.range(),s=(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=a[1]>a[0];this.scales={x:s(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:s(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=Ke(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 Qe(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]),a=qe(t.data,e.scales,e.getX,e.getY,r,n,t.key,i);e.config.gradientFill&&(a.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),o.push(a)}return Qe(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],a=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=qe(t.data,e.scales,e.getX,e.getY,i,n,t.key,a);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 Qe(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,a){var s;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===(s=u.get(o.key))||void 0===s?void 0:s.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,f=new Map;for(const e of c)f.set(e,0);for(const n of e){const e=u.get(n.key),o=[],s=[],l=new Map;for(const n of c){let r=e.get(n)||0;const a=f.get(n);i&&(r/=d.get(n));const c=a+r,u=t.x(n);s.push([u,t.y(a)]),o.push([u,t.y(c)]),f.set(n,c),l.set(n,c)}g.set(n.key,l);const p={type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key};a&&(p.curve=a),h.push(p)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),a=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)};Qe(e,n,a,o)}return a}(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 a=e.getColor?e.resolveColorMap(t):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:"#4e79a7",opacity:.8},s=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(s=i(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(r);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const l=e.getPointId?e.getPointId(r)+"":void 0,c=Xe(r,e.scales,e.getX,e.getY,s,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 a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),s=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=je(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/a,p=(g-h||1)/s,y=a*s;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)/f),a-1),d=Math.min(Math.floor((i-h)/p),s-1);if(0>l||0>d)continue;const g=d*a+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/a,A=n.height/s,S=e.config.showValues,O=e.config.heatmapValueFormat,E=[];for(let e=0;s>e;e++){const t=e*a;for(let n=0;a>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;E.push(Ue(n*w,(s-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]},S?{value:r,showValues:!0,valueFormat:O}:void 0))}}return E}(e,t,n);if(0===t.length)return[];const o=je(e.config.valueAccessor,"value"),r=Ce(e.config.xAccessor,"x"),i=Ce(e.config.yAccessor,"y"),a=new Map,s=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,a.has(o)||a.set(o,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),g=Array.from(s.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(p){g.sort((e,t)=>e-t),s.clear();for(let e=0;g.length>e;e++)s.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=a.get(l[e]),i=s.get(c[e]);if(void 0===r||void 0===i)continue;const d=o(n),h=i*u+r,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=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 Ze?e:"blues";let n=Je.get(t);if(n)return n;n=Array(256);const o=Ze[t]||P;for(let e=0;256>e;e++)n[e]=o(e/255);return Je.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:"blues"),S=255/(w-k||1),O=n.width/u,E=n.height/d,j=e.config.showValues,C=e.config.heatmapValueFormat,M=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;M.push(Ue(o*O,(d-1-(n-o)/u)*E,O,E,A[Math.min((t-k)*S+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:C}:void 0))}return M}(i,t,e);case"bar":{const e=function(e,t){var n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Oe(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),a=Array.from(t).filter(e=>!i.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const i=[],a=e.scales,[s,l]=a.x.domain();for(const t of o.values()){const o=Math.max(t.start,s),c=Math.min(t.end,l);if(o>=c)continue;const u=a.x(o),d=a.x(c),h=Math.abs(d-u),g=h>2?1:0,f=Math.min(u,d)+g/2,p=Math.max(h-g,1);if(p>0)if(r&&t.categories.size>0){let o=0;for(const s of r){const r=t.categories.get(s)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r);i.push(Ve(f,Math.min(l,c),p,Math.abs(l-c),{fill:(null===(n=e.config.barColors)||void 0===n?void 0:n[s])||"#4e79a7"},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:r},s)),o+=r}}else{const e=a.y(0),n=a.y(t.total);i.push(Ve(f,Math.min(e,n),p,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 a=[],s=e.config.swarmStyle||{},l=null!==(n=s.radius)&&void 0!==n?n:3,c=null!==(o=s.fill)&&void 0!==o?o:"#007bff",u=null!==(r=s.opacity)&&void 0!==r?r:.7,d=s.stroke,h=s.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),s=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 f={type:"point",x:r,y:s,r:l,style:{fill:g,opacity:u,stroke:d,strokeWidth:h},datum:n};e.getPointId&&(f.pointId=e.getPointId(n)+""),a.push(f)}return a}(i,t);case"waterfall":return function(e,t,n){var o,r,i;const a=[],s=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 a;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,f=null==l?void 0:l.strokeWidth;let p=0;for(let t=0;c.length>t;t++){const o=c[t],r=e.getX(o),i=e.getY(o),y=p+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=s.x(r),b=0!==m?s.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){p=y;continue}const w=s.y(p),A=s.y(y);a.push(Ve(x,Math.min(w,A),k,Math.abs(w-A),{fill:0>i?d:u,stroke:g,strokeWidth:f},Object.assign(Object.assign({},o),{baseline:p,cumEnd:y,delta:i,_connectorStroke:null==l?void 0:l.connectorStroke,_connectorWidth:null==l?void 0:l.connectorWidth}))),p=y}return a}(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=[],a=e.config.candlestickStyle||{},s=a.rangeColor||"#6366f1",l=r?s:a.upColor||"#28a745",c=r?s:a.downColor||"#dc3545",u=r?s:a.wickColor||"#333",d=a.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=a.bodyWidth)&&void 0!==o?o:0;if(!r&&null==a.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!=a.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),a=e.getLow(n);if(null==o||Number.isNaN(o)||null==a||Number.isNaN(a))continue;const s=r?o:e.getOpen(n),h=r?a:e.getClose(n);if(!r&&[s,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=s,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(s),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(a),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};r&&(p.isRange=!0),i.push(p)}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?He(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 a=new Map;for(let e=0;n.length>e;e++)a.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 s=a.get(t[n]);null!=s?(o[n]=He(e,s,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 s=!1;for(let n=0;t.length>n;n++){const o=a.get(t[n]);null!=o?(r[n]=He(e,o,i),1>r[n]&&(s=!0)):r[n]=1}s&&(n._decayOpacities=r)}else{let r=1;for(const n of t){const t=a.get(n);if(null!=t){const n=He(e,t,i);r>n&&(r=n)}}if(1>r){const e=Array(o);e.fill(r),n._decayOpacities=e}}continue}const t=a.get(n.datum);if(null==t)continue;const s=He(e,t,i);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;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*s})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var r,i;const a="undefined"!=typeof performance?performance.now():Date.now(),s=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 s=We(e,i,a);s>r&&(r=s)}r>0&&(n._pulseIntensity=r,n._pulseColor=s);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);if(null==r)continue;const i=We(e,r,a);i>0&&(n._pulseIntensity=i,n._pulseColor=s,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,a;n.clear(),o.clear();for(let s=0;t.length>s;s++){const l=t[s],c=Ge(e,l,s);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===(a=l.style)||void 0===a?void 0:a.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,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,P,M,L,_;if(0===o.size&&0===r.size)return n;const T=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 B=!1;const N=new Set,D=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],A=Ge(e,i,t);if(!A)continue;if(i._transitionKey=A,"line"===i.type||"area"===i.type){const e=r.get(A);if(e){if(D.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]];B=!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]];B=!0}i._targetOpacity=null!==(a=i.style.opacity)&&void 0!==a?a:1,i._startOpacity=null!==(l=null!==(s=e.opacity)&&void 0!==s?s: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}),B=!0;continue}const S=o.get(A);if("point"===i.type)if(S){N.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,S.x===e.x&&S.y===e.y&&S.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=S.x,i.y=S.y,i.r=null!==(d=S.r)&&void 0!==d?d:i.r,B=!0)}else i._targetOpacity=null!==(h=i.style.opacity)&&void 0!==h?h:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("rect"===i.type)if(S){N.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,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(f=S.w)&&void 0!==f?f:i.w,i.h=null!==(p=S.h)&&void 0!==p?p:i.h,B=!0)}else i._targetOpacity=null!==(y=i.style.opacity)&&void 0!==y?y:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("heatcell"===i.type)if(S){N.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,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(b=S.w)&&void 0!==b?b:i.w,i.h=null!==(x=S.h)&&void 0!==x?x:i.h,B=!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}),B=!0}for(const[e,t]of r)if(!D.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),B=!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!==(S=t.opacity)&&void 0!==S?S:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),B=!0}for(const[e,t]of o)if(!N.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(O=t.r)&&void 0!==O?O:3,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E: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!==(j=t.w)&&void 0!==j?j:0,h:null!==(C=t.h)&&void 0!==C?C:0,style:{opacity:null!==(P=t.opacity)&&void 0!==P?P: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!==(M=t.w)&&void 0!==M?M:0,h:null!==(L=t.h)&&void 0!==L?L:0,fill:"#999",datum:null,style:{opacity:null!==(_=t.opacity)&&void 0!==_?_:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}B=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),B&&(n.activeTransition={startTime:$e(),duration:T}),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,a,s,l;if(!n.activeTransition)return!1;const c=ze(e,n.activeTransition),u=Fe(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=Re(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,u),e.y=Re(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=Re(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=Re(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,u),e.y=Re(n.y,e._targetY,u),void 0!==n.w&&(e.w=Re(n.w,e._targetW,u)),void 0!==n.h&&(e.h=Re(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!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Re(r,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,u),e.y=Re(n.y,e._targetY,u),void 0!==n.w&&(e.w=Re(n.w,e._targetW,u)),void 0!==n.h&&(e.h=Re(n.h,e._targetH,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(s=e._startOpacity)&&void 0!==s?s:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Re(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]=Re(t[o][0],n[o][0],u),e.path[o][1]=Re(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:Re(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]=Re(t[n][0],o[n][0],u),e.topPath[n][1]=Re(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]=Re(n[t][0],r[t][0],u),e.bottomPath[t][1]=Re(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:_e,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:_e,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");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 a=!1;Object.assign(this.config,e);const s="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(s||void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor){const l=s||!Ee(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=s||!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=je(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=je(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=je(this.config.xAccessor,"x"),this.getY=je(this.config.yAccessor,"y")),a=!0)}if("groupAccessor"in e&&!Ee(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Pe(this.config.groupAccessor):void 0,a=!0),"categoryAccessor"in e&&!Ee(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Pe(this.config.categoryAccessor):void 0,a=!0),"sizeAccessor"in e&&!Ee(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?je(this.config.sizeAccessor,"size"):void 0,a=!0),"colorAccessor"in e&&!Ee(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0,a=!0),"y0Accessor"in e&&!Ee(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?je(this.config.y0Accessor,"y0"):void 0,a=!0),"pointIdAccessor"in e&&!Ee(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Pe(this.config.pointIdAccessor):void 0,a=!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?je(this.config.openAccessor,"open"):void 0,this.getHigh=je(this.config.highAccessor,"high"),this.getLow=je(this.config.lowAccessor,"low"),this.getClose=t?je(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,a=!0}if(!a){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){a=!0;break}}a&&(this.needsFullRebuild=!0)}}function tt(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 nt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ot(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function rt(e,t){const n=ot(e);if(!n)return!1;const o=ot(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function it(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function at(e,t,n,o=30,r){let i=null,a=!1;if(r){const e=r.find(t,n,o);if(e){const r=lt(e,t,n,o);r&&o>r.distance&&(i=r,a=!0)}}for(const s of e){let e=null;switch(s.type){case"point":if(r&&a)break;e=lt(s,t,n,o);break;case"line":e=ct(s,t,n,o);break;case"rect":e=dt(s,t,n);break;case"heatcell":e=ht(s,t,n);break;case"area":if(!1===s.interactive)break;e=ft(s,t,n);break;case"candlestick":e=gt(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}function st(e,t,n){if(0===e.length)return null;const o=pt(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[a,s]=e[r],[l,c]=e[i];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function lt(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function ct(e,t,n,o=30){var r,i,a,s;if(0===e.path.length)return null;const l=pt(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 a=r;i>=a;a++){const[r,i]=e.path[a],[s,l]=e.path[a+1],c=ut(t,n,r,i,s,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!==(s=null!==(i=null===(r=e.style)||void 0===r?void 0:r.strokeWidth)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.lineWidth)&&void 0!==s?s: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 ut(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function dt(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function ht(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function gt(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,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+a*a)}}return null}function ft(e,t,n){if(0===e.topPath.length)return null;const o=pt(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],a=t-r,s=n-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function pt(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 yt(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 a=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&&a.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:a}}function mt(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}}function vt(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?bt(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?bt(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}}function bt(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 xt(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})}function kt(e,n,i){const a=t(null),[s,l]=r(null);return o(()=>{if(!n&&!i)return;const e=a.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]),[a,[n&&s?s.w:e[0],i&&s?s.h:e[1]]]}function wt(e,t,n,r,i,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}et.QUADTREE_THRESHOLD=500;const At={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 St(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,At[n])(o(e,t)),r}function Ot(){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 Et(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function jt({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=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":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+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":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),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 Ct(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[f,p]=e.useState(0),y=e.useCallback((e,t)=>{g(e),p(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,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,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,f=[];let p=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=St(t,u,d,h),b=Et(t,r,i),x=i&&i.size>0&&i.has(t.label);f.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===a&&u===s?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(Ot,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),p+=22}),f})(t,o,r,i,a,s,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let f=0;t.label&&(f+=16);const p=((t,n,o,r,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;f.forEach((t,u)=>{const x=St(t,u,h,g),k=Et(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),p.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===a&&u===s?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)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus: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(Ot,null),e.createElement("text",{y:8,x:22,dominantBaseline:"central",fontSize:12,fill:"var(--semiotic-text, #333)"},t.label))),y+=A});let x=0,k=0;for(const e of f){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:p,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,a,s,l,c,n,u,d,o);f+=p.offset+5,g.push(Object.assign(Object.assign({label:t.label},p),{offset:f,totalRows:p.totalRows,totalHeight:p.totalHeight})),h+=f+12});let f=h>o?0:Math.max(0,(o-h)/2);const p=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(p.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),f+=16),p.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${f},0)`},o.items)),f+=o.offset+5,t[r+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:f,y1:-8,x2:f,y2:(o.totalHeight||n)+0+8})),f+=12}),e.createElement("g",null,p)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==a))||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 Pt(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===a||"bottom"===a;let f,p;return"left"===a?(f=4,p=i.top):"top"===a?(f=0,p=s?32:8):"bottom"===a?(f=0,p=r-i.bottom+50):(f=o-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${f}, ${p})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(n)?e.createElement(jt,{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(Ct,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)}function Mt(e){return"string"==typeof e?{type:e}:e}function Lt({orient:t,config:o,values:r,scale:i,size:a,length:s}){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=a-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)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*o,20),f=(o-g)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),p=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*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+y*f,x2:c,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-f-g:m+f,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-f-g:m+f,x2:r,y2:"top"===t?m-f:m+f+g,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),y="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+y*(f+g/2),y1:c,x2:m+y*(f+g/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:c,x2:m+y*(f+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-f-g:m+f,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-f-g:m+f,y1:r,x2:"left"===t?m-f:m+f+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=T().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 a=n.length/d*o;if(c){const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-a:4,y:Math.min(o,o+s),width:a,height:Math.abs(s),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 a=e.length/d*(o/2),s=i((e.x0+e.x1)/2);r.push(c?`${s},${"top"===t?-(n-a):n-a}`:`${"left"===t?-(n-a):n-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(o/2),l=i((a.x0+a.x1)/2);r.push(c?`${l},${"top"===t?-(n+s):n+s}`:`${"left"===t?-(n+s):n+s},${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,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${a},${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,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${e},${a}`),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,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function _t(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Tt(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 Bt(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(f)?f:[]);let v=r||0,b=i||0;null!=a&&(v=a-n),null!=s&&(b=s-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},p),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+a*h,c=i+s*h}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.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&&(s.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,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.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)&&s.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)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,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)-a;s.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)?s.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)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Tt((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"},s)}(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:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const f=16,p=a?u?[a]:_t(a,c):[],y=i?u?[i]:_t(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=r||"var(--semiotic-text, #333)";p.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:f},t)))),v=p.length*f),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:f},t))));let k=null;if((a||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=(p.length+y.length)*f+(y.length>0?f: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,p.length+y.length-1)*f;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+f+(y.length>0&&p.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 Nt(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=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:s});return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}function Dt(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 It(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 Ht(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Dt(e,n),c=It(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Wt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Ft={linear:re,monotoneX:oe,monotoneY:ne,step:te,stepAfter:ee,stepBefore:J,basis:Z,cardinal:Q,catmullRom:K};function zt(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,P,M,L,_,T,B,N,D,I,H,W,F,R,$,G,Y,q,X,V,K,Q,Z,J;switch(t.type){case"label":{const r=Ht(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Wt(i,a,o)?e.createElement(Nt,{key:"ann-"+n,noteData:{x:i,y:a,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=Ht(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Wt(i,a,o)?e.createElement(Nt,{key:"ann-"+n,noteData:{x:i,y:a,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=Dt(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"top";let s;return s="bottom"===a?(o.height||0)-4:"center"===a?(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:s,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=It(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"right";let s,l;return"left"===a?(s=4,l="start"):"center"===a?(s=(o.width||0)/2,l="middle"):(s=(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:s,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Dt(Object.assign(Object.assign({},e),{type:"point"}),o),y:It(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=z(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-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:Dt(Object.assign(Object.assign({},e),{type:"point"}),o),y:It(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,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+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):[],a={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Dt(n,o),s=It(n,o);if(null==i||null==s)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||a;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:l},c))}))}case"bracket":{const r=Dt(t,o),i=It(t,o);return e.createElement(Nt,{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",f=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const p=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,y=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!p||!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]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=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],f+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*f-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(f,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?ce.polynomial(f,{order:t.order||2}):ce.linear(f)).points;const b=v.map(([e,t])=>`${p(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:p(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!==(f=null==r?void 0:r(t.y0))&&void 0!==f?f:0,a=null!==(p=null==r?void 0:r(t.y1))&&void 0!==p?p:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-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,a)-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",a=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,s=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(!a||!s)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=Ft[o.curve||"linear"]||re,g=U().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const f=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:f,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(S=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==S?S:null===(O=o.scales)||void 0===O?void 0:O.time,s=null!==(j=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==j?j:null===(C=o.scales)||void 0===C?void 0:C.value;if(!a||!s)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!==(P=t.threshold)&&void 0!==P?P:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(M=t.fillOpacity)&&void 0!==M?M:.1,m=t.anomalyColor||"#ef4444",v=null!==(L=t.anomalyRadius)&&void 0!==L?L:6,b=s(c+h*d),x=s(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},f&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const r=Dt(t,o),i=It(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:p,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(T=null===(_=o.scales)||void 0===_?void 0:_.x)&&void 0!==T?T:null===(B=o.scales)||void 0===B?void 0:B.time,l=null!==(D=null===(N=o.scales)||void 0===N?void 0:N.y)&&void 0!==D?D:null===(I=o.scales)||void 0===I?void 0:I.value;if(!s||!l)return null;const c=r.map(e=>[e[i],e[a]]).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=ce.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 a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*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)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),y=null!==(H=t.confidence)&&void 0!==H?H:.95,m=.99>y?.95>y?.9>y?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+(p>0?Math.pow(e-f,2)/p:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),O=`${s(b)},${l(u(b))}`,E=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(F=t.fillOpacity)&&void 0!==F?F:.15,stroke:"none"}),e.createElement("polyline",{points:`${O} ${S}`,fill:"none",stroke:E,strokeWidth:null!==(R=t.strokeWidth)&&void 0!==R?R:2,strokeDasharray:null!==($=t.strokeDasharray)&&void 0!==$?$:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:s(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:E,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=Ht(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Wt(r,i,o))return null;const a=null!==(G=t.dx)&&void 0!==G?G:0,s=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(q=t.width)&&void 0!==q?q:32,c=null!==(X=t.height)&&void 0!==X?X:32,u=null!==(V=t.content)&&void 0!==V?V:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-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=Ht(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(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===(K=o.scales)||void 0===K?void 0:K.o,a=null===(Q=o.scales)||void 0===Q?void 0:Q.x,s=null===(Z=o.scales)||void 0===Z?void 0:Z.y,l=(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:(null==s?void 0:s.bandwidth)?s: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!==(J=t.opacity)&&void 0!==J?J:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===a)?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}}}let Rt={positions:new Map};const $t=new Set;function Gt(){for(const e of $t)e()}function Yt(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},Gt()}function qt(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},Gt()}function Xt(){return Rt}function Vt(e){return $t.add(e),()=>$t.delete(e)}const Ut={positions:new Map};function Kt(){return()=>{}}function Qt(){return Ut}function Zt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Jt(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 a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function en(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,f=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||tn,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)))),a=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,a)})),c=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);return nn(s,Math.max(55,c+8))},[l,u,h,o]),p=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||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return nn(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,S="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&(()=>{var t,n;const i=Zt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),a=Zt(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"},f.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})),p.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:a})))})(),x&&!w&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:S,strokeWidth:1}),w&&e.createElement("path",{d:Jt("bottom",o,r),fill:"none",stroke:S,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:S,strokeWidth:1}),A&&e.createElement("path",{d:Jt("left",o,r),fill:"none",stroke:S,strokeWidth:1})))}function tn(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function nn(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 on(r){var a,s;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,axes:p,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j,legendPosition:C="right",foregroundGraphics:P,marginalGraphics:M,xValues:L,yValues:_,annotations:T,svgAnnotationRules:B,xAccessor:N,yAccessor:D,annotationData:I,pointNodes:H,curve:W,underlayRendered:F,linkedCrosshairName:z,linkedCrosshairSourceId:R,children:$}=r,G=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||tn,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()),a=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),s=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),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(s+8,55)):Math.max(55,s+8);let u=nn(a,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},[f,g,p,b,l]),Y=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=nn(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},[f,g,p,x,c]),q=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||tn,o=null!==(e=t.ticks)&&void 0!==e?e:5;return nn(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)},[f,g,p,x,c]),X=t(new Map),V=t(null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0),U=null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0;V.current!==U&&(V.current=U,X.current=new Map);const K=n(()=>{if(!T||0===T.length)return null;const e=zt(),t={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:N,yAccessor:D,width:l,height:c,data:I,frameType:"xy",pointNodes:H,curve:W,stickyPositionCache:X.current};return T.map((n,o)=>{if(B){const r=B(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[T,B,l,c,N,D,I,g,H,W]),Q=function(e){var t;const n=i(e?Vt:Kt,e?Xt:Qt,e?Xt:Qt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(z);return o(()=>{if(!(null==Q?void 0:Q.locked)||!z)return;const e=e=>{"Escape"===e.key&&qt(z)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Q?void 0:Q.locked,z]),f||w||A||P||M||K&&K.length>0||k||$||Q?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&&!F&&(()=>{var t,n;const o=Zt(null===(t=null==p?void 0:p.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=Zt(null===(n=null==p?void 0:p.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},G.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})),Y.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})))})(),f&&g&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,i=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,s=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))",f="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=l/Math.max(G.length-1,1),t=G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!F&&r&&!a&&e.createElement("line",{x1:0,y1:c,x2:l,y2:c,stroke:d,strokeWidth:1}),!F&&a&&e.createElement("path",{d:Jt("bottom",l,c),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!s&&("function"==typeof s?s(t.value,n):rt(t.value,n>0?G[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:f,style:{userSelect:"none"}},y),!F&&o&&!i&&e.createElement("line",{x1:0,y1:0,x2:0,y2:c,stroke:d,strokeWidth:1}),!F&&i&&e.createElement("path",{d:Jt("left",l,c),fill:"none",stroke:d,strokeWidth:1}),Y.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):rt(t.value,n>0?Y[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:f,transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==p?void 0:p.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):rt(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:f,transform:`rotate(90, ${l+h.right-15}, ${c/2})`,style:{userSelect:"none"}},o))})())})(),K,M&&g&&L&&_&&e.createElement(e.Fragment,null,M.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Lt,{orient:"top",config:Mt(M.top),values:L,scale:g.x,size:h.top,length:l})),M.bottom&&e.createElement("g",{transform:`translate(0, ${c})`},e.createElement(Lt,{orient:"bottom",config:Mt(M.bottom),values:L,scale:g.x,size:h.bottom,length:l})),M.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Lt,{orient:"left",config:Mt(M.left),values:_,scale:g.y,size:h.left,length:c})),M.right&&e.createElement("g",{transform:`translate(${l}, 0)`},e.createElement(Lt,{orient:"right",config:Mt(M.right),values:_,scale:g.y,size:h.right,length:c}))),P,Q&&Q.sourceId!==R&&(null==g?void 0:g.x)&&(()=>{const t=g.x(Q.xValue);if(null==t||0>t||t>l)return null;const n=Q.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"})})(),$),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),Pt({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:w,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j})):null}function rn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const an="undefined"==typeof window||"undefined"==typeof document,sn=e.createContext(null);function ln({children:t}){const[n,o]=e.useState(!1),r=e.useMemo(()=>({visible:n,setVisible:o}),[n]);return e.createElement(sn.Provider,{value:r},t)}function cn(){return e.useContext(sn)}const un={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function dn(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"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function hn(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const gn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},fn={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"},pn={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},yn={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)"},mn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},vn={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)"},bn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},xn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function kn({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[a,s]=e.useState(!1),l=cn(),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=a||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{a||c||s(!0)},[a,c]),f=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:un}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:un,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",t.length," elements)"));const p=function(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O;const E=[];if(!Array.isArray(e))return E;for(const j of e)if(j&&"object"==typeof j)try{switch(j.type){case"point":E.push({label:"Point",values:{x:j.x,y:j.y}});break;case"line":{const e=j.path,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=j.topPath,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=j.datum&&"object"==typeof j.datum?j.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;E.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":E.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":E.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=j.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=j.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=j.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":E.push({label:"Node",values:{id:null!==(h=null===(d=j.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=j.cx)&&void 0!==g?g:j.x,y:null!==(f=j.cy)&&void 0!==f?f:j.y}});break;case"arc":E.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=j.cx)&&void 0!==m?m:j.x,y:null!==(v=j.cy)&&void 0!==v?v:j.y}});break;case"candlestick":E.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":E.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=j.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=j.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(S=j.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return E}(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}(p),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${gn(e.min)} to ${gn(e.max)}, mean ${gn(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(p.length,y),v=p.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:f,style:fn,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:mn},e.createElement("caption",{style:xn},"First ",v.length," of ",p.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"type"),x.map(t=>e.createElement("th",{key:t,style:vn},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.label),x.map(n=>{return e.createElement("td",{key:n,style:bn},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":gn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function wn({nodes:t,edges:n,chartType:o,tableId:r,chartTitle:i}){var a,s,l,c,u,d,h,g,f,p,y,m,v,b;const[x,k]=e.useState(!1),w=cn(),A=null!==(a=null==w?void 0:w.visible)&&void 0!==a&&a,S=x||A,O=i?"Data summary for "+i:r?`Data summary for ${o} ${r}`:"Data summary for "+o,E=e.useRef(null),j=e.useCallback(()=>{x||A||k(!0)},[x,A]),C=e.useCallback(e=>{var t;A||(null===(t=E.current)||void 0===t?void 0:t.contains(e.relatedTarget))||k(!1)},[A]);if(!t||0===t.length)return r?e.createElement("span",{id:r,tabIndex:-1,style:un}):null;if(!S)return e.createElement("div",{id:r,tabIndex:-1,onFocus:j,style:un,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>k(!0)},"View data summary (",t.length," nodes, ",n.length," edges)"));const P=Array.isArray(t)?t:[],M=Array.isArray(n)?n:[],L=new Map,_=new Map,T=new Map,B=new Map;for(const e of M){if(!e||"object"!=typeof e)continue;const t=null!==(s=e.datum)&&void 0!==s?s:e,n="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,o="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";_.set(e,(null!==(u=_.get(e))&&void 0!==u?u:0)+1),B.set(e,(null!==(d=B.get(e))&&void 0!==d?d:0)+r)}if(null!=o&&""!==o){const e=o+"";L.set(e,(null!==(h=L.get(e))&&void 0!==h?h:0)+1),T.set(e,(null!==(g=T.get(e))&&void 0!==g?g:0)+r)}}const N=[];for(let e=0;P.length>e;e++){const t=P[e];if(!t||"object"!=typeof t)continue;const n=null!==(p=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==p?p:t.id,o=null!=n?n+"":"node-"+e,r=null!==(y=L.get(o))&&void 0!==y?y:0,i=null!==(m=_.get(o))&&void 0!==m?m:0,a=null!==(v=T.get(o))&&void 0!==v?v:0,s=null!==(b=B.get(o))&&void 0!==b?b:0;N.push({id:o,degree:r+i,inDeg:r,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}N.sort((e,t)=>t.degree-e.degree);let D=0,I=0;if(N.length>0){let e=0;for(const t of N)e+=t.degree,t.degree>I&&(I=t.degree);D=e/N.length}const H=M.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),W=[`${N.length} nodes, ${M.length} edges.`];N.length>0&&W.push(`Mean degree: ${gn(D)}, max degree: ${I}.`);const F=N.slice(0,5);return e.createElement("div",{ref:E,id:r,tabIndex:-1,onBlur:C,style:fn,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>{A&&w&&w.setVisible(!1),k(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},W.join(" ")),e.createElement("table",{role:"table","aria-label":"Node degree summary for "+o,style:mn},e.createElement("caption",{style:xn},"Top ",F.length," of ",N.length," nodes by degree"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"id"),e.createElement("th",{style:vn},"degree"),e.createElement("th",{style:vn},"in"),e.createElement("th",{style:vn},"out"),H&&e.createElement("th",{style:vn},"w. degree"),H&&e.createElement("th",{style:vn},"w. in"),H&&e.createElement("th",{style:vn},"w. out"))),e.createElement("tbody",null,F.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.id),e.createElement("td",{style:bn},t.degree),e.createElement("td",{style:bn},t.inDeg),e.createElement("td",{style:bn},t.outDeg),H&&e.createElement("td",{style:bn},gn(t.wDegree)),H&&e.createElement("td",{style:bn},gn(t.wInDeg)),H&&e.createElement("td",{style:bn},gn(t.wOutDeg)))))))}function An({summary:t}){return t?e.createElement("div",{role:"note",style:un},t):null}function Sn({tableId:t}){return e.createElement("a",{href:"#"+t,style:un,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,un)}},"Skip to data table")}function On({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:un},n)}const En="var(--semiotic-focus, #005fcc)";function jn({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,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:En,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:En,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:En,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 Cn({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:a,className:s="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})},[a,s,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:s,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},a)}function Pn(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function Mn(){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),Pn(e,e=>t(e.matches))},[]),e}function Ln(o){const r=a(null),c=_n(o);return[function({children:t}){const i=n(()=>_n(o),[]);return e.createElement(r.Provider,{value:i,children:t})},e=>{var n;const o=null!==(n=s(r))&&void 0!==n?n:c,a=t(e);a.current=e;const u=l(()=>a.current(o.getState()),[o]),d=l(()=>a.current(o.getState()),[o]);return i(o.subscribe,u,d)}]}function _n(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 Tn={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Bn={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Nn={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"},[Dn,In]=Ln(e=>({theme:Tn,setTheme(t){e(e=>{if("light"===t)return{theme:Tn};if("dark"===t)return{theme:Bn};if("high-contrast"===t)return{theme:Nn};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Bn:Tn;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 Hn(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Wn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}const Fn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,zn=new WeakMap;function Rn(e,t){var n,o;if(!t)return t;const r=Fn.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 a=zn.get(i);if(a||(a=new Map,zn.set(i,a)),a.has(t))return a.get(t);const s=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return a.set(t,s),s}function $n(e){zn.delete(e)}function Gn(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Q;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Z;case"natural":return se;default:return null}}function Yn(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 qn(e,t,n,o,r,i){if(2>t.length)return;const a=[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];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-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 Xn=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s.style.stroke||"#007bff",c=s.style.strokeWidth||2,u=s.colorThresholds,d=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=c,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const p=null!==(r=s.style.opacity)&&void 0!==r?r:1;qn(e,s.path,l,c,p,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Gn(s.curve),g=u&&u.length>0&&d&&d.length===s.path.length,f=s._decayOpacities;if(f&&f.length===s.path.length&&!g){e.strokeStyle=l;const y=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let m=0;s.path.length-1>m;m++)e.globalAlpha=.5*(f[m]+f[m+1])*y,e.beginPath(),e.moveTo(s.path[m][0],s.path[m][1]),e.lineTo(s.path[m+1][0],s.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 S(){w&&(e.stroke(),w=!1)}for(let O=0;s.path.length>O;O++){const[E,j]=s.path[O],C=d[O],P=Yn(C,u,l);if(null!==v&&null!==k&&null!==x){if(P===k)e.lineTo(E,j);else{const M=[];for(const L of u){const _=L.value;(x>_||_>C)&&(_>x||C>_)||x===_||C===_||M.push({t:(_-x)/(C-x)})}M.sort((e,t)=>e.t-t.t);for(const T of M){const B=v+(E-v)*T.t,N=b+(j-b)*T.t,D=Yn(x+(C-x)*Math.min(T.t+1e-4,1),u,l);e.lineTo(B,N),S(),A(D,B,N)}e.lineTo(E,j)}v=E,b=j,x=C,k=P}else A(P,E,j),v=E,b=j,x=C,k=P}S()}else{if(e.beginPath(),!s.strokeGradient||2>s.strokeGradient.colorStops.length||2>s.path.length)e.strokeStyle=l;else{const I=e.createLinearGradient(s.path[0][0],0,s.path[s.path.length-1][0],0);for(const H of s.strokeGradient.colorStops)I.addColorStop(Math.max(0,Math.min(1,H.offset)),H.color);e.strokeStyle=I}if(h)ae().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[W,F]=s.path[0];e.moveTo(W,F);for(let z=1;s.path.length>z;z++)e.lineTo(s.path[z][0],s.path[z][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=("string"==typeof s.style.fill?Rn(e,s.style.fill):s.style.fill)||s.style.fill,h&&!g)ae().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[$,G]=s.path[0];e.moveTo($,G);for(let Y=1;s.path.length>Y;Y++)e.lineTo(s.path[Y][0],s.path[Y][1])}const R=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(R,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Vn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Un(e,t,n=.3){Vn(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 Kn(e,t,n=.6){var o,r,i,a,s;if(!Vn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Qn(e,t,n,o=.35){Vn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Zn(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Q;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Z;case"natural":return se;default:return null}}function Jn(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 eo(e,t){const n=Zn(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=U().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 to=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"area"===e.type);for(const t of s){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=Rn(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 s=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(eo(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=Jn("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=s}else{const o=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=o*s,e.fillStyle=n}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(eo(e,t),Qn(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=s,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=Rn(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=Zn(t.curve);if(e.beginPath(),n)ae().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}},no=(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?Rn(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?Rn(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Kn(e,t),e.globalAlpha=1}}finally{e.restore()}}},oo=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?ro(e,t):(e.fillStyle=("string"==typeof t.style.fill?Rn(e,t.style.fill):t.style.fill)||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),Un(e,t),e.globalAlpha=1};function ro(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}function io(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 ao(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const so=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function lo(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`${so[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${so[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const co={line:[to,Xn,no],area:[to,no],stackedarea:[to,no],scatter:[no],bubble:[no],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),Un(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):ao(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=io(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[oo],swarm:[no],waterfall:[(e,t,n,o)=>{var r,i,a;oo(e,t);const s=t.filter(e=>"rect"===e.type);if(2>s.length)return;const l=s[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;s.length-1>t;t++){const o=s[t],r=s[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(a=r.datum)||void 0===a?void 0:a.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:[to,Xn,no]},uo={top:20,right:20,bottom:30,left:40},ho={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"},go={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 fo({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:go},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}const po=c(function(i,a){var s,c,d,h,g,f,p,y,m,v,b;const{chartType:x,runtimeMode:k,data:w,chunkThreshold:A,chunkSize:S,xAccessor:O,yAccessor:E,colorAccessor:j,sizeAccessor:C,groupAccessor:P,lineDataAccessor:M,curve:L,normalize:_,binSize:T,valueAccessor:B,arrowOfTime:N="right",windowMode:D="sliding",windowSize:I=200,timeAccessor:H,xExtent:W,yExtent:F,extentPadding:z=.1,scalePadding:R,sizeRange:$,size:G=[500,300],responsiveWidth:Y,responsiveHeight:q,margin:X,className:V,background:U,lineStyle:K,pointStyle:Q,areaStyle:Z,waterfallStyle:J,swarmStyle:ee,barColors:te,colorScheme:ne,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:ae,lineGradient:se,areaGroups:le,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,showAxes:fe=!0,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:be,yFormat:xe,tickFormatTime:Ae,tickFormatValue:Se,hoverAnnotation:Oe,tooltipContent:Ee,customHoverBehavior:je,customClickBehavior:Ce,enableHover:Pe,hoverRadius:Me=30,tooltipMode:Le,annotations:_e,svgAnnotationRules:Te,showGrid:Be,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:We,legendPosition:Fe,backgroundGraphics:ze,foregroundGraphics:Re,canvasPreRenderers:$e,svgPreRenderers:Ge,title:Ye,categoryAccessor:qe,brush:Xe,onBrush:Ve,decay:Ue,pulse:Ke,transition:Qe,staleness:Ze,heatmapAggregation:Je,heatmapXBins:tt,heatmapYBins:nt,showValues:ot,heatmapValueFormat:rt,marginalGraphics:it,pointIdAccessor:lt,xScaleType:ct,yScaleType:ut,accessibleTable:dt=!0,description:ht,summary:gt,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}=i,At=Mn(),St=t(At);St.current=At;const[Ot,Et]=kt(G,Y,q),jt=Object.assign(Object.assign({},uo),X);if(it){const e=60;it.top&&e>jt.top&&(jt.top=e),it.bottom&&e>jt.bottom&&(jt.bottom=e),it.left&&e>jt.left&&(jt.left=e),it.right&&e>jt.right&&(jt.right=e)}const Ct=Et[0]-jt.left-jt.right,Pt=Et[1]-jt.top-jt.bottom,Mt="function"==typeof Re?Re({size:Et,margin:jt}):Re,Lt="function"==typeof ze?ze({size:Et,margin:jt}):ze,_t=null!=Oe?Oe:Pe,Tt=t(null),Bt=t(null),Nt=t(0),Dt=t(!1),It=In(e=>e.theme),[Ht,Wt]=r(0),[Ft,zt]=r(null),Rt=t(null),$t=t(null),[Gt,Yt]=r(null),[qt,Xt]=r(!1),[Vt,Ut]=r([]),[Kt,Qt]=r([]),Zt=t(()=>{}),Jt="streaming"===k||["bar","swarm","waterfall"].includes(x),tn=n(()=>({chartType:x,runtimeMode:Jt?"streaming":"bounded",windowSize:I,windowMode:D,arrowOfTime:Jt?N:"right",extentPadding:z,scalePadding:R,xAccessor:Jt?void 0:O,yAccessor:Jt?void 0:E,timeAccessor:Jt?H:void 0,valueAccessor:B,colorAccessor:j,sizeAccessor:C,groupAccessor:P||(M?"_lineGroup":void 0),categoryAccessor:qe,lineDataAccessor:M,xScaleType:ct,yScaleType:ut,xExtent:W,yExtent:F,sizeRange:$,binSize:T,normalize:_,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:!0===ae?{topOpacity:.8,bottomOpacity:.05}:!1===ae?void 0:ae,areaGroups:le?new Set(le):void 0,lineGradient:se,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,lineStyle:K,pointStyle:Q,areaStyle:Z,swarmStyle:ee,waterfallStyle:J,colorScheme:ne,barColors:te,annotations:_e,decay:Ue,pulse:Ke,transition:Qe,staleness:Ze,heatmapAggregation:Je,heatmapXBins:tt,heatmapYBins:nt,showValues:ot,heatmapValueFormat:rt,pointIdAccessor:lt,curve:L}),[x,I,D,N,z,R,O,E,H,B,ct,ut,j,C,P,qe,M,W,F,$,T,_,oe,re,ie,ae,se,le,ce,ue,de,he,ge,K,Q,Z,ee,J,ne,te,_e,Ue,Ke,Qe,Ze,Je,tt,nt,ot,rt,Jt,lt,L]),nn=t(null);nn.current||(nn.current=new et(tn));const sn=l(()=>{Nt.current||(Nt.current=requestAnimationFrame(()=>Zt.current()))},[]);o(()=>{var e;null===(e=nn.current)||void 0===e||e.updateConfig(tn),Dt.current=!0,sn()},[tn,sn]),o(()=>{Tt.current&&$n(Tt.current),Dt.current=!0,sn()},[It,sn]);const ln=t(null);ln.current||(ln.current=new we(e=>{const t=nn.current;t&&t.ingest(e)&&(Dt.current=!0,sn())},{chunkThreshold:A,chunkSize:S})),o(()=>{var e;null===(e=ln.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:S})},[A,S]);const cn=l(e=>{var t;null===(t=ln.current)||void 0===t||t.push(e)},[]),un=l(e=>{var t;null===(t=ln.current)||void 0===t||t.pushMany(e)},[]),hn=l(()=>{var e,t;null===(e=ln.current)||void 0===e||e.clear(),null===(t=nn.current)||void 0===t||t.clear(),Dt.current=!0,sn()},[sn]);u(a,()=>({push:cn,pushMany:un,remove:e=>{var t,n,o;null===(t=ln.current)||void 0===t||t.flush();const r=null!==(o=null===(n=nn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return r.length>0&&(Dt.current=!0,sn()),r},update:(e,t)=>{var n,o,r;null===(n=ln.current)||void 0===n||n.flush();const i=null!==(r=null===(o=nn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(Dt.current=!0,sn()),i},clear:hn,getData:()=>{var e,t,n;return null===(e=ln.current)||void 0===e||e.flush(),null!==(n=null===(t=nn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[cn,un,hn,sn]),o(()=>{var e,t;if(w){if(M&&w.length>0&&"object"==typeof w[0]&&null!==w[0]){const t="string"==typeof M?M:"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=ln.current)||void 0===e||e.setBoundedData(n))}}null===(t=ln.current)||void 0===t||t.setBoundedData(w)}},[w,M]);const gn=t(()=>{}),fn=t(()=>{});gn.current=e=>{if(!_t)return;const t=Tt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-jt.left,r=e.clientY-n.top-jt.top;if(0>o||o>Ct||0>r||r>Pt)return void(Rt.current&&(Rt.current=null,$t.current=null,Yt(null),je&&(je(null),Dt.current=!0),sn()));const i=nn.current;if(!i||0===i.scene.length)return;const a=at(i.scene,o,r,Me,i.quadtree);if(!a)return void(Rt.current&&(Rt.current=null,$t.current=null,Yt(null),je&&je(null),sn()));const s=a.datum||{},l=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{data:s,time:a.x,value:a.y,x:a.x,y:a.y});if("multi"===Le&&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=st(e.path,t,n);if(null===i)continue;const a=pt(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][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=st(e.topPath,t,n);if(null===i)continue;const a=pt(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.topPath[a][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,a.x,Me),t=i.scales.y.invert,n=i.scales.x.invert;if(e.length>0){const o=n?n(a.x):a.x;l.xValue=o,l.xPx=a.x,l.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||"#007bff",datum:e.datum}))}}Rt.current=l,$t.current=a.node,Yt(l),je&&(je(l),Dt.current=!0),sn()},fn.current=()=>{Rt.current&&(Rt.current=null,$t.current=null,Yt(null),je&&(je(null),Dt.current=!0),sn())},l(e=>gn.current(e),[]);const pn=l(()=>fn.current(),[]),yn=t(()=>{});yn.current=e=>{if(!Ce)return;const t=Tt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-jt.left,r=e.clientY-n.top-jt.top;if(0>o||o>Ct||0>r||r>Pt)return void Ce(null);const i=nn.current;if(!i||0===i.scene.length)return void Ce(null);const a=at(i.scene,o,r,Me,i.quadtree);if(!a)return void Ce(null);const s=a.datum||{},l=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{data:s,time:a.x,value:a.y,x:a.x,y:a.y});Ce(l)};const mn=l(e=>yn.current(e),[]),vn=t(-1),bn=t(null),xn=t(null),wn=l(e=>{const t=nn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(xn.current&&xn.current.version===n)o=xn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)switch(a.type){case"point":i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(t=a.group)&&void 0!==t?t:"_default"});break;case"line":{const e=a,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=a,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:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(r=a.group)&&void 0!==r?r:"_default"});break;case"heatcell":i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.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=yt(e),xn.current={version:n,graph:o}}const r=vn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),vn.current=0;const t=o.flat[0];bn.current={shape:t.shape,w:t.w,h:t.h};const n=xt(t);return Rt.current=n,Yt(n),je&&je(n),void sn()}const i=mt(o,r),a=vt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return vn.current=-1,bn.current=null,Rt.current=null,$t.current=null,Yt(null),je&&je(null),void sn();vn.current=a;const s=o.flat[a];bn.current={shape:s.shape,w:s.w,h:s.h};const l=xt(s);Rt.current=l,Yt(l),je&&je(l),sn()},[je,sn]),En=l(e=>{vn.current=-1,bn.current=null,gn.current(e)},[]);Zt.current=()=>{var e,t;Nt.current=0;const n=Tt.current,o=Bt.current;if(!n||!o)return;const r=nn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(St.current?i+1e6:i),s=!St.current&&a,l=Dt.current||a;l&&!s&&r.computeScene({width:Ct,height:Pt});const c=Wn(),u=function(e){if(!e)return ho;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(),a=t.getPropertyValue("--text-primary").trim(),s=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||a||n?{axisStroke:s||ho.axisStroke,tickText:i||ho.tickText,crosshair:i?i+"66":ho.crosshair,hoverFill:l?l+"4D":ho.hoverFill,hoverStroke:i?i+"99":ho.hoverStroke,pointRing:l||ho.pointRing}:ho}(n),d=null!==(e=null==Ze?void 0:Ze.threshold)&&void 0!==e?e:5e3,h=Ze&&r.lastIngestTime>0&&i-r.lastIngestTime>d;if(l){const e=Hn(n,Et,jt,c);if(e){e.clearRect(-jt.left,-jt.top,Et[0],Et[1]),h&&(e.globalAlpha=null!==(t=null==Ze?void 0:Ze.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=U||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-jt.left,-jt.top,Et[0],Et[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Ct,Pt),e.clip()),$e&&r.scales)for(const t of $e)e.save(),t(e,r.scene,r.scales,{width:Ct,height:Pt}),e.restore();const a=co[x];if(a&&r.scales)for(const t of a)t(e,r.scene,r.scales,{width:Ct,height:Pt});e.restore(),h&&(e.globalAlpha=1)}}{const e=Hn(o,Et,jt,c);if(e&&(e.clearRect(-jt.left,-jt.top,Et[0],Et[1]),_t&&Rt.current&&r.scales&&function(e,t,n,o,r,i,a){var s,l;if(!1===r.crosshair)return;const c=t.allSeries,u=c&&c.length>0,d=null!==(s=t.xPx)&&void 0!==s?s:t.x;e.save();const h="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=h.stroke||a.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=a.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=a.pointRing,e.lineWidth=2,e.stroke()}}(e,Rt.current,Ct,Pt,"object"==typeof _t?_t:{},$t.current,u),$t.current&&Array.isArray(Oe))){const t=Oe.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,$t.current,t)}}l&&n&&n.setAttribute("aria-label",dn(r.scene,x+" chart"));const g=Dt.current;if(Dt.current=!1,g&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Ft||e(Ft.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Ft.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Ft.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Ft.y.domain()[1])!==e(r.scales.y.domain()[1])||Ft.x.range()[0]!==r.scales.x.range()[0]||Ft.x.range()[1]!==r.scales.x.range()[1]||Ft.y.range()[0]!==r.scales.y.range()[0]||Ft.y.range()[1]!==r.scales.y.range()[1])&&zt(r.scales),it){const e=r.getData(),t="function"==typeof O?O:e=>e[O||"x"],n="function"==typeof E?E:e=>e[E||"y"];Ut(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Qt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&_e&&_e.length>0&&Wt(e=>e+1),(null==Ze?void 0:Ze.showBadge)&&Xt(!!h),(s||r.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Zt.current()))},o(()=>(sn(),()=>{Nt.current&&(cancelAnimationFrame(Nt.current),Nt.current=0)}),[sn]),o(()=>{Dt.current=!0,sn()},[x,Ct,Pt,fe,U,K,$e,sn]),wt(Ze,nn,Dt,sn,qt,Xt);const Pn=n(()=>{if(be||Ae)return;const e=nn.current;return(null==e?void 0:e.xIsDate)&&Ft?lo(Ft.x.domain()):void 0},[be,Ae,Ft]),Ln=be||Ae||Pn,_n=_t&&Gt?Ee?Ee(Gt):e.createElement(fo,{hover:Gt}):null,Tn=_n?e.createElement(Cn,{x:Gt.x,y:Gt.y,containerWidth:Ct,containerHeight:Pt,margin:jt,className:"stream-frame-tooltip"},_n):null,Bn=bn.current,Nn=e.createElement(jn,{active:vn.current>=0,hoverPoint:Gt,margin:jt,size:Et,shape:null==Bn?void 0:Bn.shape,width:null==Bn?void 0:Bn.w,height:null==Bn?void 0:Bn.h}),Dn=(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},Fn=Dn(O,H,"__semiotic_resolvedX","__semiotic_resolvedTime"),zn=Dn(E,B,"__semiotic_resolvedY","__semiotic_resolvedValue"),Rn=Fn.key,Gn=zn.key,Yn=_e&&_e.length>0,qn=e=>{if(!e||!Yn||!Fn.fn&&!zn.fn)return e;let t=!1;const n=e.map(e=>{const n=Fn.fn&&Fn.key&&!(Fn.key in e),o=zn.fn&&zn.key&&!(zn.key in e);if(!n&&!o)return e;t=!0;const r=Object.assign({},e);return n&&(r[Fn.key]=Fn.fn(e)),o&&(r[zn.key]=zn.fn(e)),r});return t?n:e};if(an){const t=nn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:Ct,height:Pt}));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=Ln||(()=>{if((null==t?void 0:t.xIsDate)&&o)return lo(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(V?" "+V:""),role:"img","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:Et[0],height:Et[1]}},e.createElement(An,{summary:gt}),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(${jt.left},${jt.top})`},Lt),e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},U&&e.createElement("rect",{x:0,y:0,width:Ct,height:Pt,fill:U}),Ge&&o&&Ge.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:Ct,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 a=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),s=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${a}L${s}Z`,fill:rn(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:rn(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:rn(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,a]=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),s=.299*r+.587*i+.114*a>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:s,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),a=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:a,stroke:a,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(on,{width:Ct,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:o,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:r,yFormat:xe||Se,showGrid:Be,title:Ye,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:We,legendPosition:Fe,foregroundGraphics:Mt,marginalGraphics:it,xValues:[],yValues:[],annotations:_e,svgAnnotationRules:Te,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 L?L:void 0,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}))}const Xn="semiotic-table-"+e.useId();return e.createElement("div",{ref:Ot,className:"stream-xy-frame"+(V?" "+V:""),role:"group","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":Et[0],height:q?"100%":Et[1],overflow:"visible"},onKeyDown:wn},dt&&e.createElement(Sn,{tableId:Xn}),dt&&e.createElement(kn,{scene:null!==(h=null===(d=nn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:x+" chart",tableId:Xn,chartTitle:"string"==typeof Ye?Ye:void 0}),e.createElement(An,{summary:gt}),e.createElement("div",{role:"img","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:_t?En:void 0,onMouseLeave:_t?pn:void 0,onClick:Ce?mn:void 0},Lt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Et[0],height:Et[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},Lt)),e.createElement(en,{width:Ct,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:Ft,showAxes:fe,axes:pe,showGrid:Be,xFormat:Ln,yFormat:xe||Se}),e.createElement("canvas",{ref:Tt,"aria-label":dn(null!==(f=null===(g=nn.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],x+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Bt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(On,{hoverPoint:Gt}),e.createElement(on,{width:Ct,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:Ft,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:Ln,yFormat:xe||Se,showGrid:Be,title:Ye,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:We,legendPosition:Fe,foregroundGraphics:Mt,marginalGraphics:it,xValues:Vt,yValues:Kt,annotations:_e,svgAnnotationRules:Te,annotationFrame:Ht,xAccessor:Rn,yAccessor:Gn,annotationData:qn(null===(p=nn.current)||void 0===p?void 0:p.getData()),pointNodes:null===(y=nn.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type),curve:"string"==typeof L?L:void 0,underlayRendered:!0,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}),(Xe||Ve)&&e.createElement(ke,{width:Ct,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,dimension:null!==(m=null==Xe?void 0:Xe.dimension)&&void 0!==m?m:"xy",scales:Ft,onBrush:null!=Ve?Ve:()=>{},binSize:T,snap:null==Xe?void 0:Xe.snap,binBoundaries:null!==(v=null==Xe?void 0:Xe.binBoundaries)&&void 0!==v?v:"bar"===x?null===(b=nn.current)||void 0===b?void 0:b.getBinBoundaries():void 0,snapDuring:null==Xe?void 0:Xe.snapDuring,streaming:"streaming"===k}),(null==Ze?void 0:Ze.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ze.badgePosition?{top:4,left:4}:"bottom-left"===Ze.badgePosition?{bottom:4,left:4}:"bottom-right"===Ze.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:qt?"#dc3545":"#28a745",color:"white"})},qt?"STALE":"LIVE"),Nn,Tn))});po.displayName="StreamXYFrame";const yo=a(null);function mo({colors:t,categories:o,colorScheme:r="category10",children:i}){const a=n(()=>{if(t)return t;if(o){const e=Array.isArray(r)?r:Me[r]||Le,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,r]);return e.createElement(yo.Provider,{value:a},i)}function vo(){return s(yo)}function bo(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 xo(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(bo(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function ko(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}mo.displayName="CategoryColorProvider";const[wo,Ao]=Ln(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=ko(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=ko(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}})}})),[So,Oo]=Ln(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 Eo(e){const t=d(),o=e.clientId||t,{name:r}=e,i=Ao(e=>e.selections.get(r)),a=Ao(e=>e.setClause),s=Ao(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?xo(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)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:l(()=>{s(r,o)},[s,r,o]),clientId:o}}function jo(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=Eo({name:t});return{onHover:l(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}function Co(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:a,selectInterval:s,clear:c}=Eo({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&&s(t)},[u,o,r,s,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function Po(e,t,o){const r=Ao(e=>e.selections.get(t));return n(()=>{if(!r||0===r.clauses.size)return e;const t=xo(r,o);return e.filter(t)},[e,r,o])}function Mo(e={}){const{limit:t=50,types:o,chartId:r}=e,i=Oo(e=>e.version),a=Oo(e=>e.observations),s=Oo(e=>e.clearObservations),l=n(()=>{let e=a;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[a,o,r,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const Lo=a(!1);function _o({selections:e}){const t=Ao(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function To({categoryColors:n,interaction:i,selectionName:a,field:s}){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=jo({name:a,fields:[s]}),g=Eo({name:a,clientId:"__linked-legend-isolate__"}),[f,p]=r(new Set),[y,m]=r(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(f.size>0?v.current({[s]:Array.from(f)}):b.current())},[i,f,s]);const x=l(e=>{"highlight"===i&&(e?(m(e.label),h.onHover({[s]:e.label})):(m(null),h.onHover(null)))},[i,s,h]),k=l(e=>{"isolate"===i&&p(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(Ct,{legendGroups:d,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:y,isolatedCategories:f}))}function Bo({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:a="legend",legendField:s="category"}){const l=vo(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(wo,null,e.createElement(So,null,n&&e.createElement(_o,{selections:n}),e.createElement(Lo.Provider,{value:c},c&&"top"===r&&l&&e.createElement(To,{categoryColors:l,interaction:i,selectionName:a,field:s}),t,c&&"bottom"===r&&l&&e.createElement(To,{categoryColors:l,interaction:i,selectionName:a,field:s}))))}function No({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):_e[i%_e.length];return{label:r+"",color: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,label:""}]}}function Do(e){return e?"string"==typeof e?{name:e}:e:null}function Io(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const Ho={light:Tn,dark:Bn,"high-contrast":Nn,pastels:{mode:"light",colors:{primary:"#c9a0dc",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Wo(e){return Ho[e]}const Fo=e.createContext(void 0);function zo({theme:t}){const n=In(e=>e.setTheme),o=In(e=>e.theme),r=e.useRef(o);r.current=o;const i=e.useRef(null);return e.useEffect(()=>{if(void 0!==t)return;if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(forced-colors: active)");return e.matches&&(i.current=r.current,n(Nn)),Pn(e,e=>{var t;e.matches?(i.current=r.current,n(Nn)):(n(null!==(t=i.current)&&void 0!==t?t:Tn),i.current=null)})},[t,n]),e.useEffect(()=>{if(void 0!==t)if("string"==typeof t){const e=Wo(t);n(e||t)}else n(t)},[t,n]),null}function Ro({children:t}){var n,o,r,i,a;const s=In(e=>e.theme),l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":s.colors.background,"--semiotic-text":s.colors.text,"--semiotic-text-secondary":s.colors.textSecondary,"--semiotic-grid":s.colors.grid,"--semiotic-border":s.colors.border,"--semiotic-primary":s.colors.primary,"--semiotic-font-family":s.typography.fontFamily},s.colors.focus?{"--semiotic-focus":s.colors.focus}:{}),(null===(n=s.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":s.tooltip.background}:{}),(null===(o=s.tooltip)||void 0===o?void 0:o.text)?{"--semiotic-tooltip-text":s.tooltip.text}:{}),(null===(r=s.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":s.tooltip.borderRadius}:{}),(null===(i=s.tooltip)||void 0===i?void 0:i.fontSize)?{"--semiotic-tooltip-font-size":s.tooltip.fontSize}:{}),(null===(a=s.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":s.tooltip.shadow}:{}),s.borderRadius?{"--semiotic-border-radius":s.borderRadius}:{}),s.colors.selection?{"--semiotic-selection-color":s.colors.selection}:{}),null!=s.colors.selectionOpacity?{"--semiotic-selection-opacity":s.colors.selectionOpacity+""}:{}),s.colors.diverging?{"--semiotic-diverging":s.colors.diverging}:{}),c=e.useContext(Fo),u={};return c&&(u["data-semiotic-theme"]=c),e.createElement("div",Object.assign({style:l},u),t)}function $o({theme:t,children:n}){const o="string"==typeof t&&Wo(t)?t:void 0;return e.createElement(Dn,null,e.createElement(Fo.Provider,{value:o},e.createElement(zo,{theme:t}),e.createElement(Ro,null,n)))}function Go(){return In(e=>e.theme)}const Yo="#007bff";function qo(){var e;const t=Go(),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 Xo(e,t,n,o,r){if(e)return e;let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Me[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:Yo}function Vo(e){return"function"==typeof e?e:t=>t[e]}function Uo(e,t,o){const r=vo(),i=qo();return n(()=>{var n;if(!t)return;const a=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=De(n.map(e=>({_cat:e})),"_cat",a);return t=>r[t]||e(t)}return De(n.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const n=De(e,t,a);return e=>r[e]||n(e)}return De(e,t,a)}if(r&&Object.keys(r).length>0){const e=De([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[e,t,o,r,i])}function Ko(e,t,o){return n(()=>{if(!t)return e;const n=[...e];if("function"==typeof t)return n.sort(t);const r=Vo(o);return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function Qo({selection:e,linkedHover:t,fallbackFields:i=[],unwrapData:a=!1,onObservation:s,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:f}){const p=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,i),m=Eo({name:(null==e?void 0:e.name)||"__unused__"}),v=jo({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||i||[]}),b=Oo(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=r(null),A=f||i[0],S=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]),O=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==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})},Gt())}(y.name||"hover",Number(e),p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Yt(y.name||"hover",p),"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,p,s,c,u,b,g,A]),E=l(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},Gt(),!1}Rt={positions:new Map(Rt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Gt()}(y.name||"hover",Number(n),p)}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,p]);return o(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{qt(e,p),Yt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:E,crosshairSourceId:p}}function Zo(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 Jo({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(Lo),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return No({data:e,colorBy:t,colorScale:o,getColor:Ne,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 er(e,t,o){const[i,a]=r(null),[s,c]=r(new Set),u=l(t=>{"highlight"===e&&a(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&&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,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const tr={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 nr(e,t,n){var o,r,i,a,s,l,c;const u=tr[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!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!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:or(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function or(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 rr={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 ir(e,t){return"function"==typeof t?t(e):e[t]}function ar(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 sr(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=ir(t,o);s=ar(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 a=ir(t,o);l.push({label:n,value:ar(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=ar(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=ar(t[e[0]],r))}}const c=Object.assign(Object.assign({},rr),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function lr(t={}){const{fields:n=[],title:o,format:r,style:i={},className:a="",showLabels:s=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=ir(t,o);c.push({value:ar(e,r)})}n&&Array.isArray(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 a=ar(ir(t,o),i);c.push({label:s?n:void 0,value:a})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:s?e:void 0,value:ar(t[e],r)})});const u=Object.assign(Object.assign({},rr),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function cr(t){if(!0===t)return sr();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:rr},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?sr(t):sr())}function ur(e){return"string"==typeof e?e:"value"}function dr(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function hr(e,t){return"function"==typeof t?t(e):e[t]}function gr(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?dr(hr(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:rr},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=dr(hr(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 fr({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return a=>{var s;const l=i?(null===(s=a.data)||void 0===s?void 0:s[0])||a.data||a:a.data||a,c=hr(l,t),u=hr(l,n),d=o?hr(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:rr},e.createElement("div",{style:{fontWeight:"bold"}},dr(c)),e.createElement("div",{style:{marginTop:4}},dr(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||ur(o),": ",dr(d)))}}function pr({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 yr 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(pr,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function mr(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function vr(e,t,n=3){let o,r=n+1;for(const n of t){const t=mr(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function br(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function xr(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=vr(e,t,3))&&void 0!==n?n:null)}function kr({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=br(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=xr(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function wr({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}function Ar({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=br(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=xr(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const Sr={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"}},Or={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Er={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},jr=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Cr=["vertical","horizontal"],Pr={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Sr),Or),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:jr},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({},Sr),Or),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:jr},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Sr),Or),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:jr},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({},Sr),Or),{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({},Sr),Or),{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({},Sr),Or),{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({},Sr),Or),{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({},Sr),Or),{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({},Sr),Or),{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({},Sr),Er),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Cr},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Sr),Er),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Cr},normalize:{type:"boolean"},barPadding:{type:"number"}})},LikertChart:{required:["levels"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},Sr),Er),{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:Cr},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Sr),Er),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Cr},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Sr),Er),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Cr},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({},Sr),Er),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Cr},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Sr),Er),{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({},Sr),Er),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Cr},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({},Sr),Er),{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({},Sr),Er),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Cr},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Sr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Sr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Sr),{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({},Sr),Er),{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({},Sr),Er),{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({},Sr),{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({},Sr),{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:Cr},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({},Sr),{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({},Sr),{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({},Sr),{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({},Sr),{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({},Sr),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Mr(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function Lr(e,t){const n=[],o=Pr[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Pr).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(!Mr(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=vr(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=kr({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=wr({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=Ar({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}}const _r=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Tr=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Br=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Nr=new Set(["LineChart","AreaChart","StackedAreaChart"]),Dr=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Ir(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 Hr(e,t){const n=Ir(e),o=Ir(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const Wr=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Fr(e,t){const n=[],o=Lr(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Pr[e]?(function(e,t,n){const o=Pr[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=Pr[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){_r.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){Tr.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=Pr[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Br.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(!Nr.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=Pr[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!Dr.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=Hr(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=Hr(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 Wr)"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 zr;const Rr="undefined"!=typeof process&&"production"!==(null===(zr=process.env)||void 0===zr?void 0:zr.NODE_ENV);function $r({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(yr,{fallback:i=>{let a="";if(Rr&&r)try{const e=Fr(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(pr,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const Gr={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"},Yr={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function qr(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({},Gr),{width:n,height:o})},r||"No data available"):null}function Xr(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))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/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({},Yr),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function Vr(e,t,n,o){if(!Rr)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 Ur(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){e.done?r(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Kr="__forecastSegment";let Qr=null;function Zr(){return Ur(this,void 0,void 0,function*(){return Qr||(Qr=yield import("./semiotic-ai-statisticalOverlays-C2PPlmXv.js")),Qr})}const Jr=c(function(i,a){var s,c;const d=t(null);u(a,()=>({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=nr(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:f,className:p,xFormat:y,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:E=3,fillArea:j=!1,areaOpacity:C=.3,lineWidth:P=2,lineGradient:M,tooltip:L,pointIdAccessor:_,annotations:T,directLabel:B,gapStrategy:N="break",anomaly:D,forecast:I,frameProps:H={},selection:W,linkedHover:F,onObservation:z,onClick:R,hoverHighlight:$,hoverRadius:G,chartId:Y,loading:q,emptyContent:X,legendInteraction:V,legendPosition:U,xScaleType:K,yScaleType:Q,color:Z}=i,J=h.width,ee=h.height,te=h.enableHover,ne=h.showGrid,oe=h.showLegend,re=h.title,ie=h.description,ae=h.summary,se=h.accessibleTable,le=h.xLabel,ce=h.yLabel,ue=Xr(q,J,ee),de=ue?null:qr(g,J,ee,X),he=g||[];Vr("LineChart",he,"xAccessor",v),Vr("LineChart",he,"yAccessor",b);const ge="string"==typeof v?v:"__semiotic_resolvedX",fe="string"==typeof b?b:"__semiotic_resolvedY",[pe,ye]=r(null),[me,ve]=r([]),be=n(()=>{if(!I&&!D)return he;const e="function"==typeof v,t="function"==typeof b;return e||t?he.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):he},[he,I,D,v,b]),xe=t(I),ke=t(D);o(()=>{if(!I&&!D)return void((xe.current||ke.current)&&(ye(null),ve([]),xe.current=I,ke.current=D));let e=!1;const t=I!==xe.current||D!==ke.current;if(xe.current=I,ke.current=D,t&&(ye(null),ve([])),I){const t=x&&"string"==typeof x&&"object"==typeof I?Object.assign(Object.assign({},I),{_groupBy:x}):I;(function(...e){return Ur(this,void 0,void 0,function*(){return(yield Zr()).buildForecast(...e)})})(be,ge,fe,t,D).then(t=>{e||(ye(t),ve(t.annotations))}).catch(()=>{e||(ye(null),ve([]))})}else D&&function(...e){return Ur(this,void 0,void 0,function*(){return(yield Zr()).buildAnomalyAnnotations(...e)})}(D).then(t=>{e||(ye(null),ve(t))}).catch(()=>{e||ve([])});return()=>{e=!0}},[be,I,D,ge,fe]);const we=pe?pe.processedData:he,Ae="__compoundGroup",Se=!(!I||!x),Oe=Se?Ae:I?Kr:x,Ee=n(()=>{if(!Se)return we;const e="function"==typeof x?x:e=>e[x];return we.map(t=>{const n=Object.assign({},t);return n[Ae]=`${e(t)}__${t[Kr]||"observed"}`,n})},[we,Se,x]),je=Se?Ee:we,Ce=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 a=pe?pe.processedData:he;for(const e of a){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,pe,he,b]),{activeSelectionHook:Pe,hoverSelectionHook:Me,customHoverBehavior:Le,customClickBehavior:_e,crosshairSourceId:Te}=Qo({selection:W,linkedHover:F,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:z,onClick:R,chartType:"LineChart",chartId:Y,hoverHighlight:$,colorByField:"string"==typeof w?w:void 0}),Be=Zo(F,Te),De=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===(s=je[0])||void 0===s?void 0:s[k]),He=n(()=>{if(Ie)return je;if(Oe){const e=je.reduce((e,t)=>{const n="function"==typeof Oe?Oe(t):t[Oe];if(!e[n]){const o={[k]:[]};"string"==typeof Oe&&(o[Oe]=n),Se&&(o[Kr]=t[Kr],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:je}]},[je,Oe,k,Ie]),{gapProcessedLineData:We,hasGaps:Fe}=n(()=>{if("interpolate"===N){let e=!1;const t=[];for(const n of He){const o=(n[k]||[]).filter(t=>!De(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===N){let e=!1;const t=[];for(const n of He){const o=n[k]||[];let r=[],i=0;const a=Oe&&"string"==typeof Oe?n[Oe]:void 0;for(const s of o)if(De(s))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=a?`${a}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},s),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===N){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of He){const r=o[k]||[],i=[];for(const n of r)De(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:He,hasGaps:!1}},[He,N,k,De,Oe,b]),ze=Uo(we,w,A),Re=n(()=>{if(!w)return[];const e=new Set;for(const t of we){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[we,w]),$e=er(V,w,Re),Ge=n(()=>Me||($e.legendSelectionHook?$e.legendSelectionHook:Pe),[Me,$e.legendSelectionHook,Pe]),Ye=n(()=>(e,t)=>{const n={strokeWidth:P},o=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return w?ze&&(n.stroke=Ne(e,w,ze),o&&(n.fill=n.stroke,n.fillOpacity=C)):(n.stroke=Z||Yo,o&&(n.fill=Z||Yo,n.fillOpacity=C)),n},[w,ze,P,j,C,Z]),[qe,Xe]=r(null);o(()=>{if(!I)return void Xe(null);let e=!1;return function(...e){return Ur(this,void 0,void 0,function*(){return(yield Zr()).createSegmentLineStyle(...e)})}(Ye,I).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,I]);const Ve=qe||Ye,Ue=n(()=>Io(Ve,Ge,W),[Ve,Ge,W]),Ke=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return w?ze&&(t.fill=Ne(e.parentLine||e,w,ze)):t.fill=Z||Yo,t}},[O,E,w,ze,Z]),Qe=Array.isArray(j)?"mixed":j?"area":"line",Ze="object"==typeof B?B:{},Je=Ze.position||"end",et=Ze.fontSize||11,tt=n(()=>{var e,t;if(!B||!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 We){const o=n[k]||[];if(0===o.length)continue;const a="end"===Je?o[o.length-1]:o[0],s=null!==(t=null!==(e=r(a))&&void 0!==e?e:r(n))&&void 0!==t?t:"";s&&!i.has(s+"")&&i.set(s+"",a)}const a=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"===Je?6:-6,dy:0,color:ze?ze(e):Yo,fontSize:et}));a.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;a.length>e;e++){const t="string"==typeof b?b:"y",n=a[e-1],o=a[e];et+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=et+2)}return a},[B,w,ze,We,k,v,b,Je,et]),nt=(!B||void 0!==oe)&&oe,ot=n(()=>{if(!B)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"===Je?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[B,tt,et,Je,h.marginDefaults]),{legend:rt,margin:it,legendPosition:at}=Jo({data:We,colorBy:w,colorScale:ze,showLegend:nt,legendPosition:U,userMargin:f,defaults:ot}),st=x||w,lt=n(()=>gr([{label:le||ur(v),accessor:v,role:"x"},{label:ce||ur(b),accessor:b,role:"y"},...st?[{label:ur(st),accessor:st,role:"group"}]:[]]),[v,b,le,ce,st]),ct=kr({componentName:"LineChart",data:Ie?(null===(c=we[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),ut=n(()=>Ie||Oe||Fe?We.flatMap(e=>{const t=e[k]||[];return Oe&&"string"==typeof Oe?t.map(t=>Object.assign(Object.assign({},t),{[Oe]:e[Oe]})):t}):je,[We,k,Ie,Oe,je,Fe]),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:Qe},Array.isArray(j)&&{areaGroups:j}),M&&{lineGradient:M}),null!=G&&{hoverRadius:G}),null!=g&&{data:ut}),{xAccessor:v,yAccessor:b,xScaleType:K,yScaleType:Q}),Ce&&{yExtent:Ce}),{groupAccessor:"break"===N&&Fe?"_gapSegment":Oe||void 0,curve:S,lineStyle:Ue}),O&&{pointStyle:Ke}),{size:[J,ee],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:it,showAxes:h.showAxes,xLabel:le,yLabel:ce,xFormat:y,yFormat:m,enableHover:te,showGrid:ne}),rt&&{legend:rt,legendPosition:at}),V&&"none"!==V&&{legendHoverBehavior:$e.onLegendHover,legendClickBehavior:$e.onLegendClick,legendHighlightedCategory:$e.highlightedCategory,legendIsolatedCategories:$e.isolatedCategories}),re&&{title:re}),ie&&{description:ie}),ae&&{summary:ae}),void 0!==se&&{accessibleTable:se}),p&&{className:p}),{tooltipContent:!1===L?()=>null:"multi"===L?t=>{var n,o,r,i,a,s,l,c,u,d;const h=t.allSeries;if(!h||0===h.length){const s=null!==(a=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!==a?a:t.y;return e.createElement("div",{className:"semiotic-tooltip",style:rr},e.createElement("div",null,ar(s)))}const g=null!==(d=null!==(c=null!==(s=t.xValue)&&void 0!==s?s: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:rr},null!=g&&e.createElement("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4}},ar(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"}},ar(t.value)))))}:cr(L)||lt}),"multi"===L&&{tooltipMode:"multi"}),(F||z||R||$)&&{customHoverBehavior:Le}),(z||R||F)&&{customClickBehavior:_e}),_&&{pointIdAccessor:_}),((null==T?void 0:T.length)||me.length||tt.length)&&{annotations:[...T||[],...me,...tt]}),Be),H);return ue||de||(ct?e.createElement(pr,{componentName:"LineChart",message:ct,width:J,height:ee}):e.createElement($r,{componentName:"LineChart",width:J,height:ee},e.createElement(po,Object.assign({ref:d},dt))))});Jr.displayName="LineChart";const ei=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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 s=nr(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:f="x",yAccessor:p="y",areaBy:y,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:S,showLine:O=!0,lineWidth:E=2,showPoints:j=!1,pointRadius:C=3,tooltip:P,annotations:M,frameProps:L={},selection:_,linkedHover:T,onObservation:B,onClick:N,hoverHighlight:D,chartId:I,loading:H,emptyContent:W,legendInteraction:F,legendPosition:z,color:R}=o,$=s.width,G=s.height,Y=s.enableHover,q=s.showGrid,X=s.showLegend,V=s.title,U=s.description,K=s.summary,Q=s.accessibleTable,Z=s.xLabel,J=s.yLabel,ee=Xr(H,$,G),te=ee?null:qr(l,$,G,W),ne=l||[];Vr("AreaChart",ne,"xAccessor",f),Vr("AreaChart",ne,"yAccessor",p);const{activeSelectionHook:oe,hoverSelectionHook:re,customHoverBehavior:ie,customClickBehavior:ae,crosshairSourceId:se}=Qo({selection:_,linkedHover:T,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:B,onClick:N,chartType:"AreaChart",chartId:I,hoverHighlight:D,colorByField:"string"==typeof x?x:void 0}),le=Zo(T,se),ce=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[b]),ue=n(()=>{if(ce)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,ce]),de=Uo(ne,x,k),he=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]),ge=er(F,x,he),fe=n(()=>re||(ge.legendSelectionHook?ge.legendSelectionHook:oe),[re,ge.legendSelectionHook,oe]),pe=n(()=>e=>{const t={};if(x){if(de){const n=Ne(e,x,de);t.fill=n,O?(t.stroke=n,t.strokeWidth=E):t.stroke="none"}}else{const e=R||Yo;t.fill=e,O?(t.stroke=e,t.strokeWidth=E):t.stroke="none"}return t.fillOpacity=A,t},[x,de,R,A,O,E]),ye=n(()=>Io(pe,fe,_),[pe,fe,_]),me=n(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return x?de&&(t.fill=Ne(e.parentLine||e,x,de)):t.fill=Yo,t}},[j,C,x,de]),{legend:ve,margin:be,legendPosition:xe}=Jo({data:ue,colorBy:x,colorScale:de,showLegend:X,legendPosition:z,userMargin:c,defaults:s.marginDefaults}),ke=y||x,we=n(()=>gr([{label:Z||ur(f),accessor:f,role:"x"},{label:J||ur(p),accessor:p,role:"y"},...ke?[{label:ur(ke),accessor:ke,role:"group"}]:[]]),[f,p,Z,J,ke]),Ae=kr({componentName:"AreaChart",data:l,accessors:{xAccessor:f,yAccessor:p}}),Se=n(()=>ce||y?ue.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):ne,[ue,b,ce,y,ne]),Oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:Se}),{xAccessor:f,yAccessor:p,groupAccessor:y||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),S&&{lineGradient:S}),{curve:w,lineStyle:ye}),j&&me&&{pointStyle:me}),{size:[$,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:be,showAxes:s.showAxes,xLabel:Z,yLabel:J,xFormat:h,yFormat:g,enableHover:Y}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:q}),ve&&{legend:ve,legendPosition:xe}),F&&"none"!==F&&{legendHoverBehavior:ge.onLegendHover,legendClickBehavior:ge.onLegendClick,legendHighlightedCategory:ge.highlightedCategory,legendIsolatedCategories:ge.isolatedCategories}),V&&{title:V}),U&&{description:U}),K&&{summary:K}),void 0!==Q&&{accessibleTable:Q}),d&&{className:d}),{tooltipContent:!1===P?()=>null:cr(P)||we}),(T||B||N||D)&&{customHoverBehavior:ie}),(B||N||T)&&{customClickBehavior:ae}),M&&M.length>0&&{annotations:M}),le),L);return ee||te||(Ae?e.createElement(pr,{componentName:"AreaChart",message:Ae,width:$,height:G}):e.createElement($r,{componentName:"AreaChart",width:$,height:G},e.createElement(po,Object.assign({ref:a},Oe))))});function ti({isPushMode:e,colorBy:o,colorScheme:i,showLegend:a,legendPosition:s="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]),f=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]),p=l(e=>t=>{f([t]),e(t)},[f]),y=l(e=>t=>{f(t),e(t)},[f]),m=l(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!o||!1===a)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:_e,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const s="string"==typeof o?o:"__streamCat";return No({data:t.map(e=>({[s]:e})),colorBy:s,colorScale:e=>r.get(e)||"#999",getColor:Ne})},[e,o,a,i,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:p,wrapPushMany:y,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}ei.displayName="AreaChart";const ni=c(function(o,r){var i;const a=t(null),s=nr(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:f,xAccessor:p="x",yAccessor:y="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:E=3,normalize:j=!1,tooltip:C,annotations:P,frameProps:M={},selection:L,linkedHover:_,onObservation:T,onClick:B,hoverHighlight:N,chartId:D,loading:I,emptyContent:H,legendInteraction:W,legendPosition:F,color:z}=o,R=s.width,$=s.height,G=s.enableHover,Y=s.showGrid,q=s.showLegend,X=s.title,V=s.description,U=s.summary,K=s.accessibleTable,Q=s.xLabel,Z=s.yLabel,J=Xr(I,R,$),ee=J?null:qr(c,R,$,H),te=c||[],ne=ti({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:q,legendPosition:F}),oe=l(ne.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[ne.wrapPush]),re=l(ne.wrapPushMany(e=>{var t;return null===(t=a.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=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;ne.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[oe,re,ne.resetCategories]);const{activeSelectionHook:ie,hoverSelectionHook:ae,customHoverBehavior:se,customClickBehavior:le,crosshairSourceId:ce}=Qo({selection:L,linkedHover:_,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:T,onClick:B,chartType:"StackedAreaChart",chartId:D,hoverHighlight:N,colorByField:"string"==typeof b?b:void 0}),ue=Zo(_,ce),de=void 0!==(null===(i=te[0])||void 0===i?void 0:i[v]),he=n(()=>{if(de)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,de]),ge=Uo(te,b,x),fe=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]),pe=er(W,b,fe),ye=n(()=>ae||(pe.legendSelectionHook?pe.legendSelectionHook:ie),[ae,pe.legendSelectionHook,ie]),me=n(()=>e=>{const t={};if(b&&ge){const n=Ne(e,b,ge);t.fill=n,A?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}else if(!b){const e=z||Yo;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=S)}return t.fillOpacity=w,t},[b,ge,w,A,S,z]),ve=n(()=>Io(me,ye,L),[me,ye,L]),be=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return b?ge&&(t.fill=Ne(e.parentLine||e,b,ge)):t.fill=z||Yo,t}},[O,E,b,ge,z]),{legend:xe,margin:ke,legendPosition:we}=Jo({data:he,colorBy:b,colorScale:ge,showLegend:q,legendPosition:F,userMargin:d,defaults:s.marginDefaults}),Ae=ne.streamingLegend||xe,Se=F||we,Oe=n(()=>{if(ne.streamingMarginAdjust){const e=Object.assign({},ke);for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return ke},[ke,ne.streamingMarginAdjust]),Ee=m||b,je=n(()=>gr([{label:Q||ur(p),accessor:p,role:"x"},{label:Z||ur(y),accessor:y,role:"y"},...Ee?[{label:ur(Ee),accessor:Ee,role:"group"}]:[]]),[p,y,Q,Z,Ee]),Ce=kr({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:p,yAccessor:y}}),Pe=n(()=>de||m?he.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):te,[he,v,de,m,te]),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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=c&&{data:Pe}),{xAccessor:p,yAccessor:y,groupAccessor:m||void 0,curve:k,normalize:j,lineStyle:ve}),O&&be&&{pointStyle:be}),{size:[R,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Oe,showAxes:s.showAxes,xLabel:Q,yLabel:Z,xFormat:g,yFormat:f,enableHover:G}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:Y}),Ae&&{legend:Ae,legendPosition:Se}),W&&"none"!==W&&{legendHoverBehavior:pe.onLegendHover,legendClickBehavior:pe.onLegendClick,legendHighlightedCategory:pe.highlightedCategory,legendIsolatedCategories:pe.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),{tooltipContent:!1===C?()=>null:cr(C)||je}),(_||T||B||N)&&{customHoverBehavior:se}),(T||B||_)&&{customClickBehavior:le}),P&&P.length>0&&{annotations:P}),ue),M);return J||ee||(Ce?e.createElement(pr,{componentName:"StackedAreaChart",message:Ce,width:R,height:$}):e.createElement($r,{componentName:"StackedAreaChart",width:R,height:$},e.createElement(po,Object.assign({ref:a},Me))))});function oi(e){const{data:t,rawData:o,colorBy:r,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,S="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:O,hoverSelectionHook:E,customHoverBehavior:j,customClickBehavior:C,crosshairSourceId:P}=Qo({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:S}),M=Zo(c,P),L=Uo(t,r,i),_=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]),T=er(a,r,_),B=n(()=>E||(T.legendSelectionHook?T.legendSelectionHook:O),[E,T.legendSelectionHook,O]),{legend:N,margin:D,legendPosition:I}=Jo({data:t,colorBy:r,colorScale:L,showLegend:p,legendPosition:s,userMargin:y,defaults:m}),H=n(()=>{const e={};return N&&(e.legend=N,e.legendPosition=I),a&&"none"!==a&&(e.legendHoverBehavior=T.onLegendHover,e.legendClickBehavior=T.onLegendClick,e.legendHighlightedCategory=T.highlightedCategory,e.legendIsolatedCategories=T.isolatedCategories),e},[N,I,a,T.onLegendHover,T.onLegendClick,T.highlightedCategory,T.isolatedCategories]),W=Xr(x,w,A),F=W?null:qr(o,w,A,k);return{colorScale:L,allCategories:_,legendState:T,effectiveSelectionHook:B,activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:C,legend:N,margin:D,legendPosition:I,earlyReturn:W||F||null,legendBehaviorProps:H,crosshairProps:M}}ni.displayName="StackedAreaChart";const ri=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 a=nr(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:s,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,frameProps:E={},selection:j,linkedHover:C,linkedBrush:P,onObservation:M,onClick:L,hoverHighlight:_,chartId:T,loading:B,emptyContent:N,legendInteraction:D,legendPosition:I,color:H}=o,W=a.width,F=a.height,z=a.enableHover,R=a.showGrid,$=a.title,G=a.description,Y=a.summary,q=a.accessibleTable,X=a.xLabel,V=a.yLabel,U=s||[],K=oi({data:U,rawData:s,colorBy:y,colorScheme:m,legendInteraction:D,legendPosition:I,selection:j,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:M,onClick:L,hoverHighlight:_,chartType:"Scatterplot",chartId:T,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:B,emptyContent:N,width:W,height:F}),Q=Do(P),Z=Co({name:(null==Q?void 0:Q.name)||"__unused_brush__",xField:(null==Q?void 0:Q.xField)||("string"==typeof f?f:void 0),yField:(null==Q?void 0:Q.yField)||("string"==typeof p?p:void 0)}),J=Q?"xyBrush"===Z.brushInteraction.brush?"xy":"xBrush"===Z.brushInteraction.brush?"x":"y":void 0,ee=e.useRef(Z.brushInteraction);ee.current=Z.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(K.earlyReturn)return K.earlyReturn;Vr("Scatterplot",U,"xAccessor",f),Vr("Scatterplot",U,"yAccessor",p);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?K.colorScale&&(t.fill=Ne(e,y,K.colorScale)):t.fill=H||Yo,t.r=v?Ie(e,v,b,ne):x,t},[y,K.colorScale,v,b,ne,x,k,H]),re=n(()=>Io(oe,K.effectiveSelectionHook,j),[oe,K.effectiveSelectionHook,j]),ie=n(()=>gr([{label:X||ur(f),accessor:f,role:"x"},{label:V||ur(p),accessor:p,role:"y"},...y?[{label:ur(y),accessor:y,role:"color"}]:[],...v?[{label:ur(v),accessor:v,role:"size"}]:[]]),[f,p,X,V,y,v]),ae=kr({componentName:"Scatterplot",data:s,accessors:{xAccessor:f,yAccessor:p}});if(ae)return e.createElement(pr,{componentName:"Scatterplot",message:ae,width:W,height:F});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:U}),{xAccessor:f,yAccessor:p,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:re,colorScheme:m,size:[W,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,showAxes:a.showAxes,xLabel:X,yLabel:V,xFormat:h,yFormat:g,enableHover:z,showGrid:R}),K.legendBehaviorProps),$&&{title:$}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),{tooltipContent:!1===w?()=>null:cr(w)||ie}),(C||M||L||_)&&{customHoverBehavior:K.customHoverBehavior}),(M||L||C)&&{customClickBehavior:K.customClickBehavior}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),O&&O.length>0&&{annotations:O}),Q&&{brush:{dimension:J},onBrush:te}),K.crosshairProps),E);return e.createElement($r,{componentName:"Scatterplot",width:W,height:F},e.createElement(po,Object.assign({ref:i},se)))});function ii(e,t){return S(1===t?.5:e/(t-1))}ri.displayName="Scatterplot";const ai=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 a=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,className:l,xFormat:c,yFormat:d,xAccessor:h="x",yAccessor:g="y",orderAccessor:f,orderLabel:p,pointRadius:y=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:E,loading:j,emptyContent:C,legendInteraction:P}=o,M=a.width,L=a.height,_=a.enableHover,T=a.showGrid,B=a.title,N=a.description,D=a.summary,I=a.accessibleTable,H=a.xLabel,W=a.yLabel,F=s||[],{safeData:z,orderMap:R}=n(()=>{const e="function"==typeof h?h:e=>e[h],t="function"==typeof g?g:e=>e[g];let n=F;if(f&&F.length>0){const e="function"==typeof f?f:e=>e[f];n=[...F].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 a of n){const n=e(a),s=t(a);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&o.set(a,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[F,f,h,g]);Vr("ConnectedScatterplot",z,"xAccessor",h),Vr("ConnectedScatterplot",z,"yAccessor",g);const{activeSelectionHook:$,hoverSelectionHook:G,customHoverBehavior:Y,customClickBehavior:q,crosshairSourceId:X}=Qo({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,onClick:S,chartType:"ConnectedScatterplot",chartId:E,hoverHighlight:O,colorByField:void 0}),V=Zo(w,X),U=er(P,void 0,[]),K=n(()=>G||(U.legendSelectionHook?U.legendSelectionHook:$),[G,U.legendSelectionHook,$]),Q=n(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==K?void 0:K.isActive,a=null==K?void 0:K.predicate,s=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=ii(t,l),h=!i||!a||a(null!==(n=c.datum)&&void 0!==n?n:c)||a(null!==(o=u.datum)&&void 0!==o?o:u),g=i?h?1:.2:1;s&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=y+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=y,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[y,K]),Z=n(()=>[Q],[Q]),J=n(()=>(t,n,o)=>{var r,i;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const s=a.length,l=100>s,c=[];for(let t=0;s-1>t;t++){const n=a[t],o=a[t+1],u=ii(t,s),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:y+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:y,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[y]),ee=n(()=>[J],[J]),te=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?ii(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:y,fillOpacity:1}},[y,R]),ne=n(()=>Io(te,K,k),[te,K,k]),oe=Object.assign({top:50,right:40,bottom:60,left:70},o.margin),re=p||("string"==typeof f?f:"Order"),ie=n(()=>gr([{label:H||ur(h),accessor:h,role:"x"},{label:W||ur(g),accessor:g,role:"y"},...f?[{label:re,accessor:f,role:"group"}]:[]]),[h,g,H,W,f,re]),ae=kr({componentName:"ConnectedScatterplot",data:s,accessors:{xAccessor:h,yAccessor:g}}),se=Xr(j,M,L),le=se?null:qr(s,M,L,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!=s&&{data:z}),{xAccessor:h,yAccessor:g,pointStyle:ne,size:[M,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,showAxes:a.showAxes,xLabel:H,yLabel:W,xFormat:c,yFormat:d,enableHover:_,showGrid:T}),B&&{title:B}),N&&{description:N}),D&&{summary:D}),void 0!==I&&{accessibleTable:I}),l&&{className:l}),{tooltipContent:!1===m?()=>null:cr(m)||ie}),(w||A||S||O)&&{customHoverBehavior:Y}),(A||S||w)&&{customClickBehavior:q}),v&&{pointIdAccessor:v}),{canvasPreRenderers:Z,svgPreRenderers:ee}),b&&b.length>0&&{annotations:b}),V),x);return se||le||(ae?e.createElement(pr,{componentName:"ConnectedScatterplot",message:ae,width:M,height:L}):e.createElement($r,{componentName:"ConnectedScatterplot",width:M,height:L},e.createElement(po,Object.assign({ref:i},ce))))});ai.displayName="ConnectedScatterplot";const si=c(function(o,i){const a=t(null),s=nr(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:f,xAccessor:p="x",yAccessor:y="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:S,marginalGraphics:O,pointIdAccessor:E,annotations:j,frameProps:C={},selection:P,linkedHover:M,linkedBrush:L,onObservation:_,onClick:T,hoverHighlight:B,chartId:N,loading:D,emptyContent:I,legendInteraction:H,legendPosition:W,color:F}=o,z=s.width,R=s.height,$=s.enableHover,G=s.showGrid,Y=s.showLegend,q=s.title,X=s.description,V=s.summary,U=s.accessibleTable,K=s.xLabel,Q=s.yLabel,Z=Xr(D,z,R),J=Z?null:qr(c,z,R,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]),ae=ti({isPushMode:te,colorBy:b,colorScheme:x,showLegend:Y,legendPosition:W}),se=l(ae.wrapPush(e=>{var t;ie([e]),null===(t=a.current)||void 0===t||t.push(e)}),[ae.wrapPush,ie]),le=l(ae.wrapPushMany(e=>{var t;ie(e),null===(t=a.current)||void 0===t||t.pushMany(e)}),[ae.wrapPushMany,ie]);u(i,()=>({push:se,pushMany:le,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;ae.resetCategories(),ne.current=null,re(e=>e+1),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[se,le,ae.resetCategories]);const{activeSelectionHook:ce,hoverSelectionHook:ue,customHoverBehavior:de,customClickBehavior:he,crosshairSourceId:ge}=Qo({selection:P,linkedHover:M,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:_,onClick:T,chartType:"BubbleChart",chartId:N,hoverHighlight:B,colorByField:"string"==typeof b?b:void 0}),fe=Zo(M,ge),pe=Do(L);Co({name:(null==pe?void 0:pe.name)||"__unused_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof p?p:void 0),yField:(null==pe?void 0:pe.yField)||("string"==typeof y?y:void 0)});const ye=Uo(ee,b,x),me=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]),ve=er(H,b,me),be=n(()=>ue||(ve.legendSelectionHook?ve.legendSelectionHook:ce),[ue,ve.legendSelectionHook,ce]),xe=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]),ke=n(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?ye&&(t.fill=Ne(e,b,ye)):t.fill=F||Yo,t.r=Ie(e,m,v,xe),t},[b,ye,m,v,xe,k,w,A,F]),we=n(()=>Io(ke,be,P),[ke,be,P]),{legend:Ae,margin:Se,legendPosition:Oe}=Jo({data:ee,colorBy:b,colorScale:ye,showLegend:Y,legendPosition:W,userMargin:d,defaults:s.marginDefaults}),Ee=ae.streamingLegend||Ae,je=W||Oe,Ce=n(()=>{if(ae.streamingMarginAdjust){const e=Object.assign({},Se);for(const[t,n]of Object.entries(ae.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Se},[Se,ae.streamingMarginAdjust]),Pe=n(()=>gr([{label:K||ur(p),accessor:p,role:"x"},{label:Q||ur(y),accessor:y,role:"y"},{label:ur(m),accessor:m,role:"size"},...b?[{label:ur(b),accessor:b,role:"color"}]:[]]),[p,y,K,Q,m,b]),Me=kr({componentName:"BubbleChart",data:c,accessors:{xAccessor:p,yAccessor:y},requiredProps:{sizeBy:m}});if(Me)return e.createElement(pr,{componentName:"BubbleChart",message:Me,width:z,height:R});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:p,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:we,colorScheme:x,size:[z,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ce,showAxes:s.showAxes,xLabel:K,yLabel:Q,xFormat:g,yFormat:f,enableHover:$,showGrid:G}),Ee&&{legend:Ee,legendPosition:je}),H&&"none"!==H&&{legendHoverBehavior:ve.onLegendHover,legendClickBehavior:ve.onLegendClick,legendHighlightedCategory:ve.highlightedCategory,legendIsolatedCategories:ve.isolatedCategories}),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),{tooltipContent:!1===S?()=>null:cr(S)||Pe}),(M||_||T||B)&&{customHoverBehavior:de}),(_||T||M)&&{customClickBehavior:he}),O&&{marginalGraphics:O}),E&&{pointIdAccessor:E}),j&&j.length>0&&{annotations:j}),fe),C);return Z||J||e.createElement($r,{componentName:"BubbleChart",width:z,height:R},e.createElement(po,Object.assign({ref:a},Le)))});si.displayName="BubbleChart";const li=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 a=nr(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:s,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y="blues",customColorScale:m,showValues:v=!1,valueFormat:b,cellBorderColor:k="#fff",cellBorderWidth:w=1,tooltip:A,annotations:O,frameProps:E={},selection:M,linkedHover:L,onObservation:_,onClick:T,hoverHighlight:B,chartId:N,loading:D,emptyContent:I,showLegend:H,legendPosition:W,legendInteraction:F}=o,z=a.width,R=a.height,$=a.enableHover,G=a.title,Y=a.description,q=a.summary,X=a.accessibleTable,V=a.xLabel,U=a.yLabel,K=Xr(D,z,R),Q=K?null:qr(s,z,R,I),Z=s||[],J=null!=H&&H,ee=null!=W?W:"right",{margin:te}=Jo({data:Z,colorBy:J?"value":void 0,colorScale:void 0,showLegend:J,legendPosition:ee,userMargin:l,defaults:a.marginDefaults}),{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=Qo({selection:M,linkedHover:L,fallbackFields:[],onObservation:_,onClick:T,chartType:"Heatmap",chartId:N,hoverHighlight:B,colorByField:void 0}),se=Zo(L,ae),le=er(F,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=Z.map(ue);return[Math.min(...e),Math.max(...e)]},[Z,ue]),he=n(()=>"custom"===y&&m?m:x({blues:P,reds:C,greens:j,viridis:S}[y]||P).domain(de),[y,m,de]);n(()=>{const e=Vo(d),t=Vo(h);return{xBinCount:new Set(Z.map(e)).size,yBinCount:new Set(Z.map(t)).size}},[Z,d,h]),n(()=>({coordinates:Z}),[Z]);const ge=n(()=>e=>{const t=ue(e);return{fill:he(t),stroke:k,strokeWidth:w}},[ue,he,k,w]);n(()=>Io(ge,ce,M),[ge,ce,M]);const fe=n(()=>gr([{label:V||ur(d),accessor:d,role:"x"},{label:U||ur(h),accessor:h,role:"y"},{label:ur(g),accessor:g,role:"value"}]),[d,h,V,U,g]),pe=kr({componentName:"Heatmap",data:s,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ye=n(()=>{if(J)return{gradient:{colorFn:e=>he(e),domain:de,label:"string"==typeof g?g:"value",format:b}}},[J,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!=s&&{data:Z}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==y?y:void 0,showValues:v,heatmapValueFormat:b,size:[z,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:f,yFormat:p,enableHover:$}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),ye&&{legend:ye,legendPosition:ee}),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),{tooltipContent:!1===A?()=>null:cr(A)||fe}),(L||_||T||B)&&{customHoverBehavior:re}),(_||T||L)&&{customClickBehavior:ie}),O&&O.length>0&&{annotations:O}),se),E);return K||Q||(pe?e.createElement(pr,{componentName:"Heatmap",message:pe,width:z,height:R}):e.createElement($r,{componentName:"Heatmap",width:z,height:R},e.createElement(po,Object.assign({ref:i},me))))});li.displayName="Heatmap";const ci="__splomIdx",ui={top:4,bottom:4,left:4,right:4};function di({frameRef:n,cellSize:r,onBrush:i}){const a=t(null),s=r-ui.left-ui.right,l=r-ui.top-ui.bottom;return o(()=>{if(!a.current)return;const e=h(a.current).select(".brush-g"),t=p().extent([[0,0],[s,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,a],[s,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(a)],[o.x.invert(s),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)}},[s,l,n,i]),e.createElement("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${ui.left},${ui.top})`}))}function hi({data:n,xField:o,yField:r,cellSize:i,pointRadius:a,pointOpacity:s,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:f,onPointHover:p}){const y=t(null),m=Eo({name:d,clientId:`splom-${o}-${r}`}),v=Co({name:d,xField:o,yField:r}),b=Eo({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==p||p(null));const t=e.data,n=null==t?void 0:t[ci];void 0!==n&&(x({[ci]:[n]}),null==p||p(t,e.x+ui.left,e.y+ui.top))},[x,p]),A=l(e=>{const t={opacity:s,r:a};return t.fill=c?Ne(e,c,u):Yo,"hover"===f?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*s):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,s,a,f,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(po,{ref:y,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:ui,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?w:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.createElement(di,{frameRef:y,cellSize:i,xField:o,yField:r,onBrush:k}))}function gi({data:t,field:o,label:r,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=Eo({name:c,clientId:"splom-diag-"+o}),g=Eo({name:u,clientId:`splom-diag-${o}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.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)/a||1,l="string"==typeof s?s: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(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),f=Array.from({length:a},()=>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),a-1);if(d[i]++,p&&!y(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,p&&!y(e)||f[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),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})}),b=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})});return{bars:d.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,o,a,i,p,y,s]);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):Yo,opacity:p?.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:Yo,opacity:p?.3:.6})),p&&(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):Yo,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:Yo,opacity:.7}))))}function fi({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 pi(t){const{data:o,fields:i,fieldLabels:a={},colorBy:s,colorScheme:c,cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:f="histogram",histogramBins:p=20,brushMode:y="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:S,chartId:O}=t,E="splom",j="splom-hover",C=m?"hover":y?"brush":"hover",P=Ao(e=>e.clearSelection),[M,L]=r(null),_=l(()=>{P(j),L(null)},[P,j]),T=n(()=>(o||[]).map((e,t)=>void 0!==e[ci]?e:Object.assign(Object.assign({},e),{[ci]:t})),[o]),B=Uo(T,s,c),N=void 0!==k?k:!!s,D=n(()=>{if(!N||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:B?B(e+""):Yo})):null},[N,s,T,B]),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"}},D&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},D.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?_: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"}},a[t]||t),i.map((o,r)=>n===r?"label"===f?e.createElement(fi,{key:"diag-"+t,label:a[t]||t,cellSize:u}):e.createElement(gi,{key:"diag-"+t,data:T,field:t,label:a[t]||t,cellSize:u,bins:p,colorBy:s,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,mode:C}):e.createElement(hi,{key:`cell-${t}-${o}`,data:T,xField:o,yField:t,fieldLabels:a,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:s,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,showGrid:b,tooltip:x,mode:C,onPointHover:"hover"===C?(e,i,a)=>{e?(L({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=a?a:0}),S&&S({type:"hover",datum:e,x:null!=i?i:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O})):(L(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O}))}: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"}},a[t]||t))),M&&"hover"===C&&(()=>{const t=M.datum,n=a[M.xField]||M.xField,o=a[M.yField]||M.yField,r=s?"function"==typeof s?s(t):t[s]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[ci];return e.createElement("div",{style:{position:"absolute",left:40+M.colIndex*(u+d)+M.px,top:M.rowIndex*(u+d)+M.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[M.xField]?Number(t[M.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[M.yField]?Number(t[M.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof s?s:"group",": ",r+""))})())}function yi(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(Bo,{selections:r},e.createElement(pi,Object.assign({},t)))}yi.displayName="ScatterplotMatrix";const mi=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 a=nr(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:s,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",xCenter:p,yCenter:y,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w,sizeBy:A,sizeRange:S=[3,15],pointRadius:O=5,pointOpacity:E=.8,tooltip:j,pointIdAccessor:C,annotations:P,frameProps:M={},selection:L,linkedHover:_,onObservation:T,onClick:B,hoverHighlight:N,chartId:D,loading:I,emptyContent:H,legendInteraction:W,legendPosition:F,color:z}=o,R=a.width,$=a.height,G=a.enableHover,Y=a.showGrid,q=a.showLegend,X=a.title,V=a.description,U=a.summary,K=a.accessibleTable,Q=a.xLabel,Z=a.yLabel,J=Xr(I,R,$),ee=J?null:qr(s,R,$,H),te=s||[];Vr("QuadrantChart",te,"xAccessor",g),Vr("QuadrantChart",te,"yAccessor",f);const{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=Qo({selection:L,linkedHover:_,fallbackFields:"string"==typeof k?[k]:[],onObservation:T,onClick:B,chartType:"QuadrantChart",chartId:D,hoverHighlight:N,colorByField:"string"==typeof k?k:void 0}),se=Zo(_,ae),le=Uo(te,k,w),ce=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]),ue=er(W,k,ce),de=n(()=>oe||(ue.legendSelectionHook?ue.legendSelectionHook:ne),[oe,ue.legendSelectionHook,ne]),he=n(()=>{if(!te.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof f?f:e=>+e[f];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const a of te){const s=e(a),l=t(a);isFinite(s)&&(n>s&&(n=s),s>o&&(o=s)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=p&&isFinite(p)&&(n>p&&(n=p),p>o&&(o=p)),null!=y&&isFinite(y)&&(r>y&&(r=y),y>i&&(i=y)),n===1/0)return;const a=.1*(o-n)||1,s=.1*(i-r)||1;return{xExtent:[n-a,o+a],yExtent:[r-s,i+s]}},[te,g,f,p,y]),ge=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]),pe=n(()=>"function"==typeof f?f:e=>+e[f],[f]),ye=n(()=>e=>{const t={fillOpacity:E};if(k)le&&(t.fill=Ne(e,k,le));else{const n=fe(e),o=pe(e),r=null!=p?n>=p:void 0,i=null!=y?o>=y:void 0;t.fill=void 0===i||void 0===r?z||Yo:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?Ie(e,A,S,ge):O,t},[k,le,A,S,ge,O,E,fe,pe,p,y,m,z]),me=n(()=>Io(ye,de,L),[ye,de,L]),{legend:ve,margin:be,legendPosition:xe}=Jo({data:te,colorBy:k,colorScale:le,showLegend:q,legendPosition:F,userMargin:l,defaults:a.marginDefaults}),ke=n(()=>{if(!te.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof f&&e.add(f),"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,f,k,A]),we=n(()=>gr([...ke?[{label:ke,accessor:ke,role:"title"}]:[],{label:Q||ur(g),accessor:g,role:"x"},{label:Z||ur(f),accessor:f,role:"y"},...k?[{label:ur(k),accessor:k,role:"color"}]:[],...A?[{label:ur(A),accessor:A,role:"size"}]:[]]),[ke,g,f,Q,Z,k,A]),Ae=kr({componentName:"QuadrantChart",data:s,accessors:{xAccessor:g,yAccessor:f}}),Se=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 a=r.width,s=r.height,l=null!=p?o.x(p):a/2,c=null!=y?o.y(y):s/2;if(null!=p&&!isFinite(l))return;if(null!=y&&!isFinite(c))return;const u=Math.max(0,Math.min(a,l)),d=Math.max(0,Math.min(s,c)),h=[{config:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:a-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:s-d},{config:m.bottomRight,x:u,y:d,w:a-u,h:s-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,s),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(a,d),e.stroke(),e.setLineDash([])}]},[p,y,m,v]),Oe=n(()=>b?[...Se,(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,a=null!=p?n.x(p):r/2,s=null!=y?n.y(y):i/2;(null==p||isFinite(a))&&(null==y||isFinite(s))&&(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)}]:Se,[Se,b,x,m,p,y]),Ee=n(()=>{const e=M.canvasPreRenderers||[];return[...Oe,...e]},[Oe,M.canvasPreRenderers]),je=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,a=r.height,s=null!=p?o.x(p):i/2,l=null!=y?o.y(y):a/2;if(null!=p&&!isFinite(s))return null;if(null!=y&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,s)),u=Math.max(0,Math.min(a,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:a-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:a-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:a,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:a-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:a-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[p,y,m,v,b,x]),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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:te}),{xAccessor:g,yAccessor:f,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:S,pointStyle:me,colorScheme:w,size:[R,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:be,showAxes:a.showAxes,xLabel:Q,yLabel:Z,xFormat:d,yFormat:h,enableHover:G,showGrid:Y}),he&&{xExtent:he.xExtent,yExtent:he.yExtent}),ve&&{legend:ve,legendPosition:xe}),W&&"none"!==W&&{legendHoverBehavior:ue.onLegendHover,legendClickBehavior:ue.onLegendClick,legendHighlightedCategory:ue.highlightedCategory,legendIsolatedCategories:ue.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?we:cr(j)||we}),(_||T||B||N)&&{customHoverBehavior:re}),(T||B||_)&&{customClickBehavior:ie}),C&&{pointIdAccessor:C}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:Ee}),se),M),Ee.length>0&&{canvasPreRenderers:Ee}),{svgPreRenderers:je});return J||ee||(Ae?e.createElement(pr,{componentName:"QuadrantChart",message:Ae,width:R,height:$}):e.createElement($r,{componentName:"QuadrantChart",width:R,height:$},e.createElement(po,Object.assign({ref:i},Ce))))});mi.displayName="QuadrantChart";const vi="__ma_unitized",bi="__ma_series";function xi(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function ki(e,t){return t[0]+e*(t[1]-t[0])}const wi=c(function(o,r){var i,a;const s=t(null),l=t([]);u(r,()=>({push:e=>{if(!s.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)&&s.current.push(Object.assign(Object.assign({},t),{[vi]:xi(i,r),[bi]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!s.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 a=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=a&&isFinite(a)&&t.push(Object.assign(Object.assign({},n),{[vi]:xi(a,i),[bi]:r.label||"Series "+(e+1)}))}s.current.pushMany(t)},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 c=nr(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:f,xAccessor:p="x",series:y,colorScheme:m,curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:_}=o,T=c.width,B=c.height,N=c.enableHover,D=c.showGrid,I=null===(i=c.showLegend)||void 0===i||i,H=c.title,W=c.description,F=c.summary,z=c.accessibleTable,R=c.xLabel,$=2===y.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||$||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${y.length}. Rendering as a standard multi-line chart.`);const G=Xr(P,T,B),Y=G?null:qr(d,T,B,M),q=d||[],X=qo(),V=n(()=>{let e;if(Array.isArray(m))e=m;else if(X&&X.length>0)e=X;else{const t=Me[m];e=Array.isArray(t)?t:Le}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:K,extents:Q}=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,!$){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),{[vi]:r,[bi]: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),{[vi]:xi(i,e[o]),[bi]:U[o]}))}return{unitizedData:t,extents:e}},[q,y,$,U]),Z=n(()=>{if($&&Q.length>=2)return[{orient:"left",label:U[0],tickFormat:y[0].format||(e=>{const t=ki(e,Q[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:U[1],tickFormat:y[1].format||(e=>{const t=ki(e,Q[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[$,Q,y,U]),J=oi({data:n(()=>K.length>0?K:U.map(e=>({[bi]:e})),[K,U]),rawData:d,colorBy:bi,colorScheme:V,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:[bi],unwrapData:!1,onObservation:O,onClick:E,hoverHighlight:j,chartType:"MultiAxisLineChart",chartId:C,showLegend:I,userMargin:h,marginDefaults:$?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:P,emptyContent:M,width:T,height:B});if(J.earlyReturn)return J.earlyReturn;const ee=n(()=>{const e=new Map;return U.forEach((t,n)=>e.set(t,V[n])),t=>({stroke:e.get(t[bi])||V[0],strokeWidth:b,fill:"none"})},[U,V,b]),te=n(()=>Io(ee,J.effectiveSelectionHook,A),[ee,J.effectiveSelectionHook,A]),ne=n(()=>{if(!1===x)return()=>null;return cr(x)||(t=>{var n;const o=t.data||t,r=o[bi],i=U.indexOf(r),a=o[vi],s=$&&i>=0&&Q[i]?ki(a,Q[i]):a,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 p?p(o):o[p];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 p?p:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(s)}`))})},[x,U,V,Q,$,y,p]),oe=kr({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:p}}),re=$?[0,1]:void 0,ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:K}),{xAccessor:p,yAccessor:vi,groupAccessor:bi,lineStyle:te,colorScheme:V,size:[T,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:c.showAxes}),Z&&{axes:Z}),{xLabel:R}),$?{}:{yLabel:U[0]}),{xFormat:f}),$&&re&&{yExtent:re}),{enableHover:N}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:D,curve:v}),J.legendBehaviorProps),H&&{title:H}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),g&&{className:g}),{tooltipContent:ne}),k&&{annotations:k}),(S||O||E||j)&&{customHoverBehavior:J.customHoverBehavior}),(O||E||S)&&{customClickBehavior:J.customClickBehavior}),J.crosshairProps),w);return G||Y||(oe?e.createElement(pr,{componentName:"MultiAxisLineChart",message:oe,width:T,height:B}):e.createElement($r,{componentName:"MultiAxisLineChart",width:T,height:B},e.createElement(po,Object.assign({ref:s},ie))))});function Ai(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function Si(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=B(e,.25))&&void 0!==t?t:i,median:null!==(n=B(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=B(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}wi.displayName="MultiAxisLineChart";const Oi={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize,f=[];if(a){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=a(n);e.has(t)||(e.add(t),f.push(t))}}else f.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of f){const c=t.get(i);if(!c)continue;let f=c.total;g&&n>0&&(f/=n);const p=s(c.pieces[0],a?i:e.name),y=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const t=l(0>f?r:o+f),n=0>f?l(r+f)-l(r):l(o)-l(o+f);u.push(Ve(e.x,t,e.width,Math.abs(n),p,y,i)),0>f?r+=f:o+=f}else if(h){const t=l(0>f?r+f:o),n=0>f?l(r)-l(r+f):l(o+f)-l(o);u.push(Ve(t,e.x,Math.abs(n),e.width,p,y,i)),0>f?r+=f:o+=f}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,l=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let i=0;d.length>i;i++){const h=l.get(d[i])||[];for(const l of h){const h=r(l),g=a(l,d[i]);if(u){const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(Ve(r,Math.min(a,u),o,Math.abs(a-u),g,l,d[i]))}else{const r=e.x+i*t+n/2,a=s(0),u=s(h);c.push(Ve(Math.min(a,u),r,Math.abs(u-a),o,g,l,d[i]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,f=s.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=f&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),f=c?a(s):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:o})}}return l},pie:Ai,donut:Ai,boxplot:function(e,t){var n,o,r,i,a;const{scales:s,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=s,f=[],p="vertical"===g,y=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const s=t[0],l=t[t.length-1],c=null!==(n=B(t,.25))&&void 0!==n?n:s,g=null!==(o=B(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=B(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,k=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:s,w=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:l,A=d(e.pieceData[0],e.name),S=[];if(y)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=p?e.middle:h(n),r=p?h(n):e.middle;S.push({px:o,py:r,value:n,datum:t})}}if(f.push({type:"boxplot",x:p?e.middle:0,y:p?0:e.middle,projection:p?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(k),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(w),stats:{n:t.length,min:k,q1:c,median:g,q3:m,max:w,mean:t.reduce((e,t)=>e+t,0)/t.length},style:A,datum:e.pieceData,category:e.name,outliers:S}),y)for(const e of S)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,f=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],s=(a-i)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),f-1)]++;const y=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;f>t;t++){const n=u(i+(t+.5)*s);v+=` L ${e.middle+d[t]/y*m} ${n}`}v+=` L ${e.middle} ${u(a)}`;for(let t=f-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${u(i+(t+.5)*s)} ${e.middle-d[t]/y*m}`;v+=` L ${u(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=B(t,.25))&&void 0!==n?n:i,l=null!==(o=B(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=B(t,.75))&&void 0!==r?r:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(i)),width:e.width,height:Math.abs(u(a)-u(i))}:{x:Math.min(u(i),u(a)),y:e.x,width:Math.abs(u(a)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:Si(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l}=o,c=[],u=i.bins||25,d=i.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,p=Math.max(...i,1),y=s(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/p)*e.width*.9,a=l(n+t*r),s=l(n+(t+1)*r);c.push(Ve(Math.min(a,s),e.x+e.width-o,Math.abs(s-a),o,y,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const f=Math.max(...c,1),p=s(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/f*y}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:Si(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(Ve(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(Ve(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,a,s,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,g=[],f=t.width/2,p=!1!==e.config.showLabels,y=e.scales.o.domain().map(e=>c[e]).filter(Boolean);if(0===y.length)return g;const v=[],b=new Set;for(const e of y)for(const t of e.pieceData){const e=d?d(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],k=[];let w=0;for(const e of y){const t=new Map;let n=0;for(const o of e.pieceData){const e=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}k.push({col:e,groups:t,stepTotal:n}),x||n>w&&(w=n)}if(x)for(const e of k){let t=0,n=0;for(let o=0;v.length>o;o++){const r=e.groups.get(v[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>w&&(w=o)}if(0===w)return g;const A=new Map;for(const e of v){const t=k[0].groups.get(e);A.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=k[0].stepTotal,O=x?.95*f:.9*t.width,E=m().domain([0,w]).range([0,O]),j=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let C=new Map;for(let e=0;k.length>e;e++){const t=k[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,y=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=E(o.total))}let r=f,i=f;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=E(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const k=h(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,S=w>0?c.total/w*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:S,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});p&&(0===s&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=f,O.__funnelStepLabelY=d,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+m/2,O.__funnelValueLabelY=d,O.__funnelBarW=m),g.push(Ve(x,d,m,u,k,O,l)),y.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,a=E(e),s=f-a/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});p&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=f,w.__funnelStepLabelY=d,w.__funnelRowWidth=a,w.__funnelValueLabelX=f,w.__funnelValueLabelY=d,w.__funnelBarW=a),g.push(Ve(s,d,a,u,x,w,b)),y.set(l,{x:s,y:d,w:a,h:u})}if(e>0&&C.size>0){const e=x?v:[v[0]];for(const o of e){const e=C.get(o),r=y.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),a={type:"trapezoid",points:[[e.x,e.y+e.h],[e.x+e.w,e.y+e.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:i.fill||"#999",opacity:j},datum:null!==(l=null===(s=t.groups.get(o))||void 0===s?void 0:s.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};g.push(a)}}C=y}return g},"bar-funnel":function(e,t){var n,o,r,i;const{columns:a,getR:s,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>a[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=s(o);r.total+=i,r.pieces.push(o),n+=i}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,a=e>0?y[e-1]:null,s=n.width/b,l=s*x,u=s-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(r=m.get(h))&&void 0!==r?r:y,x=b>0?y/b*100:0,k=null==a?void 0:a.groups.get(h),w=null!==(i=null==k?void 0:k.total)&&void 0!==i?i:y,A=o?0:Math.max(0,w-y),S=n.x+e*s+l/2,O=v(y),E=v(0)-O,j=c(f.pieces[0],p?h:n.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:v(y+A)});if(d.push(Ve(S,O,u,E,j,C,p?h:n.name)),A>0){const e=v(y+A),t=O-e,o=Object.assign({},j),r=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(Ve(S,e,u,t,o,r,p?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=a(n,l);if(u){const r=s(t),i=s(t+o);c.push(Ve(r,e.x,i-r,e.width,d,n,l))}else{const r=s(t+o),i=s(t);c.push(Ve(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class Ei{constructor(e){this.rExtent=new Se,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new Ae(e.windowSize),this.getO=Pe(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new Se)):(this.getR=je(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Pe(e.stackBy),this.getGroup=Pe(e.groupBy),this.getColor=Pe(e.colorAccessor),this.getConnector=Pe(e.connectorAccessor),this.getDataId=Pe(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Ae(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,i),s="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=k().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(a).range([o,n])}else s?(c=k().domain(i).range([0,e.height]).padding(l),u=m().domain(a).range([0,e.width])):(c=k().domain(i).range([0,e.width]).padding(l),u=m().domain(a).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{var i;const a=this.rExtents[r];a.dirty&&a.recalculate(n,o);let[l,c]=a.extent;l===1/0&&(l=0,c=1);const u=null!==(i=t.extentPadding)&&void 0!==i?i:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),s?m().domain([l,c]).range([0,e.width]):m().domain([l,c]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if(("streaming"===this.config.runtimeMode||this._hasStreamingData)&&void 0===n){const n=new Set;for(const t of e)n.add(this.getO(t));const o=Math.max(50,3*n.size);if(this.categories.size>o){let e=this.categories.size-o;for(const t of this.categories){if(0>=e)break;n.has(t)||(this.categories.delete(t),e--)}}return t.filter(e=>n.has(e))}if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o,r,i,a;const s=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let c=0,u=0;if("bar"===s&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===s||"bar-funnel"===s)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===s||"clusterbar"===s||"bar-funnel"===s||"swimlane"===s;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==s){const e=u-c,t=e>0?e*l:1;null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(a=this.config.rExtent)||void 0===a?void 0:a[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===s||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=Oi[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:_e,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;let o=0;for(let n=0;t.length>n;n++){const r=t[n],s=this.config.oAccessor;if(("function"==typeof s?s(r):r[s||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;a>r&&(n._pulseIntensity=1-r/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}getNodeKey(e,t){var n,o;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let g=!1;const f=new Set,p=new Map;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeKey(s,p);if(!l)continue;s._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===s.type?c?(f.add(l),s._targetOpacity=null!==(t=s.style.opacity)&&void 0!==t?t:1,c.x===s.x&&c.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=c.x,s.y=c.y,g=!0)):(s._targetOpacity=null!==(n=s.style.opacity)&&void 0!==n?n:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0):"rect"===s.type&&(c?(f.add(l),s._targetOpacity=null!==(o=s.style.opacity)&&void 0!==o?o:1,c.x===s.x&&c.y===s.y&&c.w===s.w&&c.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,g=!0)):(s._targetOpacity=null!==(a=s.style.opacity)&&void 0!==a?a:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)f.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(s=t.r)&&void 0!==s?s:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:$e(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=ze(e,this.activeTransition),i=Fe(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=Re(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=Re(o.x,e._targetX,i),e.y=Re(o.y,e._targetY,i)}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=Re(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=Re(n.x,e._targetX,i),e.y=Re(n.y,e._targetY,i),void 0!==n.w&&(e.w=Re(n.w,e._targetW,i),e.h=Re(n.h,e._targetH,i))}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this.version++,r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,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.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this.version++,i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e),(void 0!==e.oAccessor||void 0!==e.categoryAccessor)&&(Ee(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=Pe(this.config.oAccessor||this.config.categoryAccessor,"category"),this.categories.clear())),void 0!==e.rAccessor){const n=Array.isArray(e.rAccessor)?e.rAccessor:[e.rAccessor],o=Array.isArray(t.rAccessor)?t.rAccessor:[t.rAccessor];if(n.length!==o.length||n.some((e,t)=>!Ee(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Se)):(this.getR=je(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Ee(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Pe(this.config.stackBy):void 0),"groupBy"in e&&!Ee(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Pe(this.config.groupBy):void 0),"colorAccessor"in e&&!Ee(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Ee(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Pe(this.config.connectorAccessor):void 0)}}function ji(e,t,n){const o=tt(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function Ci(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function Pi(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Mi(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Li(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}function _i(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,{rTickValues:h}=t,g="radial"===(null==l?void 0:l.projection),f="horizontal"===(null==l?void 0:l.projection),p=n(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||Ti)(e)})),[l,d,g,h]),y=u&&l&&!g,m=c&&l&&!g;return y||m?e.createElement("svg",{width:i,height:a,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&e.createElement("g",{className:"ordinal-grid"},p.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:f?t.pixel:0,y1:f?0:t.pixel,x2:f?t.pixel:o,y2:f?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&e.createElement(e.Fragment,null,f?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Ti(e){return Math.round(100*e)/100+""}function Bi(o){var r,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:f,rLabel:p,oFormat:y,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:O="right",foregroundGraphics:E,annotations:j,svgAnnotationRules:C,xAccessor:P,yAccessor:M,annotationData:L,underlayRendered:_,children:T}=o,B="radial"===(null==d?void 0:d.projection),N="horizontal"===(null==d?void 0:d.projection),D=!1!==g,I=n(()=>h&&D&&d&&!B?d.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=d.o(e))&&void 0!==n?n:0)+d.o.bandwidth()/2,label:y?y(e,t):e}}):[],[h,D,d,y,B]),H=o.rTickValues,W=o.tickLabelEdgeAlign,F=n(()=>h&&d&&!B?(H||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(m||Ti)(e)})):[],[h,d,m,B,H]),z=t(new Map),R=t(null!==(r=null==j?void 0:j.length)&&void 0!==r?r:0),$=null!==(i=null==j?void 0:j.length)&&void 0!==i?i:0;R.current!==$&&(R.current=$,z.current=new Map);const G=n(()=>{if(!j||0===j.length)return null;const e=zt(),t="horizontal"===(null==d?void 0:d.projection),n=(null==d?void 0:d.o)?e=>{var t;return(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2}:null,o={scales:d?{x:t?d.r:n||d.r,y:t&&n||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:P,yAccessor:M,width:a,height:s,data:L,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:z.current};return j.map((t,n)=>{if(C){const r=C(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[j,C,a,s,d,P,M,L]);return h||b||x||E||G&&G.length>0||v||T?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!B&&!_&&e.createElement("g",{className:"ordinal-grid"},F.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:N?t.pixel:0,y1:N?0:t.pixel,x2:N?t.pixel:a,y2:N?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!B&&e.createElement("g",{className:"ordinal-axes"},N?e.createElement(e.Fragment,null,!_&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",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)))),f&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},f),!_&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!_&&(null==d?void 0:d.r)&&(()=>{const t=d.r(0);return t>1&&a-1>t?e.createElement("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),F.map((t,n)=>{const o=W?0===n?"start":n===F.length-1?"end":"middle":"middle";return e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))}),p&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p)):e.createElement(e.Fragment,null,!_&&(()=>{const t=(null==d?void 0:d.r)?d.r(0):s,n=0>t||t>s?s:t;return e.createElement("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),I.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},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:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!_&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),p&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},p))),G,E,T),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),Pt({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:O,title:b,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S})):null}function Ni({width:n,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,onBrush:c}){const u=t(null),d=t(null),p=t(c);p.current=c;const y=t(l);y.current=l;const m=t(!1),v=t(null),b="horizontal"===(null==l?void 0:l.projection),x=t(b);return x.current=b,o(()=>{if(!u.current)return;const e=h(u.current).select(".brush-g"),t=b?g():f();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(m.current)return;const t=y.current;if(!t)return;if(!e.selection)return v.current=null,void p.current(null);const[n,o]=e.selection;let r;r=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};v.current=i,p.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,b]),o(()=>{if(!l||!d.current||!v.current)return;if(!u.current)return;const e=v.current,t=h(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(m.current=!0,t.call(d.current.move,[n,o]),m.current=!1):(m.current=!0,t.call(d.current.move,[o,n]),m.current=!1)},[l,b]),e.createElement("svg",{ref:u,width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}}))}function Di(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}const Ii=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)Di(e,t),e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=("string"==typeof t.style.fill?Rn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0&&(Di(e,t),Qn(e,t)),e.globalAlpha=1},Hi=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=("string"==typeof t.style.fill?Rn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Wi=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=Rn(e,n.style.stroke)||("string"==typeof n.style.fill?Rn(e,n.style.fill):n.style.fill)||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}};function Fi(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function zi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Ri=null;const $i=new Map;function Gi(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=$i.get(n);if(void 0!==o)return o;const r=function(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Ri||(Ri=document.createElement("canvas")),Ri.width=e,Ri.height=e,Ri)}(s)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return $i.set(n,r),r}function Yi(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function qi(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Xi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Vi=e=>[Wi,...e],Ui={bar:Vi([oo]),clusterbar:Vi([oo]),point:Vi([no]),swarm:Vi([no]),pie:[Ii],donut:[Ii],boxplot:Vi([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},no]),violin:Vi([Hi]),histogram:Vi([oo]),ridgeline:Vi([Hi]),timeline:Vi([oo]),funnel:[oo,(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(i=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==i?i:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(a=t.style)||void 0===a?void 0:a.fill)||"#999",e.fill(),(null===(s=t.style)||void 0===s?void 0:s.stroke)&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(i=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==i?i:0))continue;const a=n.__funnelStepLabelX,s=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,a,s),e.fillStyle="#fff",e.fillText(o,a,s)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(a=n.__funnelBarW)&&void 0!==a?a:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Fi(r):null!=i?`${Fi(r)} (${zi(i)})`:Fi(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=Fi(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(s=n.__funnelValueLabelY)&&void 0!==s?s:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[oo,(e,t,n,o)=>{var r,i;const a=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of a){const n="string"==typeof t.style.fill?t.style.fill:"#999",o=Gi(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(i=t.style.opacity)&&void 0!==i?i:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0!==r.length){for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,a=i?Xi(r):"",s=qi(o);e.font="bold 13px sans-serif";const l=i?e.measureText(a).width:0;e.font="11px sans-serif";const c=e.measureText(s).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,f=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),Yi(e,g,f,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Yi(e,g,f,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(a,h,f+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(s,h,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(s,h,f+3))}e.lineWidth=1}}],swimlane:Vi([oo])},Ki={top:50,right:40,bottom:60,left:70},Qi={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Zi({hover:t}){var n,o,r,i,a,s;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:Qi},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:Qi},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:Qi},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Qi},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(s=null!==(a=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==a?a:l.pct)&&void 0!==s?s:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Qi},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:Qi},f&&e.createElement("div",{style:{fontWeight:"bold"}},f+""),""!==p&&e.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const Ji=c(function(i,a){var s,c,d,h,g,f,p,y,m,v;const{chartType:b,runtimeMode:x,data:k,oAccessor:w="category",rAccessor:A="value",colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:C,valueAccessor:P,categoryAccessor:M,projection:L="vertical",size:_=[600,400],responsiveWidth:T,responsiveHeight:B,margin:N,barPadding:D,baselinePadding:I,innerRadius:H,normalize:W,startAngle:F,sweepAngle:z,dynamicColumnWidth:R,bins:$,showOutliers:G,showIQR:Y,amplitude:q,connectorOpacity:X,showLabels:V,connectorAccessor:U,connectorStyle:K,dataIdAccessor:Q,rExtent:Z,oExtent:J,extentPadding:ee=.05,oSort:te,windowMode:ne="sliding",windowSize:oe=200,pieceStyle:re,summaryStyle:ae,colorScheme:se,barColors:le,showAxes:ce=!0,showCategoryTicks:ue,oLabel:de,rLabel:he,oFormat:ge,rFormat:fe,rTickValues:pe,tickLabelEdgeAlign:ye,enableHover:me=!0,hoverAnnotation:ve,tooltipContent:be,customHoverBehavior:xe,annotations:ke,svgAnnotationRules:Ae,showGrid:Se=!1,legend:Oe,legendHoverBehavior:Ee,legendClickBehavior:je,legendHighlightedCategory:Ce,legendIsolatedCategories:Pe,legendPosition:Me,backgroundGraphics:Le,foregroundGraphics:_e,title:Te,className:Be,background:Ne,centerContent:De,decay:Ie,pulse:He,transition:We,staleness:Fe,brush:ze,onBrush:Re,accessibleTable:$e=!0,description:Ge,summary:Ye}=i,qe=Mn(),Xe=t(qe);Xe.current=qe;const[Ve,Ue]=kt(_,T,B),Ke=n(()=>Object.assign(Object.assign({},Ki),N),[N]),Qe=Ue[0]-Ke.left-Ke.right,Ze=Ue[1]-Ke.top-Ke.bottom,Je="function"==typeof _e?_e({size:Ue,margin:Ke}):_e,et=t(null),tt=t(!0),nt=In(e=>e.theme),ot=t(0),rt=t(null),it=t(()=>{}),[at,st]=r(null),[lt,ct]=r(null),[ut,dt]=r(0),[ht,gt]=r(!1),ft=me||ve,pt="streaming"===x,bt=n(()=>({chartType:b,runtimeMode:pt?"streaming":"bounded",windowSize:oe,windowMode:ne,extentPadding:ee,projection:L,oAccessor:pt?void 0:w,rAccessor:pt?void 0:A,colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:pt?C:void 0,valueAccessor:pt?P||("string"==typeof A||"function"==typeof A?A:void 0):void 0,categoryAccessor:pt?M||w:void 0,rExtent:Z,oExtent:J,barPadding:D,baselinePadding:I,innerRadius:H,normalize:W,startAngle:F,sweepAngle:z,dynamicColumnWidth:R,bins:$,showOutliers:G,showIQR:Y,amplitude:q,connectorOpacity:X,showLabels:V,connectorAccessor:U,connectorStyle:K,dataIdAccessor:Q,oSort:te,pieceStyle:re,summaryStyle:ae,colorScheme:se,barColors:le,decay:Ie,pulse:He,transition:We,staleness:Fe}),[b,oe,ne,ee,L,w,A,S,O,E,j,C,P,M,Z,J,D,I,H,W,F,z,R,$,G,Y,q,X,V,U,K,Q,te,re,ae,se,le,Ie,He,We,Fe,pt]),At=t(null);At.current||(At.current=new Ei(bt));const St=l(()=>{ot.current||(ot.current=requestAnimationFrame(()=>it.current()))},[]);o(()=>{var e;null===(e=At.current)||void 0===e||e.updateConfig(bt),tt.current=!0,St()},[bt,St]),o(()=>{et.current&&$n(et.current),tt.current=!0,St()},[nt,St]);const Ot=t(null);Ot.current||(Ot.current=new we(e=>{const t=At.current;t&&t.ingest(e)&&(tt.current=!0,St())}));const Et=l(e=>{var t;null===(t=Ot.current)||void 0===t||t.push(e)},[]),jt=l(e=>{var t;null===(t=Ot.current)||void 0===t||t.pushMany(e)},[]),Ct=l(()=>{var e,t;null===(e=Ot.current)||void 0===e||e.clear(),null===(t=At.current)||void 0===t||t.clear(),tt.current=!0,St()},[St]);u(a,()=>({push:Et,pushMany:jt,remove:e=>{var t,n,o;null===(t=Ot.current)||void 0===t||t.flush();const r=null!==(o=null===(n=At.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return r.length>0&&(tt.current=!0,St()),r},update:(e,t)=>{var n,o,r;null===(n=Ot.current)||void 0===n||n.flush();const i=null!==(r=null===(o=At.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(tt.current=!0,St()),i},clear:Ct,getData:()=>{var e,t,n;return null===(e=Ot.current)||void 0===e||e.flush(),null!==(n=null===(t=At.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=At.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Et,jt,Ct,St]),o(()=>{var e;k&&(null===(e=Ot.current)||void 0===e||e.setBoundedData(k))},[k]);const Pt=t(()=>{}),Mt=t(()=>{});Pt.current=e=>{if(!ft)return;const t=et.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ke.left,r=e.clientY-n.top-Ke.top;if(0>o||o>Qe||0>r||r>Ze)return void(rt.current&&(rt.current=null,st(null),xe&&xe(null),St()));const i=At.current;if(!i||0===i.scene.length)return;const a="radial"===L,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=ji(i,t,n);break;case"point":e=Ci(i,t,n,o);break;case"wedge":e=Pi(i,t,n);break;case"boxplot":e=Mi(i,t,n);break;case"violin":e=Li(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-Qe/2:o,a?r-Ze/2:r);if(!s)return void(rt.current&&(rt.current=null,st(null),xe&&xe(null),St()));const l=s.datum||{},c=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"object"!=typeof l||null===l||Array.isArray(l)?{}:l),{data:l,time:s.x,value:s.y,x:s.x,y:s.y}),s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});rt.current=c,st(c),xe&&(xe(c),tt.current=!0),St()},Mt.current=()=>{rt.current&&(rt.current=null,st(null),xe&&(xe(null),tt.current=!0),St())},l(e=>Pt.current(e),[]);const Lt=l(()=>Mt.current(),[]),_t=t(-1),Tt=t(null),Bt=t(null),Nt=l(e=>{const t=At.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Bt.current&&Bt.current.version===n)o=Bt.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)if("rect"===a.type&&null!=a.x){const e=null!==(n=null===(t=a.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(o=a.group)&&void 0!==o?o:e})}else if("point"===a.type)i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(r=a.group)&&void 0!==r?r:"_default"});else if("wedge"===a.type&&null!=a.cx){const e=((a.startAngle||0)+(a.endAngle||0))/2,t=((a.innerRadius||0)+(a.outerRadius||50))/2;i.push({x:a.cx+Math.cos(e)*t,y:a.cy+Math.sin(e)*t,datum:a.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=yt(e),Bt.current={version:n,graph:o}}const r=_t.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),_t.current=0;const t=o.flat[0];Tt.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},xt(t)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});return rt.current=n,st(n),xe&&xe(n),void St()}const i=mt(o,r),a=vt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return _t.current=-1,Tt.current=null,rt.current=null,st(null),xe&&xe(null),void St();_t.current=a;const s=o.flat[a];Tt.current={shape:s.shape,w:s.w,h:s.h};const l=Object.assign(Object.assign({},xt(s)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});rt.current=l,st(l),xe&&xe(l),St()},[xe,St]),Dt=l(e=>{_t.current=-1,Tt.current=null,Pt.current(e)},[]);it.current=()=>{var e,t;ot.current=0;const n=et.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=At.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(Xe.current?i+1e6:i),s=!Xe.current&&a,l=tt.current;l&&!a&&(r.computeScene({width:Qe,height:Ze}),tt.current=!1),(l||s)&&n.setAttribute("aria-label",dn(r.scene,b+" chart"));const c=Wn(),u=Ue[0]*c,d=Ue[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Ue[0]+"px",n.style.height=Ue[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Ue[0],Ue[1]);const h=null!==(e=null==Fe?void 0:Fe.threshold)&&void 0!==e?e:5e3,g=Fe&&r.lastIngestTime>0&&i-r.lastIngestTime>h;g&&(o.globalAlpha=null!==(t=null==Fe?void 0:Fe.dimOpacity)&&void 0!==t?t:.5);const f=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",p=Ne||(f&&"transparent"!==f?f:null);p&&(o.fillStyle=p,o.fillRect(0,0,Ue[0],Ue[1]));const y="radial"===L;o.save(),o.beginPath(),o.rect(Ke.left,Ke.top,Qe,Ze),o.clip(),y?(o.save(),o.translate(Ke.left+Qe/2,Ke.top+Ze/2)):o.translate(Ke.left,Ke.top);const m=Ui[b]||[],v={width:Qe,height:Ze};for(const e of m)e(o,r.scene,r.scales,v);y&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(ct(r.scales),dt(e=>e+1)),(null==Fe?void 0:Fe.showBadge)&&gt(!!g),(s||r.hasActivePulses)&&(ot.current=requestAnimationFrame(()=>it.current()))},o(()=>(St(),()=>{ot.current&&(cancelAnimationFrame(ot.current),ot.current=0)}),[St]),o(()=>{tt.current=!0,St()},[b,Qe,Ze,ce,Ne,St]),wt(Fe,At,tt,St,ht,gt);const It=ft&&at?be?be(at):e.createElement(Zi,{hover:at}):null,Ht="radial"===L,Wt=It?e.createElement(Cn,{x:at?Ht?at.x+Qe/2:at.x:0,y:at?Ht?at.y+Ze/2:at.y:0,containerWidth:Qe,containerHeight:Ze,margin:Ke,className:"stream-ordinal-tooltip"},It):null;if(an){const t=At.current;t&&k&&(t.ingest({inserts:k,bounded:!0}),t.computeScene({width:Qe,height:Ze}));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="radial"===L,i=r?Ke.left+Qe/2:Ke.left,a=r?Ke.top+Ze/2:Ke.top;return e.createElement("div",{className:"stream-ordinal-frame"+(Be?" "+Be:""),role:"img","aria-label":Ge||("string"==typeof Te?Te:"Ordinal chart"),style:{position:"relative",width:Ue[0],height:Ue[1]}},e.createElement(An,{summary:Ye}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ue[0],height:Ue[1],style:{position:"absolute",left:0,top:0}},Le&&e.createElement("g",{transform:`translate(${Ke.left},${Ke.top})`},Le),e.createElement("g",{transform:`translate(${i},${a})`},Ne&&e.createElement("rect",{x:0,y:0,width:Qe,height:Ze,fill:Ne}),n.map((t,n)=>function(t,n){var o,r,i,a,s;const l=t.category||t.group||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:rn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:rn(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=ie().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle).endAngle(n.endAngle)({})||"";return e.createElement("path",{key:u,d:o,transform:`translate(${n.cx},${n.cy})`,fill:rn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:rn(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:rn(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:rn(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:rn(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(Bi,{width:Qe,height:Ze,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ke,scales:o,showAxes:ce,showCategoryTicks:ue,oLabel:de,rLabel:he,oFormat:ge,rFormat:fe,rTickValues:pe,tickLabelEdgeAlign:ye,showGrid:Se,title:Te,legend:Oe,legendHoverBehavior:Ee,legendClickBehavior:je,legendHighlightedCategory:Ce,legendIsolatedCategories:Pe,legendPosition:Me,foregroundGraphics:Je,annotations:ke,svgAnnotationRules:Ae,annotationFrame:0,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null==t?void 0:t.getData()}),De&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:Ke.left+Qe/2,top:Ke.top+Ze/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},De))}const Ft="semiotic-table-"+e.useId();return e.createElement("div",{ref:Ve,className:"stream-ordinal-frame"+(Be?" "+Be:""),role:"group","aria-label":Ge||("string"==typeof Te?Te:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":Ue[0],height:B?"100%":Ue[1],overflow:"visible"},onKeyDown:Nt},$e&&e.createElement(Sn,{tableId:Ft}),$e&&e.createElement(kn,{scene:null!==(h=null===(d=At.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:Ft,chartTitle:"string"==typeof Te?Te:void 0}),e.createElement(An,{summary:Ye}),e.createElement("div",{role:"img","aria-label":Ge||("string"==typeof Te?Te:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ft?Dt:void 0,onMouseLeave:ft?Lt:void 0},Le&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Ue[0],height:Ue[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Ke.left},${Ke.top})`},Le)),e.createElement(_i,{width:Qe,height:Ze,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ke,scales:lt,showAxes:ce,showGrid:Se,rFormat:fe,rTickValues:pe}),e.createElement("canvas",{ref:et,"aria-label":dn(null!==(f=null===(g=At.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:Ue[0],height:Ue[1]}}),e.createElement(On,{hoverPoint:at}),e.createElement(Bi,{width:Qe,height:Ze,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ke,scales:lt,showAxes:ce,showCategoryTicks:ue,oLabel:de,rLabel:he,oFormat:ge,rFormat:fe,showGrid:Se,title:Te,legend:Oe,legendHoverBehavior:Ee,legendClickBehavior:je,legendHighlightedCategory:Ce,legendIsolatedCategories:Pe,legendPosition:Me,foregroundGraphics:Je,annotations:ke,svgAnnotationRules:Ae,annotationFrame:ut,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null===(p=At.current)||void 0===p?void 0:p.getData(),underlayRendered:!0}),(ze||Re)&&"radial"!==L&&e.createElement(Ni,{width:Qe,height:Ze,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ke,scales:lt,onBrush:Re||(()=>{})}),De&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:Ke.left+Qe/2,top:Ke.top+Ze/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},De),(null==Fe?void 0:Fe.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Fe.badgePosition?{top:4,left:4}:"bottom-left"===Fe.badgePosition?{bottom:4,left:4}:"bottom-right"===Fe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:ht?"#dc3545":"#28a745",color:"white"})},ht?"STALE":"LIVE"),e.createElement(jn,{active:_t.current>=0,hoverPoint:at,margin:Ke,size:Ue,shape:null===(y=Tt.current)||void 0===y?void 0:y.shape,width:null===(m=Tt.current)||void 0===m?void 0:m.w,height:null===(v=Tt.current)||void 0===v?void 0:v.h}),Wt))});Ji.displayName="StreamOrdinalFrame";const ea=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=40,baselinePadding:b=!1,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:_,color:T,showCategoryTicks:B,categoryFormat:N,dataIdAccessor:D}=o,I=i.width,H=i.height,W=i.enableHover,F=i.showGrid,z=i.title,R=i.description,$=i.summary,G=i.accessibleTable,Y=i.categoryLabel,q=i.valueLabel,X=s||[],V=oi({data:X,rawData:s,colorBy:p,colorScheme:y,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"BarChart",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:I,height:H});if(V.earlyReturn)return V.earlyReturn;Vr("BarChart",X,"categoryAccessor",d),Vr("BarChart",X,"valueAccessor",h);const U=Ko(X,m,h),K=qo(),Q=n(()=>new Map,[X]),Z=n(()=>(e,t)=>{const n={};return n.fill=p?Ne(e,p,V.colorScale):Xo(T,K,y,void 0,Q),n},[p,V.colorScale,T,K,y,Q]),J=n(()=>{const e=null==w?void 0:w.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Z(t,n)),e(t,n)||{}):Z},[Z,w]),ee=n(()=>Io(J,V.effectiveSelectionHook,A),[J,V.effectiveSelectionHook,A]),te=n(()=>fr({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group"}),[d,h,p]),ne=kr({componentName:"BarChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(ne)return e.createElement(pr,{componentName:"BarChart",message:ne,width:I,height:H});const oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ee,size:[I,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:V.margin,barPadding:v}),D&&{dataIdAccessor:D}),{baselinePadding:b,enableHover:W,showAxes:i.showAxes,oLabel:Y,rLabel:q,rFormat:f}),N&&{oFormat:N}),{showGrid:F,showCategoryTicks:B,oSort:m}),V.legendBehaviorProps),z&&{title:z}),R&&{description:R}),$&&{summary:$}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),{tooltipContent:!1===x?()=>null:cr(x)||te}),(S||O||E||j)&&{customHoverBehavior:V.customHoverBehavior}),(O||E||S)&&{customClickBehavior:V.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement($r,{componentName:"BarChart",width:I,height:H},e.createElement(Ji,Object.assign({ref:a},oe)))});function ta({ref:e,frameRef:t,isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:s,setup:c}){const d=ti({isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:s}),h=l(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=l(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,r;return null!==(r=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==r?r:[]},clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:n(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:s||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,s]),effectiveMargin:n(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}ea.displayName="BarChart";const na=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,barPadding:v=40,baselinePadding:b=!1,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:_,color:T,categoryFormat:B}=o,N=i.width,D=i.height,I=i.enableHover,H=i.showGrid,W=i.showLegend,F=i.title,z=i.description,R=i.summary,$=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q=s||[],X=p||d,V=void 0===s,U=oi({data:q,rawData:s,colorBy:X,colorScheme:y,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:X?["string"==typeof X?X:""]:[],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"StackedBarChart",chartId:C,showLegend:W,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:N,height:D});if(U.earlyReturn)return U.earlyReturn;const K=qo(),Q=n(()=>new Map,[q]),Z=n(()=>(e,t)=>X?U.colorScale?{fill:Ne(e,X,U.colorScale)}:{}:{fill:Xo(T,K,y,t,Q)},[X,U.colorScale,T,K,y,Q]),J=n(()=>{const e=null==w?void 0:w.pieceStyle;return e&&"function"==typeof e?(t,n)=>{const o=Z(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:Z},[Z,w]),ee=n(()=>Io(J,U.effectiveSelectionHook,A),[J,U.effectiveSelectionHook,A]),te=n(()=>fr({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ne=kr({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:oe,effectiveMargin:re}=ta({ref:r,frameRef:a,isPushMode:V,colorBy:X,colorScheme:y,showLegend:W,legendPosition:_,setup:U}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:q}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ee,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re,barPadding:v,baselinePadding:b,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y,rFormat:f}),B&&{oFormat:B}),{showGrid:H}),oe),F&&{title:F}),z&&{description:z}),R&&{summary:R}),void 0!==$&&{accessibleTable:$}),c&&{className:c}),{tooltipContent:!1===x?()=>null:cr(x)||te}),(S||O||E||j)&&{customHoverBehavior:U.customHoverBehavior}),(O||E||S)&&{customClickBehavior:U.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return ne?e.createElement(pr,{componentName:"StackedBarChart",message:ne,width:N,height:D}):e.createElement($r,{componentName:"StackedBarChart",width:N,height:D},e.createElement(Ji,Object.assign({ref:a},ie)))});na.displayName="StackedBarChart";const oa=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m=60,baselinePadding:v=!1,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:_,categoryFormat:T}=o,B=i.width,N=i.height,D=i.enableHover,I=i.showGrid,H=i.showLegend,W=i.title,F=i.description,z=i.summary,R=i.accessibleTable,$=i.categoryLabel,G=i.valueLabel,Y=s||[],q=p||d,X=void 0===s,V=oi({data:Y,rawData:s,colorBy:q,colorScheme:y,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"GroupedBarChart",chartId:j,showLegend:H,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:B,height:N});if(V.earlyReturn)return V.earlyReturn;const U=qo(),K=n(()=>new Map,[Y]),Q=n(()=>(e,t)=>q?V.colorScale?{fill:Ne(e,q,V.colorScale)}:{}:{fill:Xo(_,U,y,t,K)},[q,V.colorScale,_,U,y,K]),Z=n(()=>Io(Q,V.effectiveSelectionHook,w),[Q,V.effectiveSelectionHook,w]),J=n(()=>fr({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ee=kr({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:te,effectiveMargin:ne}=ta({ref:r,frameRef:a,isPushMode:X,colorBy:q,colorScheme:y,showLegend:H,legendPosition:L,setup:V}),oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:Y}),{oAccessor:u,rAccessor:h,groupBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:Z,size:[B,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne,barPadding:m,baselinePadding:v,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:$,rLabel:G,rFormat:f}),T&&{oFormat:T}),{showGrid:I}),te),W&&{title:W}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===b?()=>null:cr(b)||J}),(A||S||O||E)&&{customHoverBehavior:V.customHoverBehavior}),(S||O||A)&&{customClickBehavior:V.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ee?e.createElement(pr,{componentName:"GroupedBarChart",message:ee,width:B,height:N}):e.createElement($r,{componentName:"GroupedBarChart",width:B,height:N},e.createElement(Ji,Object.assign({ref:a},oe)))});function ra({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const i=Do("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),a=Co({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof r?r:"value")}),s=t(a.brushInteraction);s.current=a.brushInteraction;const c=l(e=>{if(i){s.current.end(e?e.r:null)}null==n||n(e)},[n,i]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}oa.displayName="GroupedBarChart";const ia=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,tooltip:w,annotations:A,brush:S,onBrush:O,linkedBrush:E,frameProps:j={},selection:C,linkedHover:P,onObservation:M,onClick:L,hoverHighlight:_,chartId:T,loading:B,emptyContent:N,legendInteraction:D,legendPosition:I,color:H,showCategoryTicks:W,categoryFormat:F}=o,z=i.width,R=i.height,$=i.enableHover,G=i.showGrid,Y=i.title,q=i.description,X=i.summary,V=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Q=s||[],Z=oi({data:Q,rawData:s,colorBy:p,colorScheme:y,legendInteraction:D,legendPosition:I,selection:C,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:L,hoverHighlight:_,chartType:"SwarmPlot",chartId:T,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:B,emptyContent:N,width:z,height:R}),J=ra({brushProp:S,onBrushProp:O,linkedBrush:E,valueAccessor:h});if(Z.earlyReturn)return Z.earlyReturn;const ee=n(()=>{if(!m)return;const e=Q.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[Q,m]),te=qo(),ne=n(()=>new Map,[Q]),oe=n(()=>(e,t)=>{const n={fillOpacity:x};return n.fill=p?Ne(e,p,Z.colorScale):Xo(H,te,y,void 0,ne),n.r=m?Ie(e,m,v,ee):b,n},[p,Z.colorScale,m,v,ee,b,x,H,te,y,ne]),re=n(()=>Io(oe,Z.effectiveSelectionHook,C),[oe,Z.effectiveSelectionHook,C]),ie=n(()=>fr({categoryAccessor:d,valueAccessor:h,groupAccessor:p||void 0}),[d,h,p]),ae=kr({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(ae)return e.createElement(pr,{componentName:"SwarmPlot",message:ae,width:z,height:R});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:Q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[z,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:k,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:W}),Z.legendBehaviorProps),Y&&{title:Y}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),{tooltipContent:!1===w?()=>null:cr(w)||ie}),(P||M||L||_)&&{customHoverBehavior:Z.customHoverBehavior}),(M||L||P)&&{customClickBehavior:Z.customClickBehavior}),A&&A.length>0&&{annotations:A}),J.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.createElement($r,{componentName:"SwarmPlot",width:z,height:R},e.createElement(Ji,Object.assign({ref:a},se)))});function aa(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:rr},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=i.length,s=a>0?a%2!=0?i[Math.floor(a/2)]:(i[a/2-1]+i[a/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:rr},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:rr},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}ia.displayName="SwarmPlot";const sa=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:_,showCategoryTicks:T,categoryFormat:B}=o,N=i.width,D=i.height,I=i.enableHover,H=i.showGrid,W=i.title,F=i.description,z=i.summary,R=i.accessibleTable,$=i.categoryLabel,G=i.valueLabel,Y=s||[],q=oi({data:Y,rawData:s,colorBy:p,colorScheme:y,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"BoxPlot",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:N,height:D});if(q.earlyReturn)return q.earlyReturn;const X=qo(),V=n(()=>new Map,[Y]),U=n(()=>e=>{const t=p?Ne(e,p,q.colorScale):Xo(_,X,y,void 0,V);return{fill:t,stroke:t,fillOpacity:.8}},[p,q.colorScale,_,X,y,V]),K=n(()=>Io(U,q.effectiveSelectionHook,w),[U,q.effectiveSelectionHook,w]),Q=n(()=>aa(),[]),Z=kr({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(Z)return e.createElement(pr,{componentName:"BoxPlot",message:Z,width:N,height:D});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:K,showOutliers:m,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:q.margin,barPadding:v,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:$,rLabel:G,rFormat:f}),B&&{oFormat:B}),{showGrid:H,showCategoryTicks:T}),q.legendBehaviorProps),W&&{title:W}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===b?()=>null:cr(b)||Q}),(A||S||O||E)&&{customHoverBehavior:q.customHoverBehavior}),(S||O||A)&&{customClickBehavior:q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement($r,{componentName:"BoxPlot",width:N,height:D},e.createElement(Ji,Object.assign({ref:a},J)))});sa.displayName="BoxPlot";const la=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:k,onBrush:w,linkedBrush:A,frameProps:S={},selection:O,linkedHover:E,onObservation:j,onClick:C,hoverHighlight:P,chartId:M,loading:L,emptyContent:_,legendInteraction:T,legendPosition:B,color:N,showCategoryTicks:D,categoryFormat:I}=o,H=i.width,W=i.height,F=i.enableHover,z=i.showGrid,R=i.title,$=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=oi({data:V,rawData:s,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:E,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:P,chartType:"Histogram",chartId:M,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:_,width:H,height:W}),K=ra({brushProp:k,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(U.earlyReturn)return U.earlyReturn;const Q=n(()=>{if(0===V.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of V){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[V,h]),Z=qo(),J=n(()=>new Map,[V]),ee=n(()=>e=>{const t=y?Ne(e,y,U.colorScale):Xo(N,Z,m,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[y,U.colorScale,N,Z,m,J]),te=n(()=>Io(ee,U.effectiveSelectionHook,O),[ee,U.effectiveSelectionHook,O]),ne=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:rr},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),oe=kr({componentName:"Histogram",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(pr,{componentName:"Histogram",message:oe,width:H,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:te,bins:g,normalize:f}),Q&&{rExtent:Q}),{size:[H,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:p}),I&&{oFormat:I}),{showGrid:z,showCategoryTicks:D}),U.legendBehaviorProps),R&&{title:R}),$&&{description:$}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===b?()=>null:cr(b)||ne}),(E||j||C||P)&&{customHoverBehavior:U.customHoverBehavior}),(j||C||E)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),K.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.createElement($r,{componentName:"Histogram",width:H,height:W},e.createElement(Ji,Object.assign({ref:a},re)))});la.displayName="Histogram";const ca=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:f=25,showIQR:p=!0,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:E,linkedHover:j,onObservation:C,onClick:P,hoverHighlight:M,chartId:L,loading:_,emptyContent:T,legendInteraction:B,legendPosition:N,color:D,showCategoryTicks:I,categoryFormat:H}=o,W=i.width,F=i.height,z=i.enableHover,R=i.showGrid,$=i.title,G=i.description,Y=i.summary,q=i.accessibleTable,X=i.categoryLabel,V=i.valueLabel,U=s||[],K=oi({data:U,rawData:s,colorBy:m,colorScheme:v,legendInteraction:B,legendPosition:N,selection:E,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:M,chartType:"ViolinPlot",chartId:L,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:T,width:W,height:F}),Q=ra({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Z=qo(),J=n(()=>new Map,[U]),ee=n(()=>e=>{const t=m?Ne(e,m,K.colorScale):Xo(D,Z,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.6}},[m,K.colorScale,D,Z,v,J]),te=n(()=>Io(ee,K.effectiveSelectionHook,E),[ee,K.effectiveSelectionHook,E]),ne=n(()=>aa({valueAccessor:h}),[h]),oe=kr({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(pr,{componentName:"ViolinPlot",message:oe,width:W,height:F});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:te,bins:f,showIQR:p,size:[W,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,barPadding:b,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:V,rFormat:y}),H&&{oFormat:H}),{showGrid:R,showCategoryTicks:I}),K.legendBehaviorProps),$&&{title:$}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),{tooltipContent:!1===x?()=>null:cr(x)||ne}),(j||C||P||M)&&{customHoverBehavior:K.customHoverBehavior}),(C||P||j)&&{customClickBehavior:K.customClickBehavior}),k&&k.length>0&&{annotations:k}),Q.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.createElement($r,{componentName:"ViolinPlot",width:W,height:F},e.createElement(Ji,Object.assign({ref:a},re)))});ca.displayName="ViolinPlot";const ua=c(function(o,r){var i;const a=nr(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),s=t(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{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:f="horizontal",valueFormat:p,colorBy:y,colorScheme:m,sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,categoryFormat:N}=o,D=a.width,I=a.height,H=a.enableHover,W=a.showGrid,F=a.title,z=a.description,R=a.summary,$=a.accessibleTable,G=a.categoryLabel,Y=a.valueLabel,q=l||[],X=oi({data:q,rawData:l,colorBy:y,colorScheme:m,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"DotPlot",chartId:P,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:M,emptyContent:L,width:D,height:I});if(X.earlyReturn)return X.earlyReturn;const V=Ko(q,v,g),U=qo(),K=n(()=>new Map,[q]),Q=n(()=>(e,t)=>{const n={r:b,fillOpacity:.8};return n.fill=y?Ne(e,y,X.colorScale):Xo(B,U,m,void 0,K),n},[y,X.colorScale,b,B,U,m,K]),Z=n(()=>Io(Q,X.effectiveSelectionHook,S),[Q,X.effectiveSelectionHook,S]),J=n(()=>fr({categoryAccessor:h,valueAccessor:g}),[h,g]),ee=kr({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(ee)return e.createElement(pr,{componentName:"DotPlot",message:ee,width:D,height:I});const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:V}),{oAccessor:h,rAccessor:g,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:Z,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:x,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:a.showAxes,oLabel:G,rLabel:Y,rFormat:p}),N&&{oFormat:N}),{showGrid:W,oSort:v}),X.legendBehaviorProps),F&&{title:F}),z&&{description:z}),R&&{summary:R}),void 0!==$&&{accessibleTable:$}),d&&{className:d}),{tooltipContent:!1===k?()=>null:cr(k)||J}),(O||E||j||C)&&{customHoverBehavior:X.customHoverBehavior}),(E||j||O)&&{customClickBehavior:X.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement($r,{componentName:"DotPlot",width:D,height:I},e.createElement(Ji,Object.assign({ref:s},te)))});ua.displayName="DotPlot";const da=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:f=20,amplitude:p=1.5,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:_,color:T,showCategoryTicks:B,categoryFormat:N}=o,D=i.width,I=i.height,H=i.enableHover,W=i.showGrid,F=i.title,z=i.description,R=i.summary,$=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q=s||[],X=oi({data:q,rawData:s,colorBy:m,colorScheme:v,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"RidgelinePlot",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:D,height:I});if(X.earlyReturn)return X.earlyReturn;const V=qo(),U=n(()=>new Map,[q]),K=n(()=>e=>{const t=m?Ne(e,m,X.colorScale):Xo(T,V,v,void 0,U);return{fill:t,stroke:t,fillOpacity:.5}},[m,X.colorScale,T,V,v,U]),Q=n(()=>Io(K,X.effectiveSelectionHook,A),[K,X.effectiveSelectionHook,A]),Z=n(()=>aa(),[]),J=kr({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(J)return e.createElement(pr,{componentName:"RidgelinePlot",message:J,width:D,height:I});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=s&&{data:q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:Q,bins:f,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:b,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y,rFormat:y}),N&&{oFormat:N}),{showGrid:W,showCategoryTicks:B,oSort:!1,amplitude:p}),X.legendBehaviorProps),F&&{title:F}),z&&{description:z}),R&&{summary:R}),void 0!==$&&{accessibleTable:$}),c&&{className:c}),{tooltipContent:!1===x?()=>null:cr(x)||Z}),(S||O||E||j)&&{customHoverBehavior:X.customHoverBehavior}),(O||E||S)&&{customClickBehavior:X.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement($r,{componentName:"RidgelinePlot",width:D,height:I},e.createElement(Ji,Object.assign({ref:a},ee)))});da.displayName="RidgelinePlot";const ha=c(function(o,r){var i,a;const s=nr(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:A,hoverHighlight:S,chartId:O,loading:E,emptyContent:j,legendInteraction:C,legendPosition:P,color:M}=o,L=s.width,_=s.height,T=s.enableHover,B=s.showLegend,N=s.title,D=s.description,I=s.summary,H=s.accessibleTable,W=c||[],F=f||h,z=void 0===c,R=oi({data:W,rawData:c,colorBy:F,colorScheme:p,legendInteraction:C,legendPosition:P,selection:x,linkedHover:k,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:w,onClick:A,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:B,userMargin:u,marginDefaults:s.marginDefaults,loading:E,emptyContent:j,width:L,height:_});if(R.earlyReturn)return R.earlyReturn;const $=qo(),G=n(()=>new Map,[W]),Y=n(()=>(e,t)=>F?R.colorScale?{fill:Ne(e,F,R.colorScale)}:{}:{fill:Xo(M,$,p,t,G)},[F,R.colorScale,M,$,p,G]),q=n(()=>{const e=null==b?void 0:b.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},Y(t,n)),e(t,n)||{}):Y},[Y,b]),X=n(()=>Io(q,R.effectiveSelectionHook,x),[q,R.effectiveSelectionHook,x]),V=n(()=>fr({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),U=kr({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:K,effectiveMargin:Q}=ta({ref:r,frameRef:l,isPushMode:z,colorBy:F,colorScheme:p,showLegend:B,legendPosition:P,setup:R}),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:W}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:X,startAngle:y,size:[L,_],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q,enableHover:T}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),K),N&&{title:N}),D&&{description:D}),I&&{summary:I}),void 0!==H&&{accessibleTable:H}),d&&{className:d}),{tooltipContent:!1===m?()=>null:cr(m)||V}),(k||w||A||S)&&{customHoverBehavior:R.customHoverBehavior}),(w||A||k)&&{customClickBehavior:R.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return U?e.createElement(pr,{componentName:"PieChart",message:U,width:L,height:_}):e.createElement($r,{componentName:"PieChart",width:L,height:_},e.createElement(Ji,Object.assign({ref:l},Z)))});ha.displayName="PieChart";const ga=c(function(o,r){var i,a;const s=nr(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:f=60,centerContent:p,colorBy:y,colorScheme:m,startAngle:v=0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:_}=o,T=s.width,B=s.height,N=s.enableHover,D=s.showLegend,I=s.title,H=s.description,W=s.summary,F=s.accessibleTable,z=c||[],R=y||h,$=void 0===c,G=oi({data:z,rawData:c,colorBy:R,colorScheme:m,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"DonutChart",chartId:j,showLegend:D,userMargin:u,marginDefaults:s.marginDefaults,loading:C,emptyContent:P,width:T,height:B});if(G.earlyReturn)return G.earlyReturn;const Y=qo(),q=n(()=>new Map,[z]),X=n(()=>(e,t)=>R?G.colorScale?{fill:Ne(e,R,G.colorScale)}:{}:{fill:Xo(_,Y,m,t,q)},[R,G.colorScale,_,Y,m,q]),V=n(()=>Io(X,G.effectiveSelectionHook,w),[X,G.effectiveSelectionHook,w]),U=n(()=>fr({categoryAccessor:h,valueAccessor:g,groupAccessor:y&&y!==h?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[h,g,y]),K=kr({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Q,effectiveMargin:Z}=ta({ref:r,frameRef:l,isPushMode:$,colorBy:R,colorScheme:m,showLegend:D,legendPosition:L,setup:G}),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=c&&{data:z}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:V,innerRadius:f,startAngle:v,centerContent:p,size:[T,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z,enableHover:N}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Q),I&&{title:I}),H&&{description:H}),W&&{summary:W}),void 0!==F&&{accessibleTable:F}),d&&{className:d}),{tooltipContent:!1===b?()=>null:cr(b)||U}),(A||S||O||E)&&{customHoverBehavior:G.customHoverBehavior}),(S||O||A)&&{customClickBehavior:G.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return K?e.createElement(pr,{componentName:"DonutChart",message:K,width:T,height:B}):e.createElement($r,{componentName:"DonutChart",width:T,height:B},e.createElement(Ji,Object.assign({ref:l},J)))});ga.displayName="DonutChart";const fa=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:_,categoryFormat:T}=o,B="vertical"===y,N=i.width,D=i.height,I=i.enableHover,H=i.title,W=i.description,F=i.summary,z=i.accessibleTable,R=s||[],$=f||g,G=!$,Y=oi({data:R,rawData:s,colorBy:$,colorScheme:p,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:$?["string"==typeof $?$:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"FunnelChart",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:B?{top:H?60:40,right:20,bottom:60,left:60}:{top:H?40:10,right:10,bottom:10,left:10},loading:C,emptyContent:P,width:N,height:D});if(Y.earlyReturn)return Y.earlyReturn;Vr("FunnelChart",R,"stepAccessor",d),Vr("FunnelChart",R,"valueAccessor",h);const q=qo(),X=n(()=>new Map,[R]),V=n(()=>{if(G)return _||((null==q?void 0:q[0])?q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[G,_,q,p]),U=n(()=>(e,t)=>{const n={};return n.fill=V||($?Ne(e,$,Y.colorScale):Xo(_,q,p,t,X)),n},[V,$,Y.colorScale,_,q,p,X]),K=n(()=>Io(U,Y.effectiveSelectionHook,w),[U,Y.effectiveSelectionHook,w]),Q=n(()=>t=>{var n,o,r,i,a,s;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(a=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==a?a:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(s=null==l?void 0:l.__barFunnelCategory)&&void 0!==s?s:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:rr},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),f&&f!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},f+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",p))},[]),Z=kr({componentName:"FunnelChart",data:s,accessors:{stepAccessor:d,valueAccessor:h}});if(Z)return e.createElement(pr,{componentName:"FunnelChart",message:Z,width:N,height:D});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=s&&{data:R}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:K,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Y.margin,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:B,showCategoryTicks:B}),T&&{oFormat:T}),{showGrid:B}),!B&&{connectorOpacity:m}),{showLabels:v}),Y.legendBehaviorProps),H&&{title:H}),W&&{description:W}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:!0===b||null==b?Q:cr(b)||Q}),(A||S||O||E)&&{customHoverBehavior:Y.customHoverBehavior}),(S||O||A)&&{customClickBehavior:Y.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement($r,{componentName:"FunnelChart",width:N,height:D},e.createElement(Ji,Object.assign({ref:a},J)))});fa.displayName="FunnelChart";const pa="__likert_neutral_neg",ya="__likert_neutral_pos";function ma(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function va(e,t,n,o,r,i){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],a=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:r})}}return l}function ba(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:pa,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:ya,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function xa(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const a=[];for(const[,e]of i){const t=new Map;let i,s;for(const n of e)n.__likertLevel===pa?i=n:n.__likertLevel===ya?s=n:t.set(n.__likertLevelIndex,n);o&&i&&a.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}const ka=c(function(o,r){const i=nr(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:f,countAccessor:p="count",levels:y,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,valueFormat:P,loading:M,emptyContent:L,legendInteraction:_,legendPosition:T,categoryFormat:B}=o,N=i.width,D=i.height,I=i.enableHover,H=i.showGrid,W=i.showLegend,F=i.title,z=i.description,R=i.summary,$=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q="horizontal"===m,X=void 0===s,V=!f,U=n(()=>v&&Array.isArray(v)&&v.length>=y.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),a=[];for(let e=0;i>e;e++)a.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&a.push(o);for(let e=0;i>e;e++)a.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return a}(y.length),[v,y.length]),K=n(()=>{const e=new Map;for(let t=0;y.length>t;t++)e.set(y[t],U[t]||"#888");return e},[y,U]),{processedData:Q,reAggregate:Z,accumulatorRef:J}=function({data:e,levels:o,categoryAccessor:r,valueAccessor:i,levelAccessor:a,countAccessor:s,isDiverging:c,frameRef:u}){const d=!a,h=n(()=>ma(r,"question"),[r]),g=n(()=>d?ma(i,"score"):null,[d,i]),f=n(()=>d?null:ma(a,"level"),[d,a]),p=n(()=>d?null:ma(s,"count"),[d,s]),y=e||[],m=t([]),v=n(()=>{if(0===y.length)return[];let e=va(y,o,h,g,f,p);return c&&(e=ba(e,o),e=xa(e,o)),e},[y,o,h,g,f,p,c]),b=l(e=>{var t,n;let r=va(e,o,h,g,f,p);c&&(r=ba(r,o),r=xa(r,o)),null===(t=u.current)||void 0===t||t.clear(),r.length>0&&(null===(n=u.current)||void 0===n||n.pushMany(r))},[o,h,g,f,p,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:s,levels:y,categoryAccessor:h,valueAccessor:g,levelAccessor:f,countAccessor:p,isDiverging:q,frameRef:a}),ee="__likertLevelLabel",te=ti({isPushMode:X,colorBy:ee,colorScheme:U,showLegend:W,legendPosition:T}),ne=l(te.wrapPush(e=>{J.current.push(e),Z(J.current)}),[te.wrapPush,Z,J]),oe=l(te.wrapPushMany(e=>{J.current.push(...e),Z(J.current)}),[te.wrapPushMany,Z,J]);u(r,()=>({push:ne,pushMany:oe,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;J.current=[],te.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[ne,oe,te.resetCategories,J]);const re=oi({data:Q,rawData:s,colorBy:ee,colorScheme:U,legendInteraction:_,legendPosition:T,selection:A,linkedHover:S,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"LikertChart",chartId:C,showLegend:W,userMargin:c,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:N,height:D});if(re.earlyReturn)return re.earlyReturn;const ie=n(()=>{const e=y.length;return e%2!=0&&K.get(y[Math.floor(e/2)])||"#888"},[y,K]),ae=n(()=>e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(r===pa||r===ya)return{fill:ie};const i=o||r;return i&&K.has(i)?{fill:K.get(i)}:{fill:"#888"}},[K,ie]),se=n(()=>Io(ae,re.effectiveSelectionHook,A),[ae,re.effectiveSelectionHook,A]),le=n(()=>{const e=y.length;return e%2!=0?y[Math.floor(e/2)]:""},[y]),ce=n(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===pa||o===ya?le:o,i=n.__likertCategory||"",a=Math.abs(n.__likertPct||0),s=o===pa||o===ya?2*a:a,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:rr},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${s.toFixed(1)}% (n=${l})`))},[le]),ue=n(()=>{if(!y||2>y.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&f)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(f&&!p)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:h};return V?g&&(e.valueAccessor=g):(f&&(e.levelAccessor=f),p&&(e.countAccessor=p)),kr({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:y}})},[s,h,g,f,p,y,V]),de=n(()=>[{styleFn:e=>({fill:K.get(e.label)||"#888"}),items:y.map(e=>({label:e})),label:""}],[y,K]),he=n(()=>!1!==W?Object.assign(Object.assign({},re.legendBehaviorProps),{legend:{legendGroups:de},legendPosition:T||re.legendPosition||"bottom"}):re.legendBehaviorProps,[re.legendBehaviorProps,re.legendPosition,T,W,de]),ge=n(()=>{const e=Object.assign({},re.margin);if(X&&!1!==W){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(te.streamingMarginAdjust)for(const[t,n]of Object.entries(te.streamingMarginAdjust))n>e[t]&&(e[t]=n);return q&&100>e.left&&(e.left=100),e},[re.margin,te.streamingMarginAdjust,q,X,W,T]),fe=n(()=>P||(q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[q,P]),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({chartType:"bar"},null!=s&&{data:Q}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:q?"horizontal":"vertical",pieceStyle:se,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge,barPadding:b,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y||(q?void 0:"Percentage"),rFormat:fe}),B&&{oFormat:B}),{showGrid:H}),he),F&&{title:F}),z&&{description:z}),R&&{summary:R}),void 0!==$&&{accessibleTable:$}),d&&{className:d}),{tooltipContent:!1===x?()=>null:!0===x?ce:cr(x)||ce}),(S||O||E||j)&&{customHoverBehavior:re.customHoverBehavior}),(O||E||S)&&{customClickBehavior:re.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return ue?e.createElement(pr,{componentName:"LikertChart",message:ue,width:N,height:D}):e.createElement($r,{componentName:"LikertChart",width:N,height:D},e.createElement(Ji,Object.assign({ref:a},pe)))});ka.displayName="LikertChart";const wa={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Aa={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Sa{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){var r;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1;continue}const l=o&&null!==(r=o[a.edgeIndex])&&void 0!==r?r:1;if(a.t+=e*t*l*(s.bezier.circular?.3:1),a.t>=1){a.active=!1;continue}const c=Oa(s.bezier,a.t,a.offset);a.x=c.x,a.y=c.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function Oa(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),s=i-a,[l,c,u,d]=e[a],h=Ea(l,c,u,d,s),g=d.x-l.x,f=d.y-l.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;h.x+=-f/p*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,i,a]=e.points,s=Ea(o,r,i,a,t),l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;s.x+=-c/u*n*e.halfWidth*2,s.y+=t*n*e.halfWidth*2}return s}function Ea(e,t,n,o,r){const i=1-r,a=i*i,s=a*i,l=r*r,c=l*r;return{x:s*e.x+3*a*r*t.x+3*i*l*n.x+c*o.x,y:s*e.y+3*a*r*t.y+3*i*l*n.y+c*o.y}}function ja(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Ca(e,t){var n,o=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,o,d=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,r),d=!0):i[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return r.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,r[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>i[t]){for(var f=i[t];g.length>f;++f){var p=g[f];if(0>n[p]){n[p]=o[p]=u,r[p]=!0,u+=1,l.push(p),c.push(p);break}r[p]&&(o[t]=0|Math.min(o[t],o[p])),0>a[p]||s[t].push(a[p])}i[t]=f}else{if(o[t]===n[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(r[b]=!1,y.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),r=o.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],n=a);var l=r[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:i,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var f=0;s.length>f;f++)for(var p=0;s[f].length>p;p++){var y=s[f][p];i[+y]=!1,a[y]={}}c(n),n+=1}else n=h}return o}function Pa(e){return e.y0-e.y1>0?"up":"down"}function Ma(e,t){return t(e.source)==t(e.target)}function La(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function _a(e){return e.target.x0-e.source.x1}function Ta(e,t){var n=Na(e),o=_a(t)/Math.tan(n);return"up"==Pa(e)?e.y1-o:e.y1+o}function Ba(e,t){var n=Na(e),o=_a(t)/Math.tan(n);return"up"==Pa(e)?e.y1+o:e.y1-o}function Na(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Da(e,t){return t(e)}function Ia(e){return Wa(e.source)}function Ha(e){return Wa(e.target)}function Wa(e){return(e.y0+e.y1)/2}function Fa(e){return e.virtual?0:e.value}function za(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!Ma(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!Ma(e,t)?o+1:o}),n+o}function Ra(e){return e.target.depth}function $a(e,t){return e.sourceLinks.length?e.depth:t-1}function Ga(e,t){return e.y0-t.y0}function Ya(e,t){return t.y0-e.y0}function qa(e,t){return e.y1-t.y1}function Xa(e,t){return t.y1-e.y1}function Va(e,t){return Ka(e.source,t.source)||e.index-t.index}function Ua(e,t){return Ka(e.target,t.target)||e.index-t.index}function Ka(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Qa(e,t){return Za(e)==Za(t)?"bottom"==e.circularLinkType?Ya(e,t):Ga(e,t):Za(t)-Za(e)}function Za(e){return e.target.column-e.source.column}function Ja(e,t){return es(e)==es(t)}function es(e){return e.y0-e.y1>0?"up":"down"}function ts(e,t,n,o,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=N(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),ns(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),ns(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Ma(e,t)&&La(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Ya:Ga);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Xa:qa),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,r=e.y1,i=(t+o)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+o+","+r}(e)}),i}function ns(e,t,n){e.sort(Qa);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Ma(e,t)&&La(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&os(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function os(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function rs(e){return function(){return e}}function is(e){return e.index}function as(e){return e.nodes}function ss(e){return e.links}function ls(e,t,n){var o=D(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(r,i){var a=r.length;if(t)r.sort(t);else if(i>0){var s=new Map;r.forEach(function(e,t){var n,o,r,i=(o=0,r=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=Wa(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=Wa(e.target)*t,o+=t}}),o>0?r/o:NaN);s.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var n=s.get(e),o=s.get(t),r=n.bc,i=o.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(r)||isNaN(i)?isNaN(r)?isNaN(i)?n.idx-o.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?za(t,n)-za(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==za(t,n)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+r,t.y1=t.y0+t.value*e.ky)})})}function cs(e,t,n,o,r,i){var a=D(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=i;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&za(r,n)>0){var l=W(r.sourceLinks,Ha),c=W(r.targetLinks,Ia),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Wa(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==o-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=W(r.sourceLinks,Ha),g=W(r.targetLinks,Ia),f=((h&&g?(h+g)/2:h||g)-Wa(r))*t;r.y0+=f,r.y1+=f}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||Ka),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+o;if((a=l-o-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function us(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Ua),e.targetLinks.sort(Va)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,r=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function ds(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=is,l=$a,c=void 0,u=32,d=2,h=as,g=ss;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return F(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,r=e.target;"object"!=typeof o&&(o=e.source=ja(n,o)),"object"!=typeof r&&(r=e.target=ja(n,r)),o.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],r=0;e.links.length>r;r++){var i=e.links[r],a=i.source.index,s=i.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=Ca(o);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:o>n?"top":"bottom","top"==r.circularLinkType?n++:o++,e.nodes.forEach(function(e){Da(e,t)!=Da(r.source,t)&&Da(e,t)!=Da(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Ma(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(H(e.sourceLinks,Fa),H(e.targetLinks,Fa)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,r,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,c,l);var g=i;if(null!==a){var f=D(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=I(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=D(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=N(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/H(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=I(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,r),ls(h,c,s),cs(h,c,s,g,g,u),us(h),ts(h,s,d,10,8),ls(h,c,s),cs(h,c,s,g,g,u),us(h),ts(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return Da(n.source,t)==Da(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Ja(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Ta(t,e);return e.y1-n}if(t.target.column>e.target.column)return Ta(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return Da(n.target,t)==Da(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Ja(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=Ba(t,e);return e.y0-n}if(t.source.column>e.source.column)return Ba(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,r=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==o||0==r){var i=N(t,function(e){return e.y0}),a=I(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function l(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),ts(h,s,d,10,8)}(f),f}return f.update=function(e){return us(e),ts(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(r=+e,f):r},f.nodePadding=function(e){return arguments.length?(i=+e,f):i},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:rs(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:rs(e),f):g},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:rs(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:rs(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],f):[[e,t],[n,o]]},f.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],f):[n-e,o-t]},f}const hs=e=>{let t,n,o,r,i,a,s,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=ue(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,s=ue(t,n),o=s(.5),r=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${a} ${n},${a}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function gs(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const t=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${i},${a-n}L${i-l},${a-n}L${i-l},${a+n}L${i},${a+n}Z`}const i=r.sourceX,a=r.sourceY,s=r.targetX,l=r.targetY,c=r.rightFullExtent,u=r.leftFullExtent,d=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${i},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${a+h*n}L${i},${a+h*n}Z`}const fs=new Set,ps=new WeakMap;function ys(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=ps.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,ps.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;fs.has(e)||(fs.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const ms={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Ra))-1:0},justify:$a},vs={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(r=n.nodeWidth)&&void 0!==r?r:15,f=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=ds().extent(v).links(m).nodes(y).nodeAlign(ms[h]||$a).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>r&&(r=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-n,u=o[0],d=o[1];if(i>0&&a>0&&(0>e||0>n||t>u||r>d)){const t=Math.min(u/i,d/a),o=-e*t+(u-i*t)/2,r=-n*t+(d-a*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of m)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+r,n.targetY=n.targetY*t+r,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+r,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+r,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+r,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=e.source,n=e.target,o="object"==typeof t&&null!==t?t.id:t+"",r="object"==typeof n&&null!==n?n.id:n+"",i=k.get(e._edgeKey?e._edgeKey:`${o}\0${r}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(o),n=x.get(r);t&&(i.source=t),n&&(i.target=n)}}},buildScene(e,t,n,o){var r,i,a,s;const l="vertical"===n.orientation?"down":"right",c=n.nodeStyle,u=n.edgeStyle,d=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,h=n.edgeColorBy||"source",g=Array.isArray(n.colorScheme)?n.colorScheme:_,f=new Map;e.forEach((e,t)=>{f.set(e.id,g[t%g.length])});const p=[],y=[],m=[],v=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=c?c(ys(t,"nodeStyle")):{},r={fill:o.fill||f.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};v.set(t.id,("string"==typeof r.fill?r.fill:null)||f.get(t.id)||"#4d430c"),p.push("down"===l?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:r,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const b=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of b){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o="#999";o="function"==typeof h?h(e)||o:"target"===h?v.get(n.id)||f.get(n.id)||o:v.get(t.id)||f.get(t.id)||o;const r=u?u(ys(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),l=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=r.fill||o;y.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+s},${t.sourceY-n}L${t.sourceX+s},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:c,fillOpacity:null!==(i=r.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),y.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-l},${t.targetY-n}L${t.targetX-l},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:c,fillOpacity:null!==(a=r.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-l,x1:t.targetX}});continue}let l;if(l=e.circular&&e.circularPathData?gs(e):hs(e),!l)continue;const c={fill:r.fill||o,fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:d,stroke:r.stroke||"none",strokeWidth:r.strokeWidth,opacity:r.opacity};y.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,s,c;"down"===l?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),s=n.y0+r/2),m.push({x:a,y:s,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var x;return{sceneNodes:p,sceneEdges:y,labels:m}}},bs={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const a=null!==(r=n.forceStrength)&&void 0!==r?r:.1,s=o[0]/2,l=o[1]/2,c=n.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of d){const o=xs(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const r=ks(e.id),i=r%360*(Math.PI/180),a=10+r%20;e.x=t/o.length+a*Math.cos(i),e.y=n/o.length+a*Math.sin(i)}else{const t=ks(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),r=n*t;o.x=s+e*Math.cos(r),o.y=l+e*Math.sin(r)}}}const g=null!==(i=n.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===n.iterations?0:h?40:g,p=ws(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e);if(f>0){const n=de().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),o=he().force("charge",ge().strength(e=>-25*y(e))).force("center",fe(s,l).strength(.8)).force("x",pe(s).strength(.15)).force("y",ye(l).strength(.15));if(o.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));o.force("link",n),o.force("link").links(e)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;f>e;++e)o.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var r,i,a;const s=n.nodeStyle,l=n.edgeStyle,c=ws(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:_,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],f=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(ys(t,"nodeSize")),n=s?s(ys(t,"nodeStyle")):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const o=l?l(ys(e,"edgeStyle")):{},r={stroke:o.stroke||"#999",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(y=n.nodeLabel)?"function"==typeof y?y:e=>e[y]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(ys(n,"nodeSize"));f.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var y;return{sceneNodes:h,sceneEdges:g,labels:f}}};function xs(e,t,n){const o=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,i="string"==typeof r.target?r.target:r.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function ks(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function ws(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(o=N(a))&&void 0!==o?o:0,l=null!==(r=I(a))&&void 0!==r?r:1;if(s===l)return()=>(i[0]+i[1])/2;const c=m().domain([s,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const As=_,Ss={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-i,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const r=d(e);p[n][o]=r}const y=ve().padAngle(r);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=ie().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const n=e[t.source.index].id,o=e[t.target.index].id,r=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);r&&(r.chordData=t)}},buildScene(e,t,n,o){var r,i;const{groupWidth:a=20,edgeOpacity:s=.5}=n,l=Math.min(o[0],o[1])/2,c=l-a,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,g=n.edgeStyle,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:As,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=me().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(ys(n,"nodeStyle")).fill||y.get(n.id)||p[t%p.length]:y.get(n.id)||p[t%p.length];const a=h?h(ys(n,"nodeStyle")):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m(t);if(!n)continue;const o=Os(n,u,d);let r="#999";if(g)r=g(ys(e,"edgeStyle")).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===f&&n?r=y.get(n.id)||r:t&&(r=y.get(t.id)||r)}const a=g?g(ys(e,"edgeStyle")):{},l={fill:r,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(k=n.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*o,y:d+Math.sin(a)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:v,sceneEdges:b,labels:x}}};function Os(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const Es=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function js(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>150?"#222":"#fff"}function Cs(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Ps(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}function Ms(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}const Ls={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),c=R(i,s);c.sum(l),c.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[u,d]=o;switch(a){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=V();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(c,n,u,d);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=X();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(c,n,u,d);break;case"treemap":!function(e,t,n,o){var r,i;const a=null!==(r=t.padding)&&void 0!==r?r:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=Y().size([n,o]).tile(q).padding(a);s>0&&l.paddingTop(s),l(e)}(c,n,u,d);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;G().size([n,o]).padding(i)(e)}(c,n,u,d);break;case"partition":!function(e,t,n,o){var r;$().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(c,n,u,d)}const h=c.descendants();e.length=0,t.length=0;const g=new Map;for(let t=0;h.length>t;t++){const o=h[t],i={id:Cs(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?_s(i,o,n):"treemap"===a||"partition"===a?Ts(i,o):"circlepack"===a&&Bs(i,o),i.__hierarchyNode=o,e.push(i),g.set(o,i)}if("tree"===a||"cluster"===a)for(const e of h)if(e.parent){const n=g.get(e.parent),o=g.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var a,s,l,c,u;const d=[],h=[],g=[],f=n.treeOrientation||"vertical",p="radial"===f,y=o[0]/2,m=o[1]/2,v="number"==typeof(b=n.nodeSize)?b:5;var b;for(const t of e){let e=t.x,o=t.y;p&&(e+=y,o+=m);const i=r(ys(t,"nodeStyle"));let s=i.fill||"#4d430c";n.colorByDepth&&void 0!==t.depth&&(s=Es[t.depth%Es.length]);const l={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:o,r:v,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(s=n.edgeOpacity)&&void 0!==s?s:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,r=t.y,a=n.x,s=n.y;p&&(o+=y,r+=m,a+=y,s+=m);const u=Ms(o,r,a,s,f),d=i(ys(e,"edgeStyle")),g={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:x};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=Ps(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,a=n.x,s=n.y;if(p&&(a+=y,s+=m),p){const e=a-y,t=s-m,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,r=s+t/n*10,i=0>e?"end":"start"):(o=a,r=s-12,i="middle")}else"horizontal"===f?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=a-v-6,i="end"):(o=a+v+6,i="start"),r=s):(o=a,r=s+v+14,i="middle");g.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:g}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const a=[],s=[];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const s=o(ys(n,"nodeStyle"));let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=Es[n.depth%Es.length]);const c={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};a.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:c,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ps(t.nodeLabel),r=t.labelMode||"leaf",a="partition"===t.chartType;for(const l of e){const e=l.x1-l.x0,c=l.y1-l.y0;if(0>=e||0>=c)continue;const u=!((null===(i=l.data)||void 0===i?void 0:i.children)&&l.data.children.length>0);if(!a){if("leaf"===r&&!u)continue;if("parent"===r&&u)continue}const d=n?n(l):l.id;if(!d)continue;if((u?30:40)>e||(u?16:14)>c)continue;let h=o(ys(l,"nodeStyle")).fill||"#4d430c";t.colorByDepth&&void 0!==l.depth&&(h=Es[l.depth%Es.length]);const g=js(h);s.push(u?{x:l.x0+e/2,y:l.y0+c/2,text:d+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:g}:{x:l.x0+4,y:l.y0+12,text:d+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:g})}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,a,s,l;const c=[],u=[];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(ys(n,"nodeStyle"));let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=Es[n.depth%Es.length]);const u={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ps(t.nodeLabel);for(const r of e){const e=null!==(s=r.__radius)&&void 0!==s?s:5,i=n?n(r):r.id;if(!i)continue;if(15>e)continue;const a=!((null===(l=r.data)||void 0===l?void 0:l.children)&&r.data.children.length>0);let c=o(ys(r,"nodeStyle")).fill||"#4d430c";if(t.colorByDepth&&void 0!==r.depth&&(c=Es[r.depth%Es.length]),a){const t=js(c);u.push({x:r.x,y:r.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:t})}else u.push({x:r.x,y:r.y-e+14,text:i+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:"#000",stroke:"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function _s(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Ts(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Bs(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Ns(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const Ds={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const r=n.__hierarchyRoot;r&&function(e,t,n,o,r){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(i=n.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=Ns(n);f.metaMap.clear(),o.length=0,r.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,i,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:n,depth:d,data:t,parentId:n},O=p?u/h(S)*A:u*A,E=le().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=E(k),C=g(S);for(let t=0;k.length>t;t++){const s=(j[t].startAngle+j[t].endAngle)/2,c=k[t],u=y(l(c)),h=i+O*Math.sin(s),g=a+O*Math.cos(s)*C;o.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:O,angle:s,depth:d,parentId:n,eccentricity:C}),r.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(r,o,n,e,t)},buildScene(e,t,n,o){var r,i,a,s,l;const c=n.nodeStyle,u=n.nodeSize,d="number"==typeof u?()=>u:"function"==typeof u?u:()=>6,h=[],g=[],f=[];if(!1!==n.orbitShowRings){const t=Ns(n),o=new Map;for(const t of e)o.set(t.id,t);const r=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;r.has(n)||r.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of r)for(let r=0;i>r;r++){const s=r/i*Math.PI*2,l=(r+1)/i*Math.PI*2;g.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=d(ys(t,"nodeSize")),n=c?c(ys(t,"nodeStyle")):{},o={fill:n.fill||"#6366f1",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:1,opacity:null!==(i=n.opacity)&&void 0!==i?i:0===(null!==(a=t.depth)&&void 0!==a?a:0)?1:.85};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id,depth:t.depth})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=d(ys(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(l=null===(s=n.data)||void 0===s?void 0:s[t])&&void 0!==l?l:n.id;f.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:g,labels:f}},tick:(e,t,n,o,r)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const r=Ns(t),i=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,l=i*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},Is={sankey:vs,force:bs,chord:Ss,tree:Ls,cluster:Ls,treemap:Ls,circlepack:Ls,partition:Ls,orbit:Ds};function Hs(e){return Is[e]}class Ws{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},wa),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Sa(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},wa),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new Sa(2e3))}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Fs(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",r=c(n)+"",i=Number(u(n))||1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Fs(o)),{data:n})),this.nodes.has(r)||this.nodes.set(r,Object.assign(Object.assign({},Fs(r)),{data:n}));const a=`${o}\0${r}\0${e}`;this.edges.set(a,{source:o,target:r,value:i,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:a})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Fs(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,Fs(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,r,i,a;const s=Hs(this.config.chartType);if(!s)return;let l=Array.from(this.nodes.values()),c=Array.from(this.edges.values());if(0===l.length&&!s.hierarchical)return;if(this.prepareForRelayout(),s.supportsStreaming&&!s.hierarchical){const e=new Map;for(const s of l)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(r=s._prevY0)&&void 0!==r?r:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(s.computeLayout(l,c,this.config,e),this.config.__previousPositions=void 0,s.hierarchical&&l.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of l)this.nodes.set(e.id,e);for(let e=0;c.length>e;e++){const t=c[e],n=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=n,this.edges.set(n,t)}}this.finalizeLayout();const u=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||u.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=u,this.saveTargetPositions(),l.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const d=new Set(this.nodes.keys()),h=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of d)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)d.has(e)||this.removedNodes.add(e);for(const e of h)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)h.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=d,this.previousEdgeKeys=h,this.layoutVersion++}buildScene(e){const t=Hs(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:a}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=a}get isAnimating(){const e=Hs(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=Hs(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=Array.from(this.nodes.values()),r=Array.from(this.edges.values());return n.tick(o,r,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=ze(e,this.transition),n=Fe(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Re(e._prevX0,e._targetX0,n),e.x1=Re(e._prevX1,e._targetX1,n),e.y0=Re(e._prevY0,e._targetY0,n),e.y1=Re(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=Re(e._prevY0,e._targetY0,n),e.y1=Re(e._prevY1,e._targetY1,n),e.sankeyWidth=Re(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,a=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,r,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const r=e-o;s>r&&(t._pulseIntensity=1-r/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(r=n.source)||void 0===r?void 0:r.id:n.source,a="object"==typeof n.target?null===(i=n.target)||void 0===i?void 0:i.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t,n,o,r;const i=this.config.decay;if(!i)return;const a=null!==(e=i.minOpacity)&&void 0!==e?e:.1,s=this.nodeTimestamps.size;if(1>=s)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const l=this._decaySortedNodes,c=new Map;for(let e=0;l.length>e;e++)c.set(l[e][0],e);for(const e of this.sceneNodes){const l=e.id;if(!l)continue;const u=c.get(l);if(void 0===u)continue;const d=s-1-u;let h;switch(i.type){case"linear":h=a+(1-d/(s-1))*(1-a);break;case"exponential":{const e=null!==(t=i.halfLife)&&void 0!==t?t:s/2;h=a+Math.pow(.5,d/e)*(1-a);break}case"step":h=(null!==(n=i.stepThreshold)&&void 0!==n?n:.5*s)>d?1:a;break;default:h=1}const g=null!==(r=null===(o=e.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;e.style=Object.assign(Object.assign({},e.style),{opacity:g*h})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const r=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=r):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const r=o.data?Object.assign({},o.data):{};return o.data=t(null!==(n=o.data)&&void 0!==n?n:{}),this.layoutVersion++,r}updateEdge(e,t,n){var o;const r=this.config.valueAccessor,i="function"==typeof r?r:r?e=>e[r]:e=>e.value,a=[];for(const[,r]of this.edges)if(("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t){a.push(r.data?Object.assign({},r.data):{}),r.data=n(null!==(o=r.data)&&void 0!==o?o:{});const e=i(r.data);null!=e&&(r.value=Number(e))}return a.length>0&&this.layoutVersion++,a}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const n=[];for(const[o,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0&&this.layoutVersion++,n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function Fs(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function zs(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=Rs(t,n,o,r);if(e)if("rect"===t.type){const n=t.w*t.h;s>n&&(i=e,s=n)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=qs(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function Rs(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const r=t-e.cx,i=n-e.cy,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=tt(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}let $s=null,Gs=null;function Ys(){return Gs||($s=document.createElement("canvas"),$s.width=1,$s.height=1,Gs=$s.getContext("2d")),Gs}function qs(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),a=Ys();if(!a)return null;if(a.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,a="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}const s=a.lineWidth;a.lineWidth=10;const l=a.isPointInStroke(i,t,n);if(a.lineWidth=s,l)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let a=((t-e.x1)*o+(n-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*r,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=Ys();if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(o,t,n);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function Xs(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:a,labels:s,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",foregroundGraphics:p,sceneNodes:y,annotations:m,svgAnnotationRules:v}=t;return e.createElement(e.Fragment,null,e.createElement("svg",{role:"img",width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof l?l:"Network Chart"),e.createElement("desc",null,"string"==typeof l?l+" — network data visualization":"Network data visualization"),e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,n)=>e.createElement("text",{key:"label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),m&&m.filter(e=>"widget"!==e.type).map((t,r)=>{if(v){const i=v(t,r,{width:n,height:o,sceneNodes:y});if(i)return e.createElement(e.Fragment,{key:"annotation-"+r},i)}return null}),p),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:a.top},l):null,Pt({legend:c,totalWidth:r,totalHeight:i,margin:a,legendPosition:f,title:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&y).map((t,n)=>{var o,r,i,s,l,c,u,d,h;const g=y.find(e=>{var n,o,r,i,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(r=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===r?void 0:r.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!g)return null;const f=a.left+(null!==(o=g.cx)&&void 0!==o?o:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(r=g.x)&&void 0!==r?r:0),p=a.top+(null!==(i=g.cy)&&void 0!==i?i:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),m=null!==(l=t.dx)&&void 0!==l?l:0,v=null!==(c=t.dy)&&void 0!==c?c:-16,b=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e.createElement("span",{style:{fontSize:18,cursor:"default"}},"ℹ️");return e.createElement("div",{key:"widget-"+n,style:{position:"absolute",left:f+m-b/2,top:p+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function Vs(e,t){var n,o,r,i,a,s;if(!t.pathD)return;e.save();const l=new Path2D(t.pathD);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const r=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999";r.addColorStop(0,1===a.from?s:"transparent"),r.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Us(e,t){var n,o;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Ks(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const a=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function Qs(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Xs.displayName="NetworkSVGOverlay";const Zs={top:20,right:80,bottom:20,left:80},Js={top:40,right:40,bottom:40,left:40},el=new Set(["chord","force","circlepack","orbit"]),tl=[800,600],nl={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 ol({data:t}){var n,o,r,i,a,s;if("edge"===t.type){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:nl},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let a=c;for(;a;){const e=null!==(i=null!==(o=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:nl},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(a=l.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=l.targetLinks)||void 0===s?void 0:s.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:nl},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const rl=c(function(i,a){var s,c,d,h,g,f,p,y,m,v,b,x,k,w;const{chartType:A,nodes:S,edges:O,data:E,initialEdges:j,nodeIDAccessor:C="id",sourceAccessor:P="source",targetAccessor:M="target",valueAccessor:L="value",childrenAccessor:_,hierarchySum:T,orientation:B="horizontal",nodeAlign:N="justify",nodePaddingRatio:D=.05,nodeWidth:I=15,iterations:H=300,forceStrength:W=.1,padAngle:F=.01,groupWidth:z=20,sortGroups:R,edgeSort:$,treeOrientation:G="vertical",edgeType:Y="curve",padding:q,paddingTop:X,tensionConfig:V,showParticles:U=!1,particleStyle:K,nodeStyle:Q,edgeStyle:Z,colorBy:J,colorScheme:ee="category10",edgeColorBy:te="source",edgeOpacity:ne=.5,colorByDepth:oe=!1,nodeSize:re=8,nodeSizeRange:ae=[5,20],nodeLabel:se,showLabels:le=!0,labelMode:ce,size:ue=tl,responsiveWidth:de,responsiveHeight:he,margin:ge,className:fe,background:pe,enableHover:ye=!0,tooltipContent:me,customHoverBehavior:ve,customClickBehavior:be,onObservation:xe,chartId:ke,onTopologyChange:we,annotations:Ae,svgAnnotationRules:Se,legend:Oe,legendPosition:Ee,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Pe,legendIsolatedCategories:Me,title:_e,foregroundGraphics:Te,backgroundGraphics:Be,decay:Ne,pulse:De,staleness:Ie,thresholds:He,accessibleTable:We=!0,description:Fe,summary:ze,orbitMode:Re,orbitSize:$e,orbitSpeed:Ge,orbitRevolution:Ye,orbitRevolutionStyle:qe,orbitEccentricity:Xe,orbitShowRings:Ve,orbitAnimated:Ue}=i,Ke=Mn(),Qe=t(Ke);Qe.current=Ke;const Ze="semiotic-table-"+e.useId(),Je=el.has(A)?Js:Zs,[et,tt]=kt(ue,de,he),nt=Object.assign(Object.assign({},Je),ge),ot=tt[0]-nt.left-nt.right,rt=tt[1]-nt.top-nt.bottom,it="function"==typeof Te?Te({size:tt,margin:nt}):Te,at=n(()=>Object.assign(Object.assign({},wa),V),[V]),st=n(()=>Object.assign(Object.assign({},Aa),K),[K]),lt=n(()=>({chartType:A,nodeIDAccessor:C,sourceAccessor:P,targetAccessor:M,valueAccessor:L,childrenAccessor:_,hierarchySum:T,orientation:B,nodeAlign:N,nodePaddingRatio:D,nodeWidth:I,iterations:H,forceStrength:W,padAngle:F,groupWidth:z,sortGroups:R,edgeSort:$,treeOrientation:G,edgeType:Y,padding:q,paddingTop:X,tensionConfig:at,showParticles:U,particleStyle:st,nodeStyle:Q,edgeStyle:Z,nodeLabel:se,showLabels:le,labelMode:ce,colorBy:J,colorScheme:ee,edgeColorBy:te,edgeOpacity:ne,colorByDepth:oe,nodeSize:re,nodeSizeRange:ae,decay:Ne,pulse:De,staleness:Ie,thresholds:He,orbitMode:Re,orbitSize:$e,orbitSpeed:Ge,orbitRevolution:Ye,orbitRevolutionStyle:qe,orbitEccentricity:Xe,orbitShowRings:Ve,orbitAnimated:Ue}),[A,C,P,M,L,_,T,B,N,D,I,H,W,F,z,R,$,G,Y,q,X,at,U,st,Q,Z,se,le,ce,J,ee,te,ne,oe,re,ae,Ne,De,Ie,He,Re,$e,Ge,Ye,qe,Xe,Ve,Ue]),ct=t(null),ut=t(0),dt=t(0),ht=t(!0),gt=In(e=>e.theme),ft=t(()=>{}),pt=t(null);pt.current||(pt.current=new Ws(lt));const[bt,xt]=r(null),[At,St]=r(0),[Ot,Et]=r(0),[jt,Ct]=r(!1),Pt=t(null),Mt=t(new Map),Lt=t(0),_t=l(e=>{if("function"==typeof J)return J(e)+"";if("string"==typeof J&&e.data){const t=e.data[J];if(void 0!==t){if(!Mt.current.has(t+"")){const e=Array.isArray(ee)?ee:Le;Mt.current.set(t+"",e[Lt.current++%e.length])}return Mt.current.get(t+"")}}if(Mt.current.has(e.id))return Mt.current.get(e.id);const t=Array.isArray(ee)?ee:Le,n=J?t[Lt.current++%t.length]:t[0];return Mt.current.set(e.id,n),n},[J,ee]),Tt=l(e=>{if("function"==typeof te)return te(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===te&&n?_t(n):t?_t(t):"#999"},[te,_t]),Bt=l(e=>{if(!(null==K?void 0:K.colorBy))return Tt(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===st.colorBy&&n?_t(n):t?_t(t):"#999"},[null==K?void 0:K.colorBy,st.colorBy,_t,Tt]),Nt="sankey"===A&&U||!!De||null!==(c=null===(s=pt.current)||void 0===s?void 0:s.isAnimating)&&void 0!==c&&c,Dt=l(()=>{ut.current&&!Nt||ut.current||(ut.current=requestAnimationFrame(()=>ft.current()))},[Nt]);o(()=>{var e;null===(e=pt.current)||void 0===e||e.updateConfig(lt),ht.current=!0,Dt()},[lt,Dt]),o(()=>{ht.current=!0,Dt()},[gt,Dt]);const It=l(()=>{var e;const t=pt.current;if(!t)return;t.runLayout([ot,rt]),t.buildScene([ot,rt]),ht.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&Mt.current.set(n.id,n.style.fill);const n=Array.isArray(ee)?ee:Le,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];Mt.current.has(t.id)||Mt.current.set(t.id,n[e%n.length])}if(Lt.current=o.length,St(t.layoutVersion),we){const{nodes:e,edges:n}=t.getLayoutData();we(e,n)}},[ot,rt,we,ee]),Ht=l(e=>{const t=pt.current;t&&(t.ingestEdge(e)&&It(),Dt())},[It,Dt]),Wt=l(e=>{const t=pt.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&It(),Dt()},[It,Dt]),Ft=l(()=>{var e;null===(e=pt.current)||void 0===e||e.clear(),Mt.current.clear(),Lt.current=0,St(0),xt(null),Pt.current=null,ht.current=!0,Dt()},[Dt]),zt=l(()=>{const e=pt.current;e&&(e.tension+=999,It(),Dt())},[It,Dt]);u(a,()=>({push:Ht,pushMany:Wt,removeNode:e=>{var t,n;const o=null!==(n=null===(t=pt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;return o&&(Mt.current.delete(e),It(),ht.current=!0,Dt()),o},removeEdge:(e,t)=>{var n,o;const r=null!==(o=null===(n=pt.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;return r&&(It(),ht.current=!0,Dt()),r},updateNode:(e,t)=>{var n,o;const r=null!==(o=null===(n=pt.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return r&&(ht.current=!0,Dt()),r},updateEdge:(e,t,n)=>{var o,r;const i=null!==(r=null===(o=pt.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==r?r:[];return i.length>0&&(It(),ht.current=!0,Dt()),i},clear:Ft,getTopology:()=>{var e,t;return null!==(t=null===(e=pt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=pt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:zt,getTension:()=>{var e,t;return null!==(t=null===(e=pt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Ht,Wt,Ft,zt,It,Dt]);const Rt=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),$t=Rt?E||(Array.isArray(O)?void 0:O):void 0;o(()=>{var e;const t=pt.current;if(t)if(Rt&&$t)t.ingestHierarchy($t,[ot,rt]),t.buildScene([ot,rt]),ht.current=!0,Dt();else{const n=S||[],o=Array.isArray(O)?O:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[ot,rt]),t.buildScene([ot,rt]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&Mt.current.set(n.id,n.style.fill+"");const r=Array.isArray(ee)?ee:Le,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];Mt.current.has(t.id)||Mt.current.set(t.id,r[e%r.length])}Lt.current=i.length,ht.current=!0,Dt()}},[S,O,E,$t,Rt,ot,rt,lt,Dt,ee]),o(()=>{j&&j.length>0&&Wt(j)},[]);const Gt=l(e=>{if(ve&&ve(e),xe){const t=Date.now();xe(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ke}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ke})}},[ve,xe,ke]),Yt=l(e=>{if(be&&be(e),xe){const t=Date.now();xe(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ke}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ke})}},[be,xe,ke]),qt=t(()=>{}),Xt=t(()=>{});qt.current=e=>{if(!ye)return;const t=ct.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-nt.left,r=e.clientY-n.top-nt.top;if(0>o||o>ot||0>r||r>rt)return void(Pt.current&&(Pt.current=null,xt(null),Gt&&(Gt(null),ht.current=!0),Dt()));const i=pt.current;if(!i)return;const a=zs(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(Pt.current&&(Pt.current=null,xt(null),Gt&&(Gt(null),ht.current=!0),Dt()));const s=a.datum||{},l=Object.assign(Object.assign({},"object"!=typeof s||null===s||Array.isArray(s)?{}:s),{type:a.type,data:s,x:a.x,y:a.y});Pt.current=l,xt(l),Gt&&(Gt(l),ht.current=!0),Dt()},Xt.current=()=>{Pt.current&&(Pt.current=null,xt(null),Gt&&(Gt(null),ht.current=!0),Dt())};const Vt=t(()=>{});Vt.current=e=>{if(!be&&!xe)return;const t=ct.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-nt.left,r=e.clientY-n.top-nt.top;if(0>o||o>ot||0>r||r>rt)return;const i=pt.current;if(!i)return;const a=zs(i.sceneNodes,i.sceneEdges,o,r);if(a){const e=a.datum||{};Yt(Object.assign(Object.assign({},"object"!=typeof e||null===e||Array.isArray(e)?{}:e),{type:a.type,data:e,x:a.x,y:a.y}))}else Yt(null)},l(e=>qt.current(e),[]);const Ut=l(()=>Xt.current(),[]),Kt=l(e=>Vt.current(e),[]),Qt=t(-1),Zt=t(null),Jt=t(-1),en=l(e=>{var t;const n=pt.current;if(!n)return;const o=function(e){var t,n,o,r,i,a;const s=[];for(const l of e)"circle"===l.type&&null!=l.cx?s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(n=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"}):"rect"===l.type&&null!=l.x?s.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(r=null===(o=l.datum)||void 0===o?void 0:o.id)&&void 0!==r?r:"_default"}):"arc"===l.type&&null!=l.cx&&s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(a=null===(i=l.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(n.sceneNodes);if(0===o.length)return;const r=yt(o),i=Qt.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Qt.current=0,Jt.current=-1;const t=r.flat[0];Zt.current={shape:t.shape,w:t.w,h:t.h};const n=t.datum||{},o=Object.assign(Object.assign({},"object"!=typeof n||null===n||Array.isArray(n)?{}:n),{type:"node",data:n,x:t.x,y:t.y});return Pt.current=o,xt(o),Gt&&(Gt(o),ht.current=!0),void Dt()}const a=mt(r,i),s=function(e,t,n,o,r){var i,a,s;const l=n.flat[t.flatIndex];if(!l)return vt(e,t,n);const c=null===(i=l.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,r=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;r>u&&(r=u,o=i)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(r.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n,o,r;const i=e+"",a=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,s="object"==typeof t.source?null===(o=t.source)||void 0===o?void 0:o.id:t.source,l="object"==typeof t.target?null===(r=t.target)||void 0===r?void 0:r.id:t.target,c=null!=s,u=null!=l;c&&s+""===i&&u?a.push(l+""):u&&l+""===i&&c&&a.push(s+"")}return a}(c,o);if(0===e.length)return t.flatIndex;const i=null!==(s=n.idToIdx.get(e[(r.current+1)%e.length]))&&void 0!==s?s:-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const o=vt(e,t,n);return null!==o&&o!==t.flatIndex&&(r.current=-1),o}}}(e.key,a,r,null!==(t=n.sceneEdges)&&void 0!==t?t:[],Jt);if(null===s)return;if(e.preventDefault(),0>s)return Qt.current=-1,Zt.current=null,Jt.current=-1,Pt.current=null,xt(null),Gt&&(Gt(null),ht.current=!0),void Dt();Qt.current=s;const l=r.flat[s];Zt.current={shape:l.shape,w:l.w,h:l.h};const c=l.datum||{},u=Object.assign(Object.assign({},"object"!=typeof c||null===c||Array.isArray(c)?{}:c),{type:"node",data:c,x:l.x,y:l.y});Pt.current=u,xt(u),Gt&&(Gt(u),ht.current=!0),Dt()},[Gt,Dt]),tn=l(e=>{Qt.current=-1,Zt.current=null,qt.current(e)},[]);ft.current=()=>{var e,t,n,o,r,i,a;ut.current=0;const s=ct.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=pt.current;if(!c)return;const u=performance.now(),d=dt.current?Math.min((u-dt.current)/1e3,.1):.016;dt.current=u;const h=c.advanceTransition(Qe.current?u+1e6:u),g=!Qe.current&&h,f=!Qe.current&&c.tickAnimation([ot,rt],d);(h||ht.current||f)&&c.buildScene([ot,rt]);const p=Wn();if(!Hn(s,tt,nt,p))return;l.clearRect(-nt.left,-nt.top,tt[0],tt[1]),pe&&(l.fillStyle=pe,l.fillRect(0,0,ot,rt)),Ne&&c.applyDecay(),De&&c.applyPulse(u),He&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==Ie?void 0:Ie.threshold)&&void 0!==e?e:5e3,m=Ie&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Ie?void 0:Ie.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Vs(e,n);break;case"line":Us(e,n);break;case"ribbon":Ks(e,n);break;case"curved":Qs(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),Un(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),Kn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(l,c.sceneNodes),U&&c.particlePool&&!m){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,n,o){var r,i;const a=null!==(r=o.spawnRate)&&void 0!==r?r:Aa.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:Aa.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=s)continue;const i=r.value*a*n*(r.bezier.circular?.3:1),l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(c.particlePool,e,d,st);const t=.5*(null!==(n=st.speedMultiplier)&&void 0!==n?n:1);let o;if(st.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,o),function(e,t,n,o,r){var i,a;const s=null!==(i=o.radius)&&void 0!==i?i:Aa.radius,l=null!==(a=o.opacity)&&void 0!==a?a:Aa.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(l,c.particlePool,e,st,Bt)}}m&&(l.globalAlpha=1);const v=ht.current;if(ht.current=!1,v||g||f){const e=ct.current;e&&e.setAttribute("aria-label",hn(null!==(r=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==r?r:0,null!==(a=null===(i=c.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}(v||g||f)&&Et(e=>e+1),(Nt||g||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff)&&(ut.current=requestAnimationFrame(()=>ft.current()))},o(()=>(Dt(),()=>{ut.current&&(cancelAnimationFrame(ut.current),ut.current=0)}),[Dt]),o(()=>{ht.current=!0,Dt()},[A,ot,rt,pe,Dt]),wt(Ie,pt,ht,Dt,jt,Ct);const nn=ye&&bt?e.createElement(Cn,{x:bt.x,y:bt.y,containerWidth:ot,containerHeight:rt,margin:nt,className:"stream-network-tooltip",zIndex:2},me?me(bt):e.createElement(ol,{data:bt})):null;if(an){const t=pt.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),n=e?E||(Array.isArray(O)?void 0:O):void 0;if(e&&n)t.ingestHierarchy(n,[ot,rt]),t.buildScene([ot,rt]);else{const e=S||[],n=Array.isArray(O)?O:[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[ot,rt]),t.buildScene([ot,rt]))}}const n=null!==(d=null==t?void 0:t.sceneNodes)&&void 0!==d?d:[],o=null!==(h=null==t?void 0:t.sceneEdges)&&void 0!==h?h:[],r=null!==(g=null==t?void 0:t.labels)&&void 0!==g?g:[];return e.createElement("div",{className:"stream-network-frame"+(fe?" "+fe:""),role:"img","aria-label":Fe||("string"==typeof _e?_e:"Network chart"),style:{position:"relative",width:tt[0],height:tt[1]}},e.createElement(An,{summary:ze}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:tt[0],height:tt[1],style:{position:"absolute",left:0,top:0}},Be&&e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},Be),e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},pe&&e.createElement("rect",{x:0,y:0,width:ot,height:rt,fill:pe}),o.map((t,n)=>function(t,n){switch(t.type){case"line":return e.createElement("line",{key:"net-edge-"+n,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity});case"bezier":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"ribbon":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"curved":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),n.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e.createElement("circle",{key:"net-circle-"+n,cx:o.cx,cy:o.cy,r:o.r,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"rect":{const o=t;return e.createElement("rect",{key:"net-rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"arc":{const o=t,r=ie().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle).endAngle(o.endAngle)({})||"";return e.createElement("path",{key:"net-arc-"+n,d:r,transform:`translate(${o.cx},${o.cy})`,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e.createElement("text",{key:"net-label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder},t.text)}(t,n)).filter(Boolean))),e.createElement(Xs,{width:ot,height:rt,totalWidth:tt[0],totalHeight:tt[1],margin:nt,labels:r,sceneNodes:n,title:_e,legend:Oe,legendPosition:Ee,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Pe,legendIsolatedCategories:Me,foregroundGraphics:it,annotations:Ae,svgAnnotationRules:Se,annotationFrame:0}))}const on=pt.current;return e.createElement("div",{ref:et,className:"stream-network-frame"+(fe?" "+fe:""),role:"group","aria-label":Fe||("string"==typeof _e?_e:"Network chart"),tabIndex:0,style:{position:"relative",width:de?"100%":tt[0],height:he?"100%":tt[1],overflow:"visible"},onKeyDown:en},We&&e.createElement(Sn,{tableId:Ze}),We&&e.createElement(wn,{nodes:null!==(f=null==on?void 0:on.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==on?void 0:on.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:Ze,chartTitle:"string"==typeof _e?_e:void 0}),e.createElement(An,{summary:ze}),e.createElement("div",{role:"img","aria-label":Fe||("string"==typeof _e?_e:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ye?tn:void 0,onMouseLeave:ye?Ut:void 0,onClick:be||xe?Kt:void 0},Be&&e.createElement("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:tt[0],height:tt[1],pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${nt.left},${nt.top})`},Be)),e.createElement("canvas",{ref:ct,"aria-label":hn(null!==(m=null===(y=null==on?void 0:on.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==on?void 0:on.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(On,{hoverPoint:bt}),e.createElement(Xs,{width:ot,height:rt,totalWidth:tt[0],totalHeight:tt[1],margin:nt,labels:(null==on?void 0:on.labels)||[],sceneNodes:null==on?void 0:on.sceneNodes,title:_e,legend:Oe,legendPosition:Ee,legendHoverBehavior:je,legendClickBehavior:Ce,legendHighlightedCategory:Pe,legendIsolatedCategories:Me,foregroundGraphics:it,annotations:Ae,svgAnnotationRules:Se,annotationFrame:Ot}),e.createElement(jn,{active:Qt.current>=0,hoverPoint:bt,margin:nt,size:tt,shape:null===(x=Zt.current)||void 0===x?void 0:x.shape,width:null===(k=Zt.current)||void 0===k?void 0:k.w,height:null===(w=Zt.current)||void 0===w?void 0:w.h}),nn,(null==Ie?void 0:Ie.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ie.badgePosition?{top:4,left:4}:"bottom-left"===Ie.badgePosition?{bottom:4,left:4}:"bottom-right"===Ie.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:jt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},jt?"STALE":"LIVE")))});rl.displayName="StreamNetworkFrame";const il=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=nr(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,nodeIDAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:E,frameProps:j={},onObservation:C,onClick:P,chartId:M,selection:L,linkedHover:_,loading:T,emptyContent:B,legendInteraction:N,legendPosition:D}=o,I=s.width,H=s.height,W=s.enableHover,F=s.showLegend,z=null!==(i=s.showLabels)&&void 0!==i&&i,R=s.title,$=s.description,G=s.summary,Y=s.accessibleTable,q=Xr(T,I,H),X=q?null:qr(l,I,H,B),V=l||[],U=c||[],K=Uo(V,m,v),Q=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Z=er(N,m,Q),J=qo(),ee=n(()=>new Map,[]),te=n(()=>{if(Array.isArray(v))return v;if(J&&J.length>0)return J;const e=Me[v];return Array.isArray(e)?e:Le},[v,J]),ne=n(()=>e=>{const t={};return t.fill=m?Ne(e.data||e,m,K):Xo(void 0,J,v,void 0,ee),"number"==typeof b&&(t.r=b),t},[m,K,b,J,v,ee]),oe=n(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),re=n(()=>{if(z&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[z,y]),{legend:ie,margin:ae,legendPosition:se}=Jo({data:V,colorBy:m,colorScale:K,showLegend:F,legendPosition:D,userMargin:d,defaults:s.marginDefaults}),{customHoverBehavior:le,customClickBehavior:ce}=Qo({selection:L,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:C,onClick:P,chartType:"ForceDirectedGraph",chartId:M}),ue=Ar({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return ue?e.createElement(pr,{componentName:"ForceDirectedGraph",message:ue,width:I,height:H}):q||X||e.createElement($r,{componentName:"ForceDirectedGraph",width:I,height:H},e.createElement(rl,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:V},null!=c&&{edges:U},{size:[I,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,nodeIDAccessor:g,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ne,edgeStyle:oe,colorBy:m,colorScheme:te,nodeSize:b,nodeSizeRange:x,nodeLabel:re,showLabels:z,enableHover:W,tooltipContent:!1===E?()=>null:cr(E)||void 0,customHoverBehavior:_||C||P?le:void 0,customClickBehavior:C||P?ce:void 0,legend:ie,legendPosition:se},N&&"none"!==N&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories},{className:h,title:R,description:$,summary:G,accessibleTable:Y},j)))});function al(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(o)};return o(e),n}function sl(e,t,n,o){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof o?o(e):e[o];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function ll(e){return"function"==typeof e?e:t=>t[e]||1}function cl({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:r,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:r},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Ne(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Ne(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}il.displayName="ForceDirectedGraph";const ul=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=nr(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:w,nodeLabel:A,edgeOpacity:S=.5,tooltip:O,frameProps:E={},onObservation:j,onClick:C,chartId:P,selection:M,linkedHover:L,loading:_,emptyContent:T,legendInteraction:B}=o,N=s.width,D=s.height,I=s.enableHover,H=null===(i=s.showLabels)||void 0===i||i,W=s.title,F=s.description,z=s.summary,R=s.accessibleTable,$=Xr(_,N,D),G=$?null:qr(c,N,D,T),Y=c||[],q=n(()=>sl(l,Y,g,f),[l,Y,g,f]),X=Uo(q,m,v),V=n(()=>{if(!m)return[];const e=new Set;for(const t of q){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[q,m]),U=er(B,m,V),K=qo(),Q=n(()=>new Map,[]),Z=n(()=>{if(Array.isArray(v))return v;if(K&&K.length>0)return K;const e=Me[v];return Array.isArray(e)?e:Le},[v,K]),J=q.length>0,ee=n(()=>{if(J)return(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(m)r.fill=Ne(e.data||e,m,X);else{const i=Array.isArray(v)?v:Me[v]||Le,a=Array.isArray(i)?i:Le,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=a[s%a.length]}return r}},[J,m,X,v]),te=n(()=>{if(J)return cl({edgeColorBy:b,colorBy:m,colorScale:X,nodeStyleFn:ee||(e=>({fill:Xo(void 0,K,v,void 0,Q)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[J,b,m,X,ee,S,K,v,Q]),ne=n(()=>{if(!H)return;const e=A||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[H,A,y]),oe=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:re,customClickBehavior:ie}=Qo({selection:M,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"ChordDiagram",chartId:P}),ae=Ar({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return ae?e.createElement(pr,{componentName:"ChordDiagram",message:ae,width:N,height:D}):$||G||e.createElement($r,{componentName:"ChordDiagram",width:N,height:D},e.createElement(rl,Object.assign({ref:a,chartType:"chord"},q.length>0&&{nodes:q},null!=c&&{edges:Y},{size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:w,nodeStyle:ee,edgeStyle:te,colorBy:m,colorScheme:Z,edgeColorBy:b,edgeOpacity:S,nodeLabel:ne,showLabels:H,enableHover:I,tooltipContent:!1===O?()=>null:cr(O)||void 0,customHoverBehavior:L||j||C?re:void 0,customClickBehavior:j||C?ie:void 0},B&&"none"!==B&&{legendHoverBehavior:U.onLegendHover,legendClickBehavior:U.onLegendClick,legendHighlightedCategory:U.highlightedCategory,legendIsolatedCategories:U.isolatedCategories},{className:h,title:W,description:F,summary:z,accessibleTable:R},E)))});ul.displayName="ChordDiagram";const dl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=nr(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:800,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:A=15,nodeLabel:S,edgeOpacity:O=.5,edgeSort:E,tooltip:j,frameProps:C={},onObservation:P,onClick:M,chartId:L,selection:_,linkedHover:T,loading:B,emptyContent:N,legendInteraction:D}=o,I=s.width,H=s.height,W=s.enableHover,F=null===(i=s.showLabels)||void 0===i||i,z=s.title,R=s.description,$=s.summary,G=s.accessibleTable,Y=Xr(B,I,H),q=Y?null:qr(c,I,H,N),X=c||[],V=n(()=>sl(l,X,g,f),[l,X,g,f]),U=Uo(V,m,v),K=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Q=er(D,m,K),Z=qo(),J=n(()=>new Map,[]),ee=n(()=>{if(Array.isArray(v))return v;if(Z&&Z.length>0)return Z;const e=Me[v];return Array.isArray(e)?e:Le},[v,Z]),te=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?Ne(e.data||e,m,U):Xo(void 0,Z,v,void 0,J),t},[m,U,Z,v,J]),ne=n(()=>cl({edgeColorBy:b,colorBy:m,colorScale:U,nodeStyleFn:te,edgeOpacity:O,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,U,te,O]),oe=n(()=>{if(!F)return;const e=S||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[F,S,y]),re=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:ie,customClickBehavior:ae}=Qo({selection:_,linkedHover:T,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:P,onClick:M,chartType:"SankeyDiagram",chartId:L}),se=Ar({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return se?e.createElement(pr,{componentName:"SankeyDiagram",message:se,width:I,height:H}):Y||q||e.createElement($r,{componentName:"SankeyDiagram",width:I,height:H},e.createElement(rl,Object.assign({ref:a,chartType:"sankey"},V.length>0&&{nodes:V},null!=c&&{edges:X},{size:[I,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:A,nodeStyle:te,edgeStyle:ne,colorBy:m,colorScheme:ee,edgeColorBy:b,edgeOpacity:O,edgeSort:E,nodeLabel:oe,showLabels:F,enableHover:W,tooltipContent:!1===j?()=>null:cr(j)||void 0,customHoverBehavior:T||P||M?ie:void 0,customClickBehavior:P||M?ae:void 0},D&&"none"!==D&&{legendHoverBehavior:Q.onLegendHover,legendClickBehavior:Q.onLegendClick,legendHighlightedCategory:Q.highlightedCategory,legendIsolatedCategories:Q.isolatedCategories},{className:h,title:z,description:R,summary:$,accessibleTable:G},C)))});function hl(t){var o;const r=nr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:i,margin:a,className:s,layout:l="tree",orientation:c="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:f,colorByDepth:p=!1,edgeStyle:y="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,onClick:w,chartId:A,selection:S,linkedHover:O,loading:E,legendInteraction:j}=t,C=r.width,P=r.height,M=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,_=r.title,T=r.description,B=r.summary,N=r.accessibleTable,D=Xr(E,C,P),I=n(()=>al(null!=i?i:null,u),[i,u]),H=Uo(I,p?void 0:g,f),W=n(()=>{if(!g||p)return[];const e=new Set;for(const t of I){const n="function"==typeof g?g(t):t[g];null!=n&&e.add(n+"")}return Array.from(e)},[I,g,p]),F=er(j,p?void 0:g,W),z=qo(),R=n(()=>new Map,[]),$=n(()=>{if(Array.isArray(f))return f;if(z&&z.length>0)return z;const e=Me[f];return Array.isArray(e)?e:Le},[f,z]),G=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?Te[(e.depth||0)%Te.length]:g?Ne(e.data||e,g,H):Xo(void 0,z,f,void 0,R),t},[g,p,H,z,f,R]),Y=n(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),q=n(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return ll(d)},[l,d]),X=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:V,customClickBehavior:U}=Qo({selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,onClick:w,chartType:"TreeDiagram",chartId:A}),K=wr({componentName:"TreeDiagram",data:i});return K?e.createElement(pr,{componentName:"TreeDiagram",message:K,width:C,height:P}):D||e.createElement($r,{componentName:"TreeDiagram",width:C,height:P},e.createElement(rl,Object.assign({chartType:l},null!=i&&{data:i},{size:[C,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:q,treeOrientation:c,edgeType:y,nodeStyle:G,edgeStyle:Y,colorBy:g,colorScheme:$,colorByDepth:p,nodeSize:v,nodeLabel:L?m||h:void 0,showLabels:L,enableHover:M,tooltipContent:!1===b?()=>null:cr(b)||void 0,customHoverBehavior:O||k||w?V:void 0,customClickBehavior:k||w?U:void 0},j&&"none"!==j&&{legendHoverBehavior:F.onLegendHover,legendClickBehavior:F.onLegendClick,legendHighlightedCategory:F.highlightedCategory,legendIsolatedCategories:F.isolatedCategories},{className:s,title:_,description:T,summary:B,accessibleTable:N},x)))}function gl(t){var o;const r=nr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:i,margin:a,className:s,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,labelMode:p="leaf",nodeLabel:y,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:E,legendInteraction:j}=t,C=r.width,P=r.height,M=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,_=r.title,T=r.description,B=r.summary,N=r.accessibleTable,D=Xr(E,C,P),{activeSelectionHook:I,customHoverBehavior:H,customClickBehavior:W}=Qo({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,onClick:S,chartType:"Treemap",chartId:O}),F=l(e=>{if(!e)return H(null);const t=e.data||e;H({data:(null==t?void 0:t.data)||t})},[H]),z=n(()=>al(null!=i?i:null,c),[i,c]),R=Uo(z,f?void 0:h,g),$=n(()=>{if(!h||f)return[];const e=new Set;for(const t of z){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[z,h,f]),G=er(j,f?void 0:h,$),Y=qo(),q=n(()=>new Map,[]),X=n(()=>{if(Array.isArray(g))return g;if(Y&&Y.length>0)return Y;const e=Me[g];return Array.isArray(e)?e:Le},[g,Y]),V=n(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=f?Te[(e.depth||0)%Te.length]:h?Ne(e.data||e,h,R):Xo(void 0,Y,g,void 0,q),t},[h,f,R,Y,g,q]),U=n(()=>I?e=>{var t;const n=Object.assign({},V(e));if(I.isActive)if(I.predicate(e.data||e))(null==k?void 0:k.selectedStyle)&&Object.assign(n,k.selectedStyle);else{const e=null!==(t=null==k?void 0:k.unselectedOpacity)&&void 0!==t?t:.2;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==k?void 0:k.unselectedStyle)&&Object.assign(n,k.unselectedStyle)}return n}:V,[V,I,k]),K=n(()=>ll(u),[u]),Q=void 0!==v?v:!L||"parent"!==p&&"all"!==p?void 0:18,Z=Object.assign(Object.assign({},r.marginDefaults),a),J=wr({componentName:"Treemap",data:i});return J?e.createElement(pr,{componentName:"Treemap",message:J,width:C,height:P}):D||e.createElement($r,{componentName:"Treemap",width:C,height:P},e.createElement(rl,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[C,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:K,padding:m,paddingTop:Q,nodeStyle:U,colorBy:h,colorScheme:X,colorByDepth:f,nodeLabel:L?y||d:void 0,showLabels:L,labelMode:p,enableHover:M,tooltipContent:!1===b?()=>null:cr(b)||void 0},(w||A||S)&&{customHoverBehavior:F},(A||S)&&{customClickBehavior:W},j&&"none"!==j&&{legendHoverBehavior:G.onLegendHover,legendClickBehavior:G.onLegendClick,legendHighlightedCategory:G.highlightedCategory,legendIsolatedCategories:G.isolatedCategories},{className:s,title:_,description:T,summary:B,accessibleTable:N},x)))}function fl(t){var o;const r=nr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:i,margin:a,className:s,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,nodeLabel:f,circleOpacity:p=.7,padding:y=4,tooltip:m,frameProps:v={},onObservation:b,onClick:x,chartId:k,selection:w,linkedHover:A,loading:S,legendInteraction:O}=t,E=r.width,j=r.height,C=r.enableHover,P=null===(o=r.showLabels)||void 0===o||o,M=r.title,L=r.description,_=r.summary,T=r.accessibleTable,B=Xr(S,E,j),N=n(()=>al(null!=i?i:null,l),[i,l]),D=Uo(N,g?void 0:d,h),I=n(()=>{if(!d||g)return[];const e=new Set;for(const t of N){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[N,d,g]),H=er(O,g?void 0:d,I),W=qo(),F=n(()=>new Map,[]),z=n(()=>{if(Array.isArray(h))return h;if(W&&W.length>0)return W;const e=Me[h];return Array.isArray(e)?e:Le},[h,W]),R=n(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=g?Te[(e.depth||0)%Te.length]:d?Ne(e.data||e,d,D):Xo(void 0,W,h,void 0,F),t},[d,g,D,p,W,h,F]),$=n(()=>ll(c),[c]),G=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:Y,customClickBehavior:q}=Qo({selection:w,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,onClick:x,chartType:"CirclePack",chartId:k}),X=wr({componentName:"CirclePack",data:i});return X?e.createElement(pr,{componentName:"CirclePack",message:X,width:E,height:j}):B||e.createElement($r,{componentName:"CirclePack",width:E,height:j},e.createElement(rl,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[E,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:$,padding:y,nodeStyle:R,colorBy:d,colorScheme:z,colorByDepth:g,nodeLabel:P?f||u:void 0,showLabels:P,enableHover:C,tooltipContent:!1===m?()=>null:cr(m)||void 0,customHoverBehavior:A||b||x?Y:void 0,customClickBehavior:b||x?q:void 0},O&&"none"!==O&&{legendHoverBehavior:H.onLegendHover,legendClickBehavior:H.onLegendClick,legendHighlightedCategory:H.highlightedCategory,legendIsolatedCategories:H.isolatedCategories},{className:s,title:M,description:L,summary:_,accessibleTable:T},v)))}dl.displayName="SankeyDiagram",hl.displayName="TreeDiagram",gl.displayName="Treemap",fl.displayName="CirclePack";const pl=Te;function yl(t){const o=nr(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:r,margin:i,className:a,childrenAccessor:s="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:E,onClick:j,chartId:C,selection:P,linkedHover:M,loading:L}=t,_=o.width,T=o.height,B=o.enableHover,N=o.title,D=o.description,I=o.summary,H=o.accessibleTable,W=Xr(L,_,T),F=Uo(n(()=>al(r,s),[r,s]),d?void 0:c,u),z=qo(),R=n(()=>new Map,[]),$=n(()=>{if(Array.isArray(u))return u;if(z&&z.length>0)return z;const e=Me[u];return Array.isArray(e)?e:Le},[u,z]),G=n(()=>{if(Array.isArray(u))return u;const e=Me[u];return Array.isArray(e)?e:Le},[u]),Y=n(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=d?o?G[0]:pl[(e.depth||0)%pl.length]:c?Ne(e.data||e,c,F):Xo(void 0,z,u,void 0,R),n.opacity=o?1:.85,n},[c,d,F,G,z,u,R]),q=n(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),X=Object.assign({top:10,right:10,bottom:10,left:10},i),{customHoverBehavior:V,customClickBehavior:U}=Qo({selection:P,linkedHover:M,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:E,onClick:j,chartType:"OrbitDiagram",chartId:C}),K=n(()=>{if(V)return e=>{V(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[V]),Q=n(()=>{if(U)return e=>{U(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[U]),Z=wr({componentName:"OrbitDiagram",data:r});return Z?e.createElement(pr,{componentName:"OrbitDiagram",message:Z,width:_,height:T}):W||e.createElement($r,{componentName:"OrbitDiagram",width:_,height:T},e.createElement(rl,Object.assign({chartType:"orbit"},null!=r&&{data:r},{size:[_,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:Y,edgeStyle:q,colorBy:c,colorScheme:$,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&B,tooltipContent:k?void 0:!1===w?()=>null:cr(w)||void 0,customHoverBehavior:M||E||j?K:void 0,customClickBehavior:E||j?Q:void 0,foregroundGraphics:A,annotations:S,className:a,title:N,description:D,summary:I,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:H},O)))}yl.displayName="OrbitDiagram";const ml=c(function(n,o){var r,i,a,s;const c=nr(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:O,background:E,tooltipContent:j,tooltip:C,onHover:P,annotations:M,svgAnnotationRules:L,tickFormatTime:_,tickFormatValue:T,decay:B,pulse:N,staleness:D,transition:I,linkedHover:H,selection:W,onObservation:F,chartId:z,loading:R,emptyContent:$,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=j?j:C,Q=t(null),{customHoverBehavior:Z}=Qo({selection:W,linkedHover:H,unwrapData:!0,onObservation:F,chartType:"RealtimeLineChart",chartId:z}),J=l(e=>{P&&P(e),Z(e)},[P,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=Xr(R,U[0],U[1]),te=ee?null:qr(m,U[0],U[1],$),ne={stroke:A,strokeWidth:S,strokeDasharray:O};return ee||te||e.createElement(po,{ref:Q,chartType:"line",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,lineStyle:ne,showAxes:q,background:E,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:M,svgAnnotationRules:L,tickFormatTime:_,tickFormatValue:T,decay:B,pulse:N,staleness:D,transition:I,pointIdAccessor:n.pointIdAccessor,legendPosition:Y})});ml.displayName="RealtimeLineChart";const vl=c(function(n,o){var r,i,a,s;const c=nr(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{binSize:d,size:h,margin:g,className:f,arrowOfTime:p="right",windowMode:y="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,fill:E,stroke:j,strokeWidth:C,gap:P,background:M,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:H,selection:W,decay:F,pulse:z,staleness:R,transition:$,onObservation:G,chartId:Y,loading:q,emptyContent:X,emphasis:V,legendPosition:U,brush:K,onBrush:Q,linkedBrush:Z}=n,J=c.showAxes,ee=c.enableHover,te=null!=g?g:c.marginDefaults,ne=null!=h?h:[c.width,c.height],oe=null!=L?L:_,re=t(null),{customHoverBehavior:ie}=Qo({selection:W,linkedHover:H,unwrapData:!0,onObservation:G,chartType:"RealtimeTemporalHistogram",chartId:Y}),ae=l(e=>{T&&T(e),ie(e)},[T,ie]),se=!0===K?{dimension:"x",snap:"bin"}:"x"===K?{dimension:"x"}:"object"==typeof K?K:void 0,le=Do(Z),ce=Co(Object.assign({name:(null==le?void 0:le.name)||"__unused_hist_brush__",xField:(null==le?void 0:le.xField)||("string"==typeof b?b:"time")},(null==le?void 0:le.yField)?{yField:le.yField}:{})),ue=t(ce.brushInteraction);ue.current=ce.brushInteraction;const de=l(e=>{if(Q&&Q(e),G&&G(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}),le){const t=ue.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[Q,G,Y,le]);u(o,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=re.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=re.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const he=Xr(q,ne[0],ne[1]),ge=he?null:qr(v,ne[0],ne[1],X),fe={};return null!=E&&(fe.fill=E),null!=j&&(fe.stroke=j),null!=C&&(fe.strokeWidth=C),null!=P&&(fe.gap=P),he||ge||e.createElement(po,{ref:re,chartType:"bar",runtimeMode:"streaming",size:ne,margin:te,className:V?`${f||""} semiotic-emphasis-${V}`.trim():f,arrowOfTime:p,windowMode:y,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,binSize:d,categoryAccessor:S,barColors:O,barStyle:fe,showAxes:J,background:M,hoverAnnotation:ee,tooltipContent:oe,customHoverBehavior:ae,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,decay:F,pulse:z,staleness:R,transition:$,pointIdAccessor:n.pointIdAccessor,legendPosition:U,brush:se||(Z?{dimension:"x"}:void 0),onBrush:se||Z?de:void 0})});vl.displayName="RealtimeTemporalHistogram";const bl=vl,xl=c(function(n,o){var r,i,a,s;const c=nr(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,categoryAccessor:A,colors:S,radius:O,fill:E,opacity:j,stroke:C,strokeWidth:P,background:M,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:H,selection:W,onObservation:F,chartId:z,loading:R,emptyContent:$,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=L?L:_,Q=t(null),{customHoverBehavior:Z}=Qo({selection:W,linkedHover:H,unwrapData:!0,onObservation:F,chartType:"RealtimeSwarmChart",chartId:z}),J=l(e=>{T&&T(e),Z(e)},[T,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=Xr(R,U[0],U[1]),te=ee?null:qr(m,U[0],U[1],$),ne={};return null!=O&&(ne.radius=O),null!=E&&(ne.fill=E),null!=j&&(ne.opacity=j),null!=C&&(ne.stroke=C),null!=P&&(ne.strokeWidth=P),ee||te||e.createElement(po,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,categoryAccessor:A,barColors:S,swarmStyle:ne,showAxes:q,background:M,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});xl.displayName="RealtimeSwarmChart";const kl=c(function(n,o){var r,i,a,s;const c=nr(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,positiveColor:A,negativeColor:S,connectorStroke:O,connectorWidth:E,gap:j,stroke:C,strokeWidth:P,background:M,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:H,selection:W,onObservation:F,chartId:z,loading:R,emptyContent:$,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=L?L:_,Q=t(null),{customHoverBehavior:Z}=Qo({selection:W,linkedHover:H,unwrapData:!0,onObservation:F,chartType:"RealtimeWaterfallChart",chartId:z}),J=l(e=>{T&&T(e),Z(e)},[T,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=Xr(R,U[0],U[1]),te=ee?null:qr(m,U[0],U[1],$),ne={};return null!=A&&(ne.positiveColor=A),null!=S&&(ne.negativeColor=S),null!=O&&(ne.connectorStroke=O),null!=E&&(ne.connectorWidth=E),null!=j&&(ne.gap=j),null!=C&&(ne.stroke=C),null!=P&&(ne.strokeWidth=P),ee||te||e.createElement(po,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,waterfallStyle:ne,showAxes:q,background:M,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});kl.displayName="RealtimeWaterfallChart";const wl=c(function(n,o){var r,i,a,s;const c=nr(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,heatmapXBins:S=20,heatmapYBins:O=20,aggregation:E="count",background:j,tooltipContent:C,tooltip:P,onHover:M,annotations:L,svgAnnotationRules:_,tickFormatTime:T,tickFormatValue:B,decay:N,pulse:D,staleness:I,linkedHover:H,selection:W,onObservation:F,chartId:z,loading:R,emptyContent:$,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=C?C:P,Q=t(null),{customHoverBehavior:Z}=Qo({selection:W,linkedHover:H,unwrapData:!0,onObservation:F,chartType:"RealtimeHeatmap",chartId:z}),J=l(e=>{M&&M(e),Z(e)},[M,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=Xr(R,U[0],U[1]),te=ee?null:qr(m,U[0],U[1],$);return ee||te||e.createElement(po,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:k,yExtent:w,extentPadding:A,heatmapXBins:S,heatmapYBins:O,heatmapAggregation:E,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:L,svgAnnotationRules:_,tickFormatTime:T,tickFormatValue:B,decay:N,pulse:D,staleness:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});wl.displayName="RealtimeHeatmap";let[Al]=Ln(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function Sl(e,t){return Ur(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:r=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ol(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);El(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*r,n=l.height*r,a=document.createElement("canvas");a.width=t,a.height=n;const c=a.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,n),c.scale(r,r);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),a.toBlob(n=>{n?(El(n,o+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function Ol(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),a=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of a){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)Ol(o[e],r[e])}function El(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const jl=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Cl=new Set(["data","nodes","edges"]),Pl="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Ml(e,t,n){if(!Pr[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Pr).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(jl.has(e)||!o&&Cl.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=Pl(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function Ll(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Pr[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Pl(e.props)}}function _l(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Tl(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function Bl(e){return Ur(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Nl(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function Nl(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function Dl(){const t=function(){const t=e.useContext(sn);return t?()=>t.setVisible(e=>!e):null}();return t?e.createElement("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:zl},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"}))):null}const Il={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function Hl({height:t}){return e.createElement("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function Wl({error:t}){return e.createElement("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5}},t))}const Fl=e.forwardRef(function({title:t,subtitle:n,children:o,width:r="100%",height:i=400,actions:a,chartConfig:s,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:f,style:p},y){const m=e.useRef(null),v=e.useRef(null),[b,x]=e.useState(!1),k=!1!==(null==a?void 0:a.export)&&void 0!==(null==a?void 0:a.export),w=!1!==(null==a?void 0:a.fullscreen)&&void 0!==(null==a?void 0:a.fullscreen),A=!1!==(null==a?void 0:a.copyConfig)&&void 0!==(null==a?void 0:a.copyConfig)&&s,S=!0===(null==a?void 0:a.dataSummary),O="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",j=e.useCallback(e=>Ur(this,void 0,void 0,function*(){v.current&&(yield Sl(v.current,Object.assign(Object.assign({},O),e)))}),[O]),C=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),P=e.useCallback(e=>Ur(this,void 0,void 0,function*(){s&&(yield Bl(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(y,()=>({export:j,toggleFullscreen:C,copyConfig:P,element:m.current}),[j,C,P]);const M=t||n||l||k||w||A||S||h,L=c?e.createElement(Hl,{height:i}):u?e.createElement(Wl,{error:u}):d?e.createElement(yr,null,o):o;return _=e.createElement(e.Fragment,null,e.createElement("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.createElement("div",{ref:m,className:"semiotic-chart-container"+(f?" "+f:""),style:Object.assign(Object.assign({width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),p)},M&&e.createElement("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}},e.createElement("div",{className:"semiotic-chart-title-area"},t&&e.createElement("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"}},t),n&&e.createElement("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0}},n)),e.createElement("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4}},l,k&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Export chart","aria-label":"Export chart",style:zl},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.createElement("path",{d:"M2 12h10"}))),S&&e.createElement(Dl,null),w&&e.createElement("button",{className:"semiotic-chart-action",onClick:C,title:b?"Exit fullscreen":"Fullscreen","aria-label":b?"Exit fullscreen":"Enter fullscreen",style:zl},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b?e.createElement(e.Fragment,null,e.createElement("path",{d:"M9 1v4h4"}),e.createElement("path",{d:"M5 13V9H1"}),e.createElement("path",{d:"M13 5H9V1"}),e.createElement("path",{d:"M1 9h4v4"})):e.createElement(e.Fragment,null,e.createElement("path",{d:"M1 5V1h4"}),e.createElement("path",{d:"M13 9v4H9"}),e.createElement("path",{d:"M9 1h4v4"}),e.createElement("path",{d:"M5 13H1V9"})))),A&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>P(),title:"Copy config","aria-label":"Copy chart configuration",style:zl},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.createElement("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"}))),h&&e.createElement("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Il[h].bg,color:Il[h].color,lineHeight:"18px"}},h))),e.createElement("div",{className:"semiotic-chart-body",ref:v,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},b?{flex:1}:{height:i})},L,g))),S?e.createElement(ln,null,_):_;var _}),zl={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function Rl({children:t,columns:n="auto",minCellWidth:o=300,gap:r=16,className:i,style:a}){const s="number"==typeof n?n:void 0;return e.createElement("div",{className:"semiotic-chart-grid"+(i?" "+i:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},a)},e.Children.map(t,t=>e.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==s&&2>s?t:e.createElement("div",{style:{gridColumn:"span 2"}},t):t))}function $l({children:t,context:n,position:o="right",contextSize:r=250,gap:i=12,className:a,style:s}){const l="left"===o||"right"===o,c="left"===o||"top"===o,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:i,width:"100%"},s),d=l?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return e.createElement("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:u},e.createElement("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0}},t),e.createElement("div",{style:d},n))}Rl.displayName="ChartGrid",$l.displayName="ContextLayout";function Gl({children:n,position:i="right",size:a=300,trigger:s="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:f,style:p}){const[y,m]=r(null),[v,b]=r(null),[x,k]=r(!1),[w,A]=r(!1),S=t(null),O=t(),E="click"===s?["click","click-end"]:["hover","hover-end"],{latest:j}=Mo({types:E,chartId:c,limit:1}),C=void 0!==u?u:j;o(()=>{if(C)if("click"===C.type||"hover"===C.type){const e=C;m(e.datum),b(e),x||(k(!0),A(!0),clearTimeout(O.current),O.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==C.type&&"hover-end"!==C.type||P()},[C]),o(()=>{null==g||g(x)},[x,g]);const P=l(()=>{A(!0),k(!1),clearTimeout(O.current),O.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(o(()=>()=>clearTimeout(O.current),[]),!y&&!w)return null;const M=y&&v?n(y,v):null;if(null===M&&!w)return null;const L=function(e,t,n,o){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},r),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(i,a,x,w);return e.createElement("div",{ref:S,className:`semiotic-details-panel semiotic-details-${i}${f?" "+f:""}`,style:Object.assign(Object.assign({},L),p)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:Yl},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},e.createElement("path",{d:"M2 2l8 8M10 2l-8 8"}))),e.createElement("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1}},M))}const Yl={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};function ql(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function Xl(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function Vl(e){return"nominal"===e||"ordinal"===e}function Ul(e){return"quantitative"===e||"temporal"===e}Gl.displayName="DetailsPanel";const Kl={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},Ql={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},Zl={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Jl(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f;const p=[],{type:y,markProps:m}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"])}}(e.mark),v=e.encoding||{},b=v.x,x=v.y,k=v.color,w=v.size,A=v.theta,S=v.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.url)&&p.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&p.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&p.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&p.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||e.encoding&&e.encoding.facet||e.encoding&&(e.encoding.row||e.encoding.column))&&p.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&p.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&p.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const E={};e.width&&(E.width=e.width),e.height&&(E.height=e.height);const j=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(j&&(E.title=j),(null==k?void 0:k.field)&&(E.colorBy=k.field,null===(o=k.scale)||void 0===o?void 0:o.scheme)){const e=Kl[k.scale.scheme];e&&(E.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(E.pointOpacity=S.value);const C=null==b?void 0:b.aggregate,P=null==x?void 0:x.aggregate;if(O&&(C||P)){const e=P?x:b,t=P?b:x,n=Zl[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:n,value:o,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[n]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of i){let o;switch(r){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(O,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const n of O){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}O=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(E.data=O),(null==b?void 0:b.bin)?(E.valueAccessor=b.field,(null==x?void 0:x.field)&&(E.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(E.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(E.valueAccessor=x.field,(null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(E.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(a=null==b?void 0:b.bin)||void 0===a?void 0:a.maxbins)||(null===(s=null==x?void 0:x.bin)||void 0===s?void 0:s.maxbins):void 0;return t&&(E.bins=t),tc(e,E,p)}let M;switch(y){case"bar":M=function(e,t,n,o,r,i,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",Vl(null==e?void 0:e.type)&&Ul(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):Ul(null==e?void 0:e.type)&&Vl(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=i?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),r&&(o.data=r),g}(b,x,k,E,O,C,P);break;case"line":if(M="LineChart",ec(b,x,E,C,P),(null==k?void 0:k.field)&&(E.lineBy=k.field),m.interpolate){const e=Ql[m.interpolate];e&&(E.curve=e)}!0===m.point&&(E.showPoints=!0),O&&(E.data=O);break;case"area":if((null==k?void 0:k.field)?(M="StackedAreaChart",E.areaBy=k.field):M="AreaChart",ec(b,x,E,C,P),m.interpolate){const e=Ql[m.interpolate];e&&(E.curve=e)}void 0!==m.opacity&&(E.areaOpacity=m.opacity),O&&(E.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(M="BubbleChart",E.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(E.sizeRange=w.scale.range)):M="Scatterplot",ec(b,x,E,C,P),O&&(E.data=O);break;case"rect":M="Heatmap",(null==b?void 0:b.field)&&(E.xAccessor=b.field),(null==x?void 0:x.field)&&(E.yAccessor=x.field),(null==k?void 0:k.field)&&(E.valueAccessor=k.field,delete E.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(E.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(E.yLabel=x.axis.title),O&&(E.data=O);break;case"arc":m.innerRadius&&m.innerRadius>0?(M="DonutChart",E.innerRadius=m.innerRadius):M="PieChart",(null==A?void 0:A.field)?E.valueAccessor=A.field:(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field),(null==k?void 0:k.field)&&(E.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(E.categoryAccessor=b.field),O&&(E.data=O);break;case"tick":M="DotPlot",Vl(null==b?void 0:b.type)?(E.categoryAccessor=b.field,(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(E.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(E.valueLabel=x.axis.title)):Vl(null==x?void 0:x.type)?(E.categoryAccessor=x.field,(null==b?void 0:b.field)&&(E.valueAccessor=C?"value":b.field),E.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(E.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(E.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field)),O&&(E.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),M="Scatterplot",ec(b,x,E,C,P),O&&(E.data=O)}return tc(M,E,p)}function ec(e,t,n,o,r){var i,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=r?"value":t.field),(null===(i=null==e?void 0:e.axis)||void 0===i?void 0:i.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function tc(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}export{ei as AreaChart,ea as BarChart,sa as BoxPlot,si as BubbleChart,mo as CategoryColorProvider,Fl as ChartContainer,Rl as ChartGrid,ul as ChordDiagram,fl as CirclePack,ai as ConnectedScatterplot,$l as ContextLayout,Gl as DetailsPanel,ga as DonutChart,ua as DotPlot,il as ForceDirectedGraph,fa as FunnelChart,oa as GroupedBarChart,li as Heatmap,la as Histogram,ka as LikertChart,Jr as LineChart,Bo as LinkedCharts,wi as MultiAxisLineChart,lr as MultiLineTooltip,yl as OrbitDiagram,ha as PieChart,mi as QuadrantChart,wl as RealtimeHeatmap,bl as RealtimeHistogram,ml as RealtimeLineChart,xl as RealtimeSwarmChart,kl as RealtimeWaterfallChart,da as RidgelinePlot,dl as SankeyDiagram,ri as Scatterplot,yi as ScatterplotMatrix,ni as StackedAreaChart,na as StackedBarChart,ia as SwarmPlot,$o as ThemeProvider,Al as TooltipProvider,hl as TreeDiagram,gl as Treemap,ca as ViolinPlot,Nl as configToJSX,Bl as copyConfig,Xl as deserializeSelections,Fr as diagnoseConfig,Sl as exportChart,Ll as fromConfig,Tl as fromURL,Jl as fromVegaLite,ql as serializeSelections,Ml as toConfig,_l as toURL,Co as useBrushSelection,vo as useCategoryColors,Mo as useChartObserver,Po as useFilteredData,jo as useLinkedHover,Eo as useSelection,Go as useTheme,Lr as validateProps};
1
+ import*as e from"react";import{useRef as t,useMemo as n,useEffect as o,useState as r,useSyncExternalStore as i,createContext as a,useContext as s,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 f,brush as p}from"d3-brush";import{scaleOrdinal as y,scaleLinear as m,scaleLog as v,scaleTime as b,scaleSequential as x,scaleBand as k}from"d3-scale";import{quadtree as w}from"d3-quadtree";import{interpolatePlasma as A,interpolateViridis as S,interpolatePurples as O,interpolateOranges as E,interpolateGreens as j,interpolateReds as C,interpolateBlues as P,schemeSet3 as M,schemeTableau10 as L,schemeCategory10 as _}from"d3-scale-chromatic";import{bin as T,quantile as B,min as N,groups as D,max as I,sum as H,mean as W,group as $}from"d3-array";import{packEnclose as F,hierarchy as z,partition as R,pack as G,treemap as Y,treemapBinary as q,cluster as X,tree as V}from"d3-hierarchy";import{area as U,curveCatmullRom as K,curveCardinal as Q,curveBasis as Z,curveStepBefore as J,curveStepAfter as ee,curveStep as te,curveMonotoneY as ne,curveMonotoneX as oe,curveLinear as re,arc as ie,line as ae,curveNatural as se,pie as le}from"d3-shape";import ce from"regression";import{interpolateNumber as ue}from"d3-interpolate";import{forceLink as de,forceSimulation as he,forceManyBody as ge,forceCenter as fe,forceX as pe,forceY as ye}from"d3-force";import{ribbon as me,chord as ve}from"d3-chord";function be(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 xe(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 ke({width:r,height:i,totalWidth:a,totalHeight:s,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 S=t(u);S.current=u;const O=n(()=>v?[...v].sort((e,t)=>e-t):void 0,[v]),E=t(O);E.current=O;const j=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?f():p();return t.extent([[0,0],[r,i]]),t.on("brush end",n=>{if(j.current)return;const o=S.current;if(!o)return;if(!n.selection)return C.current=null,void A.current(null);let a,s;if("x"===c){const[e,t]=n.selection;a=[o.x.invert(e),o.x.invert(t)],s=[o.y.invert(i),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;a=[o.x.invert(0),o.x.invert(r)],s=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[r,i]]=n.selection;a=[o.x.invert(e),o.x.invert(r)],s=[o.y.invert(i),o.y.invert(t)]}if("bin"===m&&"y"!==c&&("end"===n.type||"brush"===n.type&&b)){const r=E.current;r&&r.length>0?a=function(e,t){return 0===t.length?e:[be(e[0],t),xe(e[1],t)]}(a,r):y&&y>0&&(a=[Math.floor(a[0]/y)*y,Math.ceil(a[1]/y)*y]);const i=o.x(a[0]),s=o.x(a[1]);if(j.current=!0,"x"===c)e.call(t.move,[i,s]);else if("xy"===c){const o=n.selection;e.call(t.move,[[i,o[0][1]],[s,o[1][1]]])}j.current=!1}const l={x:a,y:s};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 j.current=!0,n.call(w.current.move,null),j.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=E.current;e&&e.length>0?o=xe(t,e):y&&y>0&&(o=Math.ceil(t/y)*y)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,C.current=null,void A.current(null);r=!0}const i=u.x(o),a=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[i,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[i,t],[a,o]])}if(j.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:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`}))}class we{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 Ae{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,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[i]=t(a)}}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 Se{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 Oe(e,t,n,o,r){const i=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))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+=s,r){const e=r(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function Ee(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function je(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Ce(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Pe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}const Me={category10:_,tableau10:L,set3:M,blues:P,reds:C,greens:j,oranges:E,purples:O,viridis:S,plasma:A},Le=_,_e=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Te=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Be=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 Ne(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")||Be.has(t)}(o)?n(o):o}const o=null==e?void 0:e[t];return n?n(o):Le[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+""))%Le.length]}function De(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=Me[n]||Me.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:Le;return y().domain(o).range(e).unknown("#999")}}function Ie(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,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}function He(e,t,n){var o,r,i;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>s?1:a;default:return 1}}function We(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 $e(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Fe(e,t){return Math.min((e-t.startTime)/t.duration,1)}function ze(e,t,n){return e+(t-e)*n}function Re(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ge(e,t,n){var o,r,i,a;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!==(a=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!==a?a: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 a=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||a.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:r,datum:c,group:i}}function qe(e,t,n,o,r,i,a,s){const l=[];for(const i of e){const e=n(i),a=o(i);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const c=t.x(e),u=s?s(i):r;l.push({px:c,topY:t.y(a),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:a}}function Xe(e,t,n,o,r,i,a){const s=n(e),l=o(e);if(null==s||null==l||Number.isNaN(s)||Number.isNaN(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:r,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function Ve(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function Ue(e,t,n,o,r,i,a){const s={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return(null==a?void 0:a.showValues)&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function Ke(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 a=e.getBounds(n),s=e.scales.x(t);if(a&&0!==a)o.push([s,e.scales.y(i+a)]),r.push([s,e.scales.y(i-a)]);else{const t=e.scales.y(i);o.push([s,t]),r.push([s,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 Qe(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 a of o.data){let o=e.config.pointStyle(a);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const s=null!==(r=o.r)&&void 0!==r?r:3,l=e.getPointId?e.getPointId(a)+"":void 0,c=Xe(a,e.scales,e.getX,i,s,o,l);c&&n.push(c)}}}const Ze={blues:P,reds:C,greens:j,viridis:S},Je=new Map;class et{constructor(e){if(this.xExtent=new Se,this.yExtent=new Se,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 Ae(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=je(e.timeAccessor||e.xAccessor,"time"),this.getY=je(e.valueAccessor||e.yAccessor,"value")):(this.getX=je(e.xAccessor,"x"),this.getY=je(e.yAccessor,"y")),this.getGroup=Pe(e.groupAccessor),this.getCategory=Pe(e.categoryAccessor),this.getSize=e.sizeAccessor?je(e.sizeAccessor,"size"):void 0,this.getColor=Pe(e.colorAccessor),this.getBounds=e.boundsAccessor?je(e.boundsAccessor,"bounds"):void 0,this.getY0=e.y0Accessor?je(e.y0Accessor,"y0"):void 0,this.getPointId=Pe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?je(e.openAccessor,"open"):void 0,this.getHigh=je(e.highAccessor,"high"),this.getLow=je(e.lowAccessor,"low"),this.getClose=n?je(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Ae(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?je(this.config.timeAccessor||this.config.xAccessor,"time"):je(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,a,s;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,f=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 p=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!p&&c.size>0)if(l.normalize)f=[0,1+l.extentPadding];else{const e=`${c.size}:${this._ingestVersion}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)f=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);f=[0,o+(o>0?o*l.extentPadding:1)],this._stackExtentCache={key:e,yDomain:f}}}else if("bar"===l.chartType&&l.binSize&&!p&&c.size>0){const[,e]=function(e,t,n,o,r){const i=Oe(e,t,n,o,r);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(c,this.getX,this.getY,l.binSize,this.getCategory);f=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!p&&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;f=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!p&&f[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>f[1]&&(f[1]=t+n),f[0]>t-n&&(f[0]=t-n))}const e=f[1]-f[0],t=e>0?e*l.extentPadding:1,n=null===(a=l.yExtent)||void 0===a?void 0:a[0],o=null===(s=l.yExtent)||void 0===s?void 0:s[1];f=[null!=n?f[0]:f[0]-t,null!=o?f[1]:f[1]+t],"log"===l.yScaleType&&0>=f[0]&&h[0]>0&&(f[0]=null!=n?f[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];f[0]!==1/0&&f[1]!==-1/0||(f=[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(f).range([e.height-x,x])}}else{const t="down"===l.arrowOfTime?[x,e.height-x]:[e.height-x,x];this.scales={x:m().domain(f).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,f,[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>et.QUADTREE_THRESHOLD?w().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(),a=this.scales.y.range(),s=(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=a[1]>a[0];this.scales={x:s(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:s(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=Ke(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 Qe(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]),a=qe(t.data,e.scales,e.getX,e.getY,r,n,t.key,i);e.config.gradientFill&&(a.fillGradient=e.config.gradientFill),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),o.push(a)}return Qe(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],a=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=qe(t.data,e.scales,e.getX,e.getY,i,n,t.key,a);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 Qe(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,a){var s;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===(s=u.get(o.key))||void 0===s?void 0:s.get(t))||0;d.set(t,n||1)}}const h=[],g=new Map,f=new Map;for(const e of c)f.set(e,0);for(const n of e){const e=u.get(n.key),o=[],s=[],l=new Map;for(const n of c){let r=e.get(n)||0;const a=f.get(n);i&&(r/=d.get(n));const c=a+r,u=t.x(n);s.push([u,t.y(a)]),o.push([u,t.y(c)]),f.set(n,c),l.set(n,c)}g.set(n.key,l);const p={type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key};a&&(p.curve=a),h.push(p)}return{nodes:h,stackedTops:g}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o),a=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)};Qe(e,n,a,o)}return a}(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 a=e.getColor?e.resolveColorMap(t):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:"#4e79a7",opacity:.8},s=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(s=i(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(r);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const l=e.getPointId?e.getPointId(r)+"":void 0,c=Xe(r,e.scales,e.getX,e.getY,s,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 a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),s=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=je(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/a,p=(g-h||1)/s,y=a*s;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)/f),a-1),d=Math.min(Math.floor((i-h)/p),s-1);if(0>l||0>d)continue;const g=d*a+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/a,A=n.height/s,S=e.config.showValues,O=e.config.heatmapValueFormat,E=[];for(let e=0;s>e;e++){const t=e*a;for(let n=0;a>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;E.push(Ue(n*w,(s-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]},S?{value:r,showValues:!0,valueFormat:O}:void 0))}}return E}(e,t,n);if(0===t.length)return[];const o=je(e.config.valueAccessor,"value"),r=Ce(e.config.xAccessor,"x"),i=Ce(e.config.yAccessor,"y"),a=new Map,s=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,a.has(o)||a.set(o,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),g=Array.from(s.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(p){g.sort((e,t)=>e-t),s.clear();for(let e=0;g.length>e;e++)s.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=a.get(l[e]),i=s.get(c[e]);if(void 0===r||void 0===i)continue;const d=o(n),h=i*u+r,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=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 Ze?e:"blues";let n=Je.get(t);if(n)return n;n=Array(256);const o=Ze[t]||P;for(let e=0;256>e;e++)n[e]=o(e/255);return Je.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:"blues"),S=255/(w-k||1),O=n.width/u,E=n.height/d,j=e.config.showValues,C=e.config.heatmapValueFormat,M=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;M.push(Ue(o*O,(d-1-(n-o)/u)*E,O,E,A[Math.min((t-k)*S+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:C}:void 0))}return M}(i,t,e);case"bar":{const e=function(e,t){var n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Oe(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),a=Array.from(t).filter(e=>!i.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const i=[],a=e.scales,[s,l]=a.x.domain();for(const t of o.values()){const o=Math.max(t.start,s),c=Math.min(t.end,l);if(o>=c)continue;const u=a.x(o),d=a.x(c),h=Math.abs(d-u),g=h>2?1:0,f=Math.min(u,d)+g/2,p=Math.max(h-g,1);if(p>0)if(r&&t.categories.size>0){let o=0;for(const s of r){const r=t.categories.get(s)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r);i.push(Ve(f,Math.min(l,c),p,Math.abs(l-c),{fill:(null===(n=e.config.barColors)||void 0===n?void 0:n[s])||"#4e79a7"},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:r},s)),o+=r}}else{const e=a.y(0),n=a.y(t.total);i.push(Ve(f,Math.min(e,n),p,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 a=[],s=e.config.swarmStyle||{},l=null!==(n=s.radius)&&void 0!==n?n:3,c=null!==(o=s.fill)&&void 0!==o?o:"#007bff",u=null!==(r=s.opacity)&&void 0!==r?r:.7,d=s.stroke,h=s.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),s=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 f={type:"point",x:r,y:s,r:l,style:{fill:g,opacity:u,stroke:d,strokeWidth:h},datum:n};e.getPointId&&(f.pointId=e.getPointId(n)+""),a.push(f)}return a}(i,t);case"waterfall":return function(e,t,n){var o,r,i;const a=[],s=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 a;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,f=null==l?void 0:l.strokeWidth;let p=0;for(let t=0;c.length>t;t++){const o=c[t],r=e.getX(o),i=e.getY(o),y=p+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=s.x(r),b=0!==m?s.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){p=y;continue}const w=s.y(p),A=s.y(y);a.push(Ve(x,Math.min(w,A),k,Math.abs(w-A),{fill:0>i?d:u,stroke:g,strokeWidth:f},Object.assign(Object.assign({},o),{baseline:p,cumEnd:y,delta:i,_connectorStroke:null==l?void 0:l.connectorStroke,_connectorWidth:null==l?void 0:l.connectorWidth}))),p=y}return a}(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=[],a=e.config.candlestickStyle||{},s=a.rangeColor||"#6366f1",l=r?s:a.upColor||"#28a745",c=r?s:a.downColor||"#dc3545",u=r?s:a.wickColor||"#333",d=a.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=a.bodyWidth)&&void 0!==o?o:0;if(!r&&null==a.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!=a.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),a=e.getLow(n);if(null==o||Number.isNaN(o)||null==a||Number.isNaN(a))continue;const s=r?o:e.getOpen(n),h=r?a:e.getClose(n);if(!r&&[s,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=s,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(s),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(a),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};r&&(p.isRange=!0),i.push(p)}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?He(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 a=new Map;for(let e=0;n.length>e;e++)a.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 s=a.get(t[n]);null!=s?(o[n]=He(e,s,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 s=!1;for(let n=0;t.length>n;n++){const o=a.get(t[n]);null!=o?(r[n]=He(e,o,i),1>r[n]&&(s=!0)):r[n]=1}s&&(n._decayOpacities=r)}else{let r=1;for(const n of t){const t=a.get(n);if(null!=t){const n=He(e,t,i);r>n&&(r=n)}}if(1>r){const e=Array(o);e.fill(r),n._decayOpacities=e}}continue}const t=a.get(n.datum);if(null==t)continue;const s=He(e,t,i);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;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*s})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var r,i;const a="undefined"!=typeof performance?performance.now():Date.now(),s=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 s=We(e,i,a);s>r&&(r=s)}r>0&&(n._pulseIntensity=r,n._pulseColor=s);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);if(null==r)continue;const i=We(e,r,a);i>0&&(n._pulseIntensity=i,n._pulseColor=s,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,a;n.clear(),o.clear();for(let s=0;t.length>s;s++){const l=t[s],c=Ge(e,l,s);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===(a=l.style)||void 0===a?void 0:a.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,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,P,M,L,_;if(0===o.size&&0===r.size)return n;const T=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 B=!1;const N=new Set,D=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],A=Ge(e,i,t);if(!A)continue;if(i._transitionKey=A,"line"===i.type||"area"===i.type){const e=r.get(A);if(e){if(D.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]];B=!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]];B=!0}i._targetOpacity=null!==(a=i.style.opacity)&&void 0!==a?a:1,i._startOpacity=null!==(l=null!==(s=e.opacity)&&void 0!==s?s: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}),B=!0;continue}const S=o.get(A);if("point"===i.type)if(S){N.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,S.x===e.x&&S.y===e.y&&S.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=S.x,i.y=S.y,i.r=null!==(d=S.r)&&void 0!==d?d:i.r,B=!0)}else i._targetOpacity=null!==(h=i.style.opacity)&&void 0!==h?h:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("rect"===i.type)if(S){N.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,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(f=S.w)&&void 0!==f?f:i.w,i.h=null!==(p=S.h)&&void 0!==p?p:i.h,B=!0)}else i._targetOpacity=null!==(y=i.style.opacity)&&void 0!==y?y:1,i.style=Object.assign(Object.assign({},i.style),{opacity:0}),B=!0;else if("heatcell"===i.type)if(S){N.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,S.x===e.x&&S.y===e.y&&S.w===e.w&&S.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=S.x,i.y=S.y,i.w=null!==(b=S.w)&&void 0!==b?b:i.w,i.h=null!==(x=S.h)&&void 0!==x?x:i.h,B=!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}),B=!0}for(const[e,t]of r)if(!D.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),B=!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!==(S=t.opacity)&&void 0!==S?S:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),B=!0}for(const[e,t]of o)if(!N.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(O=t.r)&&void 0!==O?O:3,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E: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!==(j=t.w)&&void 0!==j?j:0,h:null!==(C=t.h)&&void 0!==C?C:0,style:{opacity:null!==(P=t.opacity)&&void 0!==P?P: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!==(M=t.w)&&void 0!==M?M:0,h:null!==(L=t.h)&&void 0!==L?L:0,fill:"#999",datum:null,style:{opacity:null!==(_=t.opacity)&&void 0!==_?_:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}B=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),B&&(n.activeTransition={startTime:Re(),duration:T}),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,a,s,l;if(!n.activeTransition)return!1;const c=Fe(e,n.activeTransition),u=$e(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=ze(i,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ze(n.x,e._targetX,u),e.y=ze(n.y,e._targetY,u),void 0!==e._targetR&&void 0!==n.r&&(e.r=ze(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=ze(r,e._targetOpacity,u)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ze(n.x,e._targetX,u),e.y=ze(n.y,e._targetY,u),void 0!==n.w&&(e.w=ze(n.w,e._targetW,u)),void 0!==n.h&&(e.h=ze(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!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:ze(r,e._targetOpacity,u)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ze(n.x,e._targetX,u),e.y=ze(n.y,e._targetY,u),void 0!==n.w&&(e.w=ze(n.w,e._targetW,u)),void 0!==n.h&&(e.h=ze(n.h,e._targetH,u))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(s=e._startOpacity)&&void 0!==s?s:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ze(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]=ze(t[o][0],n[o][0],u),e.path[o][1]=ze(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:ze(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]=ze(t[n][0],o[n][0],u),e.topPath[n][1]=ze(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]=ze(n[t][0],r[t][0],u),e.bottomPath[t][1]=ze(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:_e,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:_e,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 a=!1;Object.assign(this.config,e);const s="chartType"in e&&e.chartType!==i.chartType||"runtimeMode"in e&&e.runtimeMode!==i.runtimeMode;if(s||void 0!==e.xAccessor||void 0!==e.yAccessor||void 0!==e.timeAccessor||void 0!==e.valueAccessor){const l=s||!Ee(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=i.xAccessor)&&void 0!==n?n:i.timeAccessor),c=s||!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=je(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=je(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=je(this.config.xAccessor,"x"),this.getY=je(this.config.yAccessor,"y")),a=!0)}if("groupAccessor"in e&&!Ee(e.groupAccessor,i.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Pe(this.config.groupAccessor):void 0,a=!0),"categoryAccessor"in e&&!Ee(e.categoryAccessor,i.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Pe(this.config.categoryAccessor):void 0,a=!0),"sizeAccessor"in e&&!Ee(e.sizeAccessor,i.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?je(this.config.sizeAccessor,"size"):void 0,a=!0),"colorAccessor"in e&&!Ee(e.colorAccessor,i.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0,a=!0),"y0Accessor"in e&&!Ee(e.y0Accessor,i.y0Accessor)&&(this.getY0=this.config.y0Accessor?je(this.config.y0Accessor,"y0"):void 0,a=!0),"pointIdAccessor"in e&&!Ee(e.pointIdAccessor,i.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Pe(this.config.pointIdAccessor):void 0,a=!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?je(this.config.openAccessor,"open"):void 0,this.getHigh=je(this.config.highAccessor,"high"),this.getLow=je(this.config.lowAccessor,"low"),this.getClose=t?je(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,a=!0}if(!a){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==i[n]){a=!0;break}}a&&(this.needsFullRebuild=!0)}}function tt(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 nt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ot(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function rt(e,t){const n=ot(e);if(!n)return!1;const o=ot(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function it(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function at(e,t,n,o=30,r){let i=null,a=!1;if(r){const e=r.find(t,n,o);if(e){const r=lt(e,t,n,o);r&&o>r.distance&&(i=r,a=!0)}}for(const s of e){let e=null;switch(s.type){case"point":if(r&&a)break;e=lt(s,t,n,o);break;case"line":e=ct(s,t,n,o);break;case"rect":e=dt(s,t,n);break;case"heatcell":e=ht(s,t,n);break;case"area":if(!1===s.interactive)break;e=ft(s,t,n);break;case"candlestick":e=gt(s,t,n)}e&&o>e.distance&&(i&&e.distance>=i.distance||(i=e))}return i}function st(e,t,n){if(0===e.length)return null;const o=pt(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[a,s]=e[r],[l,c]=e[i];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function lt(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function ct(e,t,n,o=30){var r,i,a,s;if(0===e.path.length)return null;const l=pt(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 a=r;i>=a;a++){const[r,i]=e.path[a],[s,l]=e.path[a+1],c=ut(t,n,r,i,s,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!==(s=null!==(i=null===(r=e.style)||void 0===r?void 0:r.strokeWidth)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.lineWidth)&&void 0!==s?s: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 ut(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function dt(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function ht(e,t,n){const o=tt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function gt(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,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+a*a)}}return null}function ft(e,t,n){if(0===e.topPath.length)return null;const o=pt(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],a=t-r,s=n-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function pt(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 yt(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 a=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&&a.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:a}}function mt(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}}function vt(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?bt(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?bt(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}}function bt(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 xt(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})}function kt(e,n,i){const a=t(null),[s,l]=r(null);return o(()=>{if(!n&&!i)return;const e=a.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]),[a,[n&&s?s.w:e[0],i&&s?s.h:e[1]]]}function wt(e,t,n,r,i,a){o(()=>{if(!e)return;const o=setInterval(()=>{var o;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(o=e.threshold)&&void 0!==o?o:5e3,u=l-s.lastIngestTime>c;u!==i&&(a(u),n.current=!0,r())},1e3);return()=>clearInterval(o)},[e,i,r])}et.QUADTREE_THRESHOLD=500;const At={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 St(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,At[n])(o(e,t)),r}function Ot(){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 Et(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function jt({config:t,orientation:n="vertical",width:o=100}){const{colorFn:r,domain:i,label:a,format:s}=t,l=s||(e=>Math.round(100*e)/100+""),c="grad-legend-"+e.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),s=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":a||"Gradient legend"},e.createElement("defs",null,e.createElement("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},u)),a&&e.createElement("text",{x:s+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),e.createElement("rect",{x:s,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.createElement("text",{x:s,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)"},l(i[0])),e.createElement("text",{x:s+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":a||"Gradient legend"},a&&e.createElement("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)"},a),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 Ct(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,legendInteraction:s,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical"}=t,[h,g]=e.useState(0),[f,p]=e.useState(0),y=e.useCallback((e,t)=>{g(e),p(t)},[]),m="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,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,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:g}=t,f=[];let p=0;const y=!(!n&&!o),m="isolate"===u||void 0===u&&null!=i;return g.forEach((t,u)=>{const v=St(t,u,d,h),b=Et(t,r,i),x=i&&i.size>0&&i.has(t.label);f.push(e.createElement("g",{key:"legend-item-"+u,transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===a&&u===s?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(Ot,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))),p+=22}),f})(t,o,r,i,a,s,l,g,c,u))),d+=22*t.items.length+8}),h})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}):(({legendGroups:t,height:n,width:o,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d})=>{let h=0;const g=[];t.forEach((t,n)=>{let f=0;t.label&&(f+=16);const p=((t,n,o,r,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0,m=0;const v=!(!n&&!o),b="isolate"===u||void 0===u&&null!=i;f.forEach((t,u)=>{const x=St(t,u,h,g),k=Et(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),p.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===a&&u===s?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)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus: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(Ot,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 f){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:p,offset:x,totalRows:w,totalHeight:22*w}})(t,r,i,a,s,l,c,n,u,d,o);f+=p.offset+5,g.push(Object.assign(Object.assign({label:t.label},p),{offset:f,totalRows:p.totalRows,totalHeight:p.totalHeight})),h+=f+12});let f=h>o?0:Math.max(0,(o-h)/2);const p=[];return g.forEach((o,r)=>{const i=t[r];i.label&&(p.push(e.createElement("text",{key:"legend-text-"+r,transform:`translate(${f},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,fill:"var(--semiotic-text, #333)"},i.label)),f+=16),p.push(e.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${f},0)`},o.items)),f+=o.offset+5,t[r+1]&&p.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:f,y1:-8,x2:f,y2:(o.totalHeight||n)+0+8})),f+=12}),e.createElement("g",null,p)})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:h,focusedItemIndex:f,onFocusedIndexChange:y,legendInteraction:s}),v=!(!o&&!r);return e.createElement("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==a))||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 Pt(t){const{legend:n,totalWidth:o,totalHeight:r,margin:i,legendPosition:a="right",title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=t;if(!n)return null;const g="top"===a||"bottom"===a;let f,p;return"left"===a?(f=4,p=i.top):"top"===a?(f=0,p=s?32:8):"bottom"===a?(f=0,p=r-i.bottom+50):(f=o-i.right+10,p=i.top),e.createElement("g",{transform:`translate(${f}, ${p})`},function(e){return"object"==typeof e&&null!==e&&"gradient"in e}(n)?e.createElement(jt,{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(Ct,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):n)}function Mt(e){return"string"==typeof e?{type:e}:e}function Lt({orient:t,config:o,values:r,scale:i,size:a,length:s}){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=a-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)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!n)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=n,g=Math.min(.5*o,20),f=(o-g)/2+4;if(c){const n=i(a),o=i(u),r=i(s),c=i(d),p=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*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+y*f,x2:c,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(n,o),y:"top"===t?m-f-g:m+f,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-f-g:m+f,x2:r,y2:"top"===t?m-f:m+f+g,stroke:l.fill,strokeWidth:2}))}{const n=i(a),o=i(u),r=i(s),c=i(d),p=i(h),y="left"===t?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+t},e.createElement("line",{x1:m+y*(f+g/2),y1:c,x2:m+y*(f+g/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:c,x2:m+y*(f+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===t?m-f-g:m+f,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-f-g:m+f,y1:r,x2:"left"===t?m-f:m+f+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=T().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 a=n.length/d*o;if(c){const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:o,y:"top"===t?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(n.x0),s=i(n.x1)-i(n.x0);return e.createElement("rect",{key:r,x:"left"===t?-4-a:4,y:Math.min(o,o+s),width:a,height:Math.abs(s),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 a=e.length/d*(o/2),s=i((e.x0+e.x1)/2);r.push(c?`${s},${"top"===t?-(n-a):n-a}`:`${"left"===t?-(n-a):n-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(o/2),l=i((a.x0+a.x1)/2);r.push(c?`${l},${"top"===t?-(n+s):n+s}`:`${"left"===t?-(n+s):n+s},${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,a=i((e.x0+e.x1)/2);n.push(`L${a},${"top"===t?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${a},${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,a=i((e.x0+e.x1)/2);n.push(`L${"left"===t?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;n.push(`L${e},${a}`),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,a,s,t,c,4]);return u?e.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function _t(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Tt(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 Bt(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:f,events:p={},"data-testid":y}=t,m=new Set(Array.isArray(f)?f:[]);let v=r||0,b=i||0;null!=a&&(v=a-n),null!=s&&(b=s-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},p),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+a*h,c=i+s*h}}}else if("bracket"===i&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const e=(a.radius||0)+(a.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&&(s.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,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"var(--semiotic-text-secondary, currentColor)",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.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)&&s.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)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,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)-a;s.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)?s.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)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Tt((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"},s)}(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:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const f=16,p=a?u?[a]:_t(a,c):[],y=i?u?[i]:_t(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))";p.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold"},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:f},t)))),v=p.length*f),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:f},t))));let k=null;if((a||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=(p.length+y.length)*f+(y.length>0?f: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,p.length+y.length-1)*f;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+f+(y.length>0&&p.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 Nt(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=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:s});return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(Bt,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}function Dt(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 It(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 Ht(e,t,n){var o,r,i,a;const s=e.anchor||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId){const e={x:i.x,y:i.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const i=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return i&&(null===(r=n.stickyPositionCache)||void 0===r||r.set(t,i)),i}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Dt(e,n),c=It(e,n)),null!=l&&null!=c)return null===(i=n.stickyPositionCache)||void 0===i||i.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===s){const e=null===(a=n.stickyPositionCache)||void 0===a?void 0:a.get(t);if(e)return e}return null}function Wt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const $t={linear:re,monotoneX:oe,monotoneY:ne,step:te,stepAfter:ee,stepBefore:J,basis:Z,cardinal:Q,catmullRom:K};function Ft(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,E,j,C,P,M,L,_,T,B,N,D,I,H,W,$,z,R,G,Y,q,X,V,K,Q,Z,J;switch(t.type){case"label":{const r=Ht(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Wt(i,a,o)?e.createElement(Nt,{key:"ann-"+n,noteData:{x:i,y:a,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=Ht(t,n,o);if(!r)return null;const{x:i,y:a}=r;return Wt(i,a,o)?e.createElement(Nt,{key:"ann-"+n,noteData:{x:i,y:a,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=Dt(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"top";let s;return s="bottom"===a?(o.height||0)-4:"center"===a?(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:s,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=It(t,o);if(null==r)return null;const i=t.color||"#f97316",a=t.labelPosition||"right";let s,l;return"left"===a?(s=4,l="start"):"center"===a?(s=(o.width||0)/2,l="middle"):(s=(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:s,y:r-4,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Dt(Object.assign(Object.assign({},e),{type:"point"}),o),y:It(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=F(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-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:Dt(Object.assign(Object.assign({},e),{type:"point"}),o),y:It(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,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+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):[],a={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Dt(n,o),s=It(n,o);if(null==i||null==s)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||a;return e.createElement("circle",Object.assign({key:"hl-"+r,cx:i,cy:s,r:l},c))}))}case"bracket":{const r=Dt(t,o),i=It(t,o);return e.createElement(Nt,{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",f=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>f.length)return null;const p=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,y=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!p||!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]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=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],f+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*f-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(f,null!==(u=t.bandwidth)&&void 0!==u?u:.3):("polynomial"===m?ce.polynomial(f,{order:t.order||2}):ce.linear(f)).points;const b=v.map(([e,t])=>`${p(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:p(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!==(f=null==r?void 0:r(t.y0))&&void 0!==f?f:0,a=null!==(p=null==r?void 0:r(t.y1))&&void 0!==p?p:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-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,a)-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",a=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,s=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(!a||!s)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=$t[o.curve||"linear"]||re,g=U().x(e=>a(e[i])).y0(e=>s(e[c])).y1(e=>s(e[l])).curve(h)(d);if(!g)return null;const f=t.fill||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:g,fill:f,fillOpacity:null!==(w=t.fillOpacity)&&void 0!==w?w:.15,stroke:"none"}),t.label&&d.length>0&&e.createElement("text",{x:a(d[d.length-1][i])+4,y:s(d[d.length-1][l])-4,fill:f,fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(S=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==S?S:null===(O=o.scales)||void 0===O?void 0:O.time,s=null!==(j=null===(E=o.scales)||void 0===E?void 0:E.y)&&void 0!==j?j:null===(C=o.scales)||void 0===C?void 0:C.value;if(!a||!s)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!==(P=t.threshold)&&void 0!==P?P:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(M=t.fillOpacity)&&void 0!==M?M:.1,m=t.anomalyColor||"#ef4444",v=null!==(L=t.anomalyRadius)&&void 0!==L?L:6,b=s(c+h*d),x=s(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},f&&e.createElement("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const r=Dt(t,o),i=It(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:p,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(T=null===(_=o.scales)||void 0===_?void 0:_.x)&&void 0!==T?T:null===(B=o.scales)||void 0===B?void 0:B.time,l=null!==(D=null===(N=o.scales)||void 0===N?void 0:N.y)&&void 0!==D?D:null===(I=o.scales)||void 0===I?void 0:I.value;if(!s||!l)return null;const c=r.map(e=>[e[i],e[a]]).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=ce.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 a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*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)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),y=null!==(H=t.confidence)&&void 0!==H?H:.95,m=.99>y?.95>y?.9>y?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+(p>0?Math.pow(e-f,2)/p:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),O=`${s(b)},${l(u(b))}`,E=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==($=t.fillOpacity)&&void 0!==$?$:.15,stroke:"none"}),e.createElement("polyline",{points:`${O} ${S}`,fill:"none",stroke:E,strokeWidth:null!==(z=t.strokeWidth)&&void 0!==z?z:2,strokeDasharray:null!==(R=t.strokeDasharray)&&void 0!==R?R:"6,3"}),t.label&&w.length>0&&e.createElement("text",{x:s(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:E,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=Ht(t,n,o);if(!e)return null;r=e.x,i=e.y}if(null==r||null==i)return null;if(!Wt(r,i,o))return null;const a=null!==(G=t.dx)&&void 0!==G?G:0,s=null!==(Y=t.dy)&&void 0!==Y?Y:0,l=null!==(q=t.width)&&void 0!==q?q:32,c=null!==(X=t.height)&&void 0!==X?X:32,u=null!==(V=t.content)&&void 0!==V?V:e.createElement("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info"},"ℹ️");return e.createElement("foreignObject",{key:"ann-"+n,x:r+a-l/2,y:i+s-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=Ht(t,n,o);if(!r)return null;const{x:i,y:a}=r;return e.createElement("text",{key:"ann-text-"+n,x:i+(t.dx||0),y:a+(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===(K=o.scales)||void 0===K?void 0:K.o,a=null===(Q=o.scales)||void 0===Q?void 0:Q.x,s=null===(Z=o.scales)||void 0===Z?void 0:Z.y,l=(null==i?void 0:i.bandwidth)?i:(null==a?void 0:a.bandwidth)?a:(null==s?void 0:s.bandwidth)?s: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!==(J=t.opacity)&&void 0!==J?J:.15,g=t.label;return(o.projection?"vertical"===o.projection:l===a)?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}}}let zt={positions:new Map};const Rt=new Set;function Gt(){for(const e of Rt)e()}function Yt(e,t){const n=zt.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(zt.positions);o.delete(e),zt={positions:o},Gt()}function qt(e,t){const n=zt.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(zt.positions);o.delete(e),zt={positions:o},Gt()}function Xt(){return zt}function Vt(e){return Rt.add(e),()=>Rt.delete(e)}const Ut={positions:new Map};function Kt(){return()=>{}}function Qt(){return Ut}function Zt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Jt(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 a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function en(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g}=t,f=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||tn,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)))),a=i.map(e=>e.valueOf()),s=i.map((e,t)=>({value:e,pixel:l.x(e),label:n(e,t,a)})),c=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);return nn(s,Math.max(55,c+8))},[l,u,h,o]),p=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||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;return nn(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,S="var(--semiotic-border, #ccc)";return e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&(()=>{var t,n;const i=Zt(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),a=Zt(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"},f.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})),p.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:a})))})(),x&&!w&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:S,strokeWidth:1}),w&&e.createElement("path",{d:Jt("bottom",o,r),fill:"none",stroke:S,strokeWidth:1}),k&&!A&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:S,strokeWidth:1}),A&&e.createElement("path",{d:Jt("left",o,r),fill:"none",stroke:S,strokeWidth:1})))}function tn(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function nn(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 on(r){var a,s;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,axes:p,xLabel:y,yLabel:m,yLabelRight:v,xFormat:b,yFormat:x,showGrid:k,title:w,legend:A,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j,legendPosition:C="right",foregroundGraphics:P,marginalGraphics:M,xValues:L,yValues:_,annotations:T,svgAnnotationRules:B,xAccessor:N,yAccessor:D,annotationData:I,pointNodes:H,curve:W,underlayRendered:$,linkedCrosshairName:F,linkedCrosshairSourceId:z,children:R}=r,G=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"bottom"===e.orient),n=(null==t?void 0:t.tickFormat)||b||tn,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()),a=r.map((e,t)=>({value:e,pixel:g.x(e),label:n(e,t,i)})),s=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),c=(null==t?void 0:t.autoRotate)?Math.max(20,Math.min(s+8,55)):Math.max(55,s+8);let u=nn(a,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},[f,g,p,b,l]),Y=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"left"===e.orient),n=(null==t?void 0:t.tickFormat)||x||tn,o=null!==(e=null==t?void 0:t.ticks)&&void 0!==e?e:5;let r=nn(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},[f,g,p,x,c]),q=n(()=>{var e;if(!f||!g)return[];const t=null==p?void 0:p.find(e=>"right"===e.orient);if(!t)return[];const n=t.tickFormat||x||tn,o=null!==(e=t.ticks)&&void 0!==e?e:5;return nn(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)},[f,g,p,x,c]),X=t(new Map),V=t(null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0),U=null!==(s=null==T?void 0:T.length)&&void 0!==s?s:0;V.current!==U&&(V.current=U,X.current=new Map);const K=n(()=>{if(!T||0===T.length)return null;const e=Ft(),t={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:N,yAccessor:D,width:l,height:c,data:I,frameType:"xy",pointNodes:H,curve:W,stickyPositionCache:X.current};return T.map((n,o)=>{if(B){const r=B(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[T,B,l,c,N,D,I,g,H,W]),Q=function(e){var t;const n=i(e?Vt:Kt,e?Xt:Qt,e?Xt:Qt);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(F);return o(()=>{if(!(null==Q?void 0:Q.locked)||!F)return;const e=e=>{"Escape"===e.key&&qt(F)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Q?void 0:Q.locked,F]),f||w||A||P||M||K&&K.length>0||k||R||Q?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&&!$&&(()=>{var t,n;const o=Zt(null===(t=null==p?void 0:p.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=Zt(null===(n=null==p?void 0:p.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.createElement("g",{className:"stream-grid"},G.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})),Y.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})))})(),f&&g&&(()=>{const t=null==p?void 0:p.find(e=>"left"===e.orient),n=null==p?void 0:p.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,r=!n||!1!==n.baseline,i=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,s=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))",f="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=l/Math.max(G.length-1,1),t=G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})();return e.createElement("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"}},!$&&r&&!a&&e.createElement("line",{x1:0,y1:c,x2:l,y2:c,stroke:d,strokeWidth:1}),!$&&a&&e.createElement("path",{d:Jt("bottom",l,c),fill:"none",stroke:d,strokeWidth:1}),G.map((t,n)=>{const o=!!s&&("function"==typeof s?s(t.value,n):rt(t.value,n>0?G[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:f,style:{userSelect:"none"}},y),!$&&o&&!i&&e.createElement("line",{x1:0,y1:0,x2:0,y2:c,stroke:d,strokeWidth:1}),!$&&i&&e.createElement("path",{d:Jt("left",l,c),fill:"none",stroke:d,strokeWidth:1}),Y.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):rt(t.value,n>0?Y[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:f,transform:`rotate(-90, ${15-h.left}, ${c/2})`,style:{userSelect:"none"}},n):null})(),(()=>{const t=null==p?void 0:p.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):rt(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:f,transform:`rotate(90, ${l+h.right-15}, ${c/2})`,style:{userSelect:"none"}},o))})())})(),K,M&&g&&L&&_&&e.createElement(e.Fragment,null,M.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Lt,{orient:"top",config:Mt(M.top),values:L,scale:g.x,size:h.top,length:l})),M.bottom&&e.createElement("g",{transform:`translate(0, ${c})`},e.createElement(Lt,{orient:"bottom",config:Mt(M.bottom),values:L,scale:g.x,size:h.bottom,length:l})),M.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Lt,{orient:"left",config:Mt(M.left),values:_,scale:g.y,size:h.left,length:c})),M.right&&e.createElement("g",{transform:`translate(${l}, 0)`},e.createElement(Lt,{orient:"right",config:Mt(M.right),values:_,scale:g.y,size:h.right,length:c}))),P,Q&&Q.sourceId!==z&&(null==g?void 0:g.x)&&(()=>{const t=g.x(Q.xValue);if(null==t||0>t||t>l)return null;const n=Q.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"})})(),R),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),Pt({legend:A,totalWidth:u,totalHeight:d,margin:h,legendPosition:C,title:w,legendHoverBehavior:S,legendClickBehavior:O,legendHighlightedCategory:E,legendIsolatedCategories:j})):null}function rn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const an="undefined"==typeof window||"undefined"==typeof document,sn=e.createContext(null);function ln({children:t}){const[n,o]=e.useState(!1),r=e.useMemo(()=>({visible:n,setVisible:o}),[n]);return e.createElement(sn.Provider,{value:r},t)}function cn(){return e.useContext(sn)}const un={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function dn(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"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}function hn(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const gn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},fn={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"},pn={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},yn={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)"},mn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},vn={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)"},bn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},xn={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function kn({scene:t,chartType:n,tableId:o,chartTitle:r}){var i;const[a,s]=e.useState(!1),l=cn(),c=null!==(i=null==l?void 0:l.visible)&&void 0!==i&&i,u=a||c,d=e.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${n} ${o}`:"Data summary for "+n,g=e.useCallback(()=>{a||c||s(!0)},[a,c]),f=e.useCallback(e=>{var t;c||(null===(t=d.current)||void 0===t?void 0:t.contains(e.relatedTarget))||s(!1)},[c]);if(!t||0===t.length)return o?e.createElement("span",{id:o,tabIndex:-1,style:un}):null;if(!u)return e.createElement("div",{id:o,tabIndex:-1,onFocus:g,style:un,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>s(!0)},"View data summary (",t.length," elements)"));const p=function(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O;const E=[];if(!Array.isArray(e))return E;for(const j of e)if(j&&"object"==typeof j)try{switch(j.type){case"point":E.push({label:"Point",values:{x:j.x,y:j.y}});break;case"line":{const e=j.path,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Line point",values:{x:t[0],y:t[1]}})}break}case"area":{const e=j.topPath,t=Array.isArray(j.datum)?j.datum:[];if(!Array.isArray(e))break;for(let n=0;e.length>n&&t.length>n;n++){const t=e[n];Array.isArray(t)&&E.push({label:"Area point",values:{x:t[0],y:t[1]}})}break}case"rect":{const e=null!=j.datum&&"object"==typeof j.datum?j.datum:{},i=null!==(n=null!==(t=e.category)&&void 0!==t?t:j.group)&&void 0!==n?n:"",a=null!==(r=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==r?r:e.total;E.push({label:"Bar",values:{category:i,value:null!=a?a:""}});break}case"heatcell":E.push({label:"Cell",values:{x:j.x,y:j.y,value:j.value}});break;case"wedge":E.push({label:"Wedge",values:{category:null!==(l=null!==(a=null===(i=j.datum)||void 0===i?void 0:i.category)&&void 0!==a?a:null===(s=j.datum)||void 0===s?void 0:s.label)&&void 0!==l?l:"",value:null!==(u=null===(c=j.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":E.push({label:"Node",values:{id:null!==(h=null===(d=j.datum)||void 0===d?void 0:d.id)&&void 0!==h?h:"",x:null!==(g=j.cx)&&void 0!==g?g:j.x,y:null!==(f=j.cy)&&void 0!==f?f:j.y}});break;case"arc":E.push({label:"Arc",values:{id:null!==(y=null===(p=j.datum)||void 0===p?void 0:p.id)&&void 0!==y?y:"",x:null!==(m=j.cx)&&void 0!==m?m:j.x,y:null!==(v=j.cy)&&void 0!==v?v:j.y}});break;case"candlestick":E.push({label:"Candlestick",values:{x:j.x,open:j.open,high:j.high,low:j.low,close:j.close}});break;case"geoarea":E.push({label:"Region",values:{name:null!==(A=null!==(k=null===(x=null===(b=j.datum)||void 0===b?void 0:b.properties)||void 0===x?void 0:x.name)&&void 0!==k?k:null===(w=j.datum)||void 0===w?void 0:w.name)&&void 0!==A?A:"",value:null!==(O=null===(S=j.datum)||void 0===S?void 0:S.value)&&void 0!==O?O:""}})}}catch(e){}return E}(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}(p),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${gn(e.min)} to ${gn(e.max)}, mean ${gn(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(p.length,y),v=p.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:f,style:fn,role:"region","aria-label":h},e.createElement("button",{type:"button",onClick:()=>{c&&l&&l.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},m),e.createElement("table",{role:"table","aria-label":"Sample data for "+n,style:mn},e.createElement("caption",{style:xn},"First ",v.length," of ",p.length," data points"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"type"),x.map(t=>e.createElement("th",{key:t,style:vn},t)))),e.createElement("tbody",null,v.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.label),x.map(n=>{return e.createElement("td",{key:n,style:bn},null==(o=t.values[n])||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":gn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"");var o}))))))}function wn({nodes:t,edges:n,chartType:o,tableId:r,chartTitle:i}){var a,s,l,c,u,d,h,g,f,p,y,m,v,b;const[x,k]=e.useState(!1),w=cn(),A=null!==(a=null==w?void 0:w.visible)&&void 0!==a&&a,S=x||A,O=i?"Data summary for "+i:r?`Data summary for ${o} ${r}`:"Data summary for "+o,E=e.useRef(null),j=e.useCallback(()=>{x||A||k(!0)},[x,A]),C=e.useCallback(e=>{var t;A||(null===(t=E.current)||void 0===t?void 0:t.contains(e.relatedTarget))||k(!1)},[A]);if(!t||0===t.length)return r?e.createElement("span",{id:r,tabIndex:-1,style:un}):null;if(!S)return e.createElement("div",{id:r,tabIndex:-1,onFocus:j,style:un,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>k(!0)},"View data summary (",t.length," nodes, ",n.length," edges)"));const P=Array.isArray(t)?t:[],M=Array.isArray(n)?n:[],L=new Map,_=new Map,T=new Map,B=new Map;for(const e of M){if(!e||"object"!=typeof e)continue;const t=null!==(s=e.datum)&&void 0!==s?s:e,n="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,o="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";_.set(e,(null!==(u=_.get(e))&&void 0!==u?u:0)+1),B.set(e,(null!==(d=B.get(e))&&void 0!==d?d:0)+r)}if(null!=o&&""!==o){const e=o+"";L.set(e,(null!==(h=L.get(e))&&void 0!==h?h:0)+1),T.set(e,(null!==(g=T.get(e))&&void 0!==g?g:0)+r)}}const N=[];for(let e=0;P.length>e;e++){const t=P[e];if(!t||"object"!=typeof t)continue;const n=null!==(p=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==p?p:t.id,o=null!=n?n+"":"node-"+e,r=null!==(y=L.get(o))&&void 0!==y?y:0,i=null!==(m=_.get(o))&&void 0!==m?m:0,a=null!==(v=T.get(o))&&void 0!==v?v:0,s=null!==(b=B.get(o))&&void 0!==b?b:0;N.push({id:o,degree:r+i,inDeg:r,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}N.sort((e,t)=>t.degree-e.degree);let D=0,I=0;if(N.length>0){let e=0;for(const t of N)e+=t.degree,t.degree>I&&(I=t.degree);D=e/N.length}const H=M.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),W=[`${N.length} nodes, ${M.length} edges.`];N.length>0&&W.push(`Mean degree: ${gn(D)}, max degree: ${I}.`);const $=N.slice(0,5);return e.createElement("div",{ref:E,id:r,tabIndex:-1,onBlur:C,style:fn,role:"region","aria-label":O},e.createElement("button",{type:"button",onClick:()=>{A&&w&&w.setVisible(!1),k(!1)},"aria-label":"Close data summary",style:yn},"×"),e.createElement("div",{role:"note",style:pn},W.join(" ")),e.createElement("table",{role:"table","aria-label":"Node degree summary for "+o,style:mn},e.createElement("caption",{style:xn},"Top ",$.length," of ",N.length," nodes by degree"),e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:vn},"id"),e.createElement("th",{style:vn},"degree"),e.createElement("th",{style:vn},"in"),e.createElement("th",{style:vn},"out"),H&&e.createElement("th",{style:vn},"w. degree"),H&&e.createElement("th",{style:vn},"w. in"),H&&e.createElement("th",{style:vn},"w. out"))),e.createElement("tbody",null,$.map((t,n)=>e.createElement("tr",{key:n},e.createElement("td",{style:bn},t.id),e.createElement("td",{style:bn},t.degree),e.createElement("td",{style:bn},t.inDeg),e.createElement("td",{style:bn},t.outDeg),H&&e.createElement("td",{style:bn},gn(t.wDegree)),H&&e.createElement("td",{style:bn},gn(t.wInDeg)),H&&e.createElement("td",{style:bn},gn(t.wOutDeg)))))))}function An({summary:t}){return t?e.createElement("div",{role:"note",style:un},t):null}function Sn({tableId:t}){return e.createElement("a",{href:"#"+t,style:un,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,un)}},"Skip to data table")}function On({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:un},n)}const En="var(--semiotic-focus, #005fcc)";function jn({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,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:En,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.createElement("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:En,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:En,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 Cn({x:t,y:n,containerWidth:o,containerHeight:r,margin:i,children:a,className:s="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})},[a,s,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:s,style:{position:"absolute",left:i.left+t,top:i.top+n,transform:h,pointerEvents:"none",zIndex:l,width:"max-content"}},a)}function Pn(e,t){return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))}function Mn(){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),Pn(e,e=>t(e.matches))},[]),e}function Ln(o){const r=a(null),c=_n(o);return[function({children:t}){const i=n(()=>_n(o),[]);return e.createElement(r.Provider,{value:i,children:t})},e=>{var n;const o=null!==(n=s(r))&&void 0!==n?n:c,a=t(e);a.current=e;const u=l(()=>a.current(o.getState()),[o]),d=l(()=>a.current(o.getState()),[o]);return i(o.subscribe,u,d)}]}function _n(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 Tn={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}},Bn={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}},Nn={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"},[Dn,In]=Ln(e=>({theme:Tn,setTheme(t){e(e=>{if("light"===t)return{theme:Tn};if("dark"===t)return{theme:Bn};if("high-contrast"===t)return{theme:Nn};if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Bn:Tn;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 Hn(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}function Wn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}const $n=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Fn=new WeakMap;function zn(e,t){var n,o;if(!t)return t;const r=$n.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 a=Fn.get(i);if(a||(a=new Map,Fn.set(i,a)),a.has(t))return a.get(t);const s=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return a.set(t,s),s}function Rn(e){Fn.delete(e)}function Gn(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Q;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Z;case"natural":return se;default:return null}}function Yn(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 qn(e,t,n,o,r,i){if(2>t.length)return;const a=[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];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-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 Xn=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s.style.stroke||"#007bff",c=s.style.strokeWidth||2,u=s.colorThresholds,d=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=c,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const p=null!==(r=s.style.opacity)&&void 0!==r?r:1;qn(e,s.path,l,c,p,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const h=Gn(s.curve),g=u&&u.length>0&&d&&d.length===s.path.length,f=s._decayOpacities;if(f&&f.length===s.path.length&&!g){e.strokeStyle=l;const y=null!==(i=s.style.opacity)&&void 0!==i?i:1;for(let m=0;s.path.length-1>m;m++)e.globalAlpha=.5*(f[m]+f[m+1])*y,e.beginPath(),e.moveTo(s.path[m][0],s.path[m][1]),e.lineTo(s.path[m+1][0],s.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 S(){w&&(e.stroke(),w=!1)}for(let O=0;s.path.length>O;O++){const[E,j]=s.path[O],C=d[O],P=Yn(C,u,l);if(null!==v&&null!==k&&null!==x){if(P===k)e.lineTo(E,j);else{const M=[];for(const L of u){const _=L.value;(x>_||_>C)&&(_>x||C>_)||x===_||C===_||M.push({t:(_-x)/(C-x)})}M.sort((e,t)=>e.t-t.t);for(const T of M){const B=v+(E-v)*T.t,N=b+(j-b)*T.t,D=Yn(x+(C-x)*Math.min(T.t+1e-4,1),u,l);e.lineTo(B,N),S(),A(D,B,N)}e.lineTo(E,j)}v=E,b=j,x=C,k=P}else A(P,E,j),v=E,b=j,x=C,k=P}S()}else{if(e.beginPath(),!s.strokeGradient||2>s.strokeGradient.colorStops.length||2>s.path.length)e.strokeStyle=l;else{const I=e.createLinearGradient(s.path[0][0],0,s.path[s.path.length-1][0],0);for(const H of s.strokeGradient.colorStops)I.addColorStop(Math.max(0,Math.min(1,H.offset)),H.color);e.strokeStyle=I}if(h)ae().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[W,$]=s.path[0];e.moveTo(W,$);for(let F=1;s.path.length>F;F++)e.lineTo(s.path[F][0],s.path[F][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=("string"==typeof s.style.fill?zn(e,s.style.fill):s.style.fill)||s.style.fill,h&&!g)ae().x(e=>e[0]).y(e=>e[1]).curve(h).context(e)(s.path);else{const[R,G]=s.path[0];e.moveTo(R,G);for(let Y=1;s.path.length>Y;Y++)e.lineTo(s.path[Y][0],s.path[Y][1])}const z=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(z,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Vn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Un(e,t,n=.3){Vn(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 Kn(e,t,n=.6){var o,r,i,a,s;if(!Vn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,d=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Qn(e,t,n,o=.35){Vn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Zn(e){switch(e){case"monotoneX":return oe;case"monotoneY":return ne;case"cardinal":return Q;case"catmullRom":return K;case"step":return te;case"stepBefore":return J;case"stepAfter":return ee;case"basis":return Z;case"natural":return se;default:return null}}function Jn(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 eo(e,t){const n=Zn(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=U().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 to=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"area"===e.type);for(const t of s){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=zn(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 s=null!==(i=t.style.opacity)&&void 0!==i?i:1;if(eo(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=Jn("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=s}else{const o=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=o*s,e.fillStyle=n}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(eo(e,t),Qn(e,t)),t.style.stroke&&"none"!==t.style.stroke){if(e.globalAlpha=s,!t.strokeGradient||2>t.strokeGradient.colorStops.length||2>t.topPath.length)e.strokeStyle=zn(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=Zn(t.curve);if(e.beginPath(),n)ae().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}},no=(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?zn(e,t.style.fill):t.style.fill)||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=("string"==typeof t.style.stroke?zn(e,t.style.stroke):t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),Kn(e,t),e.globalAlpha=1}}finally{e.restore()}}},oo=(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)ro(e,t);else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=("string"==typeof t.style.fill?zn(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:a}=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+a-n),e.arcTo(o+i,r+a,o+i-n,r+a,n),e.lineTo(o,r+a);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+a-n),e.arcTo(o,r+a,o+n,r+a,n),e.lineTo(o+i,r+a);break;case"bottom":e.moveTo(o,r),e.lineTo(o+i,r),e.lineTo(o+i,r+a-n),e.arcTo(o+i,r+a,o+i-n,r+a,n),e.lineTo(o+n,r+a),e.arcTo(o,r+a,o,r+a-n,n);break;default:e.moveTo(o,r+a),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+a)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else e.fillStyle=("string"==typeof t.style.fill?zn(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=zn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h));Un(e,t),e.globalAlpha=1}};function ro(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}function io(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 ao(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 so(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const lo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function co(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`${lo[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${lo[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const uo={line:[to,Xn,no],area:[to,no],stackedarea:[to,no],scatter:[no],bubble:[no],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),Un(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):so(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=ao(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}}],bar:[oo],swarm:[no],waterfall:[(e,t,n,o)=>{var r,i,a;oo(e,t);const s=t.filter(e=>"rect"===e.type);if(2>s.length)return;const l=s[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;s.length-1>t;t++){const o=s[t],r=s[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(a=r.datum)||void 0===a?void 0:a.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:[to,Xn,no]},ho={top:20,right:20,bottom:30,left:40},go={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"},fo={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 po({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:fo},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}const yo=c(function(i,a){var s,c,d,h,g,f,p,y,m,v,b;const{chartType:x,runtimeMode:k,data:w,chunkThreshold:A,chunkSize:S,xAccessor:O,yAccessor:E,colorAccessor:j,sizeAccessor:C,groupAccessor:P,lineDataAccessor:M,curve:L,normalize:_,binSize:T,valueAccessor:B,arrowOfTime:N="right",windowMode:D="sliding",windowSize:I=200,timeAccessor:H,xExtent:W,yExtent:$,extentPadding:F=.1,scalePadding:z,sizeRange:R,size:G=[500,300],responsiveWidth:Y,responsiveHeight:q,margin:X,className:V,background:U,lineStyle:K,pointStyle:Q,areaStyle:Z,waterfallStyle:J,swarmStyle:ee,barColors:te,colorScheme:ne,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:ae,lineGradient:se,areaGroups:le,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,showAxes:fe=!0,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:be,yFormat:xe,tickFormatTime:Ae,tickFormatValue:Se,hoverAnnotation:Oe,tooltipContent:Ee,customHoverBehavior:je,customClickBehavior:Ce,enableHover:Pe,hoverRadius:Me=30,tooltipMode:Le,annotations:_e,svgAnnotationRules:Te,showGrid:Be,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:We,legendPosition:$e,backgroundGraphics:Fe,foregroundGraphics:ze,canvasPreRenderers:Re,svgPreRenderers:Ge,title:Ye,categoryAccessor:qe,brush:Xe,onBrush:Ve,decay:Ue,pulse:Ke,transition:Qe,staleness:Ze,heatmapAggregation:Je,heatmapXBins:tt,heatmapYBins:nt,showValues:ot,heatmapValueFormat:rt,marginalGraphics:it,pointIdAccessor:lt,xScaleType:ct,yScaleType:ut,accessibleTable:dt=!0,description:ht,summary:gt,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}=i,At=Mn(),St=t(At);St.current=At;const[Ot,Et]=kt(G,Y,q),jt=Object.assign(Object.assign({},ho),X);if(it){const e=60;it.top&&e>jt.top&&(jt.top=e),it.bottom&&e>jt.bottom&&(jt.bottom=e),it.left&&e>jt.left&&(jt.left=e),it.right&&e>jt.right&&(jt.right=e)}const Ct=Et[0]-jt.left-jt.right,Pt=Et[1]-jt.top-jt.bottom,Mt="function"==typeof ze?ze({size:Et,margin:jt}):ze,Lt="function"==typeof Fe?Fe({size:Et,margin:jt}):Fe,_t=null!=Oe?Oe:Pe,Tt=t(null),Bt=t(null),Nt=t(0),Dt=t(!1),It=In(e=>e.theme),[Ht,Wt]=r(0),[$t,Ft]=r(null),zt=t(null),Rt=t(null),[Gt,Yt]=r(null),[qt,Xt]=r(!1),[Vt,Ut]=r([]),[Kt,Qt]=r([]),Zt=t(()=>{}),Jt="streaming"===k||["bar","swarm","waterfall"].includes(x),tn=n(()=>({chartType:x,runtimeMode:Jt?"streaming":"bounded",windowSize:I,windowMode:D,arrowOfTime:Jt?N:"right",extentPadding:F,scalePadding:z,xAccessor:Jt?void 0:O,yAccessor:Jt?void 0:E,timeAccessor:Jt?H:void 0,valueAccessor:B,colorAccessor:j,sizeAccessor:C,groupAccessor:P||(M?"_lineGroup":void 0),categoryAccessor:qe,lineDataAccessor:M,xScaleType:ct,yScaleType:ut,xExtent:W,yExtent:$,sizeRange:R,binSize:T,normalize:_,boundsAccessor:oe,boundsStyle:re,y0Accessor:ie,gradientFill:!0===ae?{topOpacity:.8,bottomOpacity:.05}:!1===ae?void 0:ae,areaGroups:le?new Set(le):void 0,lineGradient:se,openAccessor:ce,highAccessor:ue,lowAccessor:de,closeAccessor:he,candlestickStyle:ge,lineStyle:K,pointStyle:Q,areaStyle:Z,swarmStyle:ee,waterfallStyle:J,colorScheme:ne,barColors:te,annotations:_e,decay:Ue,pulse:Ke,transition:Qe,staleness:Ze,heatmapAggregation:Je,heatmapXBins:tt,heatmapYBins:nt,showValues:ot,heatmapValueFormat:rt,pointIdAccessor:lt,curve:L}),[x,I,D,N,F,z,O,E,H,B,ct,ut,j,C,P,qe,M,W,$,R,T,_,oe,re,ie,ae,se,le,ce,ue,de,he,ge,K,Q,Z,ee,J,ne,te,_e,Ue,Ke,Qe,Ze,Je,tt,nt,ot,rt,Jt,lt,L]),nn=t(null);nn.current||(nn.current=new et(tn));const sn=l(()=>{Nt.current||(Nt.current=requestAnimationFrame(()=>Zt.current()))},[]);o(()=>{var e;null===(e=nn.current)||void 0===e||e.updateConfig(tn),Dt.current=!0,sn()},[tn,sn]),o(()=>{Tt.current&&Rn(Tt.current),Dt.current=!0,sn()},[It,sn]);const ln=t(null);ln.current||(ln.current=new we(e=>{const t=nn.current;t&&t.ingest(e)&&(Dt.current=!0,sn())},{chunkThreshold:A,chunkSize:S})),o(()=>{var e;null===(e=ln.current)||void 0===e||e.updateChunkOptions({chunkThreshold:A,chunkSize:S})},[A,S]);const cn=l(e=>{var t;null===(t=ln.current)||void 0===t||t.push(e)},[]),un=l(e=>{var t;null===(t=ln.current)||void 0===t||t.pushMany(e)},[]),hn=l(()=>{var e,t;null===(e=ln.current)||void 0===e||e.clear(),null===(t=nn.current)||void 0===t||t.clear(),Dt.current=!0,sn()},[sn]);u(a,()=>({push:cn,pushMany:un,remove:e=>{var t,n,o;null===(t=ln.current)||void 0===t||t.flush();const r=null!==(o=null===(n=nn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return r.length>0&&(zt.current&&r.some(e=>{var t;return e===(null===(t=zt.current)||void 0===t?void 0:t.data)})&&(zt.current=null,Yt(null)),Dt.current=!0,sn()),r},update:(e,t)=>{var n,o,r;null===(n=ln.current)||void 0===n||n.flush();const i=null!==(r=null===(o=nn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(Dt.current=!0,sn()),i},clear:hn,getData:()=>{var e,t,n;return null===(e=ln.current)||void 0===e||e.flush(),null!==(n=null===(t=nn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=nn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[cn,un,hn,sn]),o(()=>{var e,t;if(w){if(M&&w.length>0&&"object"==typeof w[0]&&null!==w[0]){const t="string"==typeof M?M:"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=ln.current)||void 0===e||e.setBoundedData(n))}}null===(t=ln.current)||void 0===t||t.setBoundedData(w)}},[w,M]);const gn=t(()=>{}),fn=t(()=>{});gn.current=e=>{if(!_t)return;const t=Tt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-jt.left,r=e.clientY-n.top-jt.top;if(0>o||o>Ct||0>r||r>Pt)return void(zt.current&&(zt.current=null,Rt.current=null,Yt(null),je&&(je(null),Dt.current=!0),sn()));const i=nn.current;if(!i||0===i.scene.length)return;const a=at(i.scene,o,r,Me,i.quadtree);if(!a)return void(zt.current&&(zt.current=null,Rt.current=null,Yt(null),je&&je(null),sn()));const s=io(a.datum||{},a.x,a.y);if("multi"===Le&&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=st(e.path,t,n);if(null===i)continue;const a=pt(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][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=st(e.topPath,t,n);if(null===i)continue;const a=pt(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.topPath[a][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,a.x,Me),t=i.scales.y.invert,n=i.scales.x.invert;if(e.length>0){const o=n?n(a.x):a.x;s.xValue=o,s.xPx=a.x,s.allSeries=e.map(e=>({group:e.group||"",value:t?t(e.y):e.y,valuePx:e.y,color:e.color||"#007bff",datum:e.datum}))}}zt.current=s,Rt.current=a.node,Yt(s),je&&(je(s),Dt.current=!0),sn()},fn.current=()=>{zt.current&&(zt.current=null,Rt.current=null,Yt(null),je&&(je(null),Dt.current=!0),sn())},l(e=>gn.current(e),[]);const pn=l(()=>fn.current(),[]),yn=t(()=>{});yn.current=e=>{if(!Ce)return;const t=Tt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-jt.left,r=e.clientY-n.top-jt.top;if(0>o||o>Ct||0>r||r>Pt)return void Ce(null);const i=nn.current;if(!i||0===i.scene.length)return void Ce(null);const a=at(i.scene,o,r,Me,i.quadtree);Ce(a?io(a.datum||{},a.x,a.y):null)};const mn=l(e=>yn.current(e),[]),vn=t(-1),bn=t(null),xn=t(null),wn=l(e=>{const t=nn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(xn.current&&xn.current.version===n)o=xn.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)switch(a.type){case"point":i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(t=a.group)&&void 0!==t?t:"_default"});break;case"line":{const e=a,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=a,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:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(r=a.group)&&void 0!==r?r:"_default"});break;case"heatcell":i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.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=yt(e),xn.current={version:n,graph:o}}const r=vn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),vn.current=0;const t=o.flat[0];bn.current={shape:t.shape,w:t.w,h:t.h};const n=xt(t);return zt.current=n,Yt(n),je&&je(n),void sn()}const i=mt(o,r),a=vt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return vn.current=-1,bn.current=null,zt.current=null,Rt.current=null,Yt(null),je&&je(null),void sn();vn.current=a;const s=o.flat[a];bn.current={shape:s.shape,w:s.w,h:s.h};const l=xt(s);zt.current=l,Yt(l),je&&je(l),sn()},[je,sn]),En=l(e=>{vn.current=-1,bn.current=null,gn.current(e)},[]);Zt.current=()=>{var e,t;Nt.current=0;const n=Tt.current,o=Bt.current;if(!n||!o)return;const r=nn.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(St.current?i+1e6:i),s=!St.current&&a,l=Dt.current||a;l&&!s&&r.computeScene({width:Ct,height:Pt});const c=Wn(),u=function(e){if(!e)return go;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(),a=t.getPropertyValue("--text-primary").trim(),s=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||a||n?{axisStroke:s||go.axisStroke,tickText:i||go.tickText,crosshair:i?i+"66":go.crosshair,hoverFill:l?l+"4D":go.hoverFill,hoverStroke:i?i+"99":go.hoverStroke,pointRing:l||go.pointRing}:go}(n),d=null!==(e=null==Ze?void 0:Ze.threshold)&&void 0!==e?e:5e3,h=Ze&&r.lastIngestTime>0&&i-r.lastIngestTime>d;if(l){const e=Hn(n,Et,jt,c);if(e){e.clearRect(-jt.left,-jt.top,Et[0],Et[1]),h&&(e.globalAlpha=null!==(t=null==Ze?void 0:Ze.dimOpacity)&&void 0!==t?t:.5);const o=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),i=U||(o&&"transparent"!==o?o:null);if(i&&(e.fillStyle=i,e.fillRect(-jt.left,-jt.top,Et[0],Et[1])),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Ct,Pt),e.clip()),Re&&r.scales)for(const t of Re)e.save(),t(e,r.scene,r.scales,{width:Ct,height:Pt}),e.restore();const a=uo[x];if(a&&r.scales)for(const t of a)t(e,r.scene,r.scales,{width:Ct,height:Pt});e.restore(),h&&(e.globalAlpha=1)}}{const e=Hn(o,Et,jt,c);if(e&&(e.clearRect(-jt.left,-jt.top,Et[0],Et[1]),_t&&zt.current&&r.scales&&function(e,t,n,o,r,i,a){var s,l;if(!1===r.crosshair)return;const c=t.allSeries,u=c&&c.length>0,d=null!==(s=t.xPx)&&void 0!==s?s:t.x;e.save();const h="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=h.stroke||a.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=a.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=a.pointRing,e.lineWidth=2,e.stroke()}}(e,zt.current,Ct,Pt,"object"==typeof _t?_t:{},Rt.current,u),Rt.current&&Array.isArray(Oe))){const t=Oe.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,Rt.current,t)}}l&&n&&n.setAttribute("aria-label",dn(r.scene,x+" chart"));const g=Dt.current;if(Dt.current=!1,g&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!$t||e($t.x.domain()[0])!==e(r.scales.x.domain()[0])||e($t.x.domain()[1])!==e(r.scales.x.domain()[1])||e($t.y.domain()[0])!==e(r.scales.y.domain()[0])||e($t.y.domain()[1])!==e(r.scales.y.domain()[1])||$t.x.range()[0]!==r.scales.x.range()[0]||$t.x.range()[1]!==r.scales.x.range()[1]||$t.y.range()[0]!==r.scales.y.range()[0]||$t.y.range()[1]!==r.scales.y.range()[1])&&Ft(r.scales),it){const e=r.getData(),t="function"==typeof O?O:e=>e[O||"x"],n="function"==typeof E?E:e=>e[E||"y"];Ut(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Qt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&_e&&_e.length>0&&Wt(e=>e+1),(null==Ze?void 0:Ze.showBadge)&&Xt(!!h),(s||r.hasActivePulses)&&(Nt.current=requestAnimationFrame(()=>Zt.current()))},o(()=>(sn(),()=>{Nt.current&&(cancelAnimationFrame(Nt.current),Nt.current=0)}),[sn]),o(()=>{Dt.current=!0,sn()},[x,Ct,Pt,fe,U,K,Re,sn]),wt(Ze,nn,Dt,sn,qt,Xt);const Pn=n(()=>{if(be||Ae)return;const e=nn.current;return(null==e?void 0:e.xIsDate)&&$t?co($t.x.domain()):void 0},[be,Ae,$t]),Ln=be||Ae||Pn,_n=_t&&Gt?Ee?Ee(Gt):e.createElement(po,{hover:Gt}):null,Tn=_n?e.createElement(Cn,{x:Gt.x,y:Gt.y,containerWidth:Ct,containerHeight:Pt,margin:jt,className:"stream-frame-tooltip"},_n):null,Bn=bn.current,Nn=e.createElement(jn,{active:vn.current>=0,hoverPoint:Gt,margin:jt,size:Et,shape:null==Bn?void 0:Bn.shape,width:null==Bn?void 0:Bn.w,height:null==Bn?void 0:Bn.h}),Dn=(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},$n=Dn(O,H,"__semiotic_resolvedX","__semiotic_resolvedTime"),Fn=Dn(E,B,"__semiotic_resolvedY","__semiotic_resolvedValue"),zn=$n.key,Gn=Fn.key,Yn=_e&&_e.length>0,qn=e=>{if(!e||!Yn||!$n.fn&&!Fn.fn)return e;let t=!1;const n=e.map(e=>{const n=$n.fn&&$n.key&&!($n.key in e),o=Fn.fn&&Fn.key&&!(Fn.key in e);if(!n&&!o)return e;t=!0;const r=Object.assign({},e);return n&&(r[$n.key]=$n.fn(e)),o&&(r[Fn.key]=Fn.fn(e)),r});return t?n:e};if(an){const t=nn.current;t&&w&&(t.ingest({inserts:w,bounded:!0}),t.computeScene({width:Ct,height:Pt}));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=Ln||(()=>{if((null==t?void 0:t.xIsDate)&&o)return co(o.x.domain())})();return e.createElement("div",{className:"stream-xy-frame"+(V?" "+V:""),role:"img","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:Et[0],height:Et[1]}},e.createElement(An,{summary:gt}),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(${jt.left},${jt.top})`},Lt),e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},U&&e.createElement("rect",{x:0,y:0,width:Ct,height:Pt,fill:U}),Ge&&o&&Ge.map((t,r)=>e.createElement(e.Fragment,{key:"svgpre-"+r},t(n,o,{width:Ct,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 a=i.topPath.map(([e,t])=>`${e},${t}`).join("L"),s=[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L");return e.createElement("path",{key:"area-"+n,d:`M${a}L${s}Z`,fill:rn(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:rn(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:rn(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,a]=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),s=.299*r+.587*i+.114*a>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:s,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),a=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:a,stroke:a,strokeWidth:1}))}default:return null}}(t,n)).filter(Boolean))),e.createElement(on,{width:Ct,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:o,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:r,yFormat:xe||Se,showGrid:Be,title:Ye,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:We,legendPosition:$e,foregroundGraphics:Mt,marginalGraphics:it,xValues:[],yValues:[],annotations:_e,svgAnnotationRules:Te,annotationFrame:0,xAccessor:zn,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 L?L:void 0,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}))}const Xn="semiotic-table-"+e.useId();return e.createElement("div",{ref:Ot,className:"stream-xy-frame"+(V?" "+V:""),role:"group","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":Et[0],height:q?"100%":Et[1],overflow:"visible"},onKeyDown:wn},dt&&e.createElement(Sn,{tableId:Xn}),dt&&e.createElement(kn,{scene:null!==(h=null===(d=nn.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:x+" chart",tableId:Xn,chartTitle:"string"==typeof Ye?Ye:void 0}),e.createElement(An,{summary:gt}),e.createElement("div",{role:"img","aria-label":ht||("string"==typeof Ye?Ye:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:_t?En:void 0,onMouseLeave:_t?pn:void 0,onClick:Ce?mn:void 0},Lt&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:Et[0],height:Et[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${jt.left},${jt.top})`},Lt)),e.createElement(en,{width:Ct,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:$t,showAxes:fe,axes:pe,showGrid:Be,xFormat:Ln,yFormat:xe||Se}),e.createElement("canvas",{ref:Tt,"aria-label":dn(null!==(f=null===(g=nn.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],x+" chart"),style:{position:"absolute",left:0,top:0}}),e.createElement("canvas",{ref:Bt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.createElement(On,{hoverPoint:Gt}),e.createElement(on,{width:Ct,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,scales:$t,showAxes:fe,axes:pe,xLabel:ye,yLabel:me,yLabelRight:ve,xFormat:Ln,yFormat:xe||Se,showGrid:Be,title:Ye,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:He,legendIsolatedCategories:We,legendPosition:$e,foregroundGraphics:Mt,marginalGraphics:it,xValues:Vt,yValues:Kt,annotations:_e,svgAnnotationRules:Te,annotationFrame:Ht,xAccessor:zn,yAccessor:Gn,annotationData:qn(null===(p=nn.current)||void 0===p?void 0:p.getData()),pointNodes:null===(y=nn.current)||void 0===y?void 0:y.scene.filter(e=>"point"===e.type),curve:"string"==typeof L?L:void 0,underlayRendered:!0,linkedCrosshairName:ft,linkedCrosshairSourceId:bt}),(Xe||Ve)&&e.createElement(ke,{width:Ct,height:Pt,totalWidth:Et[0],totalHeight:Et[1],margin:jt,dimension:null!==(m=null==Xe?void 0:Xe.dimension)&&void 0!==m?m:"xy",scales:$t,onBrush:null!=Ve?Ve:()=>{},binSize:T,snap:null==Xe?void 0:Xe.snap,binBoundaries:null!==(v=null==Xe?void 0:Xe.binBoundaries)&&void 0!==v?v:"bar"===x?null===(b=nn.current)||void 0===b?void 0:b.getBinBoundaries():void 0,snapDuring:null==Xe?void 0:Xe.snapDuring,streaming:"streaming"===k}),(null==Ze?void 0:Ze.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ze.badgePosition?{top:4,left:4}:"bottom-left"===Ze.badgePosition?{bottom:4,left:4}:"bottom-right"===Ze.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:qt?"#dc3545":"#28a745",color:"white"})},qt?"STALE":"LIVE"),Nn,Tn))});yo.displayName="StreamXYFrame";const mo=a(null);function vo({colors:t,categories:o,colorScheme:r="category10",children:i}){const a=n(()=>{if(t)return t;if(o){const e=Array.isArray(r)?r:Me[r]||Le,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[t,o,r]);return e.createElement(mo.Provider,{value:a},i)}function bo(){return s(mo)}function xo(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 ko(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(xo(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function wo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}vo.displayName="CategoryColorProvider";const[Ao,So]=Ln(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=wo(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=wo(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}})}})),[Oo,Eo]=Ln(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 jo(e){const t=d(),o=e.clientId||t,{name:r}=e,i=So(e=>e.selections.get(r)),a=So(e=>e.setClause),s=So(e=>e.clearClause),c=n(()=>!!i&&i.clauses.size>0,[i]);return{predicate:n(()=>i&&0!==i.clauses.size?ko(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)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:l(()=>{s(r,o)},[s,r,o]),clientId:o}}function Co(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=jo({name:t});return{onHover:l(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}function Po(e){const{name:t,xField:o,yField:r}=e,{predicate:i,isActive:a,selectInterval:s,clear:c}=jo({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&&s(t)},[u,o,r,s,c]);return{brushInteraction:n(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function Mo(e,t,o){const r=So(e=>e.selections.get(t));return n(()=>{if(!r||0===r.clauses.size)return e;const t=ko(r,o);return e.filter(t)},[e,r,o])}function Lo(e={}){const{limit:t=50,types:o,chartId:r}=e,i=Eo(e=>e.version),a=Eo(e=>e.observations),s=Eo(e=>e.clearObservations),l=n(()=>{let e=a;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[a,o,r,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const _o=a(!1);function To({selections:e}){const t=So(e=>e.setResolution);return o(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Bo({categoryColors:n,interaction:i,selectionName:a,field:s}){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=Co({name:a,fields:[s]}),g=jo({name:a,clientId:"__linked-legend-isolate__"}),[f,p]=r(new Set),[y,m]=r(null),v=t(g.selectPoints);v.current=g.selectPoints;const b=t(g.clear);b.current=g.clear,o(()=>{"isolate"===i&&(f.size>0?v.current({[s]:Array.from(f)}):b.current())},[i,f,s]);const x=l(e=>{"highlight"===i&&(e?(m(e.label),h.onHover({[s]:e.label})):(m(null),h.onHover(null)))},[i,s,h]),k=l(e=>{"isolate"===i&&p(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(Ct,{legendGroups:d,title:!1,orientation:"horizontal",height:20,customHoverBehavior:"highlight"===i?x:void 0,customClickBehavior:"isolate"===i?k:void 0,highlightedCategory:y,isolatedCategories:f}))}function No({children:t,selections:n,showLegend:o,legendPosition:r="top",legendInteraction:i="none",legendSelectionName:a="legend",legendField:s="category"}){const l=bo(),c=void 0!==o?o:!(!l||0>=Object.keys(l).length);return e.createElement(Ao,null,e.createElement(Oo,null,n&&e.createElement(To,{selections:n}),e.createElement(_o.Provider,{value:c},c&&"top"===r&&l&&e.createElement(Bo,{categoryColors:l,interaction:i,selectionName:a,field:s}),t,c&&"bottom"===r&&l&&e.createElement(Bo,{categoryColors:l,interaction:i,selectionName:a,field:s}))))}function Do({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):_e[i%_e.length];return{label:r+"",color: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,label:""}]}}function Io(e){return e?"string"==typeof e?{name:e}:e:null}function Ho(e,t,n){return t?o=>{var r;const i=Object.assign({},e(o));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle)}return i}:e}const Wo={light:Tn,dark:Bn,"high-contrast":Nn,pastels:{mode:"light",colors:{primary:"#c9a0dc",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",text:"#4a3728",textSecondary:"#8b7355",grid:"#e8d5c4",border:"#e8d5c4",focus:"#c9a0dc"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",text:"#2c3e50",textSecondary:"#7f8c9b",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#e45050"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:10,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:10},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function $o(e){return Wo[e]}const Fo=e.createContext(void 0);function zo({theme:t}){const n=In(e=>e.setTheme),o=In(e=>e.theme),r=e.useRef(o);r.current=o;const i=e.useRef(null);return e.useEffect(()=>{if(void 0!==t)return;if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(forced-colors: active)");return e.matches&&(i.current=r.current,n(Nn)),Pn(e,e=>{var t;e.matches?(i.current=r.current,n(Nn)):(n(null!==(t=i.current)&&void 0!==t?t:Tn),i.current=null)})},[t,n]),e.useEffect(()=>{if(void 0!==t)if("string"==typeof t){const e=$o(t);n(e||t)}else n(t)},[t,n]),null}function Ro({children:t}){var n,o,r,i,a;const s=In(e=>e.theme),l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":s.colors.background,"--semiotic-text":s.colors.text,"--semiotic-text-secondary":s.colors.textSecondary,"--semiotic-grid":s.colors.grid,"--semiotic-border":s.colors.border,"--semiotic-primary":s.colors.primary,"--semiotic-font-family":s.typography.fontFamily},s.colors.focus?{"--semiotic-focus":s.colors.focus}:{}),(null===(n=s.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":s.tooltip.background}:{}),(null===(o=s.tooltip)||void 0===o?void 0:o.text)?{"--semiotic-tooltip-text":s.tooltip.text}:{}),(null===(r=s.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":s.tooltip.borderRadius}:{}),(null===(i=s.tooltip)||void 0===i?void 0:i.fontSize)?{"--semiotic-tooltip-font-size":s.tooltip.fontSize}:{}),(null===(a=s.tooltip)||void 0===a?void 0:a.shadow)?{"--semiotic-tooltip-shadow":s.tooltip.shadow}:{}),s.borderRadius?{"--semiotic-border-radius":s.borderRadius}:{}),s.colors.selection?{"--semiotic-selection-color":s.colors.selection}:{}),null!=s.colors.selectionOpacity?{"--semiotic-selection-opacity":s.colors.selectionOpacity+""}:{}),s.colors.diverging?{"--semiotic-diverging":s.colors.diverging}:{}),s.colors.annotation?{"--semiotic-annotation-color":s.colors.annotation}:{}),null!=s.typography.legendSize?{"--semiotic-legend-font-size":s.typography.legendSize+"px"}:{}),null!=s.typography.titleFontSize?{"--semiotic-title-font-size":s.typography.titleFontSize+"px"}:{}),null!=s.typography.tickFontFamily?{"--semiotic-tick-font-family":s.typography.tickFontFamily}:{}),c=e.useContext(Fo),u={};return c&&(u["data-semiotic-theme"]=c),e.createElement("div",Object.assign({style:l},u),t)}function Go({theme:t,children:n}){const o="string"==typeof t&&$o(t)?t:void 0;return e.createElement(Dn,null,e.createElement(Fo.Provider,{value:o},e.createElement(zo,{theme:t}),e.createElement(Ro,null,n)))}function Yo(){return In(e=>e.theme)}const qo="#007bff";function Xo(){var e;const t=Yo(),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 Vo(e,t,n,o,r){if(e)return e;let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Me[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:qo}function Uo(e){return"function"==typeof e?e:t=>t[e]}function Ko(e,t,o){const r=bo(),i=Xo();return n(()=>{var n;if(!t)return;const a=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=De(n.map(e=>({_cat:e})),"_cat",a);return t=>r[t]||e(t)}return De(n.map(e=>({_cat:e})),"_cat",a)}if(r&&Object.keys(r).length>0){const n=De(e,t,a);return e=>r[e]||n(e)}return De(e,t,a)}if(r&&Object.keys(r).length>0){const e=De([{_:"a"}],"_",a);return t=>r[t]||e(t)}},[e,t,o,r,i])}function Qo(e,t,o){return n(()=>{if(!t)return e;const n=[...e];if("function"==typeof t)return n.sort(t);const r=Uo(o);return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function Zo({selection:e,linkedHover:t,fallbackFields:i=[],unwrapData:a=!1,onObservation:s,chartType:c,chartId:u,onClick:h,hoverHighlight:g,colorByField:f}){const p=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,i),m=jo({name:(null==e?void 0:e.name)||"__unused__"}),v=Co({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||i||[]}),b=Eo(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[k,w]=r(null),A=f||i[0],S=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]),O=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==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=zt.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(zt={positions:new Map(zt.positions).set(e,{xValue:t,sourceId:n})},Gt())}(y.name||"hover",Number(e),p)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Yt(y.name||"hover",p),"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,p,s,c,u,b,g,A]),E=l(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=zt.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(zt.positions);return t.delete(e),zt={positions:t},Gt(),!1}zt={positions:new Map(zt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Gt()}(y.name||"hover",Number(n),p)}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,p]);return o(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{qt(e,p),Yt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:x,hoverSelectionHook:S,customHoverBehavior:O,customClickBehavior:E,crosshairSourceId:p}}function Jo(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 er({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(_o),d=void 0!==r?r:!u&&!!t,h=n(()=>{if(d&&t)return Do({data:e,colorBy:t,colorScale:o,getColor:Ne,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 tr(e,t,o){const[i,a]=r(null),[s,c]=r(new Set),u=l(t=>{"highlight"===e&&a(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&&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,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:u,onLegendClick:d,legendSelectionHook:h}}const nr={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 or(e,t,n){var o,r,i,a,s,l,c;const u=nr[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!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!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:rr(u.marginDefaults,t.showCategoryTicks,t.orientation)}}function rr(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 ir={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 ar(e,t){return"function"==typeof t?t(e):e[t]}function sr(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 lr(t={}){const{fields:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=ar(t,o);s=sr(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 a=ar(t,o);l.push({label:n,value:sr(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=sr(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=sr(t[e[0]],r))}}const c=Object.assign(Object.assign({},ir),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}function cr(t={}){const{fields:n=[],title:o,format:r,style:i={},className:a="",showLabels:s=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=ar(t,o);c.push({value:sr(e,r)})}n&&Array.isArray(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 a=sr(ar(t,o),i);c.push({label:s?n:void 0,value:a})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:s?e:void 0,value:sr(t[e],r)})});const u=Object.assign(Object.assign({},ir),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function ur(t){if(!0===t)return lr();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:ir},o)}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?lr(t):lr())}function dr(e){return"string"==typeof e?e:"value"}function hr(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function gr(e,t){return"function"==typeof t?t(e):e[t]}function fr(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?hr(gr(r,n.accessor)):null;return e.createElement("div",{className:"semiotic-tooltip",style:ir},i&&e.createElement("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0}},i),o.map((t,n)=>{const o=hr(gr(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 pr({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return a=>{var s;const l=i?(null===(s=a.data)||void 0===s?void 0:s[0])||a.data||a:a.data||a,c=gr(l,t),u=gr(l,n),d=o?gr(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:ir},e.createElement("div",{style:{fontWeight:"bold"}},hr(c)),e.createElement("div",{style:{marginTop:4}},hr(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||dr(o),": ",hr(d)))}}function yr({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 mr 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(yr,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function vr(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function br(e,t,n=3){let o,r=n+1;for(const n of t){const t=vr(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}function xr(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function kr(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=br(e,t,3))&&void 0!==n?n:null)}function wr({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=xr(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=kr(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Ar({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}function Sr({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=xr(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=kr(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}const Or={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"}},Er={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},jr={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},Cr=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Pr=["vertical","horizontal"],Mr={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Or),Er),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Cr},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({},Or),Er),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Cr},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Or),Er),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Cr},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({},Or),Er),{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({},Or),Er),{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({},Or),Er),{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({},Or),Er),{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({},Or),Er),{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({},Or),Er),{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({},Or),jr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pr},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({},Or),jr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pr},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({},Or),jr),{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:Pr},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Or),jr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pr},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({},Or),jr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pr},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({},Or),jr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pr},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Or),jr),{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({},Or),jr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pr},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({},Or),jr),{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({},Or),jr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Pr},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Or),{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({},Or),{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({},Or),{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({},Or),jr),{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({},Or),jr),{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({},Or),{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({},Or),{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:Pr},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({},Or),{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({},Or),{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({},Or),{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({},Or),{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({},Or),{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({},Or),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Or),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},Or),{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({},Or),{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({},Or),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},Or),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})}};function Lr(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function _r(e,t){const n=[],o=Mr[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Mr).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(!Lr(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=br(o,r),i=t?`Unknown prop "${o}" for ${e}. Did you mean "${t}"?`:`Unknown prop "${o}" for ${e}. Valid props: ${r.join(", ")}.`;n.push(i)}if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=wr({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=Ar({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=Sr({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}}const Tr=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),Br=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Nr=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Dr=new Set(["LineChart","AreaChart","StackedAreaChart"]),Ir=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]);function Hr(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 Wr(e,t){const n=Hr(e),o=Hr(t);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}const $r=["xAccessor","yAccessor","timeAccessor","valueAccessor","categoryAccessor","colorBy","sizeBy","lineBy","areaBy","stackBy","groupBy","orderAccessor","y0Accessor","sourceAccessor","targetAccessor","nodeIDAccessor","childrenAccessor","costAccessor"];function Fr(e,t){const n=[],o=_r(e,t);for(const e of o.errors)n.push({severity:"error",code:"VALIDATION",message:e,fix:""});return Mr[e]?(function(e,t,n){const o=Mr[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=Mr[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=Object.keys(i);for(const e of o.dataAccessors){const o=t[e];"string"==typeof o&&(o in i||n.push({severity:"error",code:"ACCESSOR_MISSING",message:`${e}="${o}" not found in data. Available fields: ${a.join(", ")}.`,fix:`Change ${e} to one of: ${a.map(e=>`"${e}"`).join(", ")}.`}))}}(e,t,n),function(e,t,n){Tr.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){Br.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=Mr[e];if(!o||"array"!==o.dataShape)return;const r=t.data;if(!r||!Array.isArray(r)||0===r.length)return;const i=r[0];if(!i||"object"!=typeof i)return;const a=t.xAccessor;"string"==typeof a&&i[a]instanceof Date&&!t.xFormat&&n.push({severity:"warning",code:"DATE_NO_FORMAT",message:`xAccessor "${a}" contains Date objects but no xFormat is provided. Axis ticks may display "[object Object]".`,fix:"Add xFormat={d => d.toLocaleDateString()} or use timestamps (d.getTime()) instead of Date objects."})}(e,t,n),function(e,t,n){t.linkedHover&&!t.selection&&n.push({severity:"warning",code:"LINKED_HOVER_NO_SELECTION",message:"linkedHover is set but selection is not — this chart emits hover events but won't highlight from others.",fix:`Add selection={{ name: "${"object"==typeof t.linkedHover&&t.linkedHover.name||"hl"}" }} to receive cross-highlights.`})}(0,t,n),function(e,t,n){var o;if(!Nr.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(!Dr.has(e))return;if(t.gapStrategy)return;const o=t.data;if(!o||!Array.isArray(o)||0===o.length)return;const r=t.yAccessor||"y";"string"==typeof r&&o.some(e=>{const t=e[r];return null==t||Number.isNaN(t)})&&n.push({severity:"warning",code:"DATA_GAPS",message:`Data contains null/undefined/NaN values in "${r}". Default behavior breaks the line at gaps.`,fix:'Set gapStrategy="break" (default), "interpolate", or "zero" to control gap handling.'})}(e,t,n),function(e,t,n){var o,r;const i=null!==(o=t.width)&&void 0!==o?o:600,a=null!==(r=t.height)&&void 0!==r?r:400,s=t.margin;if(!s||"object"!=typeof s)return;const l=(s.left||0)+(s.right||0),c=(s.top||0)+(s.bottom||0);i>l||n.push({severity:"error",code:"MARGIN_OVERFLOW_H",message:`Horizontal margins (${l}px) >= width (${i}px) — no drawing area left.`,fix:"Reduce margin.left/right or increase width."}),a>c||n.push({severity:"error",code:"MARGIN_OVERFLOW_V",message:`Vertical margins (${c}px) >= height (${a}px) — no drawing area left.`,fix:"Reduce margin.top/bottom or increase height."})}(0,t,n),function(e,t,n){var o;const r=Mr[e];if(!r||"array"!==r.dataShape)return;const i=t.data;if(!i||!Array.isArray(i)||0===i.length)return;const a=[];t.xAccessor&&"string"==typeof t.xAccessor&&a.push({prop:"xAccessor",name:t.xAccessor}),t.yAccessor&&"string"==typeof t.yAccessor&&a.push({prop:"yAccessor",name:t.yAccessor}),t.valueAccessor&&"string"==typeof t.valueAccessor&&a.push({prop:"valueAccessor",name:t.valueAccessor});const s=Math.min(i.length,5);for(const e of a){let t=!0;for(let n=0;s>n;n++){const r=null===(o=i[n])||void 0===o?void 0:o[e.name];if("number"==typeof r&&Number.isFinite(r)){t=!1;break}}t&&n.push({severity:"error",code:"DEGENERATE_EXTENT",message:`${e.prop}="${e.name}" produces NaN or non-finite values for all sampled data points — chart extents will be invalid.`,fix:`Ensure data[].${e.name} contains finite numbers, or use a function accessor to transform values.`})}}(e,t,n),function(e,t,n){if(!Ir.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=Wr(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=Wr(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 $r)"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 zr;const Rr="undefined"!=typeof process&&"production"!==(null===(zr=process.env)||void 0===zr?void 0:zr.NODE_ENV);function Gr({componentName:t,width:n,height:o,chartProps:r,children:i}){return e.createElement(mr,{fallback:i=>{let a="";if(Rr&&r)try{const e=Fr(t,r);e.ok||(a=e.diagnoses.map(e=>`${"error"===e.severity?"✗":"⚠"} ${e.message}${e.fix?" — Fix: "+e.fix:""}`).join("\n"))}catch(e){}return e.createElement(yr,{componentName:t,message:i.message,diagnosticHint:a,width:n,height:o})}},i)}const Yr={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"},qr={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Xr(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({},Yr),{width:n,height:o})},r||"No data available"):null}function Vr(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))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/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({},qr),{position:"absolute",top:s+o*(i+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2})})))}function Ur(e,t,n,o){if(!Rr)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 Kr(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){e.done?r(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Qr="__forecastSegment";let Zr=null;function Jr(){return Kr(this,void 0,void 0,function*(){return Zr||(Zr=yield import("./semiotic-ai-statisticalOverlays-C2PPlmXv.js")),Zr})}const ei=c(function(i,a){var s,c;const d=t(null);u(a,()=>({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=or(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:f,className:p,xFormat:y,yFormat:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:E=3,fillArea:j=!1,areaOpacity:C=.3,lineWidth:P=2,lineGradient:M,tooltip:L,pointIdAccessor:_,annotations:T,directLabel:B,gapStrategy:N="break",anomaly:D,forecast:I,frameProps:H={},selection:W,linkedHover:$,onObservation:F,onClick:z,hoverHighlight:R,hoverRadius:G,chartId:Y,loading:q,emptyContent:X,legendInteraction:V,legendPosition:U,xScaleType:K,yScaleType:Q,color:Z}=i,J=h.width,ee=h.height,te=h.enableHover,ne=h.showGrid,oe=h.showLegend,re=h.title,ie=h.description,ae=h.summary,se=h.accessibleTable,le=h.xLabel,ce=h.yLabel,ue=Vr(q,J,ee),de=ue?null:Xr(g,J,ee,X),he=g||[];Ur("LineChart",he,"xAccessor",v),Ur("LineChart",he,"yAccessor",b);const ge="string"==typeof v?v:"__semiotic_resolvedX",fe="string"==typeof b?b:"__semiotic_resolvedY",[pe,ye]=r(null),[me,ve]=r([]),be=n(()=>{if(!I&&!D)return he;const e="function"==typeof v,t="function"==typeof b;return e||t?he.map(n=>{const o=Object.assign({},n);return e&&(o.__semiotic_resolvedX=v(n)),t&&(o.__semiotic_resolvedY=b(n)),o}):he},[he,I,D,v,b]),xe=t(I),ke=t(D);o(()=>{if(!I&&!D)return void((xe.current||ke.current)&&(ye(null),ve([]),xe.current=I,ke.current=D));let e=!1;const t=I!==xe.current||D!==ke.current;if(xe.current=I,ke.current=D,t&&(ye(null),ve([])),I){const t=x&&"string"==typeof x&&"object"==typeof I?Object.assign(Object.assign({},I),{_groupBy:x}):I;(function(...e){return Kr(this,void 0,void 0,function*(){return(yield Jr()).buildForecast(...e)})})(be,ge,fe,t,D).then(t=>{e||(ye(t),ve(t.annotations))}).catch(()=>{e||(ye(null),ve([]))})}else D&&function(...e){return Kr(this,void 0,void 0,function*(){return(yield Jr()).buildAnomalyAnnotations(...e)})}(D).then(t=>{e||(ye(null),ve(t))}).catch(()=>{e||ve([])});return()=>{e=!0}},[be,I,D,ge,fe]);const we=pe?pe.processedData:he,Ae="__compoundGroup",Se=!(!I||!x),Oe=Se?Ae:I?Qr:x,Ee=n(()=>{if(!Se)return we;const e="function"==typeof x?x:e=>e[x];return we.map(t=>{const n=Object.assign({},t);return n[Ae]=`${e(t)}__${t[Qr]||"observed"}`,n})},[we,Se,x]),je=Se?Ee:we,Ce=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 a=pe?pe.processedData:he;for(const e of a){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,pe,he,b]),{activeSelectionHook:Pe,hoverSelectionHook:Me,customHoverBehavior:Le,customClickBehavior:_e,crosshairSourceId:Te}=Zo({selection:W,linkedHover:$,fallbackFields:w?["string"==typeof w?w:""]:[],onObservation:F,onClick:z,chartType:"LineChart",chartId:Y,hoverHighlight:R,colorByField:"string"==typeof w?w:void 0}),Be=Jo($,Te),De=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===(s=je[0])||void 0===s?void 0:s[k]),He=n(()=>{if(Ie)return je;if(Oe){const e=je.reduce((e,t)=>{const n="function"==typeof Oe?Oe(t):t[Oe];if(!e[n]){const o={[k]:[]};"string"==typeof Oe&&(o[Oe]=n),Se&&(o[Qr]=t[Qr],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:je}]},[je,Oe,k,Ie]),{gapProcessedLineData:We,hasGaps:$e}=n(()=>{if("interpolate"===N){let e=!1;const t=[];for(const n of He){const o=(n[k]||[]).filter(t=>!De(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===N){let e=!1;const t=[];for(const n of He){const o=n[k]||[];let r=[],i=0;const a=Oe&&"string"==typeof Oe?n[Oe]:void 0;for(const s of o)if(De(s))e=!0,r.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:r})),r=[],i++);else{const e=null!=a?`${a}__seg${i}`:"__seg"+i;r.push(Object.assign(Object.assign({},s),{_gapSegment:e}))}r.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:r}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===N){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of He){const r=o[k]||[],i=[];for(const n of r)De(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:He,hasGaps:!1}},[He,N,k,De,Oe,b]),Fe=Ko(we,w,A),ze=n(()=>{if(!w)return[];const e=new Set;for(const t of we){const n="function"==typeof w?w(t):t[w];null!=n&&e.add(n+"")}return Array.from(e)},[we,w]),Re=tr(V,w,ze),Ge=n(()=>Me||(Re.legendSelectionHook?Re.legendSelectionHook:Pe),[Me,Re.legendSelectionHook,Pe]),Ye=n(()=>(e,t)=>{const n={strokeWidth:P},o=!0===j||Array.isArray(j)&&null!=t&&j.includes(t);return w?Fe&&(n.stroke=Ne(e,w,Fe),o&&(n.fill=n.stroke,n.fillOpacity=C)):(n.stroke=Z||qo,o&&(n.fill=Z||qo,n.fillOpacity=C)),n},[w,Fe,P,j,C,Z]),[qe,Xe]=r(null);o(()=>{if(!I)return void Xe(null);let e=!1;return function(...e){return Kr(this,void 0,void 0,function*(){return(yield Jr()).createSegmentLineStyle(...e)})}(Ye,I).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[Ye,I]);const Ve=qe||Ye,Ue=n(()=>Ho(Ve,Ge,W),[Ve,Ge,W]),Ke=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return w?Fe&&(t.fill=Ne(e.parentLine||e,w,Fe)):t.fill=Z||qo,t}},[O,E,w,Fe,Z]),Qe=Array.isArray(j)?"mixed":j?"area":"line",Ze="object"==typeof B?B:{},Je=Ze.position||"end",et=Ze.fontSize||11,tt=n(()=>{var e,t;if(!B||!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 We){const o=n[k]||[];if(0===o.length)continue;const a="end"===Je?o[o.length-1]:o[0],s=null!==(t=null!==(e=r(a))&&void 0!==e?e:r(n))&&void 0!==t?t:"";s&&!i.has(s+"")&&i.set(s+"",a)}const a=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"===Je?6:-6,dy:0,color:Fe?Fe(e):qo,fontSize:et}));a.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;a.length>e;e++){const t="string"==typeof b?b:"y",n=a[e-1],o=a[e];et+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=et+2)}return a},[B,w,Fe,We,k,v,b,Je,et]),nt=(!B||void 0!==oe)&&oe,ot=n(()=>{if(!B)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"===Je?"right":"left";return Object.assign(Object.assign({},h.marginDefaults),{[n]:Math.max(h.marginDefaults[n]||0,t)})},[B,tt,et,Je,h.marginDefaults]),{legend:rt,margin:it,legendPosition:at}=er({data:We,colorBy:w,colorScale:Fe,showLegend:nt,legendPosition:U,userMargin:f,defaults:ot}),st=x||w,lt=n(()=>fr([{label:le||dr(v),accessor:v,role:"x"},{label:ce||dr(b),accessor:b,role:"y"},...st?[{label:dr(st),accessor:st,role:"group"}]:[]]),[v,b,le,ce,st]),ct=wr({componentName:"LineChart",data:Ie?(null===(c=we[0])||void 0===c?void 0:c[k])||[]:g,accessors:{xAccessor:v,yAccessor:b}}),ut=n(()=>Ie||Oe||$e?We.flatMap(e=>{const t=e[k]||[];return Oe&&"string"==typeof Oe?t.map(t=>Object.assign(Object.assign({},t),{[Oe]:e[Oe]})):t}):je,[We,k,Ie,Oe,je,$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:Qe},Array.isArray(j)&&{areaGroups:j}),M&&{lineGradient:M}),null!=G&&{hoverRadius:G}),null!=g&&{data:ut}),{xAccessor:v,yAccessor:b,xScaleType:K,yScaleType:Q}),Ce&&{yExtent:Ce}),{groupAccessor:"break"===N&&$e?"_gapSegment":Oe||void 0,curve:S,lineStyle:Ue}),O&&{pointStyle:Ke}),{size:[J,ee],responsiveWidth:i.responsiveWidth,responsiveHeight:i.responsiveHeight,margin:it,showAxes:h.showAxes,xLabel:le,yLabel:ce,xFormat:y,yFormat:m,enableHover:te,showGrid:ne}),rt&&{legend:rt,legendPosition:at}),V&&"none"!==V&&{legendHoverBehavior:Re.onLegendHover,legendClickBehavior:Re.onLegendClick,legendHighlightedCategory:Re.highlightedCategory,legendIsolatedCategories:Re.isolatedCategories}),re&&{title:re}),ie&&{description:ie}),ae&&{summary:ae}),void 0!==se&&{accessibleTable:se}),p&&{className:p}),{tooltipContent:!1===L?()=>null:"multi"===L?t=>{var n,o,r,i,a,s,l,c,u,d;const h=t.allSeries;if(!h||0===h.length){const s=null!==(a=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!==a?a:t.y;return e.createElement("div",{className:"semiotic-tooltip",style:ir},e.createElement("div",null,sr(s)))}const g=null!==(d=null!==(c=null!==(s=t.xValue)&&void 0!==s?s: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:ir},null!=g&&e.createElement("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4}},sr(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"}},sr(t.value)))))}:ur(L)||lt}),"multi"===L&&{tooltipMode:"multi"}),($||F||z||R)&&{customHoverBehavior:Le}),(F||z||$)&&{customClickBehavior:_e}),_&&{pointIdAccessor:_}),((null==T?void 0:T.length)||me.length||tt.length)&&{annotations:[...T||[],...me,...tt]}),Be),H);return ue||de||(ct?e.createElement(yr,{componentName:"LineChart",message:ct,width:J,height:ee}):e.createElement(Gr,{componentName:"LineChart",width:J,height:ee},e.createElement(yo,Object.assign({ref:d},dt))))});ei.displayName="LineChart";const ti=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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 s=or(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:f="x",yAccessor:p="y",areaBy:y,y0Accessor:m,gradientFill:v=!1,lineDataAccessor:b="coordinates",colorBy:x,colorScheme:k,curve:w="monotoneX",areaOpacity:A=.7,lineGradient:S,showLine:O=!0,lineWidth:E=2,showPoints:j=!1,pointRadius:C=3,tooltip:P,annotations:M,frameProps:L={},selection:_,linkedHover:T,onObservation:B,onClick:N,hoverHighlight:D,chartId:I,loading:H,emptyContent:W,legendInteraction:$,legendPosition:F,color:z}=o,R=s.width,G=s.height,Y=s.enableHover,q=s.showGrid,X=s.showLegend,V=s.title,U=s.description,K=s.summary,Q=s.accessibleTable,Z=s.xLabel,J=s.yLabel,ee=Vr(H,R,G),te=ee?null:Xr(l,R,G,W),ne=l||[];Ur("AreaChart",ne,"xAccessor",f),Ur("AreaChart",ne,"yAccessor",p);const{activeSelectionHook:oe,hoverSelectionHook:re,customHoverBehavior:ie,customClickBehavior:ae,crosshairSourceId:se}=Zo({selection:_,linkedHover:T,fallbackFields:x?["string"==typeof x?x:""]:[],onObservation:B,onClick:N,chartType:"AreaChart",chartId:I,hoverHighlight:D,colorByField:"string"==typeof x?x:void 0}),le=Jo(T,se),ce=void 0!==(null===(i=ne[0])||void 0===i?void 0:i[b]),ue=n(()=>{if(ce)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,ce]),de=Ko(ne,x,k),he=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]),ge=tr($,x,he),fe=n(()=>re||(ge.legendSelectionHook?ge.legendSelectionHook:oe),[re,ge.legendSelectionHook,oe]),pe=n(()=>e=>{const t={};if(x){if(de){const n=Ne(e,x,de);t.fill=n,O?(t.stroke=n,t.strokeWidth=E):t.stroke="none"}}else{const e=z||qo;t.fill=e,O?(t.stroke=e,t.strokeWidth=E):t.stroke="none"}return t.fillOpacity=A,t},[x,de,z,A,O,E]),ye=n(()=>Ho(pe,fe,_),[pe,fe,_]),me=n(()=>{if(j)return e=>{const t={r:C,fillOpacity:1};return x?de&&(t.fill=Ne(e.parentLine||e,x,de)):t.fill=qo,t}},[j,C,x,de]),{legend:ve,margin:be,legendPosition:xe}=er({data:ue,colorBy:x,colorScale:de,showLegend:X,legendPosition:F,userMargin:c,defaults:s.marginDefaults}),ke=y||x,we=n(()=>fr([{label:Z||dr(f),accessor:f,role:"x"},{label:J||dr(p),accessor:p,role:"y"},...ke?[{label:dr(ke),accessor:ke,role:"group"}]:[]]),[f,p,Z,J,ke]),Ae=wr({componentName:"AreaChart",data:l,accessors:{xAccessor:f,yAccessor:p}}),Se=n(()=>ce||y?ue.flatMap(e=>{const t=e[b]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):ne,[ue,b,ce,y,ne]),Oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=l&&{data:Se}),{xAccessor:f,yAccessor:p,groupAccessor:y||void 0}),m&&{y0Accessor:m}),v&&{gradientFill:v}),S&&{lineGradient:S}),{curve:w,lineStyle:ye}),j&&me&&{pointStyle:me}),{size:[R,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:be,showAxes:s.showAxes,xLabel:Z,yLabel:J,xFormat:h,yFormat:g,enableHover:Y}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:q}),ve&&{legend:ve,legendPosition:xe}),$&&"none"!==$&&{legendHoverBehavior:ge.onLegendHover,legendClickBehavior:ge.onLegendClick,legendHighlightedCategory:ge.highlightedCategory,legendIsolatedCategories:ge.isolatedCategories}),V&&{title:V}),U&&{description:U}),K&&{summary:K}),void 0!==Q&&{accessibleTable:Q}),d&&{className:d}),{tooltipContent:!1===P?()=>null:ur(P)||we}),(T||B||N||D)&&{customHoverBehavior:ie}),(B||N||T)&&{customClickBehavior:ae}),M&&M.length>0&&{annotations:M}),le),L);return ee||te||(Ae?e.createElement(yr,{componentName:"AreaChart",message:Ae,width:R,height:G}):e.createElement(Gr,{componentName:"AreaChart",width:R,height:G},e.createElement(yo,Object.assign({ref:a},Oe))))});function ni({isPushMode:e,colorBy:o,colorScheme:i,showLegend:a,legendPosition:s="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]),f=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]),p=l(e=>t=>{f([t]),e(t)},[f]),y=l(e=>t=>{f(t),e(t)},[f]),m=l(()=>{c.current=new Set,u.current=[],h(e=>e+1)},[]),v=n(()=>{if(!e||!o||!1===a)return;const t=u.current;if(0===t.length)return;const n=Array.isArray(i)?i:_e,r=new Map;for(let e=0;t.length>e;e++)r.set(t[e],n[e%n.length]);const s="string"==typeof o?o:"__streamCat";return Do({data:t.map(e=>({[s]:e})),colorBy:s,colorScale:e=>r.get(e)||"#999",getColor:Ne})},[e,o,a,i,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:p,wrapPushMany:y,resetCategories:m,streamingLegend:v,streamingMarginAdjust:b}}ti.displayName="AreaChart";const oi=c(function(o,r){var i;const a=t(null),s=or(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:f,xAccessor:p="x",yAccessor:y="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,showLine:A=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:E=3,normalize:j=!1,tooltip:C,annotations:P,frameProps:M={},selection:L,linkedHover:_,onObservation:T,onClick:B,hoverHighlight:N,chartId:D,loading:I,emptyContent:H,legendInteraction:W,legendPosition:$,color:F}=o,z=s.width,R=s.height,G=s.enableHover,Y=s.showGrid,q=s.showLegend,X=s.title,V=s.description,U=s.summary,K=s.accessibleTable,Q=s.xLabel,Z=s.yLabel,J=Vr(I,z,R),ee=J?null:Xr(c,z,R,H),te=c||[],ne=ni({isPushMode:void 0===c,colorBy:b||m,colorScheme:x,showLegend:q,legendPosition:$}),oe=l(ne.wrapPush(e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)}),[ne.wrapPush]),re=l(ne.wrapPushMany(e=>{var t;return null===(t=a.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=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;ne.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[oe,re,ne.resetCategories]);const{activeSelectionHook:ie,hoverSelectionHook:ae,customHoverBehavior:se,customClickBehavior:le,crosshairSourceId:ce}=Zo({selection:L,linkedHover:_,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:T,onClick:B,chartType:"StackedAreaChart",chartId:D,hoverHighlight:N,colorByField:"string"==typeof b?b:void 0}),ue=Jo(_,ce),de=void 0!==(null===(i=te[0])||void 0===i?void 0:i[v]),he=n(()=>{if(de)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,de]),ge=Ko(te,b,x),fe=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]),pe=tr(W,b,fe),ye=n(()=>ae||(pe.legendSelectionHook?pe.legendSelectionHook:ie),[ae,pe.legendSelectionHook,ie]),me=n(()=>e=>{const t={};if(b&&ge){const n=Ne(e,b,ge);t.fill=n,A?(t.stroke=n,t.strokeWidth=S):t.stroke="none"}else if(!b){const e=F||qo;t.fill=e,t.stroke=A?e:"none",A&&(t.strokeWidth=S)}return t.fillOpacity=w,t},[b,ge,w,A,S,F]),ve=n(()=>Ho(me,ye,L),[me,ye,L]),be=n(()=>{if(O)return e=>{const t={r:E,fillOpacity:1};return b?ge&&(t.fill=Ne(e.parentLine||e,b,ge)):t.fill=F||qo,t}},[O,E,b,ge,F]),{legend:xe,margin:ke,legendPosition:we}=er({data:he,colorBy:b,colorScale:ge,showLegend:q,legendPosition:$,userMargin:d,defaults:s.marginDefaults}),Ae=ne.streamingLegend||xe,Se=$||we,Oe=n(()=>{if(ne.streamingMarginAdjust){const e=Object.assign({},ke);for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return ke},[ke,ne.streamingMarginAdjust]),Ee=m||b,je=n(()=>fr([{label:Q||dr(p),accessor:p,role:"x"},{label:Z||dr(y),accessor:y,role:"y"},...Ee?[{label:dr(Ee),accessor:Ee,role:"group"}]:[]]),[p,y,Q,Z,Ee]),Ce=wr({componentName:"StackedAreaChart",data:c,accessors:{xAccessor:p,yAccessor:y}}),Pe=n(()=>de||m?he.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):te,[he,v,de,m,te]),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(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=c&&{data:Pe}),{xAccessor:p,yAccessor:y,groupAccessor:m||void 0,curve:k,normalize:j,lineStyle:ve}),O&&be&&{pointStyle:be}),{size:[z,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Oe,showAxes:s.showAxes,xLabel:Q,yLabel:Z,xFormat:g,yFormat:f,enableHover:G}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:Y}),Ae&&{legend:Ae,legendPosition:Se}),W&&"none"!==W&&{legendHoverBehavior:pe.onLegendHover,legendClickBehavior:pe.onLegendClick,legendHighlightedCategory:pe.highlightedCategory,legendIsolatedCategories:pe.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),h&&{className:h}),{tooltipContent:!1===C?()=>null:ur(C)||je}),(_||T||B||N)&&{customHoverBehavior:se}),(T||B||_)&&{customClickBehavior:le}),P&&P.length>0&&{annotations:P}),ue),M);return J||ee||(Ce?e.createElement(yr,{componentName:"StackedAreaChart",message:Ce,width:z,height:R}):e.createElement(Gr,{componentName:"StackedAreaChart",width:z,height:R},e.createElement(yo,Object.assign({ref:a},Me))))});function ri(e){const{data:t,rawData:o,colorBy:r,colorScheme:i,legendInteraction:a,legendPosition:s,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,emptyContent:k,width:w,height:A}=e,S="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:O,hoverSelectionHook:E,customHoverBehavior:j,customClickBehavior:C,crosshairSourceId:P}=Zo({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:S}),M=Jo(c,P),L=Ko(t,r,i),_=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]),T=tr(a,r,_),B=n(()=>E||(T.legendSelectionHook?T.legendSelectionHook:O),[E,T.legendSelectionHook,O]),{legend:N,margin:D,legendPosition:I}=er({data:t,colorBy:r,colorScale:L,showLegend:p,legendPosition:s,userMargin:y,defaults:m}),H=n(()=>{const e={};return N&&(e.legend=N,e.legendPosition=I),a&&"none"!==a&&(e.legendHoverBehavior=T.onLegendHover,e.legendClickBehavior=T.onLegendClick,e.legendHighlightedCategory=T.highlightedCategory,e.legendIsolatedCategories=T.isolatedCategories),e},[N,I,a,T.onLegendHover,T.onLegendClick,T.highlightedCategory,T.isolatedCategories]),W=Vr(x,w,A),$=W?null:Xr(o,w,A,k);return{colorScale:L,allCategories:_,legendState:T,effectiveSelectionHook:B,activeSelectionHook:O,customHoverBehavior:j,customClickBehavior:C,legend:N,margin:D,legendPosition:I,earlyReturn:W||$||null,legendBehaviorProps:H,crosshairProps:M}}oi.displayName="StackedAreaChart";const ii=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 a=or(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:s,margin:c,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,frameProps:E={},selection:j,linkedHover:C,linkedBrush:P,onObservation:M,onClick:L,hoverHighlight:_,chartId:T,loading:B,emptyContent:N,legendInteraction:D,legendPosition:I,color:H}=o,W=a.width,$=a.height,F=a.enableHover,z=a.showGrid,R=a.title,G=a.description,Y=a.summary,q=a.accessibleTable,X=a.xLabel,V=a.yLabel,U=s||[],K=ri({data:U,rawData:s,colorBy:y,colorScheme:m,legendInteraction:D,legendPosition:I,selection:j,linkedHover:C,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:M,onClick:L,hoverHighlight:_,chartType:"Scatterplot",chartId:T,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:B,emptyContent:N,width:W,height:$}),Q=Io(P),Z=Po({name:(null==Q?void 0:Q.name)||"__unused_brush__",xField:(null==Q?void 0:Q.xField)||("string"==typeof f?f:void 0),yField:(null==Q?void 0:Q.yField)||("string"==typeof p?p:void 0)}),J=Q?"xyBrush"===Z.brushInteraction.brush?"xy":"xBrush"===Z.brushInteraction.brush?"x":"y":void 0,ee=e.useRef(Z.brushInteraction);ee.current=Z.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(K.earlyReturn)return K.earlyReturn;Ur("Scatterplot",U,"xAccessor",f),Ur("Scatterplot",U,"yAccessor",p);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?K.colorScale&&(t.fill=Ne(e,y,K.colorScale)):t.fill=H||qo,t.r=v?Ie(e,v,b,ne):x,t},[y,K.colorScale,v,b,ne,x,k,H]),re=n(()=>Ho(oe,K.effectiveSelectionHook,j),[oe,K.effectiveSelectionHook,j]),ie=n(()=>fr([{label:X||dr(f),accessor:f,role:"x"},{label:V||dr(p),accessor:p,role:"y"},...y?[{label:dr(y),accessor:y,role:"color"}]:[],...v?[{label:dr(v),accessor:v,role:"size"}]:[]]),[f,p,X,V,y,v]),ae=wr({componentName:"Scatterplot",data:s,accessors:{xAccessor:f,yAccessor:p}});if(ae)return e.createElement(yr,{componentName:"Scatterplot",message:ae,width:W,height:$});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:U}),{xAccessor:f,yAccessor:p,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:re,colorScheme:m,size:[W,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,showAxes:a.showAxes,xLabel:X,yLabel:V,xFormat:h,yFormat:g,enableHover:F,showGrid:z}),K.legendBehaviorProps),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),d&&{className:d}),{tooltipContent:!1===w?()=>null:ur(w)||ie}),(C||M||L||_)&&{customHoverBehavior:K.customHoverBehavior}),(M||L||C)&&{customClickBehavior:K.customClickBehavior}),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),O&&O.length>0&&{annotations:O}),Q&&{brush:{dimension:J},onBrush:te}),K.crosshairProps),E);return e.createElement(Gr,{componentName:"Scatterplot",width:W,height:$},e.createElement(yo,Object.assign({ref:i},se)))});function ai(e,t){return S(1===t?.5:e/(t-1))}ii.displayName="Scatterplot";const si=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 a=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,className:l,xFormat:c,yFormat:d,xAccessor:h="x",yAccessor:g="y",orderAccessor:f,orderLabel:p,pointRadius:y=4,tooltip:m,pointIdAccessor:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:E,loading:j,emptyContent:C,legendInteraction:P}=o,M=a.width,L=a.height,_=a.enableHover,T=a.showGrid,B=a.title,N=a.description,D=a.summary,I=a.accessibleTable,H=a.xLabel,W=a.yLabel,$=s||[],{safeData:F,orderMap:z}=n(()=>{const e="function"==typeof h?h:e=>e[h],t="function"==typeof g?g:e=>e[g];let n=$;if(f&&$.length>0){const e="function"==typeof f?f:e=>e[f];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 a of n){const n=e(a),s=t(a);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&o.set(a,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[$,f,h,g]);Ur("ConnectedScatterplot",F,"xAccessor",h),Ur("ConnectedScatterplot",F,"yAccessor",g);const{activeSelectionHook:R,hoverSelectionHook:G,customHoverBehavior:Y,customClickBehavior:q,crosshairSourceId:X}=Zo({selection:k,linkedHover:w,fallbackFields:[],onObservation:A,onClick:S,chartType:"ConnectedScatterplot",chartId:E,hoverHighlight:O,colorByField:void 0}),V=Jo(w,X),U=tr(P,void 0,[]),K=n(()=>G||(U.legendSelectionHook?U.legendSelectionHook:R),[G,U.legendSelectionHook,R]),Q=n(()=>(e,t)=>{var n,o;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const i=null==K?void 0:K.isActive,a=null==K?void 0:K.predicate,s=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=ai(t,l),h=!i||!a||a(null!==(n=c.datum)&&void 0!==n?n:c)||a(null!==(o=u.datum)&&void 0!==o?o:u),g=i?h?1:.2:1;s&&(e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(u.x,u.y),e.strokeStyle="white",e.lineWidth=y+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=y,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[y,K]),Z=n(()=>[Q],[Q]),J=n(()=>(t,n,o)=>{var r,i;const a=t.filter(e=>"point"===e.type);if(2>a.length)return null;const s=a.length,l=100>s,c=[];for(let t=0;s-1>t;t++){const n=a[t],o=a[t+1],u=ai(t,s),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:y+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:y,strokeLinecap:"round",opacity:g}))}return e.createElement(e.Fragment,null,c)},[y]),ee=n(()=>[J],[J]),te=n(()=>e=>{var t,n;const o=z.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?ai(r,i):"#6366f1",stroke:"white",strokeWidth:1,r:y,fillOpacity:1}},[y,z]),ne=n(()=>Ho(te,K,k),[te,K,k]),oe=Object.assign({top:50,right:40,bottom:60,left:70},o.margin),re=p||("string"==typeof f?f:"Order"),ie=n(()=>fr([{label:H||dr(h),accessor:h,role:"x"},{label:W||dr(g),accessor:g,role:"y"},...f?[{label:re,accessor:f,role:"group"}]:[]]),[h,g,H,W,f,re]),ae=wr({componentName:"ConnectedScatterplot",data:s,accessors:{xAccessor:h,yAccessor:g}}),se=Vr(j,M,L),le=se?null:Xr(s,M,L,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!=s&&{data:F}),{xAccessor:h,yAccessor:g,pointStyle:ne,size:[M,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,showAxes:a.showAxes,xLabel:H,yLabel:W,xFormat:c,yFormat:d,enableHover:_,showGrid:T}),B&&{title:B}),N&&{description:N}),D&&{summary:D}),void 0!==I&&{accessibleTable:I}),l&&{className:l}),{tooltipContent:!1===m?()=>null:ur(m)||ie}),(w||A||S||O)&&{customHoverBehavior:Y}),(A||S||w)&&{customClickBehavior:q}),v&&{pointIdAccessor:v}),{canvasPreRenderers:Z,svgPreRenderers:ee}),b&&b.length>0&&{annotations:b}),V),x);return se||le||(ae?e.createElement(yr,{componentName:"ConnectedScatterplot",message:ae,width:M,height:L}):e.createElement(Gr,{componentName:"ConnectedScatterplot",width:M,height:L},e.createElement(yo,Object.assign({ref:i},ce))))});si.displayName="ConnectedScatterplot";const li=c(function(o,i){const a=t(null),s=or(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:f,xAccessor:p="x",yAccessor:y="y",sizeBy:m,sizeRange:v=[5,40],colorBy:b,colorScheme:x,bubbleOpacity:k=.6,bubbleStrokeWidth:w=1,bubbleStrokeColor:A="white",tooltip:S,marginalGraphics:O,pointIdAccessor:E,annotations:j,frameProps:C={},selection:P,linkedHover:M,linkedBrush:L,onObservation:_,onClick:T,hoverHighlight:B,chartId:N,loading:D,emptyContent:I,legendInteraction:H,legendPosition:W,color:$}=o,F=s.width,z=s.height,R=s.enableHover,G=s.showGrid,Y=s.showLegend,q=s.title,X=s.description,V=s.summary,U=s.accessibleTable,K=s.xLabel,Q=s.yLabel,Z=Vr(D,F,z),J=Z?null:Xr(c,F,z,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]),ae=ni({isPushMode:te,colorBy:b,colorScheme:x,showLegend:Y,legendPosition:W}),se=l(ae.wrapPush(e=>{var t;ie([e]),null===(t=a.current)||void 0===t||t.push(e)}),[ae.wrapPush,ie]),le=l(ae.wrapPushMany(e=>{var t;ie(e),null===(t=a.current)||void 0===t||t.pushMany(e)}),[ae.wrapPushMany,ie]);u(i,()=>({push:se,pushMany:le,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;ae.resetCategories(),ne.current=null,re(e=>e+1),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[se,le,ae.resetCategories]);const{activeSelectionHook:ce,hoverSelectionHook:ue,customHoverBehavior:de,customClickBehavior:he,crosshairSourceId:ge}=Zo({selection:P,linkedHover:M,fallbackFields:b?["string"==typeof b?b:""]:[],onObservation:_,onClick:T,chartType:"BubbleChart",chartId:N,hoverHighlight:B,colorByField:"string"==typeof b?b:void 0}),fe=Jo(M,ge),pe=Io(L);Po({name:(null==pe?void 0:pe.name)||"__unused_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof p?p:void 0),yField:(null==pe?void 0:pe.yField)||("string"==typeof y?y:void 0)});const ye=Ko(ee,b,x),me=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]),ve=tr(H,b,me),be=n(()=>ue||(ve.legendSelectionHook?ve.legendSelectionHook:ce),[ue,ve.legendSelectionHook,ce]),xe=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]),ke=n(()=>e=>{const t={fillOpacity:k,strokeWidth:w,stroke:A};return b?ye&&(t.fill=Ne(e,b,ye)):t.fill=$||qo,t.r=Ie(e,m,v,xe),t},[b,ye,m,v,xe,k,w,A,$]),we=n(()=>Ho(ke,be,P),[ke,be,P]),{legend:Ae,margin:Se,legendPosition:Oe}=er({data:ee,colorBy:b,colorScale:ye,showLegend:Y,legendPosition:W,userMargin:d,defaults:s.marginDefaults}),Ee=ae.streamingLegend||Ae,je=W||Oe,Ce=n(()=>{if(ae.streamingMarginAdjust){const e=Object.assign({},Se);for(const[t,n]of Object.entries(ae.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return Se},[Se,ae.streamingMarginAdjust]),Pe=n(()=>fr([{label:K||dr(p),accessor:p,role:"x"},{label:Q||dr(y),accessor:y,role:"y"},{label:dr(m),accessor:m,role:"size"},...b?[{label:dr(b),accessor:b,role:"color"}]:[]]),[p,y,K,Q,m,b]),Me=wr({componentName:"BubbleChart",data:c,accessors:{xAccessor:p,yAccessor:y},requiredProps:{sizeBy:m}});if(Me)return e.createElement(yr,{componentName:"BubbleChart",message:Me,width:F,height:z});const Le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=c&&{data:ee}),{xAccessor:p,yAccessor:y,colorAccessor:b||void 0,sizeAccessor:m,sizeRange:v,pointStyle:we,colorScheme:x,size:[F,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Ce,showAxes:s.showAxes,xLabel:K,yLabel:Q,xFormat:g,yFormat:f,enableHover:R,showGrid:G}),Ee&&{legend:Ee,legendPosition:je}),H&&"none"!==H&&{legendHoverBehavior:ve.onLegendHover,legendClickBehavior:ve.onLegendClick,legendHighlightedCategory:ve.highlightedCategory,legendIsolatedCategories:ve.isolatedCategories}),q&&{title:q}),X&&{description:X}),V&&{summary:V}),void 0!==U&&{accessibleTable:U}),h&&{className:h}),{tooltipContent:!1===S?()=>null:ur(S)||Pe}),(M||_||T||B)&&{customHoverBehavior:de}),(_||T||M)&&{customClickBehavior:he}),O&&{marginalGraphics:O}),E&&{pointIdAccessor:E}),j&&j.length>0&&{annotations:j}),fe),C);return Z||J||e.createElement(Gr,{componentName:"BubbleChart",width:F,height:z},e.createElement(yo,Object.assign({ref:a},Le)))});li.displayName="BubbleChart";const ci=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 a=or(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:s,margin:l,className:c,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y="blues",customColorScale:m,showValues:v=!1,valueFormat:b,cellBorderColor:k="#fff",cellBorderWidth:w=1,tooltip:A,annotations:O,frameProps:E={},selection:M,linkedHover:L,onObservation:_,onClick:T,hoverHighlight:B,chartId:N,loading:D,emptyContent:I,showLegend:H,legendPosition:W,legendInteraction:$}=o,F=a.width,z=a.height,R=a.enableHover,G=a.title,Y=a.description,q=a.summary,X=a.accessibleTable,V=a.xLabel,U=a.yLabel,K=Vr(D,F,z),Q=K?null:Xr(s,F,z,I),Z=s||[],J=null!=H&&H,ee=null!=W?W:"right",{margin:te}=er({data:Z,colorBy:J?"value":void 0,colorScale:void 0,showLegend:J,legendPosition:ee,userMargin:l,defaults:a.marginDefaults}),{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=Zo({selection:M,linkedHover:L,fallbackFields:[],onObservation:_,onClick:T,chartType:"Heatmap",chartId:N,hoverHighlight:B,colorByField:void 0}),se=Jo(L,ae),le=tr($,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=Z.map(ue);return[Math.min(...e),Math.max(...e)]},[Z,ue]),he=n(()=>"custom"===y&&m?m:x({blues:P,reds:C,greens:j,viridis:S}[y]||P).domain(de),[y,m,de]);n(()=>{const e=Uo(d),t=Uo(h);return{xBinCount:new Set(Z.map(e)).size,yBinCount:new Set(Z.map(t)).size}},[Z,d,h]),n(()=>({coordinates:Z}),[Z]);const ge=n(()=>e=>{const t=ue(e);return{fill:he(t),stroke:k,strokeWidth:w}},[ue,he,k,w]);n(()=>Ho(ge,ce,M),[ge,ce,M]);const fe=n(()=>fr([{label:V||dr(d),accessor:d,role:"x"},{label:U||dr(h),accessor:h,role:"y"},{label:dr(g),accessor:g,role:"value"}]),[d,h,V,U,g]),pe=wr({componentName:"Heatmap",data:s,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ye=n(()=>{if(J)return{gradient:{colorFn:e=>he(e),domain:de,label:"string"==typeof g?g:"value",format:b}}},[J,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!=s&&{data:Z}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==y?y:void 0,showValues:v,heatmapValueFormat:b,size:[F,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:f,yFormat:p,enableHover:R}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),ye&&{legend:ye,legendPosition:ee}),G&&{title:G}),Y&&{description:Y}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),c&&{className:c}),{tooltipContent:!1===A?()=>null:ur(A)||fe}),(L||_||T||B)&&{customHoverBehavior:re}),(_||T||L)&&{customClickBehavior:ie}),O&&O.length>0&&{annotations:O}),se),E);return K||Q||(pe?e.createElement(yr,{componentName:"Heatmap",message:pe,width:F,height:z}):e.createElement(Gr,{componentName:"Heatmap",width:F,height:z},e.createElement(yo,Object.assign({ref:i},me))))});ci.displayName="Heatmap";const ui="__splomIdx",di={top:4,bottom:4,left:4,right:4};function hi({frameRef:n,cellSize:r,onBrush:i}){const a=t(null),s=r-di.left-di.right,l=r-di.top-di.bottom;return o(()=>{if(!a.current)return;const e=h(a.current).select(".brush-g"),t=p().extent([[0,0],[s,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,a],[s,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(a)],[o.x.invert(s),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)}},[s,l,n,i]),e.createElement("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${di.left},${di.top})`}))}function gi({data:n,xField:o,yField:r,cellSize:i,pointRadius:a,pointOpacity:s,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:f,onPointHover:p}){const y=t(null),m=jo({name:d,clientId:`splom-${o}-${r}`}),v=Po({name:d,xField:o,yField:r}),b=jo({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==p||p(null));const t=e.data,n=null==t?void 0:t[ui];void 0!==n&&(x({[ui]:[n]}),null==p||p(t,e.x+di.left,e.y+di.top))},[x,p]),A=l(e=>{const t={opacity:s,r:a};return t.fill=c?Ne(e,c,u):qo,"hover"===f?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*s):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,s,a,f,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:i,height:i}},e.createElement(yo,{ref:y,chartType:"scatter",data:n,size:[i,i],xAccessor:o,yAccessor:r,pointStyle:A,margin:di,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?w:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.createElement(hi,{frameRef:y,cellSize:i,xField:o,yField:r,onBrush:k}))}function fi({data:t,field:o,label:r,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=jo({name:c,clientId:"splom-diag-"+o}),g=jo({name:u,clientId:`splom-diag-${o}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.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)/a||1,l="string"==typeof s?s: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(a).fill(0),h=Array(a).fill(0),g=Array.from({length:a},()=>Array(c.length).fill(0)),f=Array.from({length:a},()=>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),a-1);if(d[i]++,p&&!y(e)||h[i]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[i][t]++,p&&!y(e)||f[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),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})}),b=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const r=e/m*(i-24),s={x:t/a*i,w:i/a-1,h:r,y0:n,category:c[o]};return n+=r,s})});return{bars:d.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),selectedBars:h.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/m*(i-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[t,o,a,i,p,y,s]);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):qo,opacity:p?.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:qo,opacity:p?.3:.6})),p&&(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):qo,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:qo,opacity:.7}))))}function pi({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 yi(t){const{data:o,fields:i,fieldLabels:a={},colorBy:s,colorScheme:c,cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:f="histogram",histogramBins:p=20,brushMode:y="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:k,idAccessor:w,className:A,onObservation:S,chartId:O}=t,E="splom",j="splom-hover",C=m?"hover":y?"brush":"hover",P=So(e=>e.clearSelection),[M,L]=r(null),_=l(()=>{P(j),L(null)},[P,j]),T=n(()=>(o||[]).map((e,t)=>void 0!==e[ui]?e:Object.assign(Object.assign({},e),{[ui]:t})),[o]),B=Ko(T,s,c),N=void 0!==k?k:!!s,D=n(()=>{if(!N||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:B?B(e+""):qo})):null},[N,s,T,B]),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"}},D&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},D.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?_: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"}},a[t]||t),i.map((o,r)=>n===r?"label"===f?e.createElement(pi,{key:"diag-"+t,label:a[t]||t,cellSize:u}):e.createElement(fi,{key:"diag-"+t,data:T,field:t,label:a[t]||t,cellSize:u,bins:p,colorBy:s,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,mode:C}):e.createElement(gi,{key:`cell-${t}-${o}`,data:T,xField:o,yField:t,fieldLabels:a,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:s,colorScale:B,brushSelectionName:E,hoverSelectionName:j,unselectedOpacity:v,showGrid:b,tooltip:x,mode:C,onPointHover:"hover"===C?(e,i,a)=>{e?(L({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=a?a:0}),S&&S({type:"hover",datum:e,x:null!=i?i:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O})):(L(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:O}))}: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"}},a[t]||t))),M&&"hover"===C&&(()=>{const t=M.datum,n=a[M.xField]||M.xField,o=a[M.yField]||M.yField,r=s?"function"==typeof s?s(t):t[s]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[ui];return e.createElement("div",{style:{position:"absolute",left:40+M.colIndex*(u+d)+M.px,top:M.rowIndex*(u+d)+M.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[M.xField]?Number(t[M.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[M.yField]?Number(t[M.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof s?s:"group",": ",r+""))})())}function mi(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(No,{selections:r},e.createElement(yi,Object.assign({},t)))}mi.displayName="ScatterplotMatrix";const vi=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 a=or(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:s,margin:l,className:c,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",xCenter:p,yCenter:y,quadrants:m,centerlineStyle:v={},showQuadrantLabels:b=!0,quadrantLabelSize:x=12,colorBy:k,colorScheme:w,sizeBy:A,sizeRange:S=[3,15],pointRadius:O=5,pointOpacity:E=.8,tooltip:j,pointIdAccessor:C,annotations:P,frameProps:M={},selection:L,linkedHover:_,onObservation:T,onClick:B,hoverHighlight:N,chartId:D,loading:I,emptyContent:H,legendInteraction:W,legendPosition:$,color:F}=o,z=a.width,R=a.height,G=a.enableHover,Y=a.showGrid,q=a.showLegend,X=a.title,V=a.description,U=a.summary,K=a.accessibleTable,Q=a.xLabel,Z=a.yLabel,J=Vr(I,z,R),ee=J?null:Xr(s,z,R,H),te=s||[];Ur("QuadrantChart",te,"xAccessor",g),Ur("QuadrantChart",te,"yAccessor",f);const{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:re,customClickBehavior:ie,crosshairSourceId:ae}=Zo({selection:L,linkedHover:_,fallbackFields:"string"==typeof k?[k]:[],onObservation:T,onClick:B,chartType:"QuadrantChart",chartId:D,hoverHighlight:N,colorByField:"string"==typeof k?k:void 0}),se=Jo(_,ae),le=Ko(te,k,w),ce=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]),ue=tr(W,k,ce),de=n(()=>oe||(ue.legendSelectionHook?ue.legendSelectionHook:ne),[oe,ue.legendSelectionHook,ne]),he=n(()=>{if(!te.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof f?f:e=>+e[f];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const a of te){const s=e(a),l=t(a);isFinite(s)&&(n>s&&(n=s),s>o&&(o=s)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=p&&isFinite(p)&&(n>p&&(n=p),p>o&&(o=p)),null!=y&&isFinite(y)&&(r>y&&(r=y),y>i&&(i=y)),n===1/0)return;const a=.1*(o-n)||1,s=.1*(i-r)||1;return{xExtent:[n-a,o+a],yExtent:[r-s,i+s]}},[te,g,f,p,y]),ge=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]),pe=n(()=>"function"==typeof f?f:e=>+e[f],[f]),ye=n(()=>e=>{const t={fillOpacity:E};if(k)le&&(t.fill=Ne(e,k,le));else{const n=fe(e),o=pe(e),r=null!=p?n>=p:void 0,i=null!=y?o>=y:void 0;t.fill=void 0===i||void 0===r?F||qo:i&&r?m.topRight.color:i&&!r?m.topLeft.color:!i&&r?m.bottomRight.color:m.bottomLeft.color}return t.r=A?Ie(e,A,S,ge):O,t},[k,le,A,S,ge,O,E,fe,pe,p,y,m,F]),me=n(()=>Ho(ye,de,L),[ye,de,L]),{legend:ve,margin:be,legendPosition:xe}=er({data:te,colorBy:k,colorScale:le,showLegend:q,legendPosition:$,userMargin:l,defaults:a.marginDefaults}),ke=n(()=>{if(!te.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof f&&e.add(f),"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,f,k,A]),we=n(()=>fr([...ke?[{label:ke,accessor:ke,role:"title"}]:[],{label:Q||dr(g),accessor:g,role:"x"},{label:Z||dr(f),accessor:f,role:"y"},...k?[{label:dr(k),accessor:k,role:"color"}]:[],...A?[{label:dr(A),accessor:A,role:"size"}]:[]]),[ke,g,f,Q,Z,k,A]),Ae=wr({componentName:"QuadrantChart",data:s,accessors:{xAccessor:g,yAccessor:f}}),Se=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 a=r.width,s=r.height,l=null!=p?o.x(p):a/2,c=null!=y?o.y(y):s/2;if(null!=p&&!isFinite(l))return;if(null!=y&&!isFinite(c))return;const u=Math.max(0,Math.min(a,l)),d=Math.max(0,Math.min(s,c)),h=[{config:m.topLeft,x:0,y:0,w:u,h:d},{config:m.topRight,x:u,y:0,w:a-u,h:d},{config:m.bottomLeft,x:0,y:d,w:u,h:s-d},{config:m.bottomRight,x:u,y:d,w:a-u,h:s-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,s),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(a,d),e.stroke(),e.setLineDash([])}]},[p,y,m,v]),Oe=n(()=>b?[...Se,(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,a=null!=p?n.x(p):r/2,s=null!=y?n.y(y):i/2;(null==p||isFinite(a))&&(null==y||isFinite(s))&&(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)}]:Se,[Se,b,x,m,p,y]),Ee=n(()=>{const e=M.canvasPreRenderers||[];return[...Oe,...e]},[Oe,M.canvasPreRenderers]),je=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,a=r.height,s=null!=p?o.x(p):i/2,l=null!=y?o.y(y):a/2;if(null!=p&&!isFinite(s))return null;if(null!=y&&!isFinite(l))return null;const c=Math.max(0,Math.min(i,s)),u=Math.max(0,Math.min(a,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:a-u},{config:m.bottomRight,x:c,y:u,w:i-c,h:a-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:a,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:a-8,fill:m.bottomLeft.color,fontWeight:600,fontSize:x,opacity:.5},m.bottomLeft.label),e.createElement("text",{x:i-8,y:a-8,fill:m.bottomRight.color,fontWeight:600,fontSize:x,opacity:.5,textAnchor:"end"},m.bottomRight.label)))}]},[p,y,m,v,b,x]),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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:te}),{xAccessor:g,yAccessor:f,colorAccessor:k||void 0,sizeAccessor:A||void 0,sizeRange:S,pointStyle:me,colorScheme:w,size:[z,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:be,showAxes:a.showAxes,xLabel:Q,yLabel:Z,xFormat:d,yFormat:h,enableHover:G,showGrid:Y}),he&&{xExtent:he.xExtent,yExtent:he.yExtent}),ve&&{legend:ve,legendPosition:xe}),W&&"none"!==W&&{legendHoverBehavior:ue.onLegendHover,legendClickBehavior:ue.onLegendClick,legendHighlightedCategory:ue.highlightedCategory,legendIsolatedCategories:ue.isolatedCategories}),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==K&&{accessibleTable:K}),c&&{className:c}),{tooltipContent:!1===j?()=>null:!0===j||void 0===j?we:ur(j)||we}),(_||T||B||N)&&{customHoverBehavior:re}),(T||B||_)&&{customClickBehavior:ie}),C&&{pointIdAccessor:C}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:Ee}),se),M),Ee.length>0&&{canvasPreRenderers:Ee}),{svgPreRenderers:je});return J||ee||(Ae?e.createElement(yr,{componentName:"QuadrantChart",message:Ae,width:z,height:R}):e.createElement(Gr,{componentName:"QuadrantChart",width:z,height:R},e.createElement(yo,Object.assign({ref:i},Ce))))});vi.displayName="QuadrantChart";const bi="__ma_unitized",xi="__ma_series";function ki(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function wi(e,t){return t[0]+e*(t[1]-t[0])}const Ai=c(function(o,r){var i,a;const s=t(null),l=t([]);u(r,()=>({push:e=>{if(!s.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)&&s.current.push(Object.assign(Object.assign({},t),{[bi]:ki(i,r),[xi]:n.label||"Series "+(e+1)}))}},pushMany:e=>{if(!s.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 a=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=a&&isFinite(a)&&t.push(Object.assign(Object.assign({},n),{[bi]:ki(a,i),[xi]:r.label||"Series "+(e+1)}))}s.current.pushMany(t)},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 c=or(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:f,xAccessor:p="x",series:y,colorScheme:m,curve:v="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:_}=o,T=c.width,B=c.height,N=c.enableHover,D=c.showGrid,I=null===(i=c.showLegend)||void 0===i||i,H=c.title,W=c.description,$=c.summary,F=c.accessibleTable,z=c.xLabel,R=2===y.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.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=Vr(P,T,B),Y=G?null:Xr(d,T,B,M),q=d||[],X=Xo(),V=n(()=>{let e;if(Array.isArray(m))e=m;else if(X&&X.length>0)e=X;else{const t=Me[m];e=Array.isArray(t)?t:Le}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:K,extents:Q}=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),{[bi]:r,[xi]: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),{[bi]:ki(i,e[o]),[xi]:U[o]}))}return{unitizedData:t,extents:e}},[q,y,R,U]),Z=n(()=>{if(R&&Q.length>=2)return[{orient:"left",label:U[0],tickFormat:y[0].format||(e=>{const t=wi(e,Q[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:U[1],tickFormat:y[1].format||(e=>{const t=wi(e,Q[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[R,Q,y,U]),J=ri({data:n(()=>K.length>0?K:U.map(e=>({[xi]:e})),[K,U]),rawData:d,colorBy:xi,colorScheme:V,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:[xi],unwrapData:!1,onObservation:O,onClick:E,hoverHighlight:j,chartType:"MultiAxisLineChart",chartId:C,showLegend:I,userMargin:h,marginDefaults:R?Object.assign(Object.assign({},c.marginDefaults),{left:70,right:70}):c.marginDefaults,loading:P,emptyContent:M,width:T,height:B});if(J.earlyReturn)return J.earlyReturn;const ee=n(()=>{const e=new Map;return U.forEach((t,n)=>e.set(t,V[n])),t=>({stroke:e.get(t[xi])||V[0],strokeWidth:b,fill:"none"})},[U,V,b]),te=n(()=>Ho(ee,J.effectiveSelectionHook,A),[ee,J.effectiveSelectionHook,A]),ne=n(()=>{if(!1===x)return()=>null;return ur(x)||(t=>{var n;const o=t.data||t,r=o[xi],i=U.indexOf(r),a=o[bi],s=R&&i>=0&&Q[i]?wi(a,Q[i]):a,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 p?p(o):o[p];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 p?p:"x"}: ${c}`),e.createElement("div",null,`${r}: ${l(s)}`))})},[x,U,V,Q,R,y,p]),oe=wr({componentName:"MultiAxisLineChart",data:d,accessors:{xAccessor:p}}),re=R?[0,1]:void 0,ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=d&&{data:K}),{xAccessor:p,yAccessor:bi,groupAccessor:xi,lineStyle:te,colorScheme:V,size:[T,B],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:c.showAxes}),Z&&{axes:Z}),{xLabel:z}),R?{}:{yLabel:U[0]}),{xFormat:f}),R&&re&&{yExtent:re}),{enableHover:N}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:D,curve:v}),J.legendBehaviorProps),H&&{title:H}),W&&{description:W}),$&&{summary:$}),void 0!==F&&{accessibleTable:F}),g&&{className:g}),{tooltipContent:ne}),k&&{annotations:k}),(S||O||E||j)&&{customHoverBehavior:J.customHoverBehavior}),(O||E||S)&&{customClickBehavior:J.customClickBehavior}),J.crosshairProps),w);return G||Y||(oe?e.createElement(yr,{componentName:"MultiAxisLineChart",message:oe,width:T,height:B}):e.createElement(Gr,{componentName:"MultiAxisLineChart",width:T,height:B},e.createElement(yo,Object.assign({ref:s},ie))))});function Si(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,u=r(e.pieceData[0],e.name);i.push(Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n},o.cornerRadius&&{cornerRadius:o.cornerRadius}),{style:u,datum:e.pieceData,category:e.name}))}return i}function Oi(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=B(e,.25))&&void 0!==t?t:i,median:null!==(n=B(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=B(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}Ai.displayName="MultiAxisLineChart";const Ei={bar:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,getStack:s,resolvePieceStyle:l}=e,{r:c,projection:u}=o,d=[],h="vertical"===u,g="horizontal"===u,f=i.normalize,p=[];if(s){const e=new Set;for(const t of Object.values(r))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(r)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=a(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of p){const a=t.get(i);if(!a)continue;let u=a.total;f&&n>0&&(u/=n);const p=l(a.pieces[0],s?i:e.name),y=Object.assign(Object.assign({},a.pieces[0]),{__aggregateValue:a.total,__pieceCount:a.pieces.length,category:e.name});if(h){const t=c(0>u?r:o+u),n=0>u?c(r+u)-c(r):c(o)-c(o+u);d.push(Ve(e.x,t,e.width,Math.abs(n),p,y,i)),0>u?r+=u:o+=u}else if(g){const t=c(0>u?r+u:o),n=0>u?c(r)-c(r+u):c(o+u)-c(o);d.push(Ve(t,e.x,Math.abs(n),e.width,p,y,i)),0>u?r+=u:o+=u}}}if(i.roundedTop&&i.roundedTop>0){const e=Math.max(0,i.roundedTop),t=new Map;for(const e of d){if("rect"!==e.type)continue;const o=(null===(n=e.datum)||void 0===n?void 0:n.category)||"";t.has(o)||t.set(o,[]),t.get(o).push(e)}const o="vertical"===u;for(const n of t.values()){if(0===n.length)continue;const t=n.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),r=n.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});if(t.length>0){const n=t.reduce(o?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t);n.roundedTop=e,n.roundedEdge=o?"top":"right"}if(r.length>0){const t=r.reduce(o?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t);t.roundedTop=e,t.roundedEdge=o?"bottom":"left"}}}return d},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=a?a(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let a=0;h.length>a;a++){const c=r.get(h[a])||[];for(const r of c){const c=i(r),g=s(r,h[a]);if(d){const i=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ve(i,Math.min(s,d),o,Math.abs(s-d),g,r,h[a]))}else{const i=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ve(Math.min(s,d),i,Math.abs(d-s),o,g,r,h[a]))}}}}if(r.roundedTop&&r.roundedTop>0){const e=Math.max(0,r.roundedTop);for(const t of u){if("rect"!==t.type)continue;const n=i(t.datum);t.roundedTop=e,t.roundedEdge=d?0>n?"bottom":"top":0>n?"left":"right"}}return u},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,f=s.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=f&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),f=c?a(s):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:o})}}return l},pie:Si,donut:Si,boxplot:function(e,t){var n,o,r,i,a;const{scales:s,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=s,f=[],p="vertical"===g,y=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const s=t[0],l=t[t.length-1],c=null!==(n=B(t,.25))&&void 0!==n?n:s,g=null!==(o=B(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=B(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,k=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:s,w=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:l,A=d(e.pieceData[0],e.name),S=[];if(y)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=p?e.middle:h(n),r=p?h(n):e.middle;S.push({px:o,py:r,value:n,datum:t})}}if(f.push({type:"boxplot",x:p?e.middle:0,y:p?0:e.middle,projection:p?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(k),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(w),stats:{n:t.length,min:k,q1:c,median:g,q3:m,max:w,mean:t.reduce((e,t)=>e+t,0)/t.length},style:A,datum:e.pieceData,category:e.name,outliers:S}),y)for(const e of S)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:A.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,f=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],s=(a-i)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),f-1)]++;const y=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(i)}`;for(let t=0;f>t;t++){const n=u(i+(t+.5)*s);v+=` L ${e.middle+d[t]/y*m} ${n}`}v+=` L ${e.middle} ${u(a)}`;for(let t=f-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${u(i)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${u(i+(t+.5)*s)} ${e.middle-d[t]/y*m}`;v+=` L ${u(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=B(t,.25))&&void 0!==n?n:i,l=null!==(o=B(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=B(t,.75))&&void 0!==r?r:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(i)),width:e.width,height:Math.abs(u(a)-u(i))}:{x:Math.min(u(i),u(a)),y:e.x,width:Math.abs(u(a)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:Oi(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l}=o,c=[],u=i.bins||25,d=i.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),r=(o-n)/u||1,i=Array(u).fill(0);for(const e of t)n>e||e>o||i[Math.min(Math.floor((e-n)/r),u-1)]++;const h=t.length,p=Math.max(...i,1),y=s(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===i[t])continue;const o=(d?i[t]/h:i[t]/p)*e.width*.9,a=l(n+t*r),s=l(n+(t+1)*r);c.push(Ve(Math.min(a,s),e.x+e.width-o,Math.abs(s-a),o,y,{bin:t,count:i[t],range:[n+t*r,n+(t+1)*r],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>r||c[Math.min(Math.floor((e-o)/i),d-1)]++;const f=Math.max(...c,1),p=s(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/f*y}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:Oi(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(Ve(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(Ve(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,i,a,s,l;const{columns:c,getR:u,getStack:d,resolvePieceStyle:h}=e,g=[],f=t.width/2,p=!1!==e.config.showLabels,y=e.scales.o.domain().map(e=>c[e]).filter(Boolean);if(0===y.length)return g;const v=[],b=new Set;for(const e of y)for(const t of e.pieceData){const e=d?d(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],k=[];let w=0;for(const e of y){const t=new Map;let n=0;for(const o of e.pieceData){const e=d?d(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=u(o);r.total+=i,r.pieces.push(o),n+=i}k.push({col:e,groups:t,stepTotal:n}),x||n>w&&(w=n)}if(x)for(const e of k){let t=0,n=0;for(let o=0;v.length>o;o++){const r=e.groups.get(v[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>w&&(w=o)}if(0===w)return g;const A=new Map;for(const e of v){const t=k[0].groups.get(e);A.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=k[0].stepTotal,O=x?.95*f:.9*t.width,E=m().domain([0,w]).range([0,O]),j=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let C=new Map;for(let e=0;k.length>e;e++){const t=k[e],n=t.col,o=0===e,c=n.width,u=.55*c,d=n.x+(c-u)/2,y=new Map;if(x){let e=0;for(const n of v){const o=t.groups.get(n);o&&(e+=E(o.total))}let r=f,i=f;for(let s=0;v.length>s;s++){const l=v[s],c=t.groups.get(l);if(!c)continue;const m=E(c.total),b=s%2==0,x=b?r:i-m;b?r+=m:i-=m;const k=h(c.pieces[0],l),w=null!==(a=A.get(l))&&void 0!==a?a:c.total,S=w>0?c.total/w*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:S,__funnelStep:n.name,__funnelIsFirstStep:o,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});p&&(0===s&&(O.__funnelStepLabel=n.name,O.__funnelStepLabelX=f,O.__funnelStepLabelY=d,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+m/2,O.__funnelValueLabelY=d,O.__funnelBarW=m),g.push(Ve(x,d,m,u,k,O,l)),y.set(l,{x:x,y:d,w:m,h:u})}}else{const e=t.stepTotal,a=E(e),s=f-a/2,l=v[0],c="_default"!==l,m=null!==(i=null===(r=t.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==i?i:n.pieceData[0],b=c?l:n.name,x=h(m,b),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},m),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:o,category:c?l:n.name});p&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=f,w.__funnelStepLabelY=d,w.__funnelRowWidth=a,w.__funnelValueLabelX=f,w.__funnelValueLabelY=d,w.__funnelBarW=a),g.push(Ve(s,d,a,u,x,w,b)),y.set(l,{x:s,y:d,w:a,h:u})}if(e>0&&C.size>0){const e=x?v:[v[0]];for(const o of e){const e=C.get(o),r=y.get(o);if(!e||!r)continue;const i=(()=>{const e=t.groups.get(o);return h(e?e.pieces[0]:n.pieceData[0],"_default"===o?n.name:o)})(),a={type:"trapezoid",points:[[e.x,e.y+e.h],[e.x+e.w,e.y+e.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:i.fill||"#999",opacity:j},datum:null!==(l=null===(s=t.groups.get(o))||void 0===s?void 0:s.pieces[0])&&void 0!==l?l:n.pieceData[0],category:"_default"===o?n.name:o};g.push(a)}}C=y}return g},"bar-funnel":function(e,t){var n,o,r,i;const{columns:a,getR:s,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>a[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e),i=s(o);r.total+=i,r.pieces.push(o),n+=i}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,a=e>0?y[e-1]:null,s=n.width/b,l=s*x,u=s-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(r=m.get(h))&&void 0!==r?r:y,x=b>0?y/b*100:0,k=null==a?void 0:a.groups.get(h),w=null!==(i=null==k?void 0:k.total)&&void 0!==i?i:y,A=o?0:Math.max(0,w-y),S=n.x+e*s+l/2,O=v(y),E=v(0)-O,j=c(f.pieces[0],p?h:n.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:v(y+A)});if(d.push(Ve(S,O,u,E,j,C,p?h:n.name)),A>0){const e=v(y+A),t=O-e,o=Object.assign({},j),r=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(Ve(S,e,u,t,o,r,p?h:n.name))}}}return d},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="horizontal"===l;for(const e of Object.values(o)){let t=0;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,d=a(n,l);if(u){const r=s(t),i=s(t+o);c.push(Ve(r,e.x,i-r,e.width,d,n,l))}else{const r=s(t+o),i=s(t);c.push(Ve(e.x,r,e.width,i-r,d,n,l))}t+=o}}return c}};class ji{constructor(e){this.rExtent=new Se,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new Ae(e.windowSize),this.getO=Pe(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new Se)):(this.getR=je(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Pe(e.stackBy),this.getGroup=Pe(e.groupBy),this.getColor=Pe(e.colorAccessor),this.getConnector=Pe(e.connectorAccessor),this.getDataId=Pe(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Ae(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,i),s="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=k().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(a).range([o,n])}else s?(c=k().domain(i).range([0,e.height]).padding(l),u=m().domain(a).range([0,e.width])):(c=k().domain(i).range([0,e.width]).padding(l),u=m().domain(a).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{var i;const a=this.rExtents[r];a.dirty&&a.recalculate(n,o);let[l,c]=a.extent;l===1/0&&(l=0,c=1);const u=null!==(i=t.extentPadding)&&void 0!==i?i:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),s?m().domain([l,c]).range([0,e.width]):m().domain([l,c]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if(("streaming"===this.config.runtimeMode||this._hasStreamingData)&&void 0===n){const n=new Set;for(const t of e)n.add(this.getO(t));const o=Math.max(50,3*n.size);if(this.categories.size>o){let e=this.categories.size-o;for(const t of this.categories){if(0>=e)break;n.has(t)||(this.categories.delete(t),e--)}}return t.filter(e=>n.has(e))}if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o,r,i,a;const s=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let c=0,u=0;if("bar"===s&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===s||"bar-funnel"===s)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===s||"clusterbar"===s||"bar-funnel"===s||"swimlane"===s;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(r=this.config.rExtent)||void 0===r?void 0:r[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==s){const e=u-c,t=e>0?e*l:1;null!=(null===(i=this.config.rExtent)||void 0===i?void 0:i[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(a=this.config.rExtent)||void 0===a?void 0:a[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===s||(u+=t)}return[c,u]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=Ei[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:_e,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?He(n,e,t):1}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;let o=0;for(let n=0;t.length>n;n++){const r=t[n],s=this.config.oAccessor;if(("function"==typeof s?s(r):r[s||"category"])!==e)continue;const l=this.timestampBuffer.get(n);if(null==l)continue;const c=i-l;if(a>c){const e=1-c/a;e>o&&(o=e)}}o>0&&(n._pulseIntensity=o,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const r=i-o;a>r&&(n._pulseIntensity=1-r/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}getNodeKey(e,t){var n,o;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type&&this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}))}}startTransition(){var e,t,n,o,r,i,a,s,l,c,u,d;if(!this.config.transition||0===this.prevPositionMap.size)return;const h=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let g=!1;const f=new Set,p=new Map;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeKey(s,p);if(!l)continue;s._transitionKey=l;const c=this.prevPositionMap.get(l);"point"===s.type?c?(f.add(l),s._targetOpacity=null!==(t=s.style.opacity)&&void 0!==t?t:1,c.x===s.x&&c.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=c.x,s.y=c.y,g=!0)):(s._targetOpacity=null!==(n=s.style.opacity)&&void 0!==n?n:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0):"rect"===s.type&&(c?(f.add(l),s._targetOpacity=null!==(o=s.style.opacity)&&void 0!==o?o:1,c.x===s.x&&c.y===s.y&&c.w===s.w&&c.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,g=!0)):(s._targetOpacity=null!==(a=s.style.opacity)&&void 0!==a?a:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),g=!0))}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)f.has(e)||(e.startsWith("p:")?this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(s=t.r)&&void 0!==s?s:3,style:{opacity:null!==(l=t.opacity)&&void 0!==l?l:1},datum:null,_targetOpacity:0,_transitionKey:e}):e.startsWith("r:")&&this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(c=t.w)&&void 0!==c?c:0,h:null!==(u=t.h)&&void 0!==u?u:0,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e}),g=!0);this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),g&&(this.activeTransition={startTime:Re(),duration:h})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Fe(e,this.activeTransition),i=$e(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),r=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=ze(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=ze(o.x,e._targetX,i),e.y=ze(o.y,e._targetY,i)}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),r=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=ze(r,e._targetOpacity,i)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=ze(n.x,e._targetX,i),e.y=ze(n.y,e._targetY,i),void 0!==n.w&&(e.w=ze(n.w,e._targetW,i),e.h=ze(n.h,e._targetH,i))}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const r=this.buffer.remove(o);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this.version++,r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,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.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this.version++,i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e),(void 0!==e.oAccessor||void 0!==e.categoryAccessor)&&(Ee(e.oAccessor||e.categoryAccessor,t.oAccessor||t.categoryAccessor)||(this.getO=Pe(this.config.oAccessor||this.config.categoryAccessor,"category"),this.categories.clear())),void 0!==e.rAccessor){const n=Array.isArray(e.rAccessor)?e.rAccessor:[e.rAccessor],o=Array.isArray(t.rAccessor)?t.rAccessor:[t.rAccessor];if(n.length!==o.length||n.some((e,t)=>!Ee(e,o[t]))){const e=this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>je(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Se)):(this.getR=je(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Ee(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Pe(this.config.stackBy):void 0),"groupBy"in e&&!Ee(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Pe(this.config.groupBy):void 0),"colorAccessor"in e&&!Ee(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Ee(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Pe(this.config.connectorAccessor):void 0)}}function Ci(e,t,n){const o=tt(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function Pi(e,t,n,o=30){const r=t-e.x,i=n-e.y,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function Mi(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Li(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function _i(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}function Ti(t){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,showGrid:u,rFormat:d}=t,{rTickValues:h}=t,g="radial"===(null==l?void 0:l.projection),f="horizontal"===(null==l?void 0:l.projection),p=n(()=>!l||g?[]:(h||l.r.ticks(5)).map(e=>({value:e,pixel:l.r(e),label:(d||Bi)(e)})),[l,d,g,h]),y=u&&l&&!g,m=c&&l&&!g;return y||m?e.createElement("svg",{width:i,height:a,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&e.createElement("g",{className:"ordinal-grid"},p.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:f?t.pixel:0,y1:f?0:t.pixel,x2:f?t.pixel:o,y2:f?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),m&&e.createElement(e.Fragment,null,f?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}))))):null}function Bi(e){return Math.round(100*e)/100+""}function Ni(o){var r,i;const{width:a,height:s,totalWidth:l,totalHeight:c,margin:u,scales:d,showAxes:h,showCategoryTicks:g,oLabel:f,rLabel:p,oFormat:y,rFormat:m,showGrid:v,title:b,legend:x,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S,legendPosition:O="right",foregroundGraphics:E,annotations:j,svgAnnotationRules:C,xAccessor:P,yAccessor:M,annotationData:L,underlayRendered:_,children:T}=o,B="radial"===(null==d?void 0:d.projection),N="horizontal"===(null==d?void 0:d.projection),D=!1!==g,I=n(()=>h&&D&&d&&!B?d.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=d.o(e))&&void 0!==n?n:0)+d.o.bandwidth()/2,label:y?y(e,t):e}}):[],[h,D,d,y,B]),H=o.rTickValues,W=o.tickLabelEdgeAlign,$=n(()=>h&&d&&!B?(H||d.r.ticks(5)).map(e=>({value:e,pixel:d.r(e),label:(m||Bi)(e)})):[],[h,d,m,B,H]),F=t(new Map),z=t(null!==(r=null==j?void 0:j.length)&&void 0!==r?r:0),R=null!==(i=null==j?void 0:j.length)&&void 0!==i?i:0;z.current!==R&&(z.current=R,F.current=new Map);const G=n(()=>{if(!j||0===j.length)return null;const e=Ft(),t="horizontal"===(null==d?void 0:d.projection),n=(null==d?void 0:d.o)?e=>{var t;return(null!==(t=d.o(e))&&void 0!==t?t:0)+d.o.bandwidth()/2}:null,o={scales:d?{x:t?d.r:n||d.r,y:t&&n||d.r,time:d.r,value:d.r,o:d.o}:null,timeAxis:"x",xAccessor:P,yAccessor:M,width:a,height:s,data:L,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:F.current};return j.map((t,n)=>{if(C){const r=C(t,n,o);return null!=r?r:e(t,n,o)}return e(t,n,o)}).filter(Boolean)},[j,C,a,s,d,P,M,L]);return h||b||x||E||G&&G.length>0||v||T?e.createElement("svg",{role:"img",width:l,height:c,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"}},e.createElement("title",null,"string"==typeof b?b:"Ordinal Chart"),e.createElement("desc",null,"string"==typeof b?b+" — ordinal data visualization":"Ordinal data visualization"),e.createElement("g",{transform:`translate(${u.left},${u.top})`},v&&d&&!B&&!_&&e.createElement("g",{className:"ordinal-grid"},$.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:N?t.pixel:0,y1:N?0:t.pixel,x2:N?t.pixel:a,y2:N?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),h&&d&&!B&&e.createElement("g",{className:"ordinal-axes"},N?e.createElement(e.Fragment,null,!_&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),I.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",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)))),f&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},f),!_&&e.createElement("line",{x1:0,y1:s,x2:a,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!_&&(null==d?void 0:d.r)&&(()=>{const t=d.r(0);return t>1&&a-1>t?e.createElement("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),$.map((t,n)=>{const o=W?0===n?"start":n===$.length-1?"end":"middle":"middle";return e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:o,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))}),p&&e.createElement("text",{x:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},p)):e.createElement(e.Fragment,null,!_&&(()=>{const t=(null==d?void 0:d.r)?d.r(0):s,n=0>t||t>s?s:t;return e.createElement("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),I.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${s})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},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:a/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},f),!_&&e.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),p&&e.createElement("text",{x:15-u.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-u.left}, ${s/2})`,style:{userSelect:"none"}},p))),G,E,T),b&&e.createElement("text",{x:l/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof b?b:null),Pt({legend:x,totalWidth:l,totalHeight:c,margin:u,legendPosition:O,title:b,legendHoverBehavior:k,legendClickBehavior:w,legendHighlightedCategory:A,legendIsolatedCategories:S})):null}function Di({width:n,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,onBrush:c}){const u=t(null),d=t(null),p=t(c);p.current=c;const y=t(l);y.current=l;const m=t(!1),v=t(null),b="horizontal"===(null==l?void 0:l.projection),x=t(b);return x.current=b,o(()=>{if(!u.current)return;const e=h(u.current).select(".brush-g"),t=b?g():f();return t.extent([[0,0],[n,r]]),t.on("brush end",e=>{if(m.current)return;const t=y.current;if(!t)return;if(!e.selection)return v.current=null,void p.current(null);const[n,o]=e.selection;let r;r=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};v.current=i,p.current(i)}),e.call(t),d.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),d.current=null}},[n,r,b]),o(()=>{if(!l||!d.current||!v.current)return;if(!u.current)return;const e=v.current,t=h(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(m.current=!0,t.call(d.current.move,[n,o]),m.current=!1):(m.current=!0,t.call(d.current.move,[o,n]),m.current=!1)},[l,b]),e.createElement("svg",{ref:u,width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}}))}function Ii(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Hi(e,t){const n=ie().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2).cornerRadius(t.cornerRadius)({});if(!n)return;e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}const Wi=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"wedge"===e.type);for(const t of a)e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:1,e.fillStyle=("string"==typeof t.style.fill?zn(e,t.style.fill):t.style.fill)||"#007bff",t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Hi(e,t)):(Ii(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())),t._pulseIntensity&&t._pulseIntensity>0&&(Ii(e,t),Qn(e,t)),e.globalAlpha=1},$i=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6,e.fillStyle=("string"==typeof t.style.fill?zn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=zn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Fi=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=zn(e,n.style.stroke)||("string"==typeof n.style.fill?zn(e,n.style.fill):n.style.fill)||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}};function zi(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Ri(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Gi=null;const Yi=new Map;function qi(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Yi.get(n);if(void 0!==o)return o;const r=function(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Gi||(Gi=document.createElement("canvas")),Gi.width=e,Gi.height=e,Gi)}(s)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Yi.set(n,r),r}function Xi(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Vi(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Ui(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Ki=e=>[Fi,...e],Qi={bar:Ki([oo]),clusterbar:Ki([oo]),point:Ki([no]),swarm:Ki([no]),pie:[Wi],donut:[Wi],boxplot:Ki([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},no]),violin:Ki([$i]),histogram:Ki([oo]),ridgeline:Ki([$i]),timeline:Ki([oo]),funnel:[oo,(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(i=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==i?i:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(a=t.style)||void 0===a?void 0:a.fill)||"#999",e.fill(),(null===(s=t.style)||void 0===s?void 0:s.stroke)&&(e.strokeStyle=zn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}},(e,t,n,o)=>{var r,i,a,s;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>null!=e.datum.__funnelStepLabel||null!=e.datum.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(i=null!==(r=n.__funnelRowWidth)&&void 0!==r?r:n.__funnelBarW)&&void 0!==i?i:0))continue;const a=n.__funnelStepLabelX,s=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,a,s),e.fillStyle="#fff",e.fillText(o,a,s)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(null==n.__funnelValueLabelX)continue;const o=null!==(a=n.__funnelBarW)&&void 0!==a?a:0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?zi(r):null!=i?`${zi(r)} (${Ri(i)})`:zi(r),e.measureText(c).width+16>o){if(l||null==i)continue;if(c=zi(r),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(s=n.__funnelValueLabelY)&&void 0!==s?s:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[oo,(e,t,n,o)=>{var r,i;const a=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of a){const n="string"==typeof t.style.fill?t.style.fill:"#999",o=qi(n,e);e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(i=t.style.opacity)&&void 0!==i?i:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0!==r.length){for(const t of r){const n=t.datum,o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,a=i?Ui(r):"",s=Vi(o);e.font="bold 13px sans-serif";const l=i?e.measureText(a).width:0;e.font="11px sans-serif";const c=e.measureText(s).width,u=Math.max(l,c)+12,d=i?32:17,h=n.__barFunnelLabelX,g=h-u/2,f=n.__barFunnelLabelY-d-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle="rgba(255,255,255,0.95)",e.beginPath(),Xi(e,g,f,u,d,4),e.fill(),e.restore(),e.strokeStyle="rgba(0,0,0,0.12)",e.lineWidth=.5,e.beginPath(),Xi(e,g,f,u,d,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle="#333",e.fillText(a,h,f+3),e.font="11px sans-serif",e.fillStyle="#666",e.fillText(s,h,f+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle="#333",e.fillText(s,h,f+3))}e.lineWidth=1}}],swimlane:Ki([oo])},Zi={top:50,right:40,bottom:60,left:70},Ji={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function ea({hover:t}){var n,o,r,i,a,s;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.createElement("div",{className:"semiotic-tooltip",style:Ji},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",c.n),e.createElement("div",null,"Min: ",c.min.toLocaleString()),e.createElement("div",null,"Q1: ",c.q1.toLocaleString()),e.createElement("div",null,"Median: ",c.median.toLocaleString()),e.createElement("div",null,"Q3: ",c.q3.toLocaleString()),e.createElement("div",null,"Max: ",c.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=l.length;return e.createElement("div",{className:"semiotic-tooltip",style:Ji},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:Ji},l.category&&e.createElement("div",{style:{fontWeight:"bold"}},l.category+""),e.createElement("div",null,"Count: ",l.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Ji},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(s=null!==(a=null!==(i=null!==(r=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==r?r:l.value)&&void 0!==i?i:l.__rValue)&&void 0!==a?a:l.pct)&&void 0!==s?s:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:Ji},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:Ji},f&&e.createElement("div",{style:{fontWeight:"bold"}},f+""),""!==p&&e.createElement("div",null,"number"==typeof p?p.toLocaleString():p+""))}const ta=c(function(i,a){var s,c,d,h,g,f,p,y,m,v;const{chartType:b,runtimeMode:x,data:k,oAccessor:w="category",rAccessor:A="value",colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:C,valueAccessor:P,categoryAccessor:M,projection:L="vertical",size:_=[600,400],responsiveWidth:T,responsiveHeight:B,margin:N,barPadding:D,roundedTop:I,baselinePadding:H,innerRadius:W,cornerRadius:$,normalize:F,startAngle:z,sweepAngle:R,dynamicColumnWidth:G,bins:Y,showOutliers:q,showIQR:X,amplitude:V,connectorOpacity:U,showLabels:K,connectorAccessor:Q,connectorStyle:Z,dataIdAccessor:J,rExtent:ee,oExtent:te,extentPadding:ne=.05,oSort:oe,windowMode:re="sliding",windowSize:ae=200,pieceStyle:se,summaryStyle:le,colorScheme:ce,barColors:ue,showAxes:de=!0,showCategoryTicks:he,oLabel:ge,rLabel:fe,oFormat:pe,rFormat:ye,rTickValues:me,tickLabelEdgeAlign:ve,enableHover:be=!0,hoverAnnotation:xe,tooltipContent:ke,customHoverBehavior:Ae,annotations:Se,svgAnnotationRules:Oe,showGrid:Ee=!1,legend:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:Le,legendPosition:_e,backgroundGraphics:Te,foregroundGraphics:Be,title:Ne,className:De,background:Ie,centerContent:He,decay:We,pulse:$e,transition:Fe,staleness:ze,brush:Re,onBrush:Ge,accessibleTable:Ye=!0,description:qe,summary:Xe}=i,Ve=Mn(),Ue=t(Ve);Ue.current=Ve;const[Ke,Qe]=kt(_,T,B),Ze=n(()=>Object.assign(Object.assign({},Zi),N),[N]),Je=Qe[0]-Ze.left-Ze.right,et=Qe[1]-Ze.top-Ze.bottom,tt="function"==typeof Be?Be({size:Qe,margin:Ze}):Be,nt=t(null),ot=t(!0),rt=In(e=>e.theme),it=t(0),at=t(null),st=t(()=>{}),[lt,ct]=r(null),[ut,dt]=r(null),[ht,gt]=r(0),[ft,pt]=r(!1),bt=be||xe,At="streaming"===x,St=n(()=>({chartType:b,runtimeMode:At?"streaming":"bounded",windowSize:ae,windowMode:re,extentPadding:ne,projection:L,oAccessor:At?void 0:w,rAccessor:At?void 0:A,colorAccessor:S,stackBy:O,groupBy:E,multiAxis:j,timeAccessor:At?C:void 0,valueAccessor:At?P||("string"==typeof A||"function"==typeof A?A:void 0):void 0,categoryAccessor:At?M||w:void 0,rExtent:ee,oExtent:te,barPadding:D,roundedTop:I,baselinePadding:H,innerRadius:W,cornerRadius:$,normalize:F,startAngle:z,sweepAngle:R,dynamicColumnWidth:G,bins:Y,showOutliers:q,showIQR:X,amplitude:V,connectorOpacity:U,showLabels:K,connectorAccessor:Q,connectorStyle:Z,dataIdAccessor:J,oSort:oe,pieceStyle:se,summaryStyle:le,colorScheme:ce,barColors:ue,decay:We,pulse:$e,transition:Fe,staleness:ze}),[b,ae,re,ne,L,w,A,S,O,E,j,C,P,M,ee,te,D,I,H,W,$,F,z,R,G,Y,q,X,V,U,K,Q,Z,J,oe,se,le,ce,ue,We,$e,Fe,ze,At]),Ot=t(null);Ot.current||(Ot.current=new ji(St));const Et=l(()=>{it.current||(it.current=requestAnimationFrame(()=>st.current()))},[]);o(()=>{var e;null===(e=Ot.current)||void 0===e||e.updateConfig(St),ot.current=!0,Et()},[St,Et]),o(()=>{nt.current&&Rn(nt.current),ot.current=!0,Et()},[rt,Et]);const jt=t(null);jt.current||(jt.current=new we(e=>{const t=Ot.current;t&&t.ingest(e)&&(ot.current=!0,Et())}));const Ct=l(e=>{var t;null===(t=jt.current)||void 0===t||t.push(e)},[]),Pt=l(e=>{var t;null===(t=jt.current)||void 0===t||t.pushMany(e)},[]),Mt=l(()=>{var e,t;null===(e=jt.current)||void 0===e||e.clear(),null===(t=Ot.current)||void 0===t||t.clear(),ot.current=!0,Et()},[Et]);u(a,()=>({push:Ct,pushMany:Pt,remove:e=>{var t,n,o,r;null===(t=jt.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Ot.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(i.length>0){const e=null===(r=at.current)||void 0===r?void 0:r.data;!!at.current&&i.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(at.current=null,ct(null)),ot.current=!0,Et()}return i},update:(e,t)=>{var n,o,r;null===(n=jt.current)||void 0===n||n.flush();const i=null!==(r=null===(o=Ot.current)||void 0===o?void 0:o.update(e,t))&&void 0!==r?r:[];return i.length>0&&(ot.current=!0,Et()),i},clear:Mt,getData:()=>{var e,t,n;return null===(e=jt.current)||void 0===e||e.flush(),null!==(n=null===(t=Ot.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Ot.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Ct,Pt,Mt,Et]),o(()=>{var e;k&&(null===(e=jt.current)||void 0===e||e.setBoundedData(k))},[k]);const Lt=t(()=>{}),_t=t(()=>{});Lt.current=e=>{if(!bt)return;const t=nt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ze.left,r=e.clientY-n.top-Ze.top;if(0>o||o>Je||0>r||r>et)return void(at.current&&(at.current=null,ct(null),Ae&&Ae(null),Et()));const i=Ot.current;if(!i||0===i.scene.length)return;const a="radial"===L,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=Ci(i,t,n);break;case"point":e=Pi(i,t,n,o);break;case"wedge":e=Mi(i,t,n);break;case"boxplot":e=Li(i,t,n);break;case"violin":e=_i(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-Je/2:o,a?r-et/2:r);if(!s)return void(at.current&&(at.current=null,ct(null),Ae&&Ae(null),Et()));const l=io(s.datum||{},s.x,s.y,Object.assign(Object.assign(Object.assign({},s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b}));at.current=l,ct(l),Ae&&(Ae(l),ot.current=!0),Et()},_t.current=()=>{at.current&&(at.current=null,ct(null),Ae&&(Ae(null),ot.current=!0),Et())},l(e=>Lt.current(e),[]);const Tt=l(()=>_t.current(),[]),Bt=t(-1),Nt=t(null),Dt=t(null),It=l(e=>{const t=Ot.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Dt.current&&Dt.current.version===n)o=Dt.current.graph;else{const e=function(e){var t,n,o,r;const i=[];for(const a of e)if("rect"===a.type&&null!=a.x){const e=null!==(n=null===(t=a.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:a.x+a.w/2,y:a.y+a.h/2,datum:a.datum,shape:"rect",w:a.w,h:a.h,group:null!==(o=a.group)&&void 0!==o?o:e})}else if("point"===a.type)i.push({x:a.x,y:a.y,datum:a.datum,shape:"circle",group:null!==(r=a.group)&&void 0!==r?r:"_default"});else if("wedge"===a.type&&null!=a.cx){const e=((a.startAngle||0)+(a.endAngle||0))/2,t=((a.innerRadius||0)+(a.outerRadius||50))/2;i.push({x:a.cx+Math.cos(e)*t,y:a.cy+Math.sin(e)*t,datum:a.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=yt(e),Dt.current={version:n,graph:o}}const r=Bt.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Bt.current=0;const t=o.flat[0];Nt.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},xt(t)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});return at.current=n,ct(n),Ae&&Ae(n),void Et()}const i=mt(o,r),a=vt(e.key,i,o);if(null===a)return;if(e.preventDefault(),0>a)return Bt.current=-1,Nt.current=null,at.current=null,ct(null),Ae&&Ae(null),void Et();Bt.current=a;const s=o.flat[a];Nt.current={shape:s.shape,w:s.w,h:s.h};const l=Object.assign(Object.assign({},xt(s)),{__oAccessor:"string"==typeof w?w:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:b});at.current=l,ct(l),Ae&&Ae(l),Et()},[Ae,Et]),Ht=l(e=>{Bt.current=-1,Nt.current=null,Lt.current(e)},[]);st.current=()=>{var e,t;it.current=0;const n=nt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Ot.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(Ue.current?i+1e6:i),s=!Ue.current&&a,l=ot.current;l&&!a&&(r.computeScene({width:Je,height:et}),ot.current=!1),(l||s)&&n.setAttribute("aria-label",dn(r.scene,b+" chart"));const c=Wn(),u=Qe[0]*c,d=Qe[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=Qe[0]+"px",n.style.height=Qe[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Qe[0],Qe[1]);const h=null!==(e=null==ze?void 0:ze.threshold)&&void 0!==e?e:5e3,g=ze&&r.lastIngestTime>0&&i-r.lastIngestTime>h;g&&(o.globalAlpha=null!==(t=null==ze?void 0:ze.dimOpacity)&&void 0!==t?t:.5);const f=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",p=Ie||(f&&"transparent"!==f?f:null);p&&(o.fillStyle=p,o.fillRect(0,0,Qe[0],Qe[1]));const y="radial"===L;o.save(),o.beginPath(),o.rect(Ze.left,Ze.top,Je,et),o.clip(),y?(o.save(),o.translate(Ze.left+Je/2,Ze.top+et/2)):o.translate(Ze.left,Ze.top);const m=Qi[b]||[],v={width:Je,height:et};for(const e of m)e(o,r.scene,r.scales,v);y&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&r.scales&&(dt(r.scales),gt(e=>e+1)),(null==ze?void 0:ze.showBadge)&&pt(!!g),(s||r.hasActivePulses)&&(it.current=requestAnimationFrame(()=>st.current()))},o(()=>(Et(),()=>{it.current&&(cancelAnimationFrame(it.current),it.current=0)}),[Et]),o(()=>{ot.current=!0,Et()},[b,Je,et,de,Ie,Et]),wt(ze,Ot,ot,Et,ft,pt);const Wt=bt&&lt?ke?ke(lt):e.createElement(ea,{hover:lt}):null,$t="radial"===L,Ft=Wt?e.createElement(Cn,{x:lt?$t?lt.x+Je/2:lt.x:0,y:lt?$t?lt.y+et/2:lt.y:0,containerWidth:Je,containerHeight:et,margin:Ze,className:"stream-ordinal-tooltip"},Wt):null;if(an){const t=Ot.current;t&&k&&(t.ingest({inserts:k,bounded:!0}),t.computeScene({width:Je,height:et}));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="radial"===L,i=r?Ze.left+Je/2:Ze.left,a=r?Ze.top+et/2:Ze.top;return e.createElement("div",{className:"stream-ordinal-frame"+(De?" "+De:""),role:"img","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:Qe[0],height:Qe[1]}},e.createElement(An,{summary:Xe}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:Qe[0],height:Qe[1],style:{position:"absolute",left:0,top:0}},Te&&e.createElement("g",{transform:`translate(${Ze.left},${Ze.top})`},Te),e.createElement("g",{transform:`translate(${i},${a})`},Ie&&e.createElement("rect",{x:0,y:0,width:Je,height:et,fill:Ie}),n.map((t,n)=>function(t,n){var o,r,i,a,s;const l=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",c=e=>`ord-${t.type}-${l}-${n}-${e}`,u=`ord-${t.type}-${l}-${n}`;switch(t.type){case"rect":{const n=t;if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:r,w:i,h:a}=n;let s;switch(n.roundedEdge){case"right":s=`M${o},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+a-t} A${t},${t} 0 0 1 ${o+i-t},${r+a} L${o},${r+a} Z`;break;case"left":s=`M${o+i},${r} L${o+t},${r} A${t},${t} 0 0 0 ${o},${r+t} L${o},${r+a-t} A${t},${t} 0 0 0 ${o+t},${r+a} L${o+i},${r+a} Z`;break;case"bottom":s=`M${o},${r} L${o+i},${r} L${o+i},${r+a-t} A${t},${t} 0 0 1 ${o+i-t},${r+a} L${o+t},${r+a} A${t},${t} 0 0 1 ${o},${r+a-t} Z`;break;default:s=`M${o},${r+a} L${o},${r+t} A${t},${t} 0 0 1 ${o+t},${r} L${o+i-t},${r} A${t},${t} 0 0 1 ${o+i},${r+t} L${o+i},${r+a} Z`}return e.createElement("path",{key:u,d:s,fill:rn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}return e.createElement("rect",{key:u,x:n.x,y:n.y,width:n.w,height:n.h,fill:rn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"point":{const n=t;return e.createElement("circle",{key:u,cx:n.x,cy:n.y,r:n.r,fill:rn(n.style.fill),opacity:null!==(o=n.style.opacity)&&void 0!==o?o:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}case"wedge":{const n=t,o=ie().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&o.cornerRadius(n.cornerRadius);const r=o({})||"";return e.createElement("path",{key:u,d:r,transform:`translate(${n.cx},${n.cy})`,fill:rn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})}case"boxplot":{const n=t,o=n.columnWidth/2;return"vertical"===n.projection?e.createElement("g",{key:u},e.createElement("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:rn(n.style.fill),fillOpacity:null!==(r=n.style.fillOpacity)&&void 0!==r?r:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})):e.createElement("g",{key:u},e.createElement("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:rn(n.style.fill),fillOpacity:null!==(i=n.style.fillOpacity)&&void 0!==i?i:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.createElement("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}))}case"violin":{const n=t,o=[e.createElement("path",{key:c("path"),d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:rn(n.style.fill),fillOpacity:null!==(a=n.style.fillOpacity)&&void 0!==a?a:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1})];if(n.iqrLine&&n.bounds){const t=n.bounds,r=t.x+t.width/2,i=t.y+t.height/2;t.height>t.width?o.push(e.createElement("line",{key:c("iqr"),x1:r,y1:n.iqrLine.q1Pos,x2:r,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:r,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1})):o.push(e.createElement("line",{key:c("iqr"),x1:n.iqrLine.q1Pos,y1:i,x2:n.iqrLine.q3Pos,y2:i,stroke:n.style.stroke||"#333",strokeWidth:2}),e.createElement("circle",{key:c("med"),cx:n.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1}))}return e.createElement("g",{key:u},o)}case"connector":return e.createElement("line",{key:u,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.5});case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.createElement("polygon",{key:u,points:o,fill:rn(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})}default:return null}}(t,n)).filter(Boolean))),e.createElement(Ni,{width:Je,height:et,totalWidth:Qe[0],totalHeight:Qe[1],margin:Ze,scales:o,showAxes:de,showCategoryTicks:he,oLabel:ge,rLabel:fe,oFormat:pe,rFormat:ye,rTickValues:me,tickLabelEdgeAlign:ve,showGrid:Ee,title:Ne,legend:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:Le,legendPosition:_e,foregroundGraphics:tt,annotations:Se,svgAnnotationRules:Oe,annotationFrame:0,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null==t?void 0:t.getData()}),He&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:Ze.left+Je/2,top:Ze.top+et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},He))}const zt="semiotic-table-"+e.useId();return e.createElement("div",{ref:Ke,className:"stream-ordinal-frame"+(De?" "+De:""),role:"group","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:T?"100%":Qe[0],height:B?"100%":Qe[1],overflow:"visible"},onKeyDown:It},Ye&&e.createElement(Sn,{tableId:zt}),Ye&&e.createElement(kn,{scene:null!==(h=null===(d=Ot.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],chartType:b+" chart",tableId:zt,chartTitle:"string"==typeof Ne?Ne:void 0}),e.createElement(An,{summary:Xe}),e.createElement("div",{role:"img","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:bt?Ht:void 0,onMouseLeave:bt?Tt:void 0},Te&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:Qe[0],height:Qe[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${Ze.left},${Ze.top})`},Te)),e.createElement(Ti,{width:Je,height:et,totalWidth:Qe[0],totalHeight:Qe[1],margin:Ze,scales:ut,showAxes:de,showGrid:Ee,rFormat:ye,rTickValues:me}),e.createElement("canvas",{ref:nt,"aria-label":dn(null!==(f=null===(g=Ot.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],b+" chart"),style:{position:"absolute",top:0,left:0,width:Qe[0],height:Qe[1]}}),e.createElement(On,{hoverPoint:lt}),e.createElement(Ni,{width:Je,height:et,totalWidth:Qe[0],totalHeight:Qe[1],margin:Ze,scales:ut,showAxes:de,showCategoryTicks:he,oLabel:ge,rLabel:fe,oFormat:pe,rFormat:ye,showGrid:Ee,title:Ne,legend:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:Le,legendPosition:_e,foregroundGraphics:tt,annotations:Se,svgAnnotationRules:Oe,annotationFrame:ht,xAccessor:"string"==typeof w?w:void 0,yAccessor:"string"==typeof A?A:void 0,annotationData:null===(p=Ot.current)||void 0===p?void 0:p.getData(),underlayRendered:!0}),(Re||Ge)&&"radial"!==L&&e.createElement(Di,{width:Je,height:et,totalWidth:Qe[0],totalHeight:Qe[1],margin:Ze,scales:ut,onBrush:Ge||(()=>{})}),He&&"radial"===L&&e.createElement("div",{style:{position:"absolute",left:Ze.left+Je/2,top:Ze.top+et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},He),(null==ze?void 0:ze.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ze.badgePosition?{top:4,left:4}:"bottom-left"===ze.badgePosition?{bottom:4,left:4}:"bottom-right"===ze.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:ft?"#dc3545":"#28a745",color:"white"})},ft?"STALE":"LIVE"),e.createElement(jn,{active:Bt.current>=0,hoverPoint:lt,margin:Ze,size:Qe,shape:null===(y=Nt.current)||void 0===y?void 0:y.shape,width:null===(m=Nt.current)||void 0===m?void 0:m.w,height:null===(v=Nt.current)||void 0===v?void 0:v.h}),Ft))});ta.displayName="StreamOrdinalFrame";const na=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,showCategoryTicks:N,categoryFormat:D,dataIdAccessor:I}=o,H=i.width,W=i.height,$=i.enableHover,F=i.showGrid,z=i.title,R=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=ri({data:V,rawData:s,colorBy:p,colorScheme:y,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"BarChart",chartId:P,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:H,height:W});if(U.earlyReturn)return U.earlyReturn;Ur("BarChart",V,"categoryAccessor",d),Ur("BarChart",V,"valueAccessor",h);const K=Qo(V,m,h),Q=Xo(),Z=n(()=>new Map,[V]),J=n(()=>(e,t)=>{const n={};return n.fill=p?Ne(e,p,U.colorScale):Vo(B,Q,y,void 0,Z),n},[p,U.colorScale,B,Q,y,Z]),ee=n(()=>{const e=null==A?void 0:A.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},J(t,n)),e(t,n)||{}):J},[J,A]),te=n(()=>Ho(ee,U.effectiveSelectionHook,S),[ee,U.effectiveSelectionHook,S]),ne=n(()=>pr({categoryAccessor:d,valueAccessor:h,groupAccessor:p&&p!==d?p:void 0,groupLabel:"string"==typeof p?p:"group"}),[d,h,p]),oe=wr({componentName:"BarChart",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(yr,{componentName:"BarChart",message:oe,width:H,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:K}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:te,size:[H,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v}),null!=b&&{roundedTop:b}),I&&{dataIdAccessor:I}),{baselinePadding:x,enableHover:$,showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:f}),D&&{oFormat:D}),{showGrid:F,showCategoryTicks:N,oSort:m}),U.legendBehaviorProps),z&&{title:z}),R&&{description:R}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===k?()=>null:ur(k)||ne}),(O||E||j||C)&&{customHoverBehavior:U.customHoverBehavior}),(E||j||O)&&{customClickBehavior:U.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Gr,{componentName:"BarChart",width:H,height:W},e.createElement(ta,Object.assign({ref:a},re)))});function oa({ref:e,frameRef:t,isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:s,setup:c}){const d=ni({isPushMode:o,colorBy:r,colorScheme:i,showLegend:a,legendPosition:s}),h=l(d.wrapPush(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)}),[d.wrapPush]),g=l(d.wrapPushMany(e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)}),[d.wrapPushMany]);return u(e,()=>({push:h,pushMany:g,remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,r;return null!==(r=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==r?r:[]},clear:()=>{var e;d.resetCategories(),null===(e=t.current)||void 0===e||e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]}}),[h,g,d.resetCategories]),{effectiveLegendProps:n(()=>d.streamingLegend?Object.assign(Object.assign({},c.legendBehaviorProps),{legend:d.streamingLegend,legendPosition:s||c.legendPosition}):c.legendBehaviorProps,[c.legendBehaviorProps,c.legendPosition,d.streamingLegend,s]),effectiveMargin:n(()=>{if(d.streamingMarginAdjust){const e=Object.assign({},c.margin);for(const[t,n]of Object.entries(d.streamingMarginAdjust))n>e[t]&&(e[t]=n);return e}return c.margin},[c.margin,d.streamingMarginAdjust])}}na.displayName="BarChart";const ra=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:E,onObservation:j,onClick:C,hoverHighlight:P,chartId:M,loading:L,emptyContent:_,legendInteraction:T,legendPosition:B,color:N,categoryFormat:D}=o,I=i.width,H=i.height,W=i.enableHover,$=i.showGrid,F=i.showLegend,z=i.title,R=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=p||d,K=void 0===s,Q=ri({data:V,rawData:s,colorBy:U,colorScheme:y,legendInteraction:T,legendPosition:B,selection:O,linkedHover:E,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:P,chartType:"StackedBarChart",chartId:M,showLegend:F,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:_,width:I,height:H});if(Q.earlyReturn)return Q.earlyReturn;const Z=Xo(),J=n(()=>new Map,[V]),ee=n(()=>(e,t)=>U?Q.colorScale?{fill:Ne(e,U,Q.colorScale)}:{}:{fill:Vo(N,Z,y,t,J)},[U,Q.colorScale,N,Z,y,J]),te=n(()=>{const e=null==S?void 0:S.pieceStyle;return e&&"function"==typeof e?(t,n)=>{const o=ee(t,n),r=e(t,n)||{};return Object.assign(Object.assign({},o),r)}:ee},[ee,S]),ne=n(()=>Ho(te,Q.effectiveSelectionHook,O),[te,Q.effectiveSelectionHook,O]),oe=n(()=>pr({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),re=wr({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:ie,effectiveMargin:ae}=oa({ref:r,frameRef:a,isPushMode:K,colorBy:U,colorScheme:y,showLegend:F,legendPosition:B,setup:Q}),se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:V}),{oAccessor:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ne,size:[I,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:W}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:f}),D&&{oFormat:D}),{showGrid:$}),ie),z&&{title:z}),R&&{description:R}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===w?()=>null:ur(w)||oe}),(E||j||C||P)&&{customHoverBehavior:Q.customHoverBehavior}),(j||C||E)&&{customClickBehavior:Q.customClickBehavior}),A&&A.length>0&&{annotations:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return re?e.createElement(yr,{componentName:"StackedBarChart",message:re,width:I,height:H}):e.createElement(Gr,{componentName:"StackedBarChart",width:I,height:H},e.createElement(ta,Object.assign({ref:a},se)))});ra.displayName="StackedBarChart";const ia=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,categoryFormat:N}=o,D=i.width,I=i.height,H=i.enableHover,W=i.showGrid,$=i.showLegend,F=i.title,z=i.description,R=i.summary,G=i.accessibleTable,Y=i.categoryLabel,q=i.valueLabel,X=s||[],V=p||d,U=void 0===s,K=ri({data:X,rawData:s,colorBy:V,colorScheme:y,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"GroupedBarChart",chartId:P,showLegend:$,userMargin:l,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:D,height:I});if(K.earlyReturn)return K.earlyReturn;const Q=Xo(),Z=n(()=>new Map,[X]),J=n(()=>(e,t)=>V?K.colorScale?{fill:Ne(e,V,K.colorScale)}:{}:{fill:Vo(B,Q,y,t,Z)},[V,K.colorScale,B,Q,y,Z]),ee=n(()=>Ho(J,K.effectiveSelectionHook,S),[J,K.effectiveSelectionHook,S]),te=n(()=>pr({categoryAccessor:d,valueAccessor:h,groupAccessor:u}),[d,u,h]),ne=wr({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:oe,effectiveMargin:re}=oa({ref:r,frameRef:a,isPushMode:U,colorBy:V,colorScheme:y,showLegend:$,legendPosition:T,setup:K}),ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:X}),{oAccessor:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ee,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:q,rFormat:f}),N&&{oFormat:N}),{showGrid:W}),oe),F&&{title:F}),z&&{description:z}),R&&{summary:R}),void 0!==G&&{accessibleTable:G}),c&&{className:c}),{tooltipContent:!1===k?()=>null:ur(k)||te}),(O||E||j||C)&&{customHoverBehavior:K.customHoverBehavior}),(E||j||O)&&{customClickBehavior:K.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ne?e.createElement(yr,{componentName:"GroupedBarChart",message:ne,width:D,height:I}):e.createElement(Gr,{componentName:"GroupedBarChart",width:D,height:I},e.createElement(ta,Object.assign({ref:a},ie)))});function aa({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:r}){const i=Io("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),a=Po({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof r?r:"value")}),s=t(a.brushInteraction);s.current=a.brushInteraction;const c=l(e=>{if(i){s.current.end(e?e.r:null)}null==n||n(e)},[n,i]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}ia.displayName="GroupedBarChart";const sa=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,tooltip:w,annotations:A,brush:S,onBrush:O,linkedBrush:E,frameProps:j={},selection:C,linkedHover:P,onObservation:M,onClick:L,hoverHighlight:_,chartId:T,loading:B,emptyContent:N,legendInteraction:D,legendPosition:I,color:H,showCategoryTicks:W,categoryFormat:$}=o,F=i.width,z=i.height,R=i.enableHover,G=i.showGrid,Y=i.title,q=i.description,X=i.summary,V=i.accessibleTable,U=i.categoryLabel,K=i.valueLabel,Q=s||[],Z=ri({data:Q,rawData:s,colorBy:p,colorScheme:y,legendInteraction:D,legendPosition:I,selection:C,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:L,hoverHighlight:_,chartType:"SwarmPlot",chartId:T,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:B,emptyContent:N,width:F,height:z}),J=aa({brushProp:S,onBrushProp:O,linkedBrush:E,valueAccessor:h});if(Z.earlyReturn)return Z.earlyReturn;const ee=n(()=>{if(!m)return;const e=Q.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[Q,m]),te=Xo(),ne=n(()=>new Map,[Q]),oe=n(()=>(e,t)=>{const n={fillOpacity:x};return n.fill=p?Ne(e,p,Z.colorScale):Vo(H,te,y,void 0,ne),n.r=m?Ie(e,m,v,ee):b,n},[p,Z.colorScale,m,v,ee,b,x,H,te,y,ne]),re=n(()=>Ho(oe,Z.effectiveSelectionHook,C),[oe,Z.effectiveSelectionHook,C]),ie=n(()=>pr({categoryAccessor:d,valueAccessor:h,groupAccessor:p||void 0}),[d,h,p]),ae=wr({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(ae)return e.createElement(yr,{componentName:"SwarmPlot",message:ae,width:F,height:z});const se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:Q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[F,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:k,enableHover:R}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:K,rFormat:f}),$&&{oFormat:$}),{showGrid:G,showCategoryTicks:W}),Z.legendBehaviorProps),Y&&{title:Y}),q&&{description:q}),X&&{summary:X}),void 0!==V&&{accessibleTable:V}),c&&{className:c}),{tooltipContent:!1===w?()=>null:ur(w)||ie}),(P||M||L||_)&&{customHoverBehavior:Z.customHoverBehavior}),(M||L||P)&&{customClickBehavior:Z.customClickBehavior}),A&&A.length>0&&{annotations:A}),J.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Gr,{componentName:"SwarmPlot",width:F,height:z},e.createElement(ta,Object.assign({ref:a},se)))});function la(t){return n=>{var o;const r=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",i=n.stats||(n.data||n).stats;if(i&&null!=i.median)return e.createElement("div",{className:"semiotic-tooltip",style:ir},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),null!=i.n&&e.createElement("div",null,"n = ",i.n),null!=i.min&&e.createElement("div",null,"Min: ",i.min.toLocaleString()),null!=i.q1&&e.createElement("div",null,"Q1: ",i.q1.toLocaleString()),e.createElement("div",null,"Median: ",i.median.toLocaleString()),null!=i.q3&&e.createElement("div",null,"Q3: ",i.q3.toLocaleString()),null!=i.max&&e.createElement("div",null,"Max: ",i.max.toLocaleString()),null!=i.mean&&e.createElement("div",{style:{opacity:.8}},"Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})));if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,i=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=i.length,s=a>0?a%2!=0?i[Math.floor(a/2)]:(i[a/2-1]+i[a/2])/2:null;return e.createElement("div",{className:"semiotic-tooltip",style:ir},r&&e.createElement("div",{style:{fontWeight:"bold"}},r+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))}return e.createElement("div",{className:"semiotic-tooltip",style:ir},e.createElement("div",{style:{fontWeight:"bold"}},r+""))}}sa.displayName="SwarmPlot";const ca=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,showOutliers:m=!0,categoryPadding:v=20,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:_,showCategoryTicks:T,categoryFormat:B}=o,N=i.width,D=i.height,I=i.enableHover,H=i.showGrid,W=i.title,$=i.description,F=i.summary,z=i.accessibleTable,R=i.categoryLabel,G=i.valueLabel,Y=s||[],q=ri({data:Y,rawData:s,colorBy:p,colorScheme:y,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"BoxPlot",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:C,emptyContent:P,width:N,height:D});if(q.earlyReturn)return q.earlyReturn;const X=Xo(),V=n(()=>new Map,[Y]),U=n(()=>e=>{const t=p?Ne(e,p,q.colorScale):Vo(_,X,y,void 0,V);return{fill:t,stroke:t,fillOpacity:.8}},[p,q.colorScale,_,X,y,V]),K=n(()=>Ho(U,q.effectiveSelectionHook,w),[U,q.effectiveSelectionHook,w]),Q=n(()=>la(),[]),Z=wr({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(Z)return e.createElement(yr,{componentName:"BoxPlot",message:Z,width:N,height:D});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:K,showOutliers:m,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:q.margin,barPadding:v,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:R,rLabel:G,rFormat:f}),B&&{oFormat:B}),{showGrid:H,showCategoryTicks:T}),q.legendBehaviorProps),W&&{title:W}),$&&{description:$}),F&&{summary:F}),void 0!==z&&{accessibleTable:z}),c&&{className:c}),{tooltipContent:!1===b?()=>null:ur(b)||Q}),(A||S||O||E)&&{customHoverBehavior:q.customHoverBehavior}),(S||O||A)&&{customClickBehavior:q.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Gr,{componentName:"BoxPlot",width:N,height:D},e.createElement(ta,Object.assign({ref:a},J)))});ca.displayName="BoxPlot";const ua=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,brush:k,onBrush:w,linkedBrush:A,frameProps:S={},selection:O,linkedHover:E,onObservation:j,onClick:C,hoverHighlight:P,chartId:M,loading:L,emptyContent:_,legendInteraction:T,legendPosition:B,color:N,showCategoryTicks:D,categoryFormat:I}=o,H=i.width,W=i.height,$=i.enableHover,F=i.showGrid,z=i.title,R=i.description,G=i.summary,Y=i.accessibleTable,q=i.categoryLabel,X=i.valueLabel,V=s||[],U=ri({data:V,rawData:s,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:B,selection:O,linkedHover:E,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:C,hoverHighlight:P,chartType:"Histogram",chartId:M,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:L,emptyContent:_,width:H,height:W}),K=aa({brushProp:k,onBrushProp:w,linkedBrush:A,valueAccessor:h});if(U.earlyReturn)return U.earlyReturn;const Q=n(()=>{if(0===V.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of V){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[V,h]),Z=Xo(),J=n(()=>new Map,[V]),ee=n(()=>e=>{const t=y?Ne(e,y,U.colorScale):Vo(N,Z,m,void 0,J);return{fill:t,stroke:t,fillOpacity:.8}},[y,U.colorScale,N,Z,m,J]),te=n(()=>Ho(ee,U.effectiveSelectionHook,O),[ee,U.effectiveSelectionHook,O]),ne=n(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:ir},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),oe=wr({componentName:"Histogram",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(yr,{componentName:"Histogram",message:oe,width:H,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:V}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:te,bins:g,normalize:f}),Q&&{rExtent:Q}),{size:[H,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U.margin,barPadding:v,enableHover:$}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:q,rLabel:X,rFormat:p}),I&&{oFormat:I}),{showGrid:F,showCategoryTicks:D}),U.legendBehaviorProps),z&&{title:z}),R&&{description:R}),G&&{summary:G}),void 0!==Y&&{accessibleTable:Y}),c&&{className:c}),{tooltipContent:!1===b?()=>null:ur(b)||ne}),(E||j||C||P)&&{customHoverBehavior:U.customHoverBehavior}),(j||C||E)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),K.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Gr,{componentName:"Histogram",width:H,height:W},e.createElement(ta,Object.assign({ref:a},re)))});ua.displayName="Histogram";const da=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="vertical",bins:f=25,showIQR:p=!0,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:E,linkedHover:j,onObservation:C,onClick:P,hoverHighlight:M,chartId:L,loading:_,emptyContent:T,legendInteraction:B,legendPosition:N,color:D,showCategoryTicks:I,categoryFormat:H}=o,W=i.width,$=i.height,F=i.enableHover,z=i.showGrid,R=i.title,G=i.description,Y=i.summary,q=i.accessibleTable,X=i.categoryLabel,V=i.valueLabel,U=s||[],K=ri({data:U,rawData:s,colorBy:m,colorScheme:v,legendInteraction:B,legendPosition:N,selection:E,linkedHover:j,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:M,chartType:"ViolinPlot",chartId:L,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:_,emptyContent:T,width:W,height:$}),Q=aa({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h});if(K.earlyReturn)return K.earlyReturn;const Z=Xo(),J=n(()=>new Map,[U]),ee=n(()=>e=>{const t=m?Ne(e,m,K.colorScale):Vo(D,Z,v,void 0,J);return{fill:t,stroke:t,fillOpacity:.6}},[m,K.colorScale,D,Z,v,J]),te=n(()=>Ho(ee,K.effectiveSelectionHook,E),[ee,K.effectiveSelectionHook,E]),ne=n(()=>la({valueAccessor:h}),[h]),oe=wr({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(oe)return e.createElement(yr,{componentName:"ViolinPlot",message:oe,width:W,height:$});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:U}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:te,bins:f,showIQR:p,size:[W,$],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,barPadding:b,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:V,rFormat:y}),H&&{oFormat:H}),{showGrid:z,showCategoryTicks:I}),K.legendBehaviorProps),R&&{title:R}),G&&{description:G}),Y&&{summary:Y}),void 0!==q&&{accessibleTable:q}),c&&{className:c}),{tooltipContent:!1===x?()=>null:ur(x)||ne}),(j||C||P||M)&&{customHoverBehavior:K.customHoverBehavior}),(C||P||j)&&{customClickBehavior:K.customClickBehavior}),k&&k.length>0&&{annotations:k}),Q.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Gr,{componentName:"ViolinPlot",width:W,height:$},e.createElement(ta,Object.assign({ref:a},re)))});da.displayName="ViolinPlot";const ha=c(function(o,r){var i;const a=or(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),s=t(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{data:l,margin:c,className:d,categoryAccessor:h="category",valueAccessor:g="value",orientation:f="horizontal",valueFormat:p,colorBy:y,colorScheme:m,sort:v=!0,dotRadius:b=5,categoryPadding:x=10,tooltip:k,annotations:w,frameProps:A={},selection:S,linkedHover:O,onObservation:E,onClick:j,hoverHighlight:C,chartId:P,loading:M,emptyContent:L,legendInteraction:_,legendPosition:T,color:B,categoryFormat:N}=o,D=a.width,I=a.height,H=a.enableHover,W=a.showGrid,$=a.title,F=a.description,z=a.summary,R=a.accessibleTable,G=a.categoryLabel,Y=a.valueLabel,q=l||[],X=ri({data:q,rawData:l,colorBy:y,colorScheme:m,legendInteraction:_,legendPosition:T,selection:S,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:E,onClick:j,hoverHighlight:C,chartType:"DotPlot",chartId:P,showLegend:a.showLegend,userMargin:c,marginDefaults:a.marginDefaults,loading:M,emptyContent:L,width:D,height:I});if(X.earlyReturn)return X.earlyReturn;const V=Qo(q,v,g),U=Xo(),K=n(()=>new Map,[q]),Q=n(()=>(e,t)=>{const n={r:b,fillOpacity:.8};return n.fill=y?Ne(e,y,X.colorScale):Vo(B,U,m,void 0,K),n},[y,X.colorScale,b,B,U,m,K]),Z=n(()=>Ho(Q,X.effectiveSelectionHook,S),[Q,X.effectiveSelectionHook,S]),J=n(()=>pr({categoryAccessor:h,valueAccessor:g}),[h,g]),ee=wr({componentName:"DotPlot",data:l,accessors:{categoryAccessor:h,valueAccessor:g}});if(ee)return e.createElement(yr,{componentName:"DotPlot",message:ee,width:D,height:I});const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:V}),{oAccessor:h,rAccessor:g,projection:"horizontal"===f?"horizontal":"vertical",pieceStyle:Z,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:x,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:a.showAxes,oLabel:G,rLabel:Y,rFormat:p}),N&&{oFormat:N}),{showGrid:W,oSort:v}),X.legendBehaviorProps),$&&{title:$}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),d&&{className:d}),{tooltipContent:!1===k?()=>null:ur(k)||J}),(O||E||j||C)&&{customHoverBehavior:X.customHoverBehavior}),(E||j||O)&&{customClickBehavior:X.customClickBehavior}),w&&w.length>0&&{annotations:w}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Gr,{componentName:"DotPlot",width:D,height:I},e.createElement(ta,Object.assign({ref:s},te)))});ha.displayName="DotPlot";const ga=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",bins:f=20,amplitude:p=1.5,valueFormat:y,colorBy:m,colorScheme:v,categoryPadding:b=5,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:_,color:T,showCategoryTicks:B,categoryFormat:N}=o,D=i.width,I=i.height,H=i.enableHover,W=i.showGrid,$=i.title,F=i.description,z=i.summary,R=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q=s||[],X=ri({data:q,rawData:s,colorBy:m,colorScheme:v,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"RidgelinePlot",chartId:C,showLegend:i.showLegend,userMargin:l,marginDefaults:i.marginDefaults,loading:P,emptyContent:M,width:D,height:I});if(X.earlyReturn)return X.earlyReturn;const V=Xo(),U=n(()=>new Map,[q]),K=n(()=>e=>{const t=m?Ne(e,m,X.colorScale):Vo(T,V,v,void 0,U);return{fill:t,stroke:t,fillOpacity:.5}},[m,X.colorScale,T,V,v,U]),Q=n(()=>Ho(K,X.effectiveSelectionHook,A),[K,X.effectiveSelectionHook,A]),Z=n(()=>la(),[]),J=wr({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:d,valueAccessor:h}});if(J)return e.createElement(yr,{componentName:"RidgelinePlot",message:J,width:D,height:I});const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=s&&{data:q}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",summaryStyle:Q,bins:f,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:X.margin,barPadding:b,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y,rFormat:y}),N&&{oFormat:N}),{showGrid:W,showCategoryTicks:B,oSort:!1,amplitude:p}),X.legendBehaviorProps),$&&{title:$}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),c&&{className:c}),{tooltipContent:!1===x?()=>null:ur(x)||Z}),(S||O||E||j)&&{customHoverBehavior:X.customHoverBehavior}),(O||E||S)&&{customClickBehavior:X.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Gr,{componentName:"RidgelinePlot",width:D,height:I},e.createElement(ta,Object.assign({ref:a},ee)))});ga.displayName="RidgelinePlot";const fa=c(function(o,r){var i,a;const s=or(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:E,loading:j,emptyContent:C,legendInteraction:P,legendPosition:M,color:L}=o,_=s.width,T=s.height,B=s.enableHover,N=s.showLegend,D=s.title,I=s.description,H=s.summary,W=s.accessibleTable,$=c||[],F=f||h,z=void 0===c,R=ri({data:$,rawData:c,colorBy:F,colorScheme:p,legendInteraction:P,legendPosition:M,selection:k,linkedHover:w,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:E,showLegend:N,userMargin:u,marginDefaults:s.marginDefaults,loading:j,emptyContent:C,width:_,height:T});if(R.earlyReturn)return R.earlyReturn;const G=Xo(),Y=n(()=>new Map,[$]),q=n(()=>(e,t)=>F?R.colorScale?{fill:Ne(e,F,R.colorScale)}:{}:{fill:Vo(L,G,p,t,Y)},[F,R.colorScale,L,G,p,Y]),X=n(()=>{const e=null==x?void 0:x.pieceStyle;return e&&"function"==typeof e?(t,n)=>Object.assign(Object.assign({},q(t,n)),e(t,n)||{}):q},[q,x]),V=n(()=>Ho(X,R.effectiveSelectionHook,k),[X,R.effectiveSelectionHook,k]),U=n(()=>pr({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),K=wr({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Q,effectiveMargin:Z}=oa({ref:r,frameRef:l,isPushMode:z,colorBy:F,colorScheme:p,showLegend:N,legendPosition:M,setup:R}),J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:$}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:V,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[_,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z,enableHover:B}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Q),D&&{title:D}),I&&{description:I}),H&&{summary:H}),void 0!==W&&{accessibleTable:W}),d&&{className:d}),{tooltipContent:!1===v?()=>null:ur(v)||U}),(w||A||S||O)&&{customHoverBehavior:R.customHoverBehavior}),(A||S||w)&&{customClickBehavior:R.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e.createElement(yr,{componentName:"PieChart",message:K,width:_,height:T}):e.createElement(Gr,{componentName:"PieChart",width:_,height:T},e.createElement(ta,Object.assign({ref:l},J)))});fa.displayName="PieChart";const pa=c(function(o,r){var i,a;const s=or(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(a=o.height)&&void 0!==a?a:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks}),l=t(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",innerRadius:f=60,centerContent:p,colorBy:y,colorScheme:m,startAngle:v=0,cornerRadius:b,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,loading:P,emptyContent:M,legendInteraction:L,legendPosition:_,color:T}=o,B=s.width,N=s.height,D=s.enableHover,I=s.showLegend,H=s.title,W=s.description,$=s.summary,F=s.accessibleTable,z=c||[],R=y||h,G=void 0===c,Y=ri({data:z,rawData:c,colorBy:R,colorScheme:m,legendInteraction:L,legendPosition:_,selection:A,linkedHover:S,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"DonutChart",chartId:C,showLegend:I,userMargin:u,marginDefaults:s.marginDefaults,loading:P,emptyContent:M,width:B,height:N});if(Y.earlyReturn)return Y.earlyReturn;const q=Xo(),X=n(()=>new Map,[z]),V=n(()=>(e,t)=>R?Y.colorScale?{fill:Ne(e,R,Y.colorScale)}:{}:{fill:Vo(T,q,m,t,X)},[R,Y.colorScale,T,q,m,X]),U=n(()=>Ho(V,Y.effectiveSelectionHook,A),[V,Y.effectiveSelectionHook,A]),K=n(()=>pr({categoryAccessor:h,valueAccessor:g,groupAccessor:y&&y!==h?y:void 0,groupLabel:"string"==typeof y?y:"group",pieData:!0}),[h,g,y]),Q=wr({componentName:"DonutChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Z,effectiveMargin:J}=oa({ref:r,frameRef:l,isPushMode:G,colorBy:R,colorScheme:m,showLegend:I,legendPosition:_,setup:Y}),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({chartType:"donut"},null!=c&&{data:z}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:U,innerRadius:f,startAngle:v}),null!=b&&{cornerRadius:b}),{centerContent:p,size:[B,N],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Z),H&&{title:H}),W&&{description:W}),$&&{summary:$}),void 0!==F&&{accessibleTable:F}),d&&{className:d}),{tooltipContent:!1===x?()=>null:ur(x)||K}),(S||O||E||j)&&{customHoverBehavior:Y.customHoverBehavior}),(O||E||S)&&{customClickBehavior:Y.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return Q?e.createElement(yr,{componentName:"DonutChart",message:Q,width:B,height:N}):e.createElement(Gr,{componentName:"DonutChart",width:B,height:N},e.createElement(ta,Object.assign({ref:l},ee)))});pa.displayName="DonutChart";const ya=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},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{data:s,margin:l,className:c,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:E,chartId:j,loading:C,emptyContent:P,legendInteraction:M,legendPosition:L,color:_,categoryFormat:T}=o,B="vertical"===y,N=i.width,D=i.height,I=i.enableHover,H=i.title,W=i.description,$=i.summary,F=i.accessibleTable,z=s||[],R=f||g,G=!R,Y=ri({data:z,rawData:s,colorBy:R,colorScheme:p,legendInteraction:M,legendPosition:L,selection:w,linkedHover:A,fallbackFields:R?["string"==typeof R?R:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:E,chartType:"FunnelChart",chartId:j,showLegend:i.showLegend,userMargin:l,marginDefaults:B?{top:H?60:40,right:20,bottom:60,left:60}:{top:H?40:10,right:10,bottom:10,left:10},loading:C,emptyContent:P,width:N,height:D});if(Y.earlyReturn)return Y.earlyReturn;Ur("FunnelChart",z,"stepAccessor",d),Ur("FunnelChart",z,"valueAccessor",h);const q=Xo(),X=n(()=>new Map,[z]),V=n(()=>{if(G)return _||((null==q?void 0:q[0])?q[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[G,_,q,p]),U=n(()=>(e,t)=>{const n={};return n.fill=V||(R?Ne(e,R,Y.colorScale):Vo(_,q,p,t,X)),n},[V,R,Y.colorScale,_,q,p,X]),K=n(()=>Ho(U,Y.effectiveSelectionHook,w),[U,Y.effectiveSelectionHook,w]),Q=n(()=>t=>{var n,o,r,i,a,s;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(r=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==r?r:"",d=null!==(i=null==l?void 0:l.__funnelPercent)&&void 0!==i?i:null==l?void 0:l.__barFunnelPercent,h=null!==(a=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==a?a:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(s=null==l?void 0:l.__barFunnelCategory)&&void 0!==s?s:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.createElement("div",{className:"semiotic-tooltip",style:ir},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),f&&f!==c&&e.createElement("div",{style:{marginTop:2,opacity:.8}},f+""),g&&e.createElement("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7}},"Dropoff"),e.createElement("div",{style:{marginTop:4}},u+"",p))},[]),Z=wr({componentName:"FunnelChart",data:s,accessors:{stepAccessor:d,valueAccessor:h}});if(Z)return e.createElement(yr,{componentName:"FunnelChart",message:Z,width:N,height:D});const J=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=s&&{data:z}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:K,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Y.margin,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:B,showCategoryTicks:B}),T&&{oFormat:T}),{showGrid:B}),!B&&{connectorOpacity:m}),{showLabels:v}),Y.legendBehaviorProps),H&&{title:H}),W&&{description:W}),$&&{summary:$}),void 0!==F&&{accessibleTable:F}),c&&{className:c}),{tooltipContent:!1===b?()=>null:!0===b||null==b?Q:ur(b)||Q}),(A||S||O||E)&&{customHoverBehavior:Y.customHoverBehavior}),(S||O||A)&&{customClickBehavior:Y.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.createElement(Gr,{componentName:"FunnelChart",width:N,height:D},e.createElement(ta,Object.assign({ref:a},J)))});ya.displayName="FunnelChart";const ma="__likert_neutral_neg",va="__likert_neutral_pos";function ba(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function xa(e,t,n,o,r,i){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],a=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:r})}}return l}function ka(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push(Object.assign(Object.assign({},t),{__likertLevel:ma,__likertPct:-e})),i.push(Object.assign(Object.assign({},t),{__likertLevel:va,__likertPct:e}))}else i.push(r>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return i}function wa(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const a=[];for(const[,e]of i){const t=new Map;let i,s;for(const n of e)n.__likertLevel===ma?i=n:n.__likertLevel===va?s=n:t.set(n.__likertLevelIndex,n);o&&i&&a.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}const Aa=c(function(o,r){const i=or(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),a=t(null),{data:s,margin:c,className:d,categoryAccessor:h="question",valueAccessor:g,levelAccessor:f,countAccessor:p="count",levels:y,orientation:m="horizontal",colorScheme:v,barPadding:b=20,tooltip:x,annotations:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:E,hoverHighlight:j,chartId:C,valueFormat:P,loading:M,emptyContent:L,legendInteraction:_,legendPosition:T,categoryFormat:B}=o,N=i.width,D=i.height,I=i.enableHover,H=i.showGrid,W=i.showLegend,$=i.title,F=i.description,z=i.summary,R=i.accessibleTable,G=i.categoryLabel,Y=i.valueLabel,q="horizontal"===m,X=void 0===s,V=!f,U=n(()=>v&&Array.isArray(v)&&v.length>=y.length?v:function(e){const t=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],o="#a8a8a8";if(0>=e)return[];if(1===e)return[o];const r=e%2!=0,i=Math.floor(e/2),a=[];for(let e=0;i>e;e++)a.push(t[Math.min(Math.floor(e*t.length/i),t.length-1)]);r&&a.push(o);for(let e=0;i>e;e++)a.push(n[Math.min(Math.floor(e*n.length/i),n.length-1)]);return a}(y.length),[v,y.length]),K=n(()=>{const e=new Map;for(let t=0;y.length>t;t++)e.set(y[t],U[t]||"#888");return e},[y,U]),{processedData:Q,reAggregate:Z,accumulatorRef:J}=function({data:e,levels:o,categoryAccessor:r,valueAccessor:i,levelAccessor:a,countAccessor:s,isDiverging:c,frameRef:u}){const d=!a,h=n(()=>ba(r,"question"),[r]),g=n(()=>d?ba(i,"score"):null,[d,i]),f=n(()=>d?null:ba(a,"level"),[d,a]),p=n(()=>d?null:ba(s,"count"),[d,s]),y=e||[],m=t([]),v=n(()=>{if(0===y.length)return[];let e=xa(y,o,h,g,f,p);return c&&(e=ka(e,o),e=wa(e,o)),e},[y,o,h,g,f,p,c]),b=l(e=>{var t,n;let r=xa(e,o,h,g,f,p);c&&(r=ka(r,o),r=wa(r,o)),null===(t=u.current)||void 0===t||t.clear(),r.length>0&&(null===(n=u.current)||void 0===n||n.pushMany(r))},[o,h,g,f,p,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:s,levels:y,categoryAccessor:h,valueAccessor:g,levelAccessor:f,countAccessor:p,isDiverging:q,frameRef:a}),ee="__likertLevelLabel",te=ni({isPushMode:X,colorBy:ee,colorScheme:U,showLegend:W,legendPosition:T}),ne=l(te.wrapPush(e=>{J.current.push(e),Z(J.current)}),[te.wrapPush,Z,J]),oe=l(te.wrapPushMany(e=>{J.current.push(...e),Z(J.current)}),[te.wrapPushMany,Z,J]);u(r,()=>({push:ne,pushMany:oe,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;J.current=[],te.resetCategories(),null===(e=a.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}),[ne,oe,te.resetCategories,J]);const re=ri({data:Q,rawData:s,colorBy:ee,colorScheme:U,legendInteraction:_,legendPosition:T,selection:A,linkedHover:S,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:O,onClick:E,hoverHighlight:j,chartType:"LikertChart",chartId:C,showLegend:W,userMargin:c,marginDefaults:i.marginDefaults,loading:M,emptyContent:L,width:N,height:D});if(re.earlyReturn)return re.earlyReturn;const ie=n(()=>{const e=y.length;return e%2!=0&&K.get(y[Math.floor(e/2)])||"#888"},[y,K]),ae=n(()=>e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),r=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(r===ma||r===va)return{fill:ie};const i=o||r;return i&&K.has(i)?{fill:K.get(i)}:{fill:"#888"}},[K,ie]),se=n(()=>Ho(ae,re.effectiveSelectionHook,A),[ae,re.effectiveSelectionHook,A]),le=n(()=>{const e=y.length;return e%2!=0?y[Math.floor(e/2)]:""},[y]),ce=n(()=>t=>{const n=t.data||t,o=n.__likertLevel||"Unknown",r=o===ma||o===va?le:o,i=n.__likertCategory||"",a=Math.abs(n.__likertPct||0),s=o===ma||o===va?2*a:a,l=n.__likertCount||0;return e.createElement("div",{className:"semiotic-tooltip",style:ir},e.createElement("div",{style:{fontWeight:"bold"}},i),e.createElement("div",{style:{marginTop:4}},`${r}: ${s.toFixed(1)}% (n=${l})`))},[le]),ue=n(()=>{if(!y||2>y.length)return"LikertChart requires `levels` with at least 2 entries.";if(g&&f)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(f&&!p)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:h};return V?g&&(e.valueAccessor=g):(f&&(e.levelAccessor=f),p&&(e.countAccessor=p)),wr({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:y}})},[s,h,g,f,p,y,V]),de=n(()=>[{styleFn:e=>({fill:K.get(e.label)||"#888"}),items:y.map(e=>({label:e})),label:""}],[y,K]),he=n(()=>!1!==W?Object.assign(Object.assign({},re.legendBehaviorProps),{legend:{legendGroups:de},legendPosition:T||re.legendPosition||"bottom"}):re.legendBehaviorProps,[re.legendBehaviorProps,re.legendPosition,T,W,de]),ge=n(()=>{const e=Object.assign({},re.margin);if(X&&!1!==W){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(te.streamingMarginAdjust)for(const[t,n]of Object.entries(te.streamingMarginAdjust))n>e[t]&&(e[t]=n);return q&&100>e.left&&(e.left=100),e},[re.margin,te.streamingMarginAdjust,q,X,W,T]),fe=n(()=>P||(q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[q,P]),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({chartType:"bar"},null!=s&&{data:Q}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:q?"horizontal":"vertical",pieceStyle:se,size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge,barPadding:b,enableHover:I}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:G,rLabel:Y||(q?void 0:"Percentage"),rFormat:fe}),B&&{oFormat:B}),{showGrid:H}),he),$&&{title:$}),F&&{description:F}),z&&{summary:z}),void 0!==R&&{accessibleTable:R}),d&&{className:d}),{tooltipContent:!1===x?()=>null:!0===x?ce:ur(x)||ce}),(S||O||E||j)&&{customHoverBehavior:re.customHoverBehavior}),(O||E||S)&&{customClickBehavior:re.customClickBehavior}),k&&k.length>0&&{annotations:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return ue?e.createElement(yr,{componentName:"LikertChart",message:ue,width:N,height:D}):e.createElement(Gr,{componentName:"LikertChart",width:N,height:D},e.createElement(ta,Object.assign({ref:a},pe)))});Aa.displayName="LikertChart";const Sa={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Oa={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Ea{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){var r;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1;continue}const l=o&&null!==(r=o[a.edgeIndex])&&void 0!==r?r:1;if(a.t+=e*t*l*(s.bezier.circular?.3:1),a.t>=1){a.active=!1;continue}const c=ja(s.bezier,a.t,a.offset);a.x=c.x,a.y=c.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function ja(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),s=i-a,[l,c,u,d]=e[a],h=Ca(l,c,u,d,s),g=d.x-l.x,f=d.y-l.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;h.x+=-f/p*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,i,a]=e.points,s=Ca(o,r,i,a,t),l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;s.x+=-c/u*n*e.halfWidth*2,s.y+=t*n*e.halfWidth*2}return s}function Ca(e,t,n,o,r){const i=1-r,a=i*i,s=a*i,l=r*r,c=l*r;return{x:s*e.x+3*a*r*t.x+3*i*l*n.x+c*o.x,y:s*e.y+3*a*r*t.y+3*i*l*n.y+c*o.y}}function Pa(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Ma(e,t){var n,o=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,o,d=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,r),d=!0):i[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return r.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,r[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>i[t]){for(var f=i[t];g.length>f;++f){var p=g[f];if(0>n[p]){n[p]=o[p]=u,r[p]=!0,u+=1,l.push(p),c.push(p);break}r[p]&&(o[t]=0|Math.min(o[t],o[p])),0>a[p]||s[t].push(a[p])}i[t]=f}else{if(o[t]===n[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(r[b]=!1,y.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),r=o.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],n=a);var l=r[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:i,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var f=0;s.length>f;f++)for(var p=0;s[f].length>p;p++){var y=s[f][p];i[+y]=!1,a[y]={}}c(n),n+=1}else n=h}return o}function La(e){return e.y0-e.y1>0?"up":"down"}function _a(e,t){return t(e.source)==t(e.target)}function Ta(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function Ba(e){return e.target.x0-e.source.x1}function Na(e,t){var n=Ia(e),o=Ba(t)/Math.tan(n);return"up"==La(e)?e.y1-o:e.y1+o}function Da(e,t){var n=Ia(e),o=Ba(t)/Math.tan(n);return"up"==La(e)?e.y1+o:e.y1-o}function Ia(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Ha(e,t){return t(e)}function Wa(e){return Fa(e.source)}function $a(e){return Fa(e.target)}function Fa(e){return(e.y0+e.y1)/2}function za(e){return e.virtual?0:e.value}function Ra(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!_a(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!_a(e,t)?o+1:o}),n+o}function Ga(e){return e.target.depth}function Ya(e,t){return e.sourceLinks.length?e.depth:t-1}function qa(e,t){return e.y0-t.y0}function Xa(e,t){return t.y0-e.y0}function Va(e,t){return e.y1-t.y1}function Ua(e,t){return t.y1-e.y1}function Ka(e,t){return Za(e.source,t.source)||e.index-t.index}function Qa(e,t){return Za(e.target,t.target)||e.index-t.index}function Za(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Ja(e,t){return es(e)==es(t)?"bottom"==e.circularLinkType?Xa(e,t):qa(e,t):es(t)-es(e)}function es(e){return e.target.column-e.source.column}function ts(e,t){return ns(e)==ns(t)}function ns(e){return e.y0-e.y1>0?"up":"down"}function os(e,t,n,o,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=N(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),rs(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),rs(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,_a(e,t)&&Ta(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Xa:qa);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Ua:Va),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,r=e.y1,i=(t+o)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+o+","+r}(e)}),i}function rs(e,t,n){e.sort(Ja);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(_a(e,t)&&Ta(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&is(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function is(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function as(e){return function(){return e}}function ss(e){return e.index}function ls(e){return e.nodes}function cs(e){return e.links}function us(e,t,n){var o=D(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(r,i){var a=r.length;if(t)r.sort(t);else if(i>0){var s=new Map;r.forEach(function(e,t){var n,o,r,i=(o=0,r=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=Fa(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=Fa(e.target)*t,o+=t}}),o>0?r/o:NaN);s.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var n=s.get(e),o=s.get(t),r=n.bc,i=o.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(r)||isNaN(i)?isNaN(r)?isNaN(i)?n.idx-o.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Ra(t,n)-Ra(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Ra(t,n)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+r,t.y1=t.y0+t.value*e.ky)})})}function ds(e,t,n,o,r,i){var a=D(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=i;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&Ra(r,n)>0){var l=W(r.sourceLinks,$a),c=W(r.targetLinks,Wa),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Fa(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==o-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=W(r.sourceLinks,$a),g=W(r.targetLinks,Wa),f=((h&&g?(h+g)/2:h||g)-Fa(r))*t;r.y0+=f,r.y1+=f}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||Za),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+o;if((a=l-o-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function hs(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Qa),e.targetLinks.sort(Ka)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,r=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function gs(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=ss,l=Ya,c=void 0,u=32,d=2,h=ls,g=cs;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return $(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,r=e.target;"object"!=typeof o&&(o=e.source=Pa(n,o)),"object"!=typeof r&&(r=e.target=Pa(n,r)),o.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],r=0;e.links.length>r;r++){var i=e.links[r],a=i.source.index,s=i.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=Ma(o);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:o>n?"top":"bottom","top"==r.circularLinkType?n++:o++,e.nodes.forEach(function(e){Ha(e,t)!=Ha(r.source,t)&&Ha(e,t)!=Ha(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),_a(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(H(e.sourceLinks,za),H(e.targetLinks,za)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,r,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,c,l);var g=i;if(null!==a){var f=D(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=I(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=D(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=N(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/H(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=I(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,r),us(h,c,s),ds(h,c,s,g,g,u),hs(h),os(h,s,d,10,8),us(h,c,s),ds(h,c,s,g,g,u),hs(h),os(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return Ha(n.source,t)==Ha(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!ts(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Na(t,e);return e.y1-n}if(t.target.column>e.target.column)return Na(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return Ha(n.target,t)==Ha(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!ts(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=Da(t,e);return e.y0-n}if(t.source.column>e.source.column)return Da(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,r=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==o||0==r){var i=N(t,function(e){return e.y0}),a=I(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function l(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),os(h,s,d,10,8)}(f),f}return f.update=function(e){return hs(e),os(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(r=+e,f):r},f.nodePadding=function(e){return arguments.length?(i=+e,f):i},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:as(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:as(e),f):g},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:as(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:as(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],f):[[e,t],[n,o]]},f.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],f):[n-e,o-t]},f}const fs=e=>{let t,n,o,r,i,a,s,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=ue(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,s=ue(t,n),o=s(.5),r=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${a} ${n},${a}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function ps(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const t=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${i},${a-n}L${i-l},${a-n}L${i-l},${a+n}L${i},${a+n}Z`}const i=r.sourceX,a=r.sourceY,s=r.targetX,l=r.targetY,c=r.rightFullExtent,u=r.leftFullExtent,d=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${i},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${a+h*n}L${i},${a+h*n}Z`}const ys=new Set,ms=new WeakMap;function vs(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=ms.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,ms.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;ys.has(e)||(ys.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const bs={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Ga))-1:0},justify:Ya},xs={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(r=n.nodeWidth)&&void 0!==r?r:15,f=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,p=null!==(a=n.iterations)&&void 0!==a?a:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=gs().extent(v).links(m).nodes(y).nodeAlign(bs[h]||Ya).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>r&&(r=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-n,u=o[0],d=o[1];if(i>0&&a>0&&(0>e||0>n||t>u||r>d)){const t=Math.min(u/i,d/a),o=-e*t+(u-i*t)/2,r=-n*t+(d-a*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of m)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+r,n.targetY=n.targetY*t+r,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+r,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+r,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+r,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=e.source,n=e.target,o="object"==typeof t&&null!==t?t.id:t+"",r="object"==typeof n&&null!==n?n.id:n+"",i=k.get(e._edgeKey?e._edgeKey:`${o}\0${r}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(o),n=x.get(r);t&&(i.source=t),n&&(i.target=n)}}},buildScene(e,t,n,o){var r,i,a,s;const l="vertical"===n.orientation?"down":"right",c=n.nodeStyle,u=n.edgeStyle,d=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,h=n.edgeColorBy||"source",g=Array.isArray(n.colorScheme)?n.colorScheme:_,f=new Map;e.forEach((e,t)=>{f.set(e.id,g[t%g.length])});const p=[],y=[],m=[],v=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=c?c(vs(t,"nodeStyle")):{},r={fill:o.fill||f.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};v.set(t.id,("string"==typeof r.fill?r.fill:null)||f.get(t.id)||"#4d430c"),p.push("down"===l?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:r,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const b=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of b){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o="#999";o="function"==typeof h?h(e)||o:"target"===h?v.get(n.id)||f.get(n.id)||o:v.get(t.id)||f.get(t.id)||o;const r=u?u(vs(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),l=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=r.fill||o;y.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+s},${t.sourceY-n}L${t.sourceX+s},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:c,fillOpacity:null!==(i=r.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),y.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-l},${t.targetY-n}L${t.targetX-l},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:c,fillOpacity:null!==(a=r.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-l,x1:t.targetX}});continue}let l;if(l=e.circular&&e.circularPathData?ps(e):fs(e),!l)continue;const c={fill:r.fill||o,fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:d,stroke:r.stroke||"none",strokeWidth:r.strokeWidth,opacity:r.opacity};y.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,s,c;"down"===l?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),s=n.y0+r/2),m.push({x:a,y:s,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var x;return{sceneNodes:p,sceneEdges:y,labels:m}}},ks={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const a=null!==(r=n.forceStrength)&&void 0!==r?r:.1,s=o[0]/2,l=o[1]/2,c=n.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of d){const o=ws(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const r=As(e.id),i=r%360*(Math.PI/180),a=10+r%20;e.x=t/o.length+a*Math.cos(i),e.y=n/o.length+a*Math.sin(i)}else{const t=As(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),r=n*t;o.x=s+e*Math.cos(r),o.y=l+e*Math.sin(r)}}}const g=null!==(i=n.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===n.iterations?0:h?40:g,p=Ss(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e);if(f>0){const n=de().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),o=he().force("charge",ge().strength(e=>-25*y(e))).force("center",fe(s,l).strength(.8)).force("x",pe(s).strength(.15)).force("y",ye(l).strength(.15));if(o.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));o.force("link",n),o.force("link").links(e)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;f>e;++e)o.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var r,i,a;const s=n.nodeStyle,l=n.edgeStyle,c=Ss(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:_,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],f=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(vs(t,"nodeSize")),n=s?s(vs(t,"nodeStyle")):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const o=l?l(vs(e,"edgeStyle")):{},r={stroke:o.stroke||"#999",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(y=n.nodeLabel)?"function"==typeof y?y:e=>e[y]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(vs(n,"nodeSize"));f.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var y;return{sceneNodes:h,sceneEdges:g,labels:f}}};function ws(e,t,n){const o=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,i="string"==typeof r.target?r.target:r.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function As(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Ss(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(o=N(a))&&void 0!==o?o:0,l=null!==(r=I(a))&&void 0!==r?r:1;if(s===l)return()=>(i[0]+i[1])/2;const c=m().domain([s,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const Os=_,Es={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-i,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const r=d(e);p[n][o]=r}const y=ve().padAngle(r);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=ie().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const n=e[t.source.index].id,o=e[t.target.index].id,r=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);r&&(r.chordData=t)}},buildScene(e,t,n,o){var r,i;const{groupWidth:a=20,edgeOpacity:s=.5}=n,l=Math.min(o[0],o[1])/2,c=l-a,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,g=n.edgeStyle,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:Os,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=me().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(vs(n,"nodeStyle")).fill||y.get(n.id)||p[t%p.length]:y.get(n.id)||p[t%p.length];const a=h?h(vs(n,"nodeStyle")):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m(t);if(!n)continue;const o=js(n,u,d);let r="#999";if(g)r=g(vs(e,"edgeStyle")).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===f&&n?r=y.get(n.id)||r:t&&(r=y.get(t.id)||r)}const a=g?g(vs(e,"edgeStyle")):{},l={fill:r,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(k=n.nodeLabel)?"function"==typeof k?k:e=>e[k]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*o,y:d+Math.sin(a)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:v,sceneEdges:b,labels:x}}};function js(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const Cs=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Ps(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>150?"#222":"#fff"}function Ms(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Ls(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}function _s(e){return Array.isArray(e.colorScheme)?e.colorScheme:Cs}function Ts(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:"#4d430c"}function Bs(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}const Ns={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>{var t;return null!==(t=e[l])&&void 0!==t?t:0}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0},u=z(i,s);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(a){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=V();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=X();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var r,i;const a=null!==(r=t.padding)&&void 0!==r?r:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=Y().size([n,o]).tile(q).padding(a);s>0&&l.paddingTop(s),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;G().size([n,o]).padding(i)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var r;R().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,n,d,h)}const g=u.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const o=g[t],i={id:Ms(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?Ds(i,o,n):"treemap"===a||"partition"===a?Is(i,o):"circlepack"===a&&Hs(i,o),i.__hierarchyNode=o,e.push(i),f.set(o,i)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=f.get(e.parent),o=f.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var a,s,l,c,u;const d=[],h=[],g=[],f=n.treeOrientation||"vertical",p="radial"===f,y=o[0]/2,m=o[1]/2,v="number"==typeof(b=n.nodeSize)?b:5;var b;for(const t of e){let e=t.x,o=t.y;p&&(e+=y,o+=m);const i=r(vs(t,"nodeStyle"));let s=i.fill||Ts(n);if(n.colorByDepth&&void 0!==t.depth){const e=_s(n);s=e[t.depth%e.length]}const l={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:o,r:v,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(s=n.edgeOpacity)&&void 0!==s?s:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,r=t.y,a=n.x,s=n.y;p&&(o+=y,r+=m,a+=y,s+=m);const u=Bs(o,r,a,s,f),d=i(vs(e,"edgeStyle")),g={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:x};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=Ls(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,a=n.x,s=n.y;if(p&&(a+=y,s+=m),p){const e=a-y,t=s-m,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,r=s+t/n*10,i=0>e?"end":"start"):(o=a,r=s-12,i="middle")}else"horizontal"===f?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=a-v-6,i="end"):(o=a+v+6,i="start"),r=s):(o=a,r=s+v+14,i="middle");g.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:g}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const a=[],s=[];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const s=o(vs(n,"nodeStyle"));let l=s.fill||Ts(t);if(t.colorByDepth&&void 0!==n.depth){const e=_s(t);l=e[n.depth%e.length]}const c={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};a.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:c,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ls(t.nodeLabel),r=t.labelMode||"leaf",a="partition"===t.chartType;for(const l of e){const e=l.x1-l.x0,c=l.y1-l.y0;if(0>=e||0>=c)continue;const u=!((null===(i=l.data)||void 0===i?void 0:i.children)&&l.data.children.length>0);if(!a){if("leaf"===r&&!u)continue;if("parent"===r&&u)continue}const d=n?n(l):l.id;if(!d)continue;if((u?30:40)>e||(u?16:14)>c)continue;let h=o(vs(l,"nodeStyle")).fill||Ts(t);if(t.colorByDepth&&void 0!==l.depth){const e=_s(t);h=e[l.depth%e.length]}const g=Ps(h);s.push(u?{x:l.x0+e/2,y:l.y0+c/2,text:d+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:g}:{x:l.x0+4,y:l.y0+12,text:d+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:g})}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,a,s,l;const c=[],u=[];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(vs(n,"nodeStyle"));let l=s.fill||Ts(t);if(t.colorByDepth&&void 0!==n.depth){const e=_s(t);l=e[n.depth%e.length]}const u={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ls(t.nodeLabel);for(const r of e){const e=null!==(s=r.__radius)&&void 0!==s?s:5,i=n?n(r):r.id;if(!i)continue;if(15>e)continue;const a=!((null===(l=r.data)||void 0===l?void 0:l.children)&&r.data.children.length>0);let c=o(vs(r,"nodeStyle")).fill||Ts(t);if(t.colorByDepth&&void 0!==r.depth){const e=_s(t);c=e[r.depth%e.length]}if(a){const t=Ps(c);u.push({x:r.x,y:r.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:t})}else u.push({x:r.x,y:r.y-e+14,text:i+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:"#000",stroke:"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Ds(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Is(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Hs(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Ws(e){const t=e;return t.__orbitState||(t.__orbitState={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()}),t.__orbitState}const $s={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const r=n.__hierarchyRoot;r&&function(e,t,n,o,r){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(i=n.orbitSize)&&void 0!==i?i:2.95,d=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=Ws(n);f.metaMap.clear(),o.length=0,r.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,i,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:n,depth:d,data:t,parentId:n},O=p?u/h(S)*A:u*A,E=le().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=E(k),C=g(S);for(let t=0;k.length>t;t++){const s=(j[t].startAngle+j[t].endAngle)/2,c=k[t],u=y(l(c)),h=i+O*Math.sin(s),g=a+O*Math.cos(s)*C;o.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:O,angle:s,depth:d,parentId:n,eccentricity:C}),r.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(r,o,n,e,t)},buildScene(e,t,n,o){var r,i,a,s,l;const c=n.nodeStyle,u=n.nodeSize,d="number"==typeof u?()=>u:"function"==typeof u?u:()=>6,h=[],g=[],f=[];if(!1!==n.orbitShowRings){const t=Ws(n),o=new Map;for(const t of e)o.set(t.id,t);const r=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;r.has(n)||r.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of r)for(let r=0;i>r;r++){const s=r/i*Math.PI*2,l=(r+1)/i*Math.PI*2;g.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=d(vs(t,"nodeSize")),n=c?c(vs(t,"nodeStyle")):{},o={fill:n.fill||"#6366f1",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:1,opacity:null!==(i=n.opacity)&&void 0!==i?i:0===(null!==(a=t.depth)&&void 0!==a?a:0)?1:.85};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id,depth:t.depth})}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:p.get(e.source),n="object"==typeof e.target?e.target:p.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=d(vs(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(l=null===(s=n.data)||void 0===s?void 0:s[t])&&void 0!==l?l:n.id;f.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:h,sceneEdges:g,labels:f}},tick:(e,t,n,o,r)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const r=Ws(t),i=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,l=i*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},Fs={sankey:xs,force:ks,chord:Es,tree:Ns,cluster:Ns,treemap:Ns,circlepack:Ns,partition:Ns,orbit:$s};function zs(e){return Fs[e]}class Rs{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},Sa),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Ea(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},Sa),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&!this.particlePool&&(this.particlePool=new Ea(2e3))}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Gs(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",r=c(n)+"",i=Number(u(n))||1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Gs(o)),{data:n})),this.nodes.has(r)||this.nodes.set(r,Object.assign(Object.assign({},Gs(r)),{data:n}));const a=`${o}\0${r}\0${e}`;this.edges.set(a,{source:o,target:r,value:i,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:a})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Gs(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,Gs(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,r,i,a;const s=zs(this.config.chartType);if(!s)return;let l=Array.from(this.nodes.values()),c=Array.from(this.edges.values());if(0===l.length&&!s.hierarchical)return;if(this.prepareForRelayout(),s.supportsStreaming&&!s.hierarchical){const e=new Map;for(const s of l)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(r=s._prevY0)&&void 0!==r?r:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(s.computeLayout(l,c,this.config,e),this.config.__previousPositions=void 0,s.hierarchical&&l.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of l)this.nodes.set(e.id,e);for(let e=0;c.length>e;e++){const t=c[e],n=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=n,this.edges.set(n,t)}}this.finalizeLayout();const u=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||u.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=u,this.saveTargetPositions(),l.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const d=new Set(this.nodes.keys()),h=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of d)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)d.has(e)||this.removedNodes.add(e);for(const e of h)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)h.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=d,this.previousEdgeKeys=h,this.layoutVersion++}buildScene(e){const t=zs(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:a}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=a}get isAnimating(){const e=zs(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=zs(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=Array.from(this.nodes.values()),r=Array.from(this.edges.values());return n.tick(o,r,this.config,e,t)}advanceTransition(e){if(!this.transition)return!1;const t=Fe(e,this.transition),n=$e(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=ze(e._prevX0,e._targetX0,n),e.x1=ze(e._prevX1,e._targetX1,n),e.y0=ze(e._prevY0,e._targetY0,n),e.y1=ze(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=ze(e._prevY0,e._targetY0,n),e.y1=ze(e._prevY1,e._targetY1,n),e.sankeyWidth=ze(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,a=ue(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,a=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,r,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const r=e-o;s>r&&(t._pulseIntensity=1-r/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(r=n.source)||void 0===r?void 0:r.id:n.source,a="object"==typeof n.target?null===(i=n.target)||void 0===i?void 0:i.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t;const n=this.config.decay;if(!n)return;const o=this.nodeTimestamps.size;if(1>=o)return;this._decaySortedNodes||(this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]));const r=this._decaySortedNodes,i=new Map;for(let e=0;r.length>e;e++)i.set(r[e][0],e);for(const r of this.sceneNodes){const a=r.id;if(!a)continue;const s=i.get(a);if(void 0===s)continue;const l=He(n,s,o),c=null!==(t=null===(e=r.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;r.style=Object.assign(Object.assign({},r.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const r=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=r):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const r=o.data?Object.assign({},o.data):{};return o.data=t(null!==(n=o.data)&&void 0!==n?n:{}),this.layoutVersion++,r}updateEdge(e,t,n){var o;const r=this.config.valueAccessor,i="function"==typeof r?r:r?e=>e[r]:e=>e.value,a=[];for(const[,r]of this.edges)if(("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t){a.push(r.data?Object.assign({},r.data):{}),r.data=n(null!==(o=r.data)&&void 0!==o?o:{});const e=i(r.data);null!=e&&(r.value=Number(e))}return a.length>0&&this.layoutVersion++,a}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const n=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const o="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,r]of this.edges)o(r.data)===e&&n.push(t)}else for(const[o,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0&&this.layoutVersion++,n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function Gs(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Ys(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=qs(t,n,o,r);if(e)if("rect"===t.type){const n=t.w*t.h;s>n&&(i=e,s=n)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=Ks(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function qs(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const r=t-e.cx,i=n-e.cy,a=Math.sqrt(r*r+i*i);return a>nt(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=tt(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const a=it(Math.atan2(r,o)),s=it(e.startAngle),l=it(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}let Xs=null,Vs=null;function Us(){return Vs||(Xs=document.createElement("canvas"),Xs.width=1,Xs.height=1,Vs=Xs.getContext("2d")),Vs}function Ks(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),a=Us();if(!a)return null;if(a.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,a="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}const s=a.lineWidth;a.lineWidth=10;const l=a.isPointInStroke(i,t,n);if(a.lineWidth=s,l)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let a=((t-e.x1)*o+(n-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*r,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=Us();if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(o,t,n);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function Qs(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:a,labels:s,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",foregroundGraphics:p,sceneNodes:y,annotations:m,svgAnnotationRules:v}=t;return e.createElement(e.Fragment,null,e.createElement("svg",{role:"img",width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("title",null,"string"==typeof l?l:"Network Chart"),e.createElement("desc",null,"string"==typeof l?l+" — network data visualization":"Network data visualization"),e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,n)=>e.createElement("text",{key:"label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),m&&m.filter(e=>"widget"!==e.type).map((t,r)=>{if(v){const i=v(t,r,{width:n,height:o,sceneNodes:y});if(i)return e.createElement(e.Fragment,{key:"annotation-"+r},i)}return null}),p),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:a.top},l):null,Pt({legend:c,totalWidth:r,totalHeight:i,margin:a,legendPosition:f,title:l,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})),null==m?void 0:m.filter(e=>"widget"===e.type&&e.nodeId&&y).map((t,n)=>{var o,r,i,s,l,c,u,d,h;const g=y.find(e=>{var n,o,r,i,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(r=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===r?void 0:r.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!g)return null;const f=a.left+(null!==(o=g.cx)&&void 0!==o?o:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(r=g.x)&&void 0!==r?r:0),p=a.top+(null!==(i=g.cy)&&void 0!==i?i:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(s=g.y)&&void 0!==s?s:0),m=null!==(l=t.dx)&&void 0!==l?l:0,v=null!==(c=t.dy)&&void 0!==c?c:-16,b=null!==(u=t.width)&&void 0!==u?u:32,x=null!==(d=t.height)&&void 0!==d?d:32,k=null!==(h=t.content)&&void 0!==h?h:e.createElement("span",{style:{fontSize:18,cursor:"default"}},"ℹ️");return e.createElement("div",{key:"widget-"+n,style:{position:"absolute",left:f+m-b/2,top:p+v-x/2,width:b,height:x,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",zIndex:5}},k)}))}function Zs(e,t){var n,o,r,i,a,s;if(!t.pathD)return;e.save();const l=new Path2D(t.pathD);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const r=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999";r.addColorStop(0,1===a.from?s:"transparent"),r.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Js(e,t){var n,o;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function el(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const a=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function tl(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Qs.displayName="NetworkSVGOverlay";const nl={top:20,right:80,bottom:20,left:80},ol={top:40,right:40,bottom:40,left:40},rl=new Set(["chord","force","circlepack","orbit"]),il=[800,600],al={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 sl({data:t}){var n,o,r,i,a,s;if("edge"===t.nodeOrEdge){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:al},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let a=c;for(;a;){const e=null!==(i=null!==(o=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:al},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(a=l.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=l.targetLinks)||void 0===s?void 0:s.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:al},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const ll=c(function(i,a){var s,c,d,h,g,f,p,y,m,v,b,x,k,w;const{chartType:A,nodes:S,edges:O,data:E,initialEdges:j,nodeIDAccessor:C="id",sourceAccessor:P="source",targetAccessor:M="target",valueAccessor:L="value",edgeIdAccessor:_,childrenAccessor:T,hierarchySum:B,orientation:N="horizontal",nodeAlign:D="justify",nodePaddingRatio:I=.05,nodeWidth:H=15,iterations:W=300,forceStrength:$=.1,padAngle:F=.01,groupWidth:z=20,sortGroups:R,edgeSort:G,treeOrientation:Y="vertical",edgeType:q="curve",padding:X,paddingTop:V,tensionConfig:U,showParticles:K=!1,particleStyle:Q,nodeStyle:Z,edgeStyle:J,colorBy:ee,colorScheme:te="category10",edgeColorBy:ne="source",edgeOpacity:oe=.5,colorByDepth:re=!1,nodeSize:ae=8,nodeSizeRange:se=[5,20],nodeLabel:le,showLabels:ce=!0,labelMode:ue,size:de=il,responsiveWidth:he,responsiveHeight:ge,margin:fe,className:pe,background:ye,enableHover:me=!0,tooltipContent:ve,customHoverBehavior:be,customClickBehavior:xe,onObservation:ke,chartId:we,onTopologyChange:Ae,annotations:Se,svgAnnotationRules:Oe,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:_e,title:Te,foregroundGraphics:Be,backgroundGraphics:Ne,decay:De,pulse:Ie,staleness:He,thresholds:We,accessibleTable:$e=!0,description:Fe,summary:ze,orbitMode:Re,orbitSize:Ge,orbitSpeed:Ye,orbitRevolution:qe,orbitRevolutionStyle:Xe,orbitEccentricity:Ve,orbitShowRings:Ue,orbitAnimated:Ke}=i,Qe=Mn(),Ze=t(Qe);Ze.current=Qe;const Je="semiotic-table-"+e.useId(),et=rl.has(A)?ol:nl,[tt,nt]=kt(de,he,ge),ot=Object.assign(Object.assign({},et),fe),rt=nt[0]-ot.left-ot.right,it=nt[1]-ot.top-ot.bottom,at="function"==typeof Be?Be({size:nt,margin:ot}):Be,st=n(()=>Object.assign(Object.assign({},Sa),U),[U]),lt=n(()=>Object.assign(Object.assign({},Oa),Q),[Q]),ct=n(()=>({chartType:A,nodeIDAccessor:C,sourceAccessor:P,targetAccessor:M,valueAccessor:L,edgeIdAccessor:_,childrenAccessor:T,hierarchySum:B,orientation:N,nodeAlign:D,nodePaddingRatio:I,nodeWidth:H,iterations:W,forceStrength:$,padAngle:F,groupWidth:z,sortGroups:R,edgeSort:G,treeOrientation:Y,edgeType:q,padding:X,paddingTop:V,tensionConfig:st,showParticles:K,particleStyle:lt,nodeStyle:Z,edgeStyle:J,nodeLabel:le,showLabels:ce,labelMode:ue,colorBy:ee,colorScheme:te,edgeColorBy:ne,edgeOpacity:oe,colorByDepth:re,nodeSize:ae,nodeSizeRange:se,decay:De,pulse:Ie,staleness:He,thresholds:We,orbitMode:Re,orbitSize:Ge,orbitSpeed:Ye,orbitRevolution:qe,orbitRevolutionStyle:Xe,orbitEccentricity:Ve,orbitShowRings:Ue,orbitAnimated:Ke}),[A,C,P,M,L,T,B,N,D,I,H,W,$,F,z,R,G,Y,q,X,V,st,K,lt,Z,J,le,ce,ue,ee,te,ne,oe,re,ae,se,De,Ie,He,We,Re,Ge,Ye,qe,Xe,Ve,Ue,Ke]),ut=t(null),dt=t(0),ht=t(0),gt=t(!0),ft=In(e=>e.theme),pt=t(()=>{}),bt=t(null);bt.current||(bt.current=new Rs(ct));const[xt,At]=r(null),[St,Ot]=r(0),[Et,jt]=r(0),[Ct,Pt]=r(!1),Mt=t(null),Lt=t(new Map),_t=t(0),Tt=l(e=>{if("function"==typeof ee)return ee(e)+"";if("string"==typeof ee&&e.data){const t=e.data[ee];if(void 0!==t){if(!Lt.current.has(t+"")){const e=Array.isArray(te)?te:Le;Lt.current.set(t+"",e[_t.current++%e.length])}return Lt.current.get(t+"")}}if(Lt.current.has(e.id))return Lt.current.get(e.id);const t=Array.isArray(te)?te:Le,n=ee?t[_t.current++%t.length]:t[0];return Lt.current.set(e.id,n),n},[ee,te]),Bt=l(e=>{if("function"==typeof ne)return ne(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===ne&&n?Tt(n):t?Tt(t):"#999"},[ne,Tt]),Nt=l(e=>{if(!(null==Q?void 0:Q.colorBy))return Bt(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===lt.colorBy&&n?Tt(n):t?Tt(t):"#999"},[null==Q?void 0:Q.colorBy,lt.colorBy,Tt,Bt]),Dt="sankey"===A&&K||!!Ie||null!==(c=null===(s=bt.current)||void 0===s?void 0:s.isAnimating)&&void 0!==c&&c,It=l(()=>{dt.current&&!Dt||dt.current||(dt.current=requestAnimationFrame(()=>pt.current()))},[Dt]);o(()=>{var e;null===(e=bt.current)||void 0===e||e.updateConfig(ct),gt.current=!0,It()},[ct,It]),o(()=>{gt.current=!0,It()},[ft,It]);const Ht=l(()=>{var e;const t=bt.current;if(!t)return;t.runLayout([rt,it]),t.buildScene([rt,it]),gt.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&Lt.current.set(n.id,n.style.fill);const n=Array.isArray(te)?te:Le,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];Lt.current.has(t.id)||Lt.current.set(t.id,n[e%n.length])}if(_t.current=o.length,Ot(t.layoutVersion),Ae){const{nodes:e,edges:n}=t.getLayoutData();Ae(e,n)}},[rt,it,Ae,te]),Wt=l(e=>{const t=bt.current;t&&(t.ingestEdge(e)&&Ht(),It())},[Ht,It]),$t=l(e=>{const t=bt.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&Ht(),It()},[Ht,It]),Ft=l(()=>{var e;null===(e=bt.current)||void 0===e||e.clear(),Lt.current.clear(),_t.current=0,Ot(0),At(null),Mt.current=null,gt.current=!0,It()},[It]),zt=l(()=>{const e=bt.current;e&&(e.tension+=999,Ht(),It())},[Ht,It]);u(a,()=>({push:Wt,pushMany:$t,removeNode:e=>{var t,n,o;const r=null!==(n=null===(t=bt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(r){const t=(null===(o=Mt.current)||void 0===o?void 0:o.data)?"function"==typeof C?C(Mt.current.data):Mt.current.data[C]:void 0;Mt.current&&"node"===Mt.current.nodeOrEdge&&t===e&&(Mt.current=null,At(null)),Lt.current.delete(e),Ht(),gt.current=!0,It()}return r},removeEdge:(e,t)=>{var n,o;const r=null!==(o=null===(n=bt.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(r){if(Mt.current&&"edge"===Mt.current.nodeOrEdge){const n=Mt.current.data;let o;o=void 0!==t?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===e&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===t:!_||!n||("function"==typeof _?_:e=>null==e?void 0:e[_])(n)===e,o&&(Mt.current=null,At(null))}Ht(),gt.current=!0,It()}return r},updateNode:(e,t)=>{var n,o;const r=null!==(o=null===(n=bt.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return r&&(gt.current=!0,It()),r},updateEdge:(e,t,n)=>{var o,r;const i=null!==(r=null===(o=bt.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==r?r:[];return i.length>0&&(Ht(),gt.current=!0,It()),i},clear:Ft,getTopology:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=bt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:zt,getTension:()=>{var e,t;return null!==(t=null===(e=bt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Wt,$t,Ft,zt,Ht,It]);const Rt=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),Gt=Rt?E||(Array.isArray(O)?void 0:O):void 0;o(()=>{var e;const t=bt.current;if(t)if(Rt&&Gt)t.ingestHierarchy(Gt,[rt,it]),t.buildScene([rt,it]),gt.current=!0,It();else{const n=S||[],o=Array.isArray(O)?O:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[rt,it]),t.buildScene([rt,it]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&Lt.current.set(n.id,n.style.fill+"");const r=Array.isArray(te)?te:Le,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];Lt.current.has(t.id)||Lt.current.set(t.id,r[e%r.length])}_t.current=i.length,gt.current=!0,It()}},[S,O,E,Gt,Rt,rt,it,ct,It,te]),o(()=>{j&&j.length>0&&$t(j)},[]);const Yt=l(e=>{if(be&&be(e),ke){const t=Date.now();ke(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:we}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:we})}},[be,ke,we]),qt=l(e=>{if(xe&&xe(e),ke){const t=Date.now();ke(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:we}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:we})}},[xe,ke,we]),Xt=t(()=>{}),Vt=t(()=>{});Xt.current=e=>{if(!me)return;const t=ut.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ot.left,r=e.clientY-n.top-ot.top;if(0>o||o>rt||0>r||r>it)return void(Mt.current&&(Mt.current=null,At(null),Yt&&(Yt(null),gt.current=!0),It()));const i=bt.current;if(!i)return;const a=Ys(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(Mt.current&&(Mt.current=null,At(null),Yt&&(Yt(null),gt.current=!0),It()));const s=io(a.datum||{},a.x,a.y,{nodeOrEdge:a.type});Mt.current=s,At(s),Yt&&(Yt(s),gt.current=!0),It()},Vt.current=()=>{Mt.current&&(Mt.current=null,At(null),Yt&&(Yt(null),gt.current=!0),It())};const Ut=t(()=>{});Ut.current=e=>{if(!xe&&!ke)return;const t=ut.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ot.left,r=e.clientY-n.top-ot.top;if(0>o||o>rt||0>r||r>it)return;const i=bt.current;if(!i)return;const a=Ys(i.sceneNodes,i.sceneEdges,o,r);qt(a?io(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)},l(e=>Xt.current(e),[]);const Kt=l(()=>Vt.current(),[]),Qt=l(e=>Ut.current(e),[]),Zt=t(-1),Jt=t(null),en=t(-1),tn=l(e=>{var t;const n=bt.current;if(!n)return;const o=function(e){var t,n,o,r,i,a;const s=[];for(const l of e)"circle"===l.type&&null!=l.cx?s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(n=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"}):"rect"===l.type&&null!=l.x?s.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(r=null===(o=l.datum)||void 0===o?void 0:o.id)&&void 0!==r?r:"_default"}):"arc"===l.type&&null!=l.cx&&s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(a=null===(i=l.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(n.sceneNodes);if(0===o.length)return;const r=yt(o),i=Zt.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Zt.current=0,en.current=-1;const t=r.flat[0];Jt.current={shape:t.shape,w:t.w,h:t.h};const n=io(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Mt.current=n,At(n),Yt&&(Yt(n),gt.current=!0),void It()}const a=mt(r,i),s=function(e,t,n,o,r){var i,a,s;const l=n.flat[t.flatIndex];if(!l)return vt(e,t,n);const c=null===(i=l.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,r=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;r>u&&(r=u,o=i)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(r.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n,o,r;const i=e+"",a=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,s="object"==typeof t.source?null===(o=t.source)||void 0===o?void 0:o.id:t.source,l="object"==typeof t.target?null===(r=t.target)||void 0===r?void 0:r.id:t.target,c=null!=s,u=null!=l;c&&s+""===i&&u?a.push(l+""):u&&l+""===i&&c&&a.push(s+"")}return a}(c,o);if(0===e.length)return t.flatIndex;const i=null!==(s=n.idToIdx.get(e[(r.current+1)%e.length]))&&void 0!==s?s:-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const o=vt(e,t,n);return null!==o&&o!==t.flatIndex&&(r.current=-1),o}}}(e.key,a,r,null!==(t=n.sceneEdges)&&void 0!==t?t:[],en);if(null===s)return;if(e.preventDefault(),0>s)return Zt.current=-1,Jt.current=null,en.current=-1,Mt.current=null,At(null),Yt&&(Yt(null),gt.current=!0),void It();Zt.current=s;const l=r.flat[s];Jt.current={shape:l.shape,w:l.w,h:l.h};const c=l.datum||{},u=Object.assign(Object.assign({},"object"!=typeof c||null===c||Array.isArray(c)?{}:c),{data:c,x:l.x,y:l.y,time:l.x,value:l.y,nodeOrEdge:"node"});Mt.current=u,At(u),Yt&&(Yt(u),gt.current=!0),It()},[Yt,It]),nn=l(e=>{Zt.current=-1,Jt.current=null,Xt.current(e)},[]);pt.current=()=>{var e,t,n,o,r,i,a;dt.current=0;const s=ut.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=bt.current;if(!c)return;const u=performance.now(),d=ht.current?Math.min((u-ht.current)/1e3,.1):.016;ht.current=u;const h=c.advanceTransition(Ze.current?u+1e6:u),g=!Ze.current&&h,f=!Ze.current&&c.tickAnimation([rt,it],d);(h||gt.current||f)&&c.buildScene([rt,it]);const p=Wn();if(!Hn(s,nt,ot,p))return;l.clearRect(-ot.left,-ot.top,nt[0],nt[1]),ye&&(l.fillStyle=ye,l.fillRect(0,0,rt,it)),De&&c.applyDecay(),Ie&&c.applyPulse(u),We&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==He?void 0:He.threshold)&&void 0!==e?e:5e3,m=He&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==He?void 0:He.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Zs(e,n);break;case"line":Js(e,n);break;case"ribbon":el(e,n);break;case"curved":tl(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),Un(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),Kn(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(l,c.sceneNodes),K&&c.particlePool&&!m){const e=Array.from(c.edges.values());if(e.length>0){!function(e,t,n,o){var r,i;const a=null!==(r=o.spawnRate)&&void 0!==r?r:Oa.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:Oa.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=s)continue;const i=r.value*a*n*(r.bezier.circular?.3:1),l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(c.particlePool,e,d,lt);const t=.5*(null!==(n=lt.speedMultiplier)&&void 0!==n?n:1);let o;if(lt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,o),function(e,t,n,o,r){var i,a;const s=null!==(i=o.radius)&&void 0!==i?i:Oa.radius,l=null!==(a=o.opacity)&&void 0!==a?a:Oa.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(l,c.particlePool,e,lt,Nt)}}m&&(l.globalAlpha=1);const v=gt.current;if(gt.current=!1,v||g||f){const e=ut.current;e&&e.setAttribute("aria-label",hn(null!==(r=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==r?r:0,null!==(a=null===(i=c.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}(v||g||f)&&jt(e=>e+1),(Dt||g||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff)&&(dt.current=requestAnimationFrame(()=>pt.current()))},o(()=>(It(),()=>{dt.current&&(cancelAnimationFrame(dt.current),dt.current=0)}),[It]),o(()=>{gt.current=!0,It()},[A,rt,it,ye,It]),wt(He,bt,gt,It,Ct,Pt);const on=me&&xt?e.createElement(Cn,{x:xt.x,y:xt.y,containerWidth:rt,containerHeight:it,margin:ot,className:"stream-network-tooltip",zIndex:2},ve?ve(xt):e.createElement(sl,{data:xt})):null;if(an){const t=bt.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(A),n=e?E||(Array.isArray(O)?void 0:O):void 0;if(e&&n)t.ingestHierarchy(n,[rt,it]),t.buildScene([rt,it]);else{const e=S||[],n=Array.isArray(O)?O:[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[rt,it]),t.buildScene([rt,it]))}}const n=null!==(d=null==t?void 0:t.sceneNodes)&&void 0!==d?d:[],o=null!==(h=null==t?void 0:t.sceneEdges)&&void 0!==h?h:[],r=null!==(g=null==t?void 0:t.labels)&&void 0!==g?g:[];return e.createElement("div",{className:"stream-network-frame"+(pe?" "+pe:""),role:"img","aria-label":Fe||("string"==typeof Te?Te:"Network chart"),style:{position:"relative",width:nt[0],height:nt[1]}},e.createElement(An,{summary:ze}),e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:nt[0],height:nt[1],style:{position:"absolute",left:0,top:0}},Ne&&e.createElement("g",{transform:`translate(${ot.left},${ot.top})`},Ne),e.createElement("g",{transform:`translate(${ot.left},${ot.top})`},ye&&e.createElement("rect",{x:0,y:0,width:rt,height:it,fill:ye}),o.map((t,n)=>function(t,n){switch(t.type){case"line":return e.createElement("line",{key:"net-edge-"+n,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity});case"bezier":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"ribbon":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"curved":{const o=t;return e.createElement("path",{key:"net-edge-"+n,d:o.pathD,fill:rn(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),n.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e.createElement("circle",{key:"net-circle-"+n,cx:o.cx,cy:o.cy,r:o.r,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"rect":{const o=t;return e.createElement("rect",{key:"net-rect-"+n,x:o.x,y:o.y,width:o.w,height:o.h,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}case"arc":{const o=t,r=ie().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)({})||"";return e.createElement("path",{key:"net-arc-"+n,d:r,transform:`translate(${o.cx},${o.cy})`,fill:rn(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e.createElement("text",{key:"net-label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder},t.text)}(t,n)).filter(Boolean))),e.createElement(Qs,{width:rt,height:it,totalWidth:nt[0],totalHeight:nt[1],margin:ot,labels:r,sceneNodes:n,title:Te,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:_e,foregroundGraphics:at,annotations:Se,svgAnnotationRules:Oe,annotationFrame:0}))}const sn=bt.current;return e.createElement("div",{ref:tt,className:"stream-network-frame"+(pe?" "+pe:""),role:"group","aria-label":Fe||("string"==typeof Te?Te:"Network chart"),tabIndex:0,style:{position:"relative",width:he?"100%":nt[0],height:ge?"100%":nt[1],overflow:"visible"},onKeyDown:tn},$e&&e.createElement(Sn,{tableId:Je}),$e&&e.createElement(wn,{nodes:null!==(f=null==sn?void 0:sn.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==sn?void 0:sn.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:Je,chartTitle:"string"==typeof Te?Te:void 0}),e.createElement(An,{summary:ze}),e.createElement("div",{role:"img","aria-label":Fe||("string"==typeof Te?Te:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:me?nn:void 0,onMouseLeave:me?Kt:void 0,onClick:xe||ke?Qt:void 0},Ne&&e.createElement("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:nt[0],height:nt[1],pointerEvents:"none",overflow:"visible"}},e.createElement("g",{transform:`translate(${ot.left},${ot.top})`},Ne)),e.createElement("canvas",{ref:ut,"aria-label":hn(null!==(m=null===(y=null==sn?void 0:sn.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==sn?void 0:sn.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.createElement(On,{hoverPoint:xt}),e.createElement(Qs,{width:rt,height:it,totalWidth:nt[0],totalHeight:nt[1],margin:ot,labels:(null==sn?void 0:sn.labels)||[],sceneNodes:null==sn?void 0:sn.sceneNodes,title:Te,legend:Ee,legendPosition:je,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:Me,legendIsolatedCategories:_e,foregroundGraphics:at,annotations:Se,svgAnnotationRules:Oe,annotationFrame:Et}),e.createElement(jn,{active:Zt.current>=0,hoverPoint:xt,margin:ot,size:nt,shape:null===(x=Jt.current)||void 0===x?void 0:x.shape,width:null===(k=Jt.current)||void 0===k?void 0:k.w,height:null===(w=Jt.current)||void 0===w?void 0:w.h}),on,(null==He?void 0:He.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===He.badgePosition?{top:4,left:4}:"bottom-left"===He.badgePosition?{bottom:4,left:4}:"bottom-right"===He.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Ct?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},Ct?"STALE":"LIVE")))});ll.displayName="StreamNetworkFrame";const cl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=or(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,nodeIDAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:E,frameProps:j={},onObservation:C,onClick:P,chartId:M,selection:L,linkedHover:_,loading:T,emptyContent:B,legendInteraction:N,legendPosition:D}=o,I=s.width,H=s.height,W=s.enableHover,$=s.showLegend,F=null!==(i=s.showLabels)&&void 0!==i&&i,z=s.title,R=s.description,G=s.summary,Y=s.accessibleTable,q=Vr(T,I,H),X=q?null:Xr(l,I,H,B),V=l||[],U=c||[],K=Ko(V,m,v),Q=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Z=tr(N,m,Q),J=Xo(),ee=n(()=>new Map,[]),te=n(()=>{if(Array.isArray(v))return v;if(J&&J.length>0)return J;const e=Me[v];return Array.isArray(e)?e:Le},[v,J]),ne=n(()=>e=>{const t={};return t.fill=m?Ne(e.data||e,m,K):Vo(void 0,J,v,void 0,ee),"number"==typeof b&&(t.r=b),t},[m,K,b,J,v,ee]),oe=n(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),re=n(()=>{if(F&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[F,y]),{legend:ie,margin:ae,legendPosition:se}=er({data:V,colorBy:m,colorScale:K,showLegend:$,legendPosition:D,userMargin:d,defaults:s.marginDefaults}),{customHoverBehavior:le,customClickBehavior:ce}=Zo({selection:L,linkedHover:_,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:C,onClick:P,chartType:"ForceDirectedGraph",chartId:M}),ue=Sr({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:g}});return ue?e.createElement(yr,{componentName:"ForceDirectedGraph",message:ue,width:I,height:H}):q||X||e.createElement(Gr,{componentName:"ForceDirectedGraph",width:I,height:H},e.createElement(ll,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:V},null!=c&&{edges:U},{size:[I,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,nodeIDAccessor:g,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ne,edgeStyle:oe,colorBy:m,colorScheme:te,nodeSize:b,nodeSizeRange:x,nodeLabel:re,showLabels:F,enableHover:W,tooltipContent:!1===E?()=>null:ur(E)||void 0,customHoverBehavior:_||C||P?le:void 0,customClickBehavior:C||P?ce:void 0,legend:ie,legendPosition:se},N&&"none"!==N&&{legendHoverBehavior:Z.onLegendHover,legendClickBehavior:Z.onLegendClick,legendHighlightedCategory:Z.highlightedCategory,legendIsolatedCategories:Z.isolatedCategories},{className:h,title:z,description:R,summary:G,accessibleTable:Y},j)))});function ul(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(o)};return o(e),n}function dl(e,t,n,o){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof o?o(e):e[o];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function hl(e){return"function"==typeof e?e:t=>t[e]||1}function gl({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:r,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:r},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Ne(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Ne(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}cl.displayName="ForceDirectedGraph";const fl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=or(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",padAngle:x=.01,groupWidth:k=20,sortGroups:w,nodeLabel:A,edgeOpacity:S=.5,tooltip:O,frameProps:E={},onObservation:j,onClick:C,chartId:P,selection:M,linkedHover:L,loading:_,emptyContent:T,legendInteraction:B}=o,N=s.width,D=s.height,I=s.enableHover,H=null===(i=s.showLabels)||void 0===i||i,W=s.title,$=s.description,F=s.summary,z=s.accessibleTable,R=Vr(_,N,D),G=R?null:Xr(c,N,D,T),Y=c||[],q=n(()=>dl(l,Y,g,f),[l,Y,g,f]),X=Ko(q,m,v),V=n(()=>{if(!m)return[];const e=new Set;for(const t of q){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[q,m]),U=tr(B,m,V),K=Xo(),Q=n(()=>new Map,[]),Z=n(()=>{if(Array.isArray(v))return v;if(K&&K.length>0)return K;const e=Me[v];return Array.isArray(e)?e:Le},[v,K]),J=q.length>0,ee=n(()=>{if(J)return(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(m)r.fill=Ne(e.data||e,m,X);else{const i=Array.isArray(v)?v:Me[v]||Le,a=Array.isArray(i)?i:Le,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=a[s%a.length]}return r}},[J,m,X,v]),te=n(()=>{if(J)return gl({edgeColorBy:b,colorBy:m,colorScale:X,nodeStyleFn:ee||(e=>({fill:Vo(void 0,K,v,void 0,Q)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[J,b,m,X,ee,S,K,v,Q]),ne=n(()=>{if(!H)return;const e=A||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[H,A,y]),oe=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:re,customClickBehavior:ie}=Zo({selection:M,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:j,onClick:C,chartType:"ChordDiagram",chartId:P}),ae=Sr({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return ae?e.createElement(yr,{componentName:"ChordDiagram",message:ae,width:N,height:D}):R||G||e.createElement(Gr,{componentName:"ChordDiagram",width:N,height:D},e.createElement(ll,Object.assign({ref:a,chartType:"chord"},q.length>0&&{nodes:q},null!=c&&{edges:Y},{size:[N,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:oe,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,padAngle:x,groupWidth:k,sortGroups:w,nodeStyle:ee,edgeStyle:te,colorBy:m,colorScheme:Z,edgeColorBy:b,edgeOpacity:S,nodeLabel:ne,showLabels:H,enableHover:I,tooltipContent:!1===O?()=>null:ur(O)||void 0,customHoverBehavior:L||j||C?re:void 0,customClickBehavior:j||C?ie:void 0},B&&"none"!==B&&{legendHoverBehavior:U.onLegendHover,legendClickBehavior:U.onLegendClick,legendHighlightedCategory:U.highlightedCategory,legendIsolatedCategories:U.isolatedCategories},{className:h,title:W,description:$,summary:F,accessibleTable:z},E)))});fl.displayName="ChordDiagram";const pl=c(function(o,r){var i;const a=t(null);u(r,()=>({push:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=a.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n,o,r,i;const s=Array.isArray(e)?e:[e],l=null!==(o=null===(n=null===(t=a.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==o?o:[],c=[];for(const e of s){const t=l.find(t=>t.id===e);t&&c.push(Object.assign(Object.assign({},null!==(r=t.data)&&void 0!==r?r:{}),{id:e})),null===(i=a.current)||void 0===i||i.removeNode(e)}return c},update:(e,t)=>(Array.isArray(e)?e:[e]).flatMap(e=>{var n;const o=null===(n=a.current)||void 0===n?void 0:n.updateNode(e,t);return o?[Object.assign(Object.assign({},o),{id:e})]:[]}),clear:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=a.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==o?o:[]}}));const s=or(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:800,height:600}),{nodes:l,edges:c,margin:d,className:h,sourceAccessor:g="source",targetAccessor:f="target",valueAccessor:p="value",nodeIdAccessor:y="id",colorBy:m,colorScheme:v,edgeColorBy:b="source",orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:A=15,nodeLabel:S,edgeOpacity:O=.5,edgeSort:E,tooltip:j,frameProps:C={},onObservation:P,onClick:M,chartId:L,selection:_,linkedHover:T,loading:B,emptyContent:N,legendInteraction:D}=o,I=s.width,H=s.height,W=s.enableHover,$=null===(i=s.showLabels)||void 0===i||i,F=s.title,z=s.description,R=s.summary,G=s.accessibleTable,Y=Vr(B,I,H),q=Y?null:Xr(c,I,H,N),X=c||[],V=n(()=>dl(l,X,g,f),[l,X,g,f]),U=Ko(V,m,v),K=n(()=>{if(!m)return[];const e=new Set;for(const t of V){const n="function"==typeof m?m(t):t[m];null!=n&&e.add(n+"")}return Array.from(e)},[V,m]),Q=tr(D,m,K),Z=Xo(),J=n(()=>new Map,[]),ee=n(()=>{if(Array.isArray(v))return v;if(Z&&Z.length>0)return Z;const e=Me[v];return Array.isArray(e)?e:Le},[v,Z]),te=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?Ne(e.data||e,m,U):Vo(void 0,Z,v,void 0,J),t},[m,U,Z,v,J]),ne=n(()=>gl({edgeColorBy:b,colorBy:m,colorScale:U,nodeStyleFn:te,edgeOpacity:O,baseStyle:{stroke:"none",strokeWidth:0}}),[b,m,U,te,O]),oe=n(()=>{if(!$)return;const e=S||y;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[$,S,y]),re=Object.assign(Object.assign({},s.marginDefaults),d),{customHoverBehavior:ie,customClickBehavior:ae}=Zo({selection:_,linkedHover:T,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:P,onClick:M,chartType:"SankeyDiagram",chartId:L}),se=Sr({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return se?e.createElement(yr,{componentName:"SankeyDiagram",message:se,width:I,height:H}):Y||q||e.createElement(Gr,{componentName:"SankeyDiagram",width:I,height:H},e.createElement(ll,Object.assign({ref:a,chartType:"sankey"},V.length>0&&{nodes:V},null!=c&&{edges:X},{size:[I,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:f,valueAccessor:p,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:A,nodeStyle:te,edgeStyle:ne,colorBy:m,colorScheme:ee,edgeColorBy:b,edgeOpacity:O,edgeSort:E,nodeLabel:oe,showLabels:$,enableHover:W,tooltipContent:!1===j?()=>null:ur(j)||void 0,customHoverBehavior:T||P||M?ie:void 0,customClickBehavior:P||M?ae:void 0},D&&"none"!==D&&{legendHoverBehavior:Q.onLegendHover,legendClickBehavior:Q.onLegendClick,legendHighlightedCategory:Q.highlightedCategory,legendIsolatedCategories:Q.isolatedCategories},{className:h,title:F,description:z,summary:R,accessibleTable:G},C)))});function yl(t){var o;const r=or(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:i,margin:a,className:s,layout:l="tree",orientation:c="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:f,colorByDepth:p=!1,edgeStyle:y="curve",nodeLabel:m,nodeSize:v=5,tooltip:b,frameProps:x={},onObservation:k,onClick:w,chartId:A,selection:S,linkedHover:O,loading:E,legendInteraction:j}=t,C=r.width,P=r.height,M=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,_=r.title,T=r.description,B=r.summary,N=r.accessibleTable,D=Vr(E,C,P),I=n(()=>ul(null!=i?i:null,u),[i,u]),H=Ko(I,p?void 0:g,f),W=n(()=>{if(!g||p)return[];const e=new Set;for(const t of I){const n="function"==typeof g?g(t):t[g];null!=n&&e.add(n+"")}return Array.from(e)},[I,g,p]),$=tr(j,p?void 0:g,W),F=Xo(),z=n(()=>new Map,[]),R=n(()=>{if(Array.isArray(f))return f;if(F&&F.length>0)return F;const e=Me[f];return Array.isArray(e)?e:Le},[f,F]),G=n(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?Te[(e.depth||0)%Te.length]:g?Ne(e.data||e,g,H):Vo(void 0,F,f,void 0,z),t},[g,p,H,F,f,z]),Y=n(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),q=n(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return hl(d)},[l,d]),X=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:V,customClickBehavior:U}=Zo({selection:S,linkedHover:O,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:k,onClick:w,chartType:"TreeDiagram",chartId:A}),K=Ar({componentName:"TreeDiagram",data:i});return K?e.createElement(yr,{componentName:"TreeDiagram",message:K,width:C,height:P}):D||e.createElement(Gr,{componentName:"TreeDiagram",width:C,height:P},e.createElement(ll,Object.assign({chartType:l},null!=i&&{data:i},{size:[C,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:q,treeOrientation:c,edgeType:y,nodeStyle:G,edgeStyle:Y,colorBy:g,colorScheme:R,colorByDepth:p,nodeSize:v,nodeLabel:L?m||h:void 0,showLabels:L,enableHover:M,tooltipContent:!1===b?()=>null:ur(b)||void 0,customHoverBehavior:O||k||w?V:void 0,customClickBehavior:k||w?U:void 0},j&&"none"!==j&&{legendHoverBehavior:$.onLegendHover,legendClickBehavior:$.onLegendClick,legendHighlightedCategory:$.highlightedCategory,legendIsolatedCategories:$.isolatedCategories},{className:s,title:_,description:T,summary:B,accessibleTable:N},x)))}function ml(t){var o;const r=or(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:i,margin:a,className:s,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,labelMode:p="leaf",nodeLabel:y,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:E,legendInteraction:j}=t,C=r.width,P=r.height,M=r.enableHover,L=null===(o=r.showLabels)||void 0===o||o,_=r.title,T=r.description,B=r.summary,N=r.accessibleTable,D=Vr(E,C,P),{activeSelectionHook:I,customHoverBehavior:H,customClickBehavior:W}=Zo({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,onClick:S,chartType:"Treemap",chartId:O}),$=l(e=>{if(!e)return H(null);const t=e.data||e;H({data:(null==t?void 0:t.data)||t})},[H]),F=n(()=>ul(null!=i?i:null,c),[i,c]),z=Ko(F,f?void 0:h,g),R=n(()=>{if(!h||f)return[];const e=new Set;for(const t of F){const n="function"==typeof h?h(t):t[h];null!=n&&e.add(n+"")}return Array.from(e)},[F,h,f]),G=tr(j,f?void 0:h,R),Y=Xo(),q=n(()=>new Map,[]),X=n(()=>{if(Array.isArray(g))return g;if(Y&&Y.length>0)return Y;const e=Me[g];return Array.isArray(e)?e:Le},[g,Y]),V=n(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=f?Te[(e.depth||0)%Te.length]:h?Ne(e.data||e,h,z):Vo(void 0,Y,g,void 0,q),t},[h,f,z,Y,g,q]),U=n(()=>I?e=>{var t;const n=Object.assign({},V(e));if(I.isActive)if(I.predicate(e.data||e))(null==k?void 0:k.selectedStyle)&&Object.assign(n,k.selectedStyle);else{const e=null!==(t=null==k?void 0:k.unselectedOpacity)&&void 0!==t?t:.2;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==k?void 0:k.unselectedStyle)&&Object.assign(n,k.unselectedStyle)}return n}:V,[V,I,k]),K=n(()=>hl(u),[u]),Q=void 0!==v?v:!L||"parent"!==p&&"all"!==p?void 0:18,Z=Object.assign(Object.assign({},r.marginDefaults),a),J=Ar({componentName:"Treemap",data:i});return J?e.createElement(yr,{componentName:"Treemap",message:J,width:C,height:P}):D||e.createElement(Gr,{componentName:"Treemap",width:C,height:P},e.createElement(ll,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[C,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:K,padding:m,paddingTop:Q,nodeStyle:U,colorBy:h,colorScheme:X,colorByDepth:f,nodeLabel:L?y||d:void 0,showLabels:L,labelMode:p,enableHover:M,tooltipContent:!1===b?()=>null:ur(b)||void 0},(w||A||S)&&{customHoverBehavior:$},(A||S)&&{customClickBehavior:W},j&&"none"!==j&&{legendHoverBehavior:G.onLegendHover,legendClickBehavior:G.onLegendClick,legendHighlightedCategory:G.highlightedCategory,legendIsolatedCategories:G.isolatedCategories},{className:s,title:_,description:T,summary:B,accessibleTable:N},x)))}function vl(t){var o;const r=or(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:i,margin:a,className:s,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,nodeLabel:f,circleOpacity:p=.7,padding:y=4,tooltip:m,frameProps:v={},onObservation:b,onClick:x,chartId:k,selection:w,linkedHover:A,loading:S,legendInteraction:O}=t,E=r.width,j=r.height,C=r.enableHover,P=null===(o=r.showLabels)||void 0===o||o,M=r.title,L=r.description,_=r.summary,T=r.accessibleTable,B=Vr(S,E,j),N=n(()=>ul(null!=i?i:null,l),[i,l]),D=Ko(N,g?void 0:d,h),I=n(()=>{if(!d||g)return[];const e=new Set;for(const t of N){const n="function"==typeof d?d(t):t[d];null!=n&&e.add(n+"")}return Array.from(e)},[N,d,g]),H=tr(O,g?void 0:d,I),W=Xo(),$=n(()=>new Map,[]),F=n(()=>{if(Array.isArray(h))return h;if(W&&W.length>0)return W;const e=Me[h];return Array.isArray(e)?e:Le},[h,W]),z=n(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=g?Te[(e.depth||0)%Te.length]:d?Ne(e.data||e,d,D):Vo(void 0,W,h,void 0,$),t},[d,g,D,p,W,h,$]),R=n(()=>hl(c),[c]),G=Object.assign(Object.assign({},r.marginDefaults),a),{customHoverBehavior:Y,customClickBehavior:q}=Zo({selection:w,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:b,onClick:x,chartType:"CirclePack",chartId:k}),X=Ar({componentName:"CirclePack",data:i});return X?e.createElement(yr,{componentName:"CirclePack",message:X,width:E,height:j}):B||e.createElement(Gr,{componentName:"CirclePack",width:E,height:j},e.createElement(ll,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[E,j],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:R,padding:y,nodeStyle:z,colorBy:d,colorScheme:F,colorByDepth:g,nodeLabel:P?f||u:void 0,showLabels:P,enableHover:C,tooltipContent:!1===m?()=>null:ur(m)||void 0,customHoverBehavior:A||b||x?Y:void 0,customClickBehavior:b||x?q:void 0},O&&"none"!==O&&{legendHoverBehavior:H.onLegendHover,legendClickBehavior:H.onLegendClick,legendHighlightedCategory:H.highlightedCategory,legendIsolatedCategories:H.isolatedCategories},{className:s,title:M,description:L,summary:_,accessibleTable:T},v)))}pl.displayName="SankeyDiagram",yl.displayName="TreeDiagram",ml.displayName="Treemap",vl.displayName="CirclePack";const bl=Te;function xl(t){const o=or(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:r,margin:i,className:a,childrenAccessor:s="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:S,frameProps:O={},onObservation:E,onClick:j,chartId:C,selection:P,linkedHover:M,loading:L}=t,_=o.width,T=o.height,B=o.enableHover,N=o.title,D=o.description,I=o.summary,H=o.accessibleTable,W=Vr(L,_,T),$=Ko(n(()=>ul(r,s),[r,s]),d?void 0:c,u),F=Xo(),z=n(()=>new Map,[]),R=n(()=>{if(Array.isArray(u))return u;if(F&&F.length>0)return F;const e=Me[u];return Array.isArray(e)?e:Le},[u,F]),G=n(()=>{if(Array.isArray(u))return u;const e=Me[u];return Array.isArray(e)?e:Le},[u]),Y=n(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=d?o?G[0]:bl[(e.depth||0)%bl.length]:c?Ne(e.data||e,c,$):Vo(void 0,F,u,void 0,z),n.opacity=o?1:.85,n},[c,d,$,G,F,u,z]),q=n(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),X=Object.assign({top:10,right:10,bottom:10,left:10},i),{customHoverBehavior:V,customClickBehavior:U}=Zo({selection:P,linkedHover:M,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!0,onObservation:E,onClick:j,chartType:"OrbitDiagram",chartId:C}),K=n(()=>{if(V)return e=>{V(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[V]),Q=n(()=>{if(U)return e=>{U(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[U]),Z=Ar({componentName:"OrbitDiagram",data:r});return Z?e.createElement(yr,{componentName:"OrbitDiagram",message:Z,width:_,height:T}):W||e.createElement(Gr,{componentName:"OrbitDiagram",width:_,height:T},e.createElement(ll,Object.assign({chartType:"orbit"},null!=r&&{data:r},{size:[_,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:Y,edgeStyle:q,colorBy:c,colorScheme:R,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&B,tooltipContent:k?void 0:!1===w?()=>null:ur(w)||void 0,customHoverBehavior:M||E||j?K:void 0,customClickBehavior:E||j?Q:void 0,foregroundGraphics:A,annotations:S,className:a,title:N,description:D,summary:I,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:H},O)))}xl.displayName="OrbitDiagram";const kl=c(function(n,o){var r,i,a,s;const c=or(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:O,background:E,tooltipContent:j,tooltip:C,onHover:P,annotations:M,svgAnnotationRules:L,tickFormatTime:_,tickFormatValue:T,decay:B,pulse:N,staleness:D,transition:I,linkedHover:H,selection:W,onObservation:$,chartId:F,loading:z,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=j?j:C,Q=t(null),{customHoverBehavior:Z}=Zo({selection:W,linkedHover:H,unwrapData:!0,onObservation:$,chartType:"RealtimeLineChart",chartId:F}),J=l(e=>{P&&P(e),Z(e)},[P,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=Vr(z,U[0],U[1]),te=ee?null:Xr(m,U[0],U[1],R),ne={stroke:A,strokeWidth:S,strokeDasharray:O};return ee||te||e.createElement(yo,{ref:Q,chartType:"line",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,lineStyle:ne,showAxes:q,background:E,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:M,svgAnnotationRules:L,tickFormatTime:_,tickFormatValue:T,decay:B,pulse:N,staleness:D,transition:I,pointIdAccessor:n.pointIdAccessor,legendPosition:Y})});kl.displayName="RealtimeLineChart";const wl=c(function(n,o){var r,i,a,s;const c=or(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{binSize:d,size:h,margin:g,className:f,arrowOfTime:p="right",windowMode:y="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,fill:E,stroke:j,strokeWidth:C,gap:P,background:M,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:H,selection:W,decay:$,pulse:F,staleness:z,transition:R,onObservation:G,chartId:Y,loading:q,emptyContent:X,emphasis:V,legendPosition:U,brush:K,onBrush:Q,linkedBrush:Z}=n,J=c.showAxes,ee=c.enableHover,te=null!=g?g:c.marginDefaults,ne=null!=h?h:[c.width,c.height],oe=null!=L?L:_,re=t(null),{customHoverBehavior:ie}=Zo({selection:W,linkedHover:H,unwrapData:!0,onObservation:G,chartType:"RealtimeTemporalHistogram",chartId:Y}),ae=l(e=>{T&&T(e),ie(e)},[T,ie]),se=!0===K?{dimension:"x",snap:"bin"}:"x"===K?{dimension:"x"}:"object"==typeof K?K:void 0,le=Io(Z),ce=Po(Object.assign({name:(null==le?void 0:le.name)||"__unused_hist_brush__",xField:(null==le?void 0:le.xField)||("string"==typeof b?b:"time")},(null==le?void 0:le.yField)?{yField:le.yField}:{})),ue=t(ce.brushInteraction);ue.current=ce.brushInteraction;const de=l(e=>{if(Q&&Q(e),G&&G(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeTemporalHistogram",chartId:Y}),le){const t=ue.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[Q,G,Y,le]);u(o,()=>({push:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=re.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=re.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=re.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=re.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=re.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const he=Vr(q,ne[0],ne[1]),ge=he?null:Xr(v,ne[0],ne[1],X),fe={};return null!=E&&(fe.fill=E),null!=j&&(fe.stroke=j),null!=C&&(fe.strokeWidth=C),null!=P&&(fe.gap=P),he||ge||e.createElement(yo,{ref:re,chartType:"bar",runtimeMode:"streaming",size:ne,margin:te,className:V?`${f||""} semiotic-emphasis-${V}`.trim():f,arrowOfTime:p,windowMode:y,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,binSize:d,categoryAccessor:S,barColors:O,barStyle:fe,showAxes:J,background:M,hoverAnnotation:ee,tooltipContent:oe,customHoverBehavior:ae,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,decay:$,pulse:F,staleness:z,transition:R,pointIdAccessor:n.pointIdAccessor,legendPosition:U,brush:se||(Z?{dimension:"x"}:void 0),onBrush:se||Z?de:void 0})});wl.displayName="RealtimeTemporalHistogram";const Al=wl,Sl=c(function(n,o){var r,i,a,s;const c=or(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,categoryAccessor:A,colors:S,radius:O,fill:E,opacity:j,stroke:C,strokeWidth:P,background:M,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:H,selection:W,onObservation:$,chartId:F,loading:z,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=L?L:_,Q=t(null),{customHoverBehavior:Z}=Zo({selection:W,linkedHover:H,unwrapData:!0,onObservation:$,chartType:"RealtimeSwarmChart",chartId:F}),J=l(e=>{T&&T(e),Z(e)},[T,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=Vr(z,U[0],U[1]),te=ee?null:Xr(m,U[0],U[1],R),ne={};return null!=O&&(ne.radius=O),null!=E&&(ne.fill=E),null!=j&&(ne.opacity=j),null!=C&&(ne.stroke=C),null!=P&&(ne.strokeWidth=P),ee||te||e.createElement(yo,{ref:Q,chartType:"swarm",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,categoryAccessor:A,barColors:S,swarmStyle:ne,showAxes:q,background:M,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});Sl.displayName="RealtimeSwarmChart";const Ol=c(function(n,o){var r,i,a,s;const c=or(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,positiveColor:A,negativeColor:S,connectorStroke:O,connectorWidth:E,gap:j,stroke:C,strokeWidth:P,background:M,tooltipContent:L,tooltip:_,onHover:T,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,linkedHover:H,selection:W,onObservation:$,chartId:F,loading:z,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=L?L:_,Q=t(null),{customHoverBehavior:Z}=Zo({selection:W,linkedHover:H,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:F}),J=l(e=>{T&&T(e),Z(e)},[T,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=Vr(z,U[0],U[1]),te=ee?null:Xr(m,U[0],U[1],R),ne={};return null!=A&&(ne.positiveColor=A),null!=S&&(ne.negativeColor=S),null!=O&&(ne.connectorStroke=O),null!=E&&(ne.connectorWidth=E),null!=j&&(ne.gap=j),null!=C&&(ne.stroke=C),null!=P&&(ne.strokeWidth=P),ee||te||e.createElement(yo,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:k,extentPadding:w,waterfallStyle:ne,showAxes:q,background:M,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:B,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});Ol.displayName="RealtimeWaterfallChart";const El=c(function(n,o){var r,i,a,s;const c=or(n.mode,{width:null!==(i=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==i?i:n.width,height:null!==(s=null===(a=n.size)||void 0===a?void 0:a[1])&&void 0!==s?s:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,heatmapXBins:S=20,heatmapYBins:O=20,aggregation:E="count",background:j,tooltipContent:C,tooltip:P,onHover:M,annotations:L,svgAnnotationRules:_,tickFormatTime:T,tickFormatValue:B,decay:N,pulse:D,staleness:I,linkedHover:H,selection:W,onObservation:$,chartId:F,loading:z,emptyContent:R,emphasis:G,legendPosition:Y}=n,q=c.showAxes,X=c.enableHover,V=null!=h?h:c.marginDefaults,U=null!=d?d:[c.width,c.height],K=null!=C?C:P,Q=t(null),{customHoverBehavior:Z}=Zo({selection:W,linkedHover:H,unwrapData:!0,onObservation:$,chartType:"RealtimeHeatmap",chartId:F}),J=l(e=>{M&&M(e),Z(e)},[M,Z]);u(o,()=>({push:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Q.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Q.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Q.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Q.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const ee=Vr(z,U[0],U[1]),te=ee?null:Xr(m,U[0],U[1],R);return ee||te||e.createElement(yo,{ref:Q,chartType:"heatmap",runtimeMode:"streaming",size:U,margin:V,className:G?`${g||""} semiotic-emphasis-${G}`.trim():g,arrowOfTime:f,windowMode:p,windowSize:y,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:k,yExtent:w,extentPadding:A,heatmapXBins:S,heatmapYBins:O,heatmapAggregation:E,showAxes:q,background:j,hoverAnnotation:X,tooltipContent:K,customHoverBehavior:J,annotations:L,svgAnnotationRules:_,tickFormatTime:T,tickFormatValue:B,decay:N,pulse:D,staleness:I,legendPosition:Y,pointIdAccessor:n.pointIdAccessor})});El.displayName="RealtimeHeatmap";let[jl]=Ln(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function Cl(e,t){return Kr(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:r=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),Pl(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);Ml(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*r,n=l.height*r,a=document.createElement("canvas");a.width=t,a.height=n;const c=a.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,n),c.scale(r,r);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),a.toBlob(n=>{n?(Ml(n,o+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function Pl(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),a=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of a){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)Pl(o[e],r[e])}function Ml(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const Ll=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),_l=new Set(["data","nodes","edges"]),Tl="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Bl(e,t,n){if(!Mr[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Mr).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(Ll.has(e)||!o&&_l.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=Tl(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function Nl(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Mr[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Tl(e.props)}}function Dl(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Il(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function Hl(e){return Kr(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Wl(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function Wl(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function $l(){const t=function(){const t=e.useContext(sn);return t?()=>t.setVisible(e=>!e):null}();return t?e.createElement("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:Yl},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.createElement("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"}))):null}const Fl={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function zl({height:t}){return e.createElement("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function Rl({error:t}){return e.createElement("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5}},t))}const Gl=e.forwardRef(function({title:t,subtitle:n,children:o,width:r="100%",height:i=400,actions:a,chartConfig:s,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:f,style:p},y){const m=e.useRef(null),v=e.useRef(null),[b,x]=e.useState(!1),k=!1!==(null==a?void 0:a.export)&&void 0!==(null==a?void 0:a.export),w=!1!==(null==a?void 0:a.fullscreen)&&void 0!==(null==a?void 0:a.fullscreen),A=!1!==(null==a?void 0:a.copyConfig)&&void 0!==(null==a?void 0:a.copyConfig)&&s,S=!0===(null==a?void 0:a.dataSummary),O="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",j=e.useCallback(e=>Kr(this,void 0,void 0,function*(){v.current&&(yield Cl(v.current,Object.assign(Object.assign({},O),e)))}),[O]),C=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),P=e.useCallback(e=>Kr(this,void 0,void 0,function*(){s&&(yield Hl(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(y,()=>({export:j,toggleFullscreen:C,copyConfig:P,element:m.current}),[j,C,P]);const M=t||n||l||k||w||A||S||h,L=c?e.createElement(zl,{height:i}):u?e.createElement(Rl,{error:u}):d?e.createElement(mr,null,o):o;return _=e.createElement(e.Fragment,null,e.createElement("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.createElement("div",{ref:m,className:"semiotic-chart-container"+(f?" "+f:""),style:Object.assign(Object.assign({width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),p)},M&&e.createElement("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}},e.createElement("div",{className:"semiotic-chart-title-area"},t&&e.createElement("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"}},t),n&&e.createElement("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0}},n)),e.createElement("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4}},l,k&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Export chart","aria-label":"Export chart",style:Yl},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.createElement("path",{d:"M2 12h10"}))),S&&e.createElement($l,null),w&&e.createElement("button",{className:"semiotic-chart-action",onClick:C,title:b?"Exit fullscreen":"Fullscreen","aria-label":b?"Exit fullscreen":"Enter fullscreen",style:Yl},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b?e.createElement(e.Fragment,null,e.createElement("path",{d:"M9 1v4h4"}),e.createElement("path",{d:"M5 13V9H1"}),e.createElement("path",{d:"M13 5H9V1"}),e.createElement("path",{d:"M1 9h4v4"})):e.createElement(e.Fragment,null,e.createElement("path",{d:"M1 5V1h4"}),e.createElement("path",{d:"M13 9v4H9"}),e.createElement("path",{d:"M9 1h4v4"}),e.createElement("path",{d:"M5 13H1V9"})))),A&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>P(),title:"Copy config","aria-label":"Copy chart configuration",style:Yl},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.createElement("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"}))),h&&e.createElement("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Fl[h].bg,color:Fl[h].color,lineHeight:"18px"}},h))),e.createElement("div",{className:"semiotic-chart-body",ref:v,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},b?{flex:1}:{height:i})},L,g))),S?e.createElement(ln,null,_):_;var _}),Yl={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function ql({children:t,columns:n="auto",minCellWidth:o=300,gap:r=16,className:i,style:a}){const s="number"==typeof n?n:void 0;return e.createElement("div",{className:"semiotic-chart-grid"+(i?" "+i:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},a)},e.Children.map(t,t=>e.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==s&&2>s?t:e.createElement("div",{style:{gridColumn:"span 2"}},t):t))}function Xl({children:t,context:n,position:o="right",contextSize:r=250,gap:i=12,className:a,style:s}){const l="left"===o||"right"===o,c="left"===o||"top"===o,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:i,width:"100%"},s),d=l?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return e.createElement("div",{className:"semiotic-context-layout"+(a?" "+a:""),style:u},e.createElement("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0}},t),e.createElement("div",{style:d},n))}ql.displayName="ChartGrid",Xl.displayName="ContextLayout";function Vl({children:n,position:i="right",size:a=300,trigger:s="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:f,style:p}){const[y,m]=r(null),[v,b]=r(null),[x,k]=r(!1),[w,A]=r(!1),S=t(null),O=t(),E="click"===s?["click","click-end"]:["hover","hover-end"],{latest:j}=Lo({types:E,chartId:c,limit:1}),C=void 0!==u?u:j;o(()=>{if(C)if("click"===C.type||"hover"===C.type){const e=C;m(e.datum),b(e),x||(k(!0),A(!0),clearTimeout(O.current),O.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==C.type&&"hover-end"!==C.type||P()},[C]),o(()=>{null==g||g(x)},[x,g]);const P=l(()=>{A(!0),k(!1),clearTimeout(O.current),O.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(o(()=>()=>clearTimeout(O.current),[]),!y&&!w)return null;const M=y&&v?n(y,v):null;if(null===M&&!w)return null;const L=function(e,t,n,o){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},r),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(i,a,x,w);return e.createElement("div",{ref:S,className:`semiotic-details-panel semiotic-details-${i}${f?" "+f:""}`,style:Object.assign(Object.assign({},L),p)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:Ul},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},e.createElement("path",{d:"M2 2l8 8M10 2l-8 8"}))),e.createElement("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1}},M))}const Ul={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};function Kl(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function Ql(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function Zl(e){return"nominal"===e||"ordinal"===e}function Jl(e){return"quantitative"===e||"temporal"===e}Vl.displayName="DetailsPanel";const ec={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},tc={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},nc={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function oc(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,f;const p=[],{type:y,markProps:m}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"])}}(e.mark),v=e.encoding||{},b=v.x,x=v.y,k=v.color,w=v.size,A=v.theta,S=v.opacity;let O;(null===(t=e.data)||void 0===t?void 0:t.values)?O=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.url)&&p.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&p.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&p.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&p.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||e.encoding&&e.encoding.facet||e.encoding&&(e.encoding.row||e.encoding.column))&&p.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&p.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&p.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const E={};e.width&&(E.width=e.width),e.height&&(E.height=e.height);const j=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(j&&(E.title=j),(null==k?void 0:k.field)&&(E.colorBy=k.field,null===(o=k.scale)||void 0===o?void 0:o.scheme)){const e=ec[k.scale.scheme];e&&(E.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(E.pointOpacity=S.value);const C=null==b?void 0:b.aggregate,P=null==x?void 0:x.aggregate;if(O&&(C||P)){const e=P?x:b,t=P?b:x,n=nc[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)O=function(e,t){const{groupBy:n,value:o,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[n]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of i){let o;switch(r){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(O,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&O){const e=new Map;for(const n of O){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}O=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";O&&(E.data=O),(null==b?void 0:b.bin)?(E.valueAccessor=b.field,(null==x?void 0:x.field)&&(E.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(E.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(E.valueAccessor=x.field,(null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(E.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(a=null==b?void 0:b.bin)||void 0===a?void 0:a.maxbins)||(null===(s=null==x?void 0:x.bin)||void 0===s?void 0:s.maxbins):void 0;return t&&(E.bins=t),ic(e,E,p)}let M;switch(y){case"bar":M=function(e,t,n,o,r,i,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",Zl(null==e?void 0:e.type)&&Jl(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):Jl(null==e?void 0:e.type)&&Zl(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=i?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),r&&(o.data=r),g}(b,x,k,E,O,C,P);break;case"line":if(M="LineChart",rc(b,x,E,C,P),(null==k?void 0:k.field)&&(E.lineBy=k.field),m.interpolate){const e=tc[m.interpolate];e&&(E.curve=e)}!0===m.point&&(E.showPoints=!0),O&&(E.data=O);break;case"area":if((null==k?void 0:k.field)?(M="StackedAreaChart",E.areaBy=k.field):M="AreaChart",rc(b,x,E,C,P),m.interpolate){const e=tc[m.interpolate];e&&(E.curve=e)}void 0!==m.opacity&&(E.areaOpacity=m.opacity),O&&(E.data=O);break;case"point":case"circle":case"square":(null==w?void 0:w.field)?(M="BubbleChart",E.sizeBy=w.field,(null===(l=w.scale)||void 0===l?void 0:l.range)&&(E.sizeRange=w.scale.range)):M="Scatterplot",rc(b,x,E,C,P),O&&(E.data=O);break;case"rect":M="Heatmap",(null==b?void 0:b.field)&&(E.xAccessor=b.field),(null==x?void 0:x.field)&&(E.yAccessor=x.field),(null==k?void 0:k.field)&&(E.valueAccessor=k.field,delete E.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(E.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(E.yLabel=x.axis.title),O&&(E.data=O);break;case"arc":m.innerRadius&&m.innerRadius>0?(M="DonutChart",E.innerRadius=m.innerRadius):M="PieChart",(null==A?void 0:A.field)?E.valueAccessor=A.field:(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field),(null==k?void 0:k.field)&&(E.categoryAccessor=k.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(E.categoryAccessor=b.field),O&&(E.data=O);break;case"tick":M="DotPlot",Zl(null==b?void 0:b.type)?(E.categoryAccessor=b.field,(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(E.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(E.valueLabel=x.axis.title)):Zl(null==x?void 0:x.type)?(E.categoryAccessor=x.field,(null==b?void 0:b.field)&&(E.valueAccessor=C?"value":b.field),E.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(E.categoryLabel=x.axis.title),(null===(f=null==b?void 0:b.axis)||void 0===f?void 0:f.title)&&(E.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(E.categoryAccessor=b.field),(null==x?void 0:x.field)&&(E.valueAccessor=P?"value":x.field)),O&&(E.data=O);break;default:p.push(`Unsupported mark type "${y}". Defaulting to Scatterplot.`),M="Scatterplot",rc(b,x,E,C,P),O&&(E.data=O)}return ic(M,E,p)}function rc(e,t,n,o,r){var i,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=r?"value":t.field),(null===(i=null==e?void 0:e.axis)||void 0===i?void 0:i.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function ic(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}export{ti as AreaChart,na as BarChart,ca as BoxPlot,li as BubbleChart,vo as CategoryColorProvider,Gl as ChartContainer,ql as ChartGrid,fl as ChordDiagram,vl as CirclePack,si as ConnectedScatterplot,Xl as ContextLayout,Vl as DetailsPanel,pa as DonutChart,ha as DotPlot,cl as ForceDirectedGraph,ya as FunnelChart,ia as GroupedBarChart,ci as Heatmap,ua as Histogram,Aa as LikertChart,ei as LineChart,No as LinkedCharts,Ai as MultiAxisLineChart,cr as MultiLineTooltip,xl as OrbitDiagram,fa as PieChart,vi as QuadrantChart,El as RealtimeHeatmap,Al as RealtimeHistogram,kl as RealtimeLineChart,Sl as RealtimeSwarmChart,Ol as RealtimeWaterfallChart,ga as RidgelinePlot,pl as SankeyDiagram,ii as Scatterplot,mi as ScatterplotMatrix,oi as StackedAreaChart,ra as StackedBarChart,sa as SwarmPlot,Go as ThemeProvider,jl as TooltipProvider,yl as TreeDiagram,ml as Treemap,da as ViolinPlot,Wl as configToJSX,Hl as copyConfig,Ql as deserializeSelections,Fr as diagnoseConfig,Cl as exportChart,Nl as fromConfig,Il as fromURL,oc as fromVegaLite,Kl as serializeSelections,Bl as toConfig,Dl as toURL,Po as useBrushSelection,bo as useCategoryColors,Lo as useChartObserver,Mo as useFilteredData,Co as useLinkedHover,jo as useSelection,Yo as useTheme,_r as validateProps};