semiotic 3.8.4 → 3.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +6 -3
- package/README.md +44 -38
- package/ai/componentMetadata.cjs +1 -1
- package/ai/dist/mcp-server.js +4 -2
- package/ai/examples.md +167 -0
- package/ai/schema.json +1004 -1
- package/ai/surface-manifest.json +6 -4
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chartContainerDataAudit-74TLKIP6.module.min.js +2 -0
- package/dist/{chunk-chunk-LQBSXO7K.module.min.js → chunk-chunk-4AANPFOX.module.min.js} +1 -1
- package/dist/{chunk-chunk-N6VKKF3A.module.min.js → chunk-chunk-5I3UZV4Q.module.min.js} +1 -1
- package/dist/chunk-chunk-74CCPVXB.module.min.js +1 -0
- package/dist/{chunk-chunk-6TPGFL7M.module.min.js → chunk-chunk-BANTPINB.module.min.js} +1 -1
- package/dist/chunk-chunk-CKMD5NV3.module.min.js +2 -0
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +1 -0
- package/dist/{chunk-chunk-BFHUYEOS.module.min.js → chunk-chunk-CWQ5YIHX.module.min.js} +1 -1
- package/dist/chunk-chunk-E6TXX6MI.module.min.js +1 -0
- package/dist/{chunk-chunk-JDXT6ORT.module.min.js → chunk-chunk-I36PJ4OC.module.min.js} +1 -1
- package/dist/chunk-chunk-K3DMEW22.module.min.js +1 -0
- package/dist/chunk-chunk-KT2VAZMZ.module.min.js +1 -0
- package/dist/{chunk-chunk-AQPQN2HH.module.min.js → chunk-chunk-L6EA5V3G.module.min.js} +1 -1
- package/dist/{chunk-chunk-FBGHXL72.module.min.js → chunk-chunk-LJLS6DY7.module.min.js} +1 -1
- package/dist/chunk-chunk-LJPCLYSC.module.min.js +2 -0
- package/dist/{chunk-chunk-7RYBCTK5.module.min.js → chunk-chunk-N5DDKCCF.module.min.js} +1 -1
- package/dist/chunk-chunk-NLO44TOS.module.min.js +2 -0
- package/dist/{chunk-chunk-F5V4UIE6.module.min.js → chunk-chunk-PZJ2SBLL.module.min.js} +1 -1
- package/dist/chunk-chunk-QUJ6TTLY.module.min.js +1 -0
- package/dist/chunk-chunk-RBIDBUT4.module.min.js +2 -0
- package/dist/chunk-chunk-RFLAG356.module.min.js +1 -0
- package/dist/{chunk-chunk-7KZJUTKP.module.min.js → chunk-chunk-RPU4IZAV.module.min.js} +1 -1
- package/dist/{chunk-chunk-PLIDPQNG.module.min.js → chunk-chunk-SKMBCFIL.module.min.js} +1 -1
- package/dist/{chunk-chunk-SR4ZXOWR.module.min.js → chunk-chunk-TAE7W424.module.min.js} +1 -1
- package/dist/{chunk-chunk-KQ546MKE.module.min.js → chunk-chunk-TMWIZL3K.module.min.js} +1 -1
- package/dist/chunk-chunk-TUBMTZMU.module.min.js +2 -0
- package/dist/chunk-chunk-UFFEXJQY.module.min.js +1 -0
- package/dist/chunk-chunk-XSCHTS4D.module.min.js +2 -0
- package/dist/{chunk-chunk-F7WFPD4O.module.min.js → chunk-chunk-XXWSHGPL.module.min.js} +1 -1
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +2 -0
- package/dist/components/ChartContainer.d.ts +10 -0
- package/dist/components/ai/chartCapabilities.d.ts +2 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +14 -0
- package/dist/components/chartContainerDataAudit.d.ts +10 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +29 -3
- package/dist/components/charts/index.d.ts +1 -0
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +36 -1
- package/dist/components/charts/physics/CrucibleChart.capability.d.ts +8 -0
- package/dist/components/charts/physics/CrucibleChart.d.ts +63 -0
- package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +27 -0
- package/dist/components/charts/physics/crucibleChartProps.d.ts +90 -0
- package/dist/components/charts/physics/crucibleChrome.d.ts +47 -0
- package/dist/components/charts/physics/crucibleController.d.ts +59 -0
- package/dist/components/charts/physics/crucibleEffects.d.ts +30 -0
- package/dist/components/charts/physics/cruciblePhysics.d.ts +54 -0
- package/dist/components/charts/physics/crucibleProgram.d.ts +38 -0
- package/dist/components/charts/physics/crucibleTypes.d.ts +415 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +8 -0
- package/dist/components/charts/shared/crucibleWireSchema.d.ts +5 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/data/auditData.d.ts +51 -0
- package/dist/components/data/dataAuditPresentation.d.ts +18 -0
- package/dist/components/data/dataAuditSources.d.ts +9 -0
- package/dist/components/data/numericContracts.d.ts +59 -0
- package/dist/components/data/numericFieldProfiler.d.ts +23 -0
- package/dist/components/recipes/netEnsembleLayout.d.ts +167 -0
- package/dist/components/recipes/netEnsembleOverlays.d.ts +20 -0
- package/dist/components/recipes/wordTrails.d.ts +156 -0
- package/dist/components/recipes/wordTrailsProgressiveReveal.d.ts +42 -0
- package/dist/components/semiotic-ai-core.d.ts +3 -0
- package/dist/components/semiotic-ai-data-audit.d.ts +4 -0
- package/dist/components/semiotic-ai.d.ts +7 -5
- package/dist/components/semiotic-physics.d.ts +1 -0
- package/dist/components/semiotic-recipes-core.d.ts +4 -0
- package/dist/components/semiotic-utils-core.d.ts +3 -0
- package/dist/components/semiotic.d.ts +1 -1
- package/dist/components/server/renderEvidence.d.ts +27 -0
- package/dist/components/server/serverChartConfigs.d.ts +1 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/staticAnnotations.d.ts +12 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +1 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +7 -0
- package/dist/components/stream/geoCartogram.d.ts +7 -0
- package/dist/components/stream/geoTypes.d.ts +17 -2
- package/dist/components/stream/networkFrameHandleTypes.d.ts +4 -0
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +8 -0
- package/dist/components/useChartContainerDataAudit.d.ts +7 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-core.d.ts +3 -0
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +7 -5
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-physics.d.ts +1 -0
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +4 -0
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-utils-core.d.ts +3 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic.d.ts +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +0 -1
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +0 -1
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +0 -2
- package/dist/chunk-chunk-FP44FHFO.module.min.js +0 -2
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +0 -2
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +0 -2
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +0 -1
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +0 -1
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +0 -1
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +0 -2
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +0 -1
- package/dist/chunk-chunk-RP7WTID5.module.min.js +0 -1
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{StreamXYFrame_default as e}from"./chunk-chunk-B3DRZPBK.module.min.js";import{buildCustomBehaviorProps as t}from"./chunk-chunk-F7WFPD4O.module.min.js";import{normalizeLinkedBrush as n,useBrushSelection as i,useChartLegendAndMargin as s,useChartMode as o,useChartSelection as r}from"./chunk-chunk-BFHUYEOS.module.min.js";import{renderEmptyState as a,renderLoadingState as l}from"./chunk-chunk-ACLDBMRH.module.min.js";var c=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},u=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,i=Math.floor(e/n);for(let s=Math.floor((e-this.size)/n)+1;i>=s;s++)this.bump(s*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new c,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,i=new c;i.push(t);let s=e,o=e;const r=[],a={start:s,end:o,stats:i};for(const t of this.sessions)e-n>t.end||t.start>e+n?r.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>o&&(o=t.end));a.start=s,a.end=o,r.push(a),r.sort((e,t)=>e.start-t.start),this.sessions=r}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const i=t+this.size;e.push(this.row(t,i,n,i>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,i){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:i}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function m(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function h(e,t,n,i=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=m(e,n),o=e.stddev*i;return[s-o,s+o]}var d={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},p=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function g(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;p.lastIndex=0;let n,i=0,s=0;for(;null!==(n=p.exec(t));){const e=parseFloat(n[1]),t=d[n[2]];if(null==t||!Number.isFinite(e))return null;i+=e*t,s+=n[0].length}return s!==t.length?null:i>0?i:null}var v=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const i of this.held)this.getTime(i)>e?n.push(i):t.push(i);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as f,useImperativeHandle as w,forwardRef as y,useCallback as b,useState as x,useEffect as A}from"react";import{jsx as _,jsxs as k}from"react/jsx-runtime";var H={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},S={opacity:.7,marginRight:4};function z(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function I(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function C(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=z(o,t,"time"),a=z(o,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),I(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),I(a)]})]})}}function T(e,t){return null!=e?e:Math.max(t?.length??0,200)}var R="time",P="value",F="__aggLower",M="__aggUpper",N="__aggPartial",D="count",B="__aggStart",E="__aggEnd";function O(e,t){const n=t.stat??"mean",i=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[R]:(e.start+e.end)/2,[P]:m(e,n),[D]:e.count,[N]:e.partial,[B]:e.start,[E]:e.end},o=h(e,i,n,s);return o&&(t[F]=o[0],t[M]=o[1]),t})}import{jsx as j}from"react/jsx-runtime";function L(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isFinite(s)?s:null}var W=y(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:m,className:h,arrowOfTime:d="right",windowMode:p="sliding",windowSize:y,data:_,timeAccessor:k,valueAccessor:H,timeExtent:S,valueExtent:z,extentPadding:I,stroke:N="#007bff",strokeWidth:D=2,strokeDasharray:B,opacity:E,background:W,tooltipContent:V,tooltip:$,onHover:Y,annotations:q,autoPlaceAnnotations:U,svgAnnotationRules:X,tickFormatTime:K,tickFormatValue:Z,decay:G,pulse:J,staleness:Q,transition:ee,linkedHover:te,selection:ne,onObservation:ie,chartId:se,loading:oe,loadingContent:re,emptyContent:ae,emphasis:le,legendPosition:ce,aggregate:ue,eventTime:me}=n,he=s.showAxes,de=s.enableHover,pe=m??s.marginDefaults,ge=c??[s.width,s.height],ve=V??$??C({timeAccessor:k,valueAccessor:H}),fe=f(null),{customHoverBehavior:we}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ie,chartType:"RealtimeLineChart",chartId:se}),ye=b(e=>{Y&&Y(e),we(e)},[Y,we]),be=null!=ue,[xe,Ae]=x([]),_e=f(null),ke=f(ue);ke.current=ue;const He=f(be);He.current=be;const Se=f(xe);Se.current=xe;const ze=f({timeAccessor:k,valueAccessor:H});ze.current={timeAccessor:k,valueAccessor:H},A(()=>{if(!be)return void(_e.current=null);const e=ke.current,t=function(e){const t=e.window??"tumbling",n=g("session"===t?e.gap??e.size:e.size);if(null==n)return null;const i=null!=e.hop?g(e.hop):void 0,s=null!=e.gap?g(e.gap):void 0;return new u({window:t,size:n,hop:i??void 0,gap:s??void 0,retain:e.retain})}(e);if(_e.current=t,t&&_){const{timeAccessor:e,valueAccessor:n}=ze.current;for(const i of _){const s=L(i,e,"time"),o=L(i,n,"value");null!=s&&null!=o&&t.push(s,o)}}Ae(t?O(t,e):[])},[be?[ue.window??"tumbling",ue.size,ue.hop??"",ue.gap??"",ue.retain??""].join("|"):"",be,_]),A(()=>{be&&_e.current&&Ae(O(_e.current,ke.current))},[ue?.stat,ue?.band,ue?.sigma]);const Ie=b(e=>{const t=_e.current,n=ke.current;if(!t||!n)return;const{timeAccessor:i,valueAccessor:s}=ze.current;for(const n of e){const e=L(n,i,"time"),o=L(n,s,"value");null!=e&&null!=o&&t.push(e,o)}Ae(O(t,n))},[]),Ce=null!=me,Te=f(null),Re=f(me);Re.current=me;const Pe=f(Ce);Pe.current=Ce;const Fe=f(ie);Fe.current=ie;const Me=f(se);Me.current=se,A(()=>{Te.current=Ce?function(e){const t=g(e.lateness);return null==t?null:new v({lateness:t,getTime:e=>L(e,ze.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(Re.current):null},[Ce?`${me.lateness}|${me.latePolicy??"drop"}`:"",Ce]);const Ne=b(e=>{0!==e.length&&(He.current?Ie(e):fe.current?.pushMany(e))},[Ie]),De=b(e=>{const t=Te.current;if(!Pe.current||!t)return void Ne(e);const n=[];for(const i of e){const e=t.push(i);if(e.released.length&&n.push(...e.released),e.late.length){const n=Fe.current;if(n){const{timeAccessor:i}=ze.current,s=Re.current?.latePolicy??"drop";for(const o of e.late)n({type:"late-data",datum:o,eventTime:L(o,i,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:Me.current})}}}Ne(n)},[Ne]);w(i,()=>({push:e=>De([e]),pushMany:e=>De(e),remove:e=>He.current?[]:fe.current?.remove(e)??[],update:(e,t)=>He.current?[]:fe.current?.update(e,t)??[],clear:()=>{Te.current?.clear(),He.current?(_e.current?.clear(),Ae([])):fe.current?.clear()},getData:()=>He.current?Se.current:fe.current?.getData()??[],getScales:()=>fe.current?.getScales()??null}),[De]);const Be=l(oe,ge[0],ge[1],re),Ee=Be?null:a(be?void 0:_,ge[0],ge[1],ae),Oe={stroke:N,strokeWidth:D,strokeDasharray:B};null!=E&&(Oe.opacity=E);const je=T(y,_),Le=be?xe:_,We=be?R:k,Ve=be?P:H,$e=be&&ue&&"none"!==(ue.band??"none")?{y0Accessor:F,y1Accessor:M,perSeries:!1}:void 0;return Be||Ee||j(e,{ref:fe,chartType:"line",runtimeMode:"streaming",size:ge,margin:pe,className:le?`${h||""} semiotic-emphasis-${le}`.trim():h,arrowOfTime:d,windowMode:be?"growing":p,windowSize:be?Math.max(1,ue?.retain??Math.max(xe.length,600)):je,data:Le,timeAccessor:We,valueAccessor:Ve,xExtent:S,yExtent:z,extentPadding:I,band:$e,lineStyle:Oe,showAxes:he,background:W,hoverAnnotation:de,tooltipContent:ve,...t({linkedHover:te,selection:ne,onObservation:ie,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ye}),annotations:q,autoPlaceAnnotations:U,svgAnnotationRules:X,tickFormatTime:K,tickFormatValue:Z,decay:G,pulse:J,staleness:Q,transition:ee,pointIdAccessor:n.pointIdAccessor,legendPosition:ce})});W.displayName="RealtimeLineChart";import{useRef as V,useImperativeHandle as $,forwardRef as Y,useCallback as q,useMemo as U}from"react";function X(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();if("string"==typeof i&&""===i.trim())return null;const s=Number(i);return Number.isFinite(s)?s:null}import{jsx as K}from"react/jsx-runtime";var Z=Y(function(c,u){const m=o(c.mode,{width:c.size?.[0]??c.width,height:c.size?.[1]??c.height,showAxes:c.showAxes,showLegend:c.showLegend,enableHover:null!=c.enableHover?!!c.enableHover:void 0,linkedHover:c.linkedHover,mobileInteraction:c.mobileInteraction,mobileSemantics:c.mobileSemantics,responsiveRules:c.responsiveRules}),{binSize:h,size:d,margin:p,className:g,arrowOfTime:v="right",windowMode:f="sliding",windowSize:w,data:y,timeAccessor:b,valueAccessor:x,direction:A="up",timeExtent:C,valueExtent:R,extentPadding:P,categoryAccessor:F,colors:M,fill:N,stroke:D,strokeWidth:B,opacity:E,gap:O,background:j,tooltipContent:L,tooltip:W,onHover:Y,annotations:Z,autoPlaceAnnotations:G,svgAnnotationRules:J,tickFormatTime:Q,tickFormatValue:ee,linkedHover:te,selection:ne,decay:ie,pulse:se,staleness:oe,transition:re,onObservation:ae,chartId:le,loading:ce,loadingContent:ue,emptyContent:me,emphasis:he,legendPosition:de,legend:pe,brush:ge,onBrush:ve,linkedBrush:fe}=c,we=m.showAxes,ye=m.enableHover,be=d??[m.width,m.height],xe=U(()=>M?e=>M[e]??N??"#999":void 0,[M,N]),{legend:Ae,margin:_e,legendPosition:ke}=s({data:y??[],colorBy:F,colorScale:xe,showLegend:m.showLegend,legendPosition:de,userMargin:p,defaults:m.marginDefaults,additionalLegend:pe}),He=L??W??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null;if(null==i?.binStart||null==i?.binEnd){const e=z(i,t,"time"),s=z(i,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),I(e)]}),k("div",{children:[_("span",{style:S,children:"y:"}),I(s)]})]})}return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"range:"}),I(i.binStart),"–",I(i.binEnd)]}),null!=i.total&&k("div",{children:[_("span",{style:S,children:"count:"}),I(i.total)]}),null!=i.category&&k("div",{children:[_("span",{style:S,children:"category:"}),I(i.category)]})]})}}({timeAccessor:b,valueAccessor:x}),Se=V(null),{customHoverBehavior:ze}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ae,chartType:"RealtimeHistogram",chartId:le}),Ie=q(e=>{Y&&Y(e),ze(e)},[Y,ze]),Ce=!0===ge?{dimension:"x",snap:"bin"}:"x"===ge?{dimension:"x"}:"object"==typeof ge?ge:void 0,Te=n(fe),Re="string"==typeof b?b:"time",Pe=i({name:Te?.name||"__unused_hist_brush__",xField:Te?.xField||Re,...Te?.yField?{yField:Te.yField}:{}}),Fe=V(Pe.brushInteraction);Fe.current=Pe.brushInteraction;const Me=q(e=>{if(ve&&ve(e),ae&&ae(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}),Te){const t=Fe.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)}},[ve,ae,le,Te]);$(u,()=>({push:e=>Se.current?.push(e),pushMany:e=>Se.current?.pushMany(e),remove:e=>Se.current?.remove(e)??[],update:(e,t)=>Se.current?.update(e,t)??[],clear:()=>Se.current?.clear(),getData:()=>Se.current?.getData()??[],getScales:()=>Se.current?.getScales()??null}),[]);const Ne=l(ce,be[0],be[1],ue),De=Ne?null:a(y,be[0],be[1],me),Be={};null!=N&&(Be.fill=N),null!=D&&(Be.stroke=D),null!=B&&(Be.strokeWidth=B),null!=E&&(Be.opacity=E),null!=O&&(Be.gap=O);const Ee=he?`${g||""} semiotic-emphasis-${he}`.trim():g,Oe=T(w,y),je=U(()=>"down"!==A?R:function({data:e,valueAccessor:t,timeAccessor:n,binSize:i,valueExtent:s,extentPadding:o}){if(s)return[s[1],s[0]];if(!e||0===e.length)return;const r=new Map;for(const s of e){const e=X(s,n,"time"),o=X(s,t,"value");if(null==e||null==o)continue;const a=Math.floor(e/i)*i;r.set(a,(r.get(a)??0)+o)}let a=0;for(const e of r.values())a=Math.max(a,e);return[a>0?a+a*(o??.1):1,0]}({data:y,valueAccessor:x,timeAccessor:b,binSize:h,valueExtent:R,extentPadding:P}),[A,y,x,b,h,R,P]);return Ne||De||K(e,{ref:Se,chartType:"bar",runtimeMode:"streaming",size:be,margin:_e,className:Ee,arrowOfTime:v,windowMode:f,windowSize:Oe,data:y,timeAccessor:b,valueAccessor:x,xExtent:C,yExtent:je,extentPadding:P,binSize:h,categoryAccessor:F,barColors:M,barStyle:Be,showAxes:we,background:j,hoverAnnotation:ye,tooltipContent:He,...t({linkedHover:te,selection:ne,onObservation:ae,forceHoverBehavior:!0,mobileInteraction:m.mobileInteraction,customHoverBehavior:Ie}),annotations:Z,autoPlaceAnnotations:G,svgAnnotationRules:J,tickFormatTime:Q,tickFormatValue:ee,decay:ie,pulse:se,staleness:oe,transition:re,pointIdAccessor:c.pointIdAccessor,legend:Ae,legendPosition:ke,brush:Ce||(fe?{dimension:"x"}:void 0),onBrush:Ce||fe?Me:void 0})});function G(e){return K(Z,{...e,windowMode:"growing"})}Z.displayName="RealtimeHistogram",G.displayName="TemporalHistogram";var J=Z;import{useRef as Q,useImperativeHandle as ee,forwardRef as te,useCallback as ne}from"react";import{jsx as ie}from"react/jsx-runtime";var se=te(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,colors:_,radius:k,fill:H,opacity:S,stroke:z,strokeWidth:I,pointStyle:R,background:P,tooltipContent:F,tooltip:M,onHover:N,annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,linkedHover:L,selection:W,onObservation:V,chartId:$,loading:Y,loadingContent:q,emptyContent:U,emphasis:X,legendPosition:K}=n,Z=s.showAxes,G=s.enableHover,J=u??s.marginDefaults,te=c??[s.width,s.height],se=F??M??C({timeAccessor:v,valueAccessor:f}),oe=Q(null),{customHoverBehavior:re}=r({selection:W,linkedHover:L,unwrapData:!0,onObservation:V,chartType:"RealtimeSwarmChart",chartId:$}),ae=ne(e=>{N&&N(e),re(e)},[N,re]);ee(i,()=>({push:e=>oe.current?.push(e),pushMany:e=>oe.current?.pushMany(e),remove:e=>oe.current?.remove(e)??[],update:(e,t)=>oe.current?.update(e,t)??[],clear:()=>oe.current?.clear(),getData:()=>oe.current?.getData()??[],getScales:()=>oe.current?.getScales()??null}),[]);const le=l(Y,te[0],te[1],q),ce=le?null:a(g,te[0],te[1],U),ue={};null!=k&&(ue.radius=k),null!=H&&(ue.fill=H),null!=S&&(ue.opacity=S),null!=z&&(ue.stroke=z),null!=I&&(ue.strokeWidth=I);const me=R,he=X?`${m||""} semiotic-emphasis-${X}`.trim():m,de=T(p,g);return le||ce||ie(e,{ref:oe,chartType:"swarm",runtimeMode:"streaming",size:te,margin:J,className:he,arrowOfTime:h,windowMode:d,windowSize:de,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,barColors:_,swarmStyle:ue,pointStyle:me,showAxes:Z,background:P,hoverAnnotation:G,tooltipContent:se,...t({linkedHover:L,selection:W,onObservation:V,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ae}),annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,legendPosition:K,pointIdAccessor:n.pointIdAccessor})});se.displayName="RealtimeSwarmChart";import{useRef as oe,useImperativeHandle as re,forwardRef as ae,useCallback as le}from"react";import{jsx as ce}from"react/jsx-runtime";var ue=ae(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,extentPadding:b,positiveColor:x,negativeColor:A,connectorStroke:C,connectorWidth:R,gap:P,stroke:F,strokeWidth:M,opacity:N,background:D,tooltipContent:B,tooltip:E,onHover:O,annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,linkedHover:Y,selection:q,onObservation:U,chartId:X,loading:K,loadingContent:Z,emptyContent:G,emphasis:J,legendPosition:Q}=n,ee=s.showAxes,te=s.enableHover,ne=u??s.marginDefaults,ie=c??[s.width,s.height],se=B??E??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null,s=z(i,t,"time"),o=i?.delta??z(i,n,"value"),r=i?.cumEnd,a="number"==typeof o?0>o?I(o):"+"+I(o):I(o);return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),I(s)]}),k("div",{children:[_("span",{style:S,children:"Δ:"}),a]}),null!=r&&k("div",{children:[_("span",{style:S,children:"total:"}),I(r)]})]})}}({timeAccessor:v,valueAccessor:f}),ae=oe(null),{customHoverBehavior:ue}=r({selection:q,linkedHover:Y,unwrapData:!0,onObservation:U,chartType:"RealtimeWaterfallChart",chartId:X}),me=le(e=>{O&&O(e),ue(e)},[O,ue]);re(i,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const he=l(K,ie[0],ie[1],Z),de=he?null:a(g,ie[0],ie[1],G),pe={};null!=x&&(pe.positiveColor=x),null!=A&&(pe.negativeColor=A),null!=C&&(pe.connectorStroke=C),null!=R&&(pe.connectorWidth=R),null!=P&&(pe.gap=P),null!=F&&(pe.stroke=F),null!=M&&(pe.strokeWidth=M),null!=N&&(pe.opacity=N);const ge=J?`${m||""} semiotic-emphasis-${J}`.trim():m,ve=T(p,g);return he||de||ce(e,{ref:ae,chartType:"waterfall",runtimeMode:"streaming",size:ie,margin:ne,className:ge,arrowOfTime:h,windowMode:d,windowSize:ve,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,extentPadding:b,waterfallStyle:pe,showAxes:ee,background:D,hoverAnnotation:te,tooltipContent:se,...t({linkedHover:Y,selection:q,onObservation:U,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:me}),annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,legendPosition:Q,pointIdAccessor:n.pointIdAccessor})});ue.displayName="RealtimeWaterfallChart";import{useRef as me,useImperativeHandle as he,forwardRef as de,useCallback as pe}from"react";import{jsx as ge}from"react/jsx-runtime";var ve=de(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,timeExtent:y,valueExtent:b,extentPadding:x,heatmapXBins:A=20,heatmapYBins:C=20,aggregation:R="count",background:P,tooltipContent:F,tooltip:M,onHover:N,annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,linkedHover:$,selection:Y,onObservation:q,chartId:U,loading:X,loadingContent:K,emptyContent:Z,emphasis:G,legendPosition:J}=n,Q=s.showAxes,ee=s.enableHover,te=u??s.marginDefaults,ne=c??[s.width,s.height],ie=F??M??function(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=o?.xCenter??z(o,t,"time"),a=o?.yCenter??z(o,n,"value"),l=o?.count,c=o?.sum,u=o?.value,m=o?.agg??"count";return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),I(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),I(a)]}),null!=l&&k("div",{children:[_("span",{style:S,children:"count:"}),I(l)]}),"sum"===m&&null!=c&&k("div",{children:[_("span",{style:S,children:"sum:"}),I(c)]}),"mean"===m&&null!=u&&k("div",{children:[_("span",{style:S,children:"mean:"}),I(u)]})]})}}({timeAccessor:v,valueAccessor:f}),se=me(null),{customHoverBehavior:oe}=r({selection:Y,linkedHover:$,unwrapData:!0,onObservation:q,chartType:"RealtimeHeatmap",chartId:U}),re=pe(e=>{N&&N(e),oe(e)},[N,oe]);he(i,()=>({push:e=>se.current?.push(e),pushMany:e=>se.current?.pushMany(e),remove:e=>se.current?.remove(e)??[],update:(e,t)=>se.current?.update(e,t)??[],clear:()=>se.current?.clear(),getData:()=>se.current?.getData()??[],getScales:()=>se.current?.getScales()??null}),[]);const ae=l(X,ne[0],ne[1],K),le=ae?null:a(g,ne[0],ne[1],Z),ce=G?`${m||""} semiotic-emphasis-${G}`.trim():m,ue=T(p,g);return ae||le||ge(e,{ref:se,chartType:"heatmap",runtimeMode:"streaming",size:ne,margin:te,className:ce,arrowOfTime:h,windowMode:d,windowSize:ue,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,xExtent:y,yExtent:b,extentPadding:x,heatmapXBins:A,heatmapYBins:C,heatmapAggregation:R,showAxes:Q,background:P,hoverAnnotation:ee,tooltipContent:ie,...t({linkedHover:$,selection:Y,onObservation:q,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:re}),annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,legendPosition:J,pointIdAccessor:n.pointIdAccessor})});ve.displayName="RealtimeHeatmap";export{c as RunningStats,u as WindowAccumulator,m as statValue,h as bandBounds,g as parseWindowDuration,v as ReorderBuffer,W as RealtimeLineChart,Z as RealtimeHistogram,G as TemporalHistogram,J as RealtimeTemporalHistogram,se as RealtimeSwarmChart,ue as RealtimeWaterfallChart,ve as RealtimeHeatmap};
|
|
2
|
+
import{StreamXYFrame_default as e}from"./chunk-chunk-CKMD5NV3.module.min.js";import{buildCustomBehaviorProps as t}from"./chunk-chunk-XXWSHGPL.module.min.js";import{normalizeLinkedBrush as n,useBrushSelection as i,useChartLegendAndMargin as s,useChartMode as o,useChartSelection as r}from"./chunk-chunk-CWQ5YIHX.module.min.js";import{renderEmptyState as a,renderLoadingState as l}from"./chunk-chunk-ACLDBMRH.module.min.js";var c=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},u=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,i=Math.floor(e/n);for(let s=Math.floor((e-this.size)/n)+1;i>=s;s++)this.bump(s*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new c,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,i=new c;i.push(t);let s=e,o=e;const r=[],a={start:s,end:o,stats:i};for(const t of this.sessions)e-n>t.end||t.start>e+n?r.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>o&&(o=t.end));a.start=s,a.end=o,r.push(a),r.sort((e,t)=>e.start-t.start),this.sessions=r}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const i=t+this.size;e.push(this.row(t,i,n,i>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,i){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:i}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function m(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function h(e,t,n,i=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=m(e,n),o=e.stddev*i;return[s-o,s+o]}var d={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},p=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function g(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;p.lastIndex=0;let n,i=0,s=0;for(;null!==(n=p.exec(t));){const e=parseFloat(n[1]),t=d[n[2]];if(null==t||!Number.isFinite(e))return null;i+=e*t,s+=n[0].length}return s!==t.length?null:i>0?i:null}var v=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const i of this.held)this.getTime(i)>e?n.push(i):t.push(i);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as f,useImperativeHandle as w,forwardRef as y,useCallback as b,useState as x,useEffect as A}from"react";import{jsx as _,jsxs as k}from"react/jsx-runtime";var H={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},S={opacity:.7,marginRight:4};function z(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function I(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function C(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=z(o,t,"time"),a=z(o,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),I(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),I(a)]})]})}}function T(e,t){return null!=e?e:Math.max(t?.length??0,200)}var R="time",P="value",M="__aggLower",F="__aggUpper",N="__aggPartial",D="count",E="__aggStart",B="__aggEnd";function O(e,t){const n=t.stat??"mean",i=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[R]:(e.start+e.end)/2,[P]:m(e,n),[D]:e.count,[N]:e.partial,[E]:e.start,[B]:e.end},o=h(e,i,n,s);return o&&(t[M]=o[0],t[F]=o[1]),t})}import{jsx as j}from"react/jsx-runtime";function L(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isFinite(s)?s:null}var W=y(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:m,className:h,arrowOfTime:d="right",windowMode:p="sliding",windowSize:y,data:_,timeAccessor:k,valueAccessor:H,timeExtent:S,valueExtent:z,extentPadding:I,stroke:N="#007bff",strokeWidth:D=2,strokeDasharray:E,opacity:B,background:W,tooltipContent:V,tooltip:$,onHover:X,annotations:Y,autoPlaceAnnotations:q,svgAnnotationRules:G,tickFormatTime:K,tickFormatValue:Q,decay:U,pulse:J,staleness:Z,transition:ee,linkedHover:te,selection:ne,onObservation:ie,chartId:se,loading:oe,loadingContent:re,emptyContent:ae,emphasis:le,legendPosition:ce,aggregate:ue,eventTime:me}=n,he=s.showAxes,de=s.enableHover,pe=m??s.marginDefaults,ge=c??[s.width,s.height],ve=V??$??C({timeAccessor:k,valueAccessor:H}),fe=f(null),{customHoverBehavior:we}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ie,chartType:"RealtimeLineChart",chartId:se}),ye=b(e=>{X&&X(e),we(e)},[X,we]),be=null!=ue,[xe,Ae]=x([]),_e=f(null),ke=f(ue);ke.current=ue;const He=f(be);He.current=be;const Se=f(xe);Se.current=xe;const ze=f({timeAccessor:k,valueAccessor:H});ze.current={timeAccessor:k,valueAccessor:H},A(()=>{if(!be)return void(_e.current=null);const e=ke.current,t=function(e){const t=e.window??"tumbling",n=g("session"===t?e.gap??e.size:e.size);if(null==n)return null;const i=null!=e.hop?g(e.hop):void 0,s=null!=e.gap?g(e.gap):void 0;return new u({window:t,size:n,hop:i??void 0,gap:s??void 0,retain:e.retain})}(e);if(_e.current=t,t&&_){const{timeAccessor:e,valueAccessor:n}=ze.current;for(const i of _){const s=L(i,e,"time"),o=L(i,n,"value");null!=s&&null!=o&&t.push(s,o)}}Ae(t?O(t,e):[])},[be?[ue.window??"tumbling",ue.size,ue.hop??"",ue.gap??"",ue.retain??""].join("|"):"",be,_]),A(()=>{be&&_e.current&&Ae(O(_e.current,ke.current))},[ue?.stat,ue?.band,ue?.sigma]);const Ie=b(e=>{const t=_e.current,n=ke.current;if(!t||!n)return;const{timeAccessor:i,valueAccessor:s}=ze.current;for(const n of e){const e=L(n,i,"time"),o=L(n,s,"value");null!=e&&null!=o&&t.push(e,o)}Ae(O(t,n))},[]),Ce=null!=me,Te=f(null),Re=f(me);Re.current=me;const Pe=f(Ce);Pe.current=Ce;const Me=f(ie);Me.current=ie;const Fe=f(se);Fe.current=se,A(()=>{Te.current=Ce?function(e){const t=g(e.lateness);return null==t?null:new v({lateness:t,getTime:e=>L(e,ze.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(Re.current):null},[Ce?`${me.lateness}|${me.latePolicy??"drop"}`:"",Ce]);const Ne=b(e=>{0!==e.length&&(He.current?Ie(e):fe.current?.pushMany(e))},[Ie]),De=b(e=>{const t=Te.current;if(!Pe.current||!t)return void Ne(e);const n=[];for(const i of e){const e=t.push(i);if(e.released.length&&n.push(...e.released),e.late.length){const n=Me.current;if(n){const{timeAccessor:i}=ze.current,s=Re.current?.latePolicy??"drop";for(const o of e.late)n({type:"late-data",datum:o,eventTime:L(o,i,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:Fe.current})}}}Ne(n)},[Ne]);w(i,()=>({push:e=>De([e]),pushMany:e=>De(e),remove:e=>He.current?[]:fe.current?.remove(e)??[],update:(e,t)=>He.current?[]:fe.current?.update(e,t)??[],clear:()=>{Te.current?.clear(),He.current?(_e.current?.clear(),Ae([])):fe.current?.clear()},getData:()=>He.current?Se.current:fe.current?.getData()??[],getScales:()=>fe.current?.getScales()??null}),[De]);const Ee=l(oe,ge[0],ge[1],re),Be=Ee?null:a(be?void 0:_,ge[0],ge[1],ae),Oe={stroke:N,strokeWidth:D,strokeDasharray:E};null!=B&&(Oe.opacity=B);const je=T(y,_),Le=be?xe:_,We=be?R:k,Ve=be?P:H,$e=be&&ue&&"none"!==(ue.band??"none")?{y0Accessor:M,y1Accessor:F,perSeries:!1}:void 0;return Ee||Be||j(e,{ref:fe,chartType:"line",runtimeMode:"streaming",size:ge,margin:pe,className:le?`${h||""} semiotic-emphasis-${le}`.trim():h,arrowOfTime:d,windowMode:be?"growing":p,windowSize:be?Math.max(1,ue?.retain??Math.max(xe.length,600)):je,data:Le,timeAccessor:We,valueAccessor:Ve,xExtent:S,yExtent:z,extentPadding:I,band:$e,lineStyle:Oe,showAxes:he,background:W,hoverAnnotation:de,tooltipContent:ve,...t({linkedHover:te,selection:ne,onObservation:ie,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ye}),annotations:Y,autoPlaceAnnotations:q,svgAnnotationRules:G,tickFormatTime:K,tickFormatValue:Q,decay:U,pulse:J,staleness:Z,transition:ee,pointIdAccessor:n.pointIdAccessor,legendPosition:ce})});W.displayName="RealtimeLineChart";import{useRef as V,useImperativeHandle as $,forwardRef as X,useCallback as Y,useMemo as q}from"react";function G(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();if("string"==typeof i&&""===i.trim())return null;const s=Number(i);return Number.isFinite(s)?s:null}import{jsx as K}from"react/jsx-runtime";var Q=X(function(c,u){const m=o(c.mode,{width:c.size?.[0]??c.width,height:c.size?.[1]??c.height,showAxes:c.showAxes,showLegend:c.showLegend,enableHover:null!=c.enableHover?!!c.enableHover:void 0,linkedHover:c.linkedHover,mobileInteraction:c.mobileInteraction,mobileSemantics:c.mobileSemantics,responsiveRules:c.responsiveRules}),{binSize:h,size:d,margin:p,className:g,arrowOfTime:v="right",windowMode:f="sliding",windowSize:w,data:y,timeAccessor:b,valueAccessor:x,direction:A="up",timeExtent:C,valueExtent:R,extentPadding:P,categoryAccessor:M,colors:F,fill:N,stroke:D,strokeWidth:E,opacity:B,gap:O,background:j,tooltipContent:L,tooltip:W,onHover:X,annotations:Q,autoPlaceAnnotations:U,svgAnnotationRules:J,tickFormatTime:Z,tickFormatValue:ee,linkedHover:te,selection:ne,decay:ie,pulse:se,staleness:oe,transition:re,onObservation:ae,chartId:le,loading:ce,loadingContent:ue,emptyContent:me,emphasis:he,legendPosition:de,legend:pe,brush:ge,onBrush:ve,linkedBrush:fe}=c,we=m.showAxes,ye=m.enableHover,be=d??[m.width,m.height],xe=q(()=>F?e=>F[e]??N??"#999":void 0,[F,N]),{legend:Ae,margin:_e,legendPosition:ke}=s({data:y??[],colorBy:M,colorScale:xe,showLegend:m.showLegend,legendPosition:de,userMargin:p,defaults:m.marginDefaults,additionalLegend:pe}),He=L??W??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null;if(null==i?.binStart||null==i?.binEnd){const e=z(i,t,"time"),s=z(i,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),I(e)]}),k("div",{children:[_("span",{style:S,children:"y:"}),I(s)]})]})}return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"range:"}),I(i.binStart),"–",I(i.binEnd)]}),null!=i.total&&k("div",{children:[_("span",{style:S,children:"count:"}),I(i.total)]}),null!=i.category&&k("div",{children:[_("span",{style:S,children:"category:"}),I(i.category)]})]})}}({timeAccessor:b,valueAccessor:x}),Se=V(null),{customHoverBehavior:ze}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ae,chartType:"RealtimeHistogram",chartId:le}),Ie=Y(e=>{X&&X(e),ze(e)},[X,ze]),Ce=!0===ge?{dimension:"x",snap:"bin"}:"x"===ge?{dimension:"x"}:"object"==typeof ge?ge:void 0,Te=n(fe),Re="string"==typeof b?b:"time",Pe=i({name:Te?.name||"__unused_hist_brush__",xField:Te?.xField||Re,...Te?.yField?{yField:Te.yField}:{}}),Me=V(Pe.brushInteraction);Me.current=Pe.brushInteraction;const Fe=Y(e=>{if(ve&&ve(e),ae&&ae(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}),Te){const t=Me.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)}},[ve,ae,le,Te]);$(u,()=>({push:e=>Se.current?.push(e),pushMany:e=>Se.current?.pushMany(e),remove:e=>Se.current?.remove(e)??[],update:(e,t)=>Se.current?.update(e,t)??[],clear:()=>Se.current?.clear(),getData:()=>Se.current?.getData()??[],getScales:()=>Se.current?.getScales()??null}),[]);const Ne=l(ce,be[0],be[1],ue),De=Ne?null:a(y,be[0],be[1],me),Ee={};null!=N&&(Ee.fill=N),null!=D&&(Ee.stroke=D),null!=E&&(Ee.strokeWidth=E),null!=B&&(Ee.opacity=B),null!=O&&(Ee.gap=O);const Be=he?`${g||""} semiotic-emphasis-${he}`.trim():g,Oe=T(w,y),je=q(()=>"down"!==A?R:function({data:e,valueAccessor:t,timeAccessor:n,binSize:i,valueExtent:s,extentPadding:o}){if(s)return[s[1],s[0]];if(!e||0===e.length)return;const r=new Map;for(const s of e){const e=G(s,n,"time"),o=G(s,t,"value");if(null==e||null==o)continue;const a=Math.floor(e/i)*i;r.set(a,(r.get(a)??0)+o)}let a=0;for(const e of r.values())a=Math.max(a,e);return[a>0?a+a*(o??.1):1,0]}({data:y,valueAccessor:x,timeAccessor:b,binSize:h,valueExtent:R,extentPadding:P}),[A,y,x,b,h,R,P]);return Ne||De||K(e,{ref:Se,chartType:"bar",runtimeMode:"streaming",size:be,margin:_e,className:Be,arrowOfTime:v,windowMode:f,windowSize:Oe,data:y,timeAccessor:b,valueAccessor:x,xExtent:C,yExtent:je,extentPadding:P,binSize:h,categoryAccessor:M,barColors:F,barStyle:Ee,showAxes:we,background:j,hoverAnnotation:ye,tooltipContent:He,...t({linkedHover:te,selection:ne,onObservation:ae,forceHoverBehavior:!0,mobileInteraction:m.mobileInteraction,customHoverBehavior:Ie}),annotations:Q,autoPlaceAnnotations:U,svgAnnotationRules:J,tickFormatTime:Z,tickFormatValue:ee,decay:ie,pulse:se,staleness:oe,transition:re,pointIdAccessor:c.pointIdAccessor,legend:Ae,legendPosition:ke,brush:Ce||(fe?{dimension:"x"}:void 0),onBrush:Ce||fe?Fe:void 0})});function U(e){return K(Q,{...e,windowMode:"growing"})}Q.displayName="RealtimeHistogram",U.displayName="TemporalHistogram";var J=Q;import{useRef as Z,useImperativeHandle as ee,forwardRef as te,useCallback as ne}from"react";import{jsx as ie}from"react/jsx-runtime";var se=te(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,colors:_,radius:k,fill:H,opacity:S,stroke:z,strokeWidth:I,pointStyle:R,background:P,tooltipContent:M,tooltip:F,onHover:N,annotations:D,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,linkedHover:L,selection:W,onObservation:V,chartId:$,loading:X,loadingContent:Y,emptyContent:q,emphasis:G,legendPosition:K}=n,Q=s.showAxes,U=s.enableHover,J=u??s.marginDefaults,te=c??[s.width,s.height],se=M??F??C({timeAccessor:v,valueAccessor:f}),oe=Z(null),{customHoverBehavior:re}=r({selection:W,linkedHover:L,unwrapData:!0,onObservation:V,chartType:"RealtimeSwarmChart",chartId:$}),ae=ne(e=>{N&&N(e),re(e)},[N,re]);ee(i,()=>({push:e=>oe.current?.push(e),pushMany:e=>oe.current?.pushMany(e),remove:e=>oe.current?.remove(e)??[],update:(e,t)=>oe.current?.update(e,t)??[],clear:()=>oe.current?.clear(),getData:()=>oe.current?.getData()??[],getScales:()=>oe.current?.getScales()??null}),[]);const le=l(X,te[0],te[1],Y),ce=le?null:a(g,te[0],te[1],q),ue={};null!=k&&(ue.radius=k),null!=H&&(ue.fill=H),null!=S&&(ue.opacity=S),null!=z&&(ue.stroke=z),null!=I&&(ue.strokeWidth=I);const me=R,he=G?`${m||""} semiotic-emphasis-${G}`.trim():m,de=T(p,g);return le||ce||ie(e,{ref:oe,chartType:"swarm",runtimeMode:"streaming",size:te,margin:J,className:he,arrowOfTime:h,windowMode:d,windowSize:de,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,barColors:_,swarmStyle:ue,pointStyle:me,showAxes:Q,background:P,hoverAnnotation:U,tooltipContent:se,...t({linkedHover:L,selection:W,onObservation:V,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ae}),annotations:D,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,legendPosition:K,pointIdAccessor:n.pointIdAccessor})});se.displayName="RealtimeSwarmChart";import{useRef as oe,useImperativeHandle as re,forwardRef as ae,useCallback as le}from"react";import{jsx as ce}from"react/jsx-runtime";var ue=ae(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,extentPadding:b,positiveColor:x,negativeColor:A,connectorStroke:C,connectorWidth:R,gap:P,stroke:M,strokeWidth:F,opacity:N,background:D,tooltipContent:E,tooltip:B,onHover:O,annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,linkedHover:X,selection:Y,onObservation:q,chartId:G,loading:K,loadingContent:Q,emptyContent:U,emphasis:J,legendPosition:Z}=n,ee=s.showAxes,te=s.enableHover,ne=u??s.marginDefaults,ie=c??[s.width,s.height],se=E??B??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null,s=z(i,t,"time"),o=i?.delta??z(i,n,"value"),r=i?.cumEnd,a="number"==typeof o?0>o?I(o):"+"+I(o):I(o);return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),I(s)]}),k("div",{children:[_("span",{style:S,children:"Δ:"}),a]}),null!=r&&k("div",{children:[_("span",{style:S,children:"total:"}),I(r)]})]})}}({timeAccessor:v,valueAccessor:f}),ae=oe(null),{customHoverBehavior:ue}=r({selection:Y,linkedHover:X,unwrapData:!0,onObservation:q,chartType:"RealtimeWaterfallChart",chartId:G}),me=le(e=>{O&&O(e),ue(e)},[O,ue]);re(i,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const he=l(K,ie[0],ie[1],Q),de=he?null:a(g,ie[0],ie[1],U),pe={};null!=x&&(pe.positiveColor=x),null!=A&&(pe.negativeColor=A),null!=C&&(pe.connectorStroke=C),null!=R&&(pe.connectorWidth=R),null!=P&&(pe.gap=P),null!=M&&(pe.stroke=M),null!=F&&(pe.strokeWidth=F),null!=N&&(pe.opacity=N);const ge=J?`${m||""} semiotic-emphasis-${J}`.trim():m,ve=T(p,g);return he||de||ce(e,{ref:ae,chartType:"waterfall",runtimeMode:"streaming",size:ie,margin:ne,className:ge,arrowOfTime:h,windowMode:d,windowSize:ve,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,extentPadding:b,waterfallStyle:pe,showAxes:ee,background:D,hoverAnnotation:te,tooltipContent:se,...t({linkedHover:X,selection:Y,onObservation:q,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:me}),annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,legendPosition:Z,pointIdAccessor:n.pointIdAccessor})});ue.displayName="RealtimeWaterfallChart";import{useRef as me,useImperativeHandle as he,forwardRef as de,useCallback as pe}from"react";import{jsx as ge}from"react/jsx-runtime";var ve=de(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,timeExtent:y,valueExtent:b,extentPadding:x,heatmapXBins:A=20,heatmapYBins:C=20,aggregation:R="count",background:P,tooltipContent:M,tooltip:F,onHover:N,annotations:D,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,linkedHover:$,selection:X,onObservation:Y,chartId:q,loading:G,loadingContent:K,emptyContent:Q,emphasis:U,legendPosition:J}=n,Z=s.showAxes,ee=s.enableHover,te=u??s.marginDefaults,ne=c??[s.width,s.height],ie=M??F??function(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=o?.xCenter??z(o,t,"time"),a=o?.yCenter??z(o,n,"value"),l=o?.count,c=o?.sum,u=o?.value,m=o?.agg??"count";return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),I(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),I(a)]}),null!=l&&k("div",{children:[_("span",{style:S,children:"count:"}),I(l)]}),"sum"===m&&null!=c&&k("div",{children:[_("span",{style:S,children:"sum:"}),I(c)]}),"mean"===m&&null!=u&&k("div",{children:[_("span",{style:S,children:"mean:"}),I(u)]})]})}}({timeAccessor:v,valueAccessor:f}),se=me(null),{customHoverBehavior:oe}=r({selection:X,linkedHover:$,unwrapData:!0,onObservation:Y,chartType:"RealtimeHeatmap",chartId:q}),re=pe(e=>{N&&N(e),oe(e)},[N,oe]);he(i,()=>({push:e=>se.current?.push(e),pushMany:e=>se.current?.pushMany(e),remove:e=>se.current?.remove(e)??[],update:(e,t)=>se.current?.update(e,t)??[],clear:()=>se.current?.clear(),getData:()=>se.current?.getData()??[],getScales:()=>se.current?.getScales()??null}),[]);const ae=l(G,ne[0],ne[1],K),le=ae?null:a(g,ne[0],ne[1],Q),ce=U?`${m||""} semiotic-emphasis-${U}`.trim():m,ue=T(p,g);return ae||le||ge(e,{ref:se,chartType:"heatmap",runtimeMode:"streaming",size:ne,margin:te,className:ce,arrowOfTime:h,windowMode:d,windowSize:ue,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,xExtent:y,yExtent:b,extentPadding:x,heatmapXBins:A,heatmapYBins:C,heatmapAggregation:R,showAxes:Z,background:P,hoverAnnotation:ee,tooltipContent:ie,...t({linkedHover:$,selection:X,onObservation:Y,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:re}),annotations:D,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,legendPosition:J,pointIdAccessor:n.pointIdAccessor})});ve.displayName="RealtimeHeatmap";export{c as RunningStats,u as WindowAccumulator,m as statValue,h as bandBounds,g as parseWindowDuration,v as ReorderBuffer,W as RealtimeLineChart,Q as RealtimeHistogram,U as TemporalHistogram,J as RealtimeTemporalHistogram,se as RealtimeSwarmChart,ue as RealtimeWaterfallChart,ve as RealtimeHeatmap};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function e(e,n,r=e.responsiveRules){if(!Array.isArray(r)||0===r.length)return{props:e,matches:[]};const o=r.map((t,e)=>({rule:t,index:e})).filter(t=>function(t,e){const{when:n}=t,r=e.width,o=e.height,i=function(t){if("number"==typeof t.height&&t.height>0)return t.width/t.height}(e),a=function(t){if("number"==typeof t.height&&t.height>0)return t.height>t.width?"portrait":"landscape"}(e);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}(t.rule,n)).sort((t,e)=>("number"==typeof t.rule.priority?t.rule.priority:t.index)-("number"==typeof e.rule.priority?e.rule.priority:e.index));return{props:o.reduce((e,n)=>function(e,n){const r={...e,...n};for(const o of["margin","frameProps","mobileSemantics","style"])t(e[o])&&t(n[o])&&(r[o]={...e[o],...n[o]});return"string"==typeof e.className&&"string"==typeof n.className&&(r.className=`${e.className} ${n.className}`),r}(e,n.rule.transform),e),matches:o}}function n(t,e){return t===e}function r(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function o(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function i(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}var a=/^\d{4}-\d{1,2}$/;function s(t){const e=t.trim();if(!e||!Number.isNaN(Number(e)))return NaN;const n=a.test(e)?e+"-01":e;if(n===e&&10>e.length)return NaN;const r=Date.parse(n);return Number.isFinite(r)?r:NaN}function u(t){return t instanceof Date?t.getTime():"string"==typeof t?s(t):+t}var c=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),l=new Set(["label","callout","callout-circle","callout-rect"]);function f(t){return"string"==typeof t?.type?t.type:""}function d(t){return!!t&&"object"==typeof t&&c.has(f(t))}function h(t){return l.has(f(t))&&!function(t){return Array.isArray(t?.disable)&&t.disable.includes("connector")}(t)}function p(t,e,n={}){return Number.isFinite(e)&&e>0?Number.isNaN(t)?"fresh":t===1/0?"expired":0>t||e*(n.fresh??1)>t?"fresh":e*(n.aging??1.5)>t?"aging":e*(n.stale??3)>t?"stale":"expired":"fresh"}function m(t,e={}){const n=!0===e.showRetractedAnnotations,r=!0===e.showSupersededAnnotations,o=new Set;for(const e of t){const t=e?.lifecycle?.supersedes;t&&"retracted"!==e?.lifecycle?.status&&o.add(t)}return t.filter(t=>{if("retracted"===t?.lifecycle?.status&&!n)return!1;const e=t?.provenance?.stableId;return!(e&&o.has(e)&&!r)})}function y(t,e){const n=t.length,r=e.length,o=Array(r+1);for(let t=0;r>=t;t++)o[t]=t;for(let i=1;n>=i;i++){let n=o[0];o[0]=i;for(let a=1;r>=a;a++){const r=o[a];o[a]=t[i-1]===e[a-1]?n:1+Math.min(n,o[a],o[a-1]),n=r}}return o[r]}function b(t,e,n=3){let r,o=n+1;for(const n of e){const e=y(t.toLowerCase(),n.toLowerCase());o>e&&(o=e,r=n)}return o>n?void 0:r}function g(t){return t.length>3?[t[0],t[Math.floor(t.length/2)],t[t.length-1]]:[...t]}function v(t,e){if(0===e.length)return null;const n=t.toLowerCase();return e.find(t=>t.toLowerCase().includes(n)||n.includes(t.toLowerCase()))||(b(t,e,3)??null)}function A({componentName:t,data:e,accessors:n,requiredProps:r}){if(r)for(const[e,n]of Object.entries(r))if(null==n)return`${t}: ${e} is required. Provide a field name or function.`;if(null==e)return null;if(!Array.isArray(e)&&"object"==typeof e)return t+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(e)||0===e.length)return t+": No data provided. Pass a non-empty array to the data prop.";if(n){const r=g(e).find(t=>t&&"object"==typeof t);if(r){const e=Object.keys(r);for(const[o,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in r)){const n=v(i,e),r=n?` Try ${o}="${n}".`:"";return`${t}: ${o} "${i}" not found in data. Available fields: ${e.join(", ")}.${r}`}}}return null}function x({componentName:t,data:e,dataLabel:n="data"}){return null==e?`${t}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(e)?`${t}: ${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 N({componentName:t,nodes:e,edges:n,nodesRequired:r=!1,edgesRequired:o=!0,accessors:i}){if(null==e&&null==n)return null;if(o&&(!n||!Array.isArray(n)||0===n.length))return t+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(r&&(!e||!Array.isArray(e)||0===e.length))return t+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&e&&e.length>0){const n=g(e).find(t=>t&&"object"==typeof t);if(n){const e=Object.keys(n);for(const[r,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in n)){const n=v(o,e),i=n?` Try ${r}="${n}".`:"";return`${t}: ${r} "${o}" not found in node data. Available fields: ${e.join(", ")}.${i}`}}}return null}import{createContext as w,useCallback as $,useContext as j,useMemo as M,useRef as O,useSyncExternalStore as P}from"react";import{jsx as S}from"react/jsx-runtime";function C(t){let e=null;const n=()=>(e||(e=w(null)),e),r=I(t);return[function({children:e,initialState:r}){const o=O(r),i=M(()=>I(t,o.current),[]),a=n();return S(a.Provider,{value:i,children:e})},(t,e)=>{const o=n(),i=j(o)??r,a=O(t);a.current=t;const s=O({hasValue:!1,value:void 0}),u=$(()=>{const t=a.current(i.getState()),n=s.current;return n.hasValue&&e&&e(n.value,t)?n.value:(s.current={hasValue:!0,value:t},t)},[i,e]),c=$(()=>a.current(i.getState()),[i]);return P(i.subscribe,u,c)}]}function I(t,e){const n=new Set;let r={...t(function(t){const e=t(r);if(function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}(e)){r={...r,...e};for(const t of n)t()}}),...e??{}};return{getState:()=>r,subscribe:function(t){return n.add(t),()=>{n.delete(t)}}}}import*as k from"react";var[T,R]=C(t=>({observations:[],maxObservations:100,version:0,pushObservation(e){t(t=>{const n=t.observations;return n.push(e),n.length>t.maxObservations&&n.shift(),{version:t.version+1}})},clearObservations(){t(()=>({observations:[],version:0}))}}));function L(t){const e=R(t=>t.pushObservation),n=k.useCallback(n=>{t.onObservation?.(n),e?.(n)},[t,e]);return k.useMemo(()=>({...t,onObservation:n}),[n,t])}function q(t){const e=t.provenance,n=t.id??t.stableId??e?.stableId;return null==n||""===n?void 0:n+""}function D(t,e={}){const n=q(t);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(t){const e=t.nativeEvent;return"touch"===e.pointerType?"touch":0===e.detail?"keyboard":"pointer"}(r);e.onAnnotationActivate?.({annotation:t,annotationId:n,chartId:e.chartId,inputType:o}),n&&e.onObservation&&e.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:e.chartType??"unknown",chartId:e.chartId})}}}function F(t){return t instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]")}function H(t){return"primary"===t?.emphasis||!0===t?.defensive}function V(t,e,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):t>0&&e>0?Math.max(1,Math.round(t*e/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function W(t){let e;const n=t?.emphasis;e="primary"===n?100:"secondary"===n?10:50;const r=t?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(e+=15*Math.max(0,Math.min(1,r))),t?.lifecycle?.freshness){case"fresh":e+=8;break;case"aging":e+=4;break;case"stale":e+=1;break;case"expired":e-=200}return e}function B(t){const{annotations:e,width:n,height:r}=t,o=Math.max(0,t.minVisible??1),i=V(n,r,t),a=e.map((t,e)=>{return{annotation:t,index:e,note:(n=t,d(n))};var n}),s=a.filter(t=>t.note);if(0===s.length||i>=s.length)return{visible:e.slice(),deferred:[],budget:i};const u=s.filter(t=>H(t.annotation)),c=s.filter(t=>!H(t.annotation)).sort((t,e)=>W(e.annotation)-W(t.annotation)||t.index-e.index),l=Math.min(c.length,Math.max(Math.max(0,i-u.length),Math.max(0,o-u.length))),f=new Set([...u.map(t=>t.index),...c.slice(0,l).map(t=>t.index)]),h=[],p=[];for(const{annotation:t,index:e,note:n}of a)!n||f.has(e)?h.push(t):p.push(t);return{visible:h,deferred:p,budget:i}}function E(t){let e=t>>>0;return function(){e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}export{e as resolveResponsiveRules,C as createStore,n as accessorsEquivalent,r as resolveAccessor,o as resolveRawAccessor,i as resolveStringAccessor,s as parseDateLikeString,u as coerceDateLikeValue,p as bandFromAge,R as useObservationSelector,L as useAnnotationActivationOptions,q as annotationStableId,D as annotationActivationProps,F as isAnnotationActivationTarget,f as annotationType,d as isNoteAnnotation,h as annotationDrawsConnector,V as annotationBudget,B as annotationDensity,m as filterAnnotationsByStatus,b as closestMatch,A as validateArrayData,x as validateObjectData,N as validateNetworkData,E as mulberry32};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{buildColorStopGradient as t,resolveCSSColor as e,resolveCanvasFill as l,resolveCurveFactory as n}from"./chunk-chunk-
|
|
2
|
+
import{buildColorStopGradient as t,resolveCSSColor as e,resolveCanvasFill as l,resolveCurveFactory as n}from"./chunk-chunk-CWQ5YIHX.module.min.js";import{line as o}from"d3-shape";function i(t,e,l){let n=l;for(const l of e)"lesser"===l.thresholdType?l.value>t&&(n=l.color):t>l.value&&(n=l.color);return n}function s(t,e,l,n,o,i){if(2>e.length)return;const s=[0];for(let t=1;e.length>t;t++){const l=e[t][0]-e[t-1][0],n=e[t][1]-e[t-1][1];s.push(s[t-1]+Math.sqrt(l*l+n*n))}const a=s[s.length-1];if(0===a)return;const h=Math.min(.2*a,40);t.strokeStyle=l,t.lineWidth=n,t.lineCap=i;for(let l=0;e.length-1>l;l++){const n=(s[l]+s[l+1])/2;let i=o;h>n&&(i*=n/h),h>a-n&&(i*=(a-n)/h),t.globalAlpha=Math.max(0,i),t.beginPath(),t.moveTo(e[l][0],e[l][1]),t.lineTo(e[l+1][0],e[l+1][1]),t.stroke()}}var a=(a,h,r,p)=>{const c=h.filter(t=>"line"===t.type);for(const h of c){if(2>h.path.length)continue;const r=h._introClipFraction;void 0!==r&&1>r&&(a.save(),a.beginPath(),a.rect(0,0,p.width*r,p.height),a.clip());const c=h.style.stroke||"#007bff",f=e(a,c)||c,u=h.style.strokeWidth||2,y=h.colorThresholds,g=h.rawValues;if(a.setLineDash(h.style.strokeDasharray?h.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=h.style.opacity&&(a.globalAlpha=h.style.opacity),a.lineWidth=u,a.lineCap=h.style.strokeLinecap||"butt",h.style._edgeFade){s(a,h.path,f,u,h.style.opacity??1,h.style.strokeLinecap||"butt"),a.globalAlpha=1,a.setLineDash([]),a.lineCap="butt";continue}const k=n(h.curve),b=y&&y.length>0&&g&&g.length===h.path.length,d=h._decayOpacities;if(d&&d.length===h.path.length&&!b){a.strokeStyle=f;const t=h.style.opacity??1;for(let e=0;h.path.length-1>e;e++)a.globalAlpha=.5*(d[e]+d[e+1])*t,a.beginPath(),a.moveTo(h.path[e][0],h.path[e][1]),a.lineTo(h.path[e+1][0],h.path[e+1][1]),a.stroke()}else if(b){let t=function(t,e,l){a.beginPath(),a.strokeStyle=t,a.moveTo(e,l),r=!0},e=function(){r&&(a.stroke(),r=!1)},l=null,n=null,o=null,s=null,r=!1;for(let r=0;h.path.length>r;r++){const[p,c]=h.path[r],u=g[r],k=i(u,y,f);if(null!==l&&null!==s&&null!==o){if(k===s)a.lineTo(p,c);else{const s=[];for(const t of y){const e=t.value;(o>e||e>u)&&(e>o||u>e)||o===e||u===e||s.push({t:(e-o)/(u-o)})}s.sort((t,e)=>t.t-e.t);for(const h of s){const s=l+(p-l)*h.t,r=n+(c-n)*h.t,g=i(o+(u-o)*Math.min(h.t+1e-4,1),y,f);a.lineTo(s,r),e(),t(g,s,r)}a.lineTo(p,c)}l=p,n=c,o=u,s=k}else t(k,p,c),l=p,n=c,o=u,s=k}e()}else{a.beginPath();const e=h.strokeGradient&&h.path.length>=2?t(a,h.strokeGradient,h.path[0][0],0,h.path[h.path.length-1][0],0):null;if(a.strokeStyle=e||f,k)o().x(t=>t[0]).y(t=>t[1]).curve(k).context(a)(h.path);else{const[t,e]=h.path[0];a.moveTo(t,e);for(let t=1;h.path.length>t;t++)a.lineTo(h.path[t][0],h.path[t][1])}a.stroke()}if(h.style.fill&&h.style.fillOpacity&&h.style.fillOpacity>0){if(a.beginPath(),a.globalAlpha=h.style.fillOpacity,a.fillStyle=l(a,h.style.fill,h.style.fill),k&&!b)o().x(t=>t[0]).y(t=>t[1]).curve(k).context(a)(h.path);else{const[t,e]=h.path[0];a.moveTo(t,e);for(let t=1;h.path.length>t;t++)a.lineTo(h.path[t][0],h.path[t][1])}const t=h.path[0][0];a.lineTo(h.path[h.path.length-1][0],p.height),a.lineTo(t,p.height),a.closePath(),a.fill()}void 0!==r&&1>r&&a.restore(),a.globalAlpha=1,a.setLineDash([]),a.lineCap="butt"}};function h(t){if(!t)return null;if("heatcell"===t.type)return t.fill||null;if("candlestick"===t.type)return t.isUp?t.upColor:t.downColor;const{style:e}=t;if(!e)return null;const l="string"==typeof e.fill?e.fill:null;return"line"===t.type||"area"===t.type?e.stroke||l||null:l||e.stroke||null}export{a as lineCanvasRenderer,h as resolveNodeColor};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{coerceDateLikeValue as t,parseDateLikeString as e}from"./chunk-chunk-ZXIXAPRE.module.min.js";import{lineCanvasRenderer as i,resolveNodeColor as o}from"./chunk-chunk-BANTPINB.module.min.js";import{DataSourceAdapter as s,IncrementalExtent as n,accessorsEquivalent as r,barCanvasRenderer as a,buildAreaNode as l,buildEnrichAnnotationData as c,buildHeatcellNode as h,buildLineNode as u,buildPointNode as g,buildRectNode as d,buildStackedAreaNodes as f,buildSymbolNode as p,computeDivergingStackExtent as y,computeStackOffsets as m,resolveAccessor as x,resolveAnnotationAccessor as v,resolveFrameGraphics as b,resolveRawAccessor as k,resolveStringAccessor as w,symbolCanvasRenderer as A,ticksForMode as _,toIdSet as C}from"./chunk-chunk-L6EA5V3G.module.min.js";import{RingBuffer as S,applyPulse as M,buildAggregateRibbons as P,buildPerSeriesRibbons as Y,compactTimestampBufferForRemoval as R,createTimestampBufferForData as T,enrichDatumWithBand as W,ensureRingBufferCapacity as N,hasActivePulses as O,partitionRibbons as D,pointCanvasRenderer as E,pushWithTimestamp as L,refreshIdlePulse as z,useLegendCategoryEmission as B,useSemanticFrameInteractions as F,useXYKeyboardNavigation as I}from"./chunk-chunk-PZJ2SBLL.module.min.js";import{needsInteractionCanvasPaint as X,paintCanvasBackground as $,resolveCanvasBackground as G}from"./chunk-chunk-TMWIZL3K.module.min.js";import{StalenessBadge as V,applyDecay as H,attachUpdateResultStore as j,buildDatumIndexMap as q,composeOverlays as U,computeDecayOpacity as K,createCustomLayoutFailureDiagnostic as J,filterAnnotationsByStatus as Z,findHitPointInQuadtree as Q,getHitRadius as tt,glyphCanvasRenderer as et,hitTestRect as it,isTimeLandmark as ot,paintSceneWithBackend as st,renderPathPulse as nt,renderRectPulse as rt,renderSceneWithBackend as at,resolveStaleness as lt,useConfigSync as ct,useLayoutSelectionSync as ht,useStableShallow as ut,useStalenessCheck as gt,warnCustomLayoutDiagnostics as dt}from"./chunk-chunk-XXWSHGPL.module.min.js";import{wrapWithCustomLayoutSelection as ft}from"./chunk-chunk-5UKL5W76.module.min.js";import{AccessibleDataTable as pt,AriaLiveTooltip as yt,CanvasFrameBackground as mt,FlippingTooltip as xt,FocusRing as vt,SEQUENTIAL_INTERPOLATORS as bt,STREAMING_PALETTE as kt,SYMBOL_SEQUENCE as wt,SceneRevisionDiagnosticsObserver as At,ScreenReaderSummary as _t,SkipToTableLink as Ct,TITLE_BASELINE as St,UpdateResultTracker as Mt,annotationLayout as Pt,buildColorStopGradient as Yt,buildHoverData as Rt,buildLinearFillGradient as Tt,computeCanvasAriaLabel as Wt,computeEasing as Nt,computeRawProgress as Ot,createDefaultAnnotationRules as Dt,defaultTooltipStyle as Et,filterSparseArray as Lt,getCSSColorCacheVersion as zt,getDevicePixelRatio as Bt,getPointerHitRadius as Ft,getSequentialInterpolator as It,isAnnotationActivationTarget as Xt,isServerEnvironment as $t,lerp as Gt,now as Vt,observationInputType as Ht,prepareCanvas as jt,renderAnnotationPass as qt,renderLegendFromConfig as Ut,resolveCSSColor as Kt,resolveCanvasFill as Jt,resolveCurveFactory as Zt,smartTooltipEntries as Qt,symbolRadius as te,unlockCrosshair as ee,useAnnotationActivationOptions as ie,useCrosshairPosition as oe,useFrame as se,useFrameCanvasHost as ne,useSceneRevisionDiagnostics as re,xySceneNodeToSVG as ae}from"./chunk-chunk-CWQ5YIHX.module.min.js";import{getMax as le}from"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveThemeSemanticColors as ce}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphHitGeometry as he}from"./chunk-chunk-KTWEBFMX.module.min.js";import{useHydration as ue,useWasHydratingFromSSR as ge}from"./chunk-chunk-ACLDBMRH.module.min.js";import*as de from"react";import{useRef as fe,useState as pe,useEffect as ye,useMemo as me,useCallback as xe,useImperativeHandle as ve,useId as be,forwardRef as ke,memo as we}from"react";import*as Ae from"react";import{jsx as _e}from"react/jsx-runtime";var Ce=null,Se=null;function Me(t){const[e,i]=Ae.useState(()=>Ce);return Ae.useEffect(()=>{if(e)return;let t=!1;return(Ce?Promise.resolve(Ce):(Se||(Se=import("./chunk-XYBrushOverlay-EP2SV3UI.module.min.js").then(t=>Ce=t.XYBrushOverlay).catch(t=>{throw Se=null,t})),Se)).then(e=>{t||i(()=>e)}),()=>{t=!0}},[e]),e?_e(e,{...t}):null}function Pe(t,e,i){if(e._transitionKey)return e._transitionKey;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===t.runtimeMode&&e.datum){const i=t.getX(e.datum),o=t.getY(e.datum);if(t.getCategory)return`p:${t.getCategory(e.datum)}:${i}:${o}`;if(null!=i&&null!=o)return`p:${i}:${o}`}return"p:"+i;case"glyph":return e.pointId?"g:"+e.pointId:"g:"+i;case"rect":return`r:${e.group||""}:${e.datum?.binStart??e.datum?.category??i}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+i:"c:"+t.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}function Ye(t,e,i,o){if(!t.config.pointStyle)return;const s=o??t.getY;for(const o of e){const e=t.resolveGroupColor(o.key);for(const n of o.data){let o=t.config.pointStyle(n);!o.fill&&e&&(o={...o,fill:e});const r=o.r??3,a=t.getPointId?t.getPointId(n)+"":void 0,l=g(n,t.scales,t.getX,s,r,o,a);l&&i.push(l)}}}function Re(t){return"threshold"===t.type&&"string"==typeof t.color&&"number"==typeof t.value}var Te={topOpacity:.8,bottomOpacity:.05};function We(t){if(t)return!0===t?Te:"colorStops"in t?t:{topOpacity:t.topOpacity??Te.topOpacity,bottomOpacity:t.bottomOpacity??Te.bottomOpacity}}var Ne=new Map;function Oe(t,e,i){const o=i.config.areaStyle?.(e);return o&&(t.style=o),t}function De(t,e,i,o,s){const n=new Map;for(const r of t){const t=e(r),a=i(r);if(null==t||null==a||Number.isNaN(t)||Number.isNaN(a))continue;const l=Math.floor(t/o)*o;let c=n.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},n.set(l,c)),c.total+=a,s){const t=s(r);c.categories.set(t,(c.categories.get(t)||0)+a)}}return n}function Ee(t,e){const i="function"==typeof t?t:i=>i[t||e];return t=>{const e=i(t);return null==e?NaN:+e}}function Le(t){const e=[],i=["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode,o=Ee(i&&t.valueAccessor||t.yAccessor,i?"value":"y");if(t.boundsAccessor){const i=x(t.boundsAccessor,"bounds");e.push({kind:"bounds",getTop:t=>{const e=o(t);if(!Number.isFinite(e))return NaN;const s=i(t);return Number.isFinite(s)&&0!==s?e+s:e},getBottom:t=>{const e=o(t);if(!Number.isFinite(e))return NaN;const s=i(t);return Number.isFinite(s)&&0!==s?e-s:e},style:t.boundsStyle,perSeries:!0,interactive:!1})}if(t.band){const i=Array.isArray(t.band)?t.band:[t.band];for(const t of i)e.push({kind:"band",getTop:Ee(t.y1Accessor,"y1"),getBottom:Ee(t.y0Accessor,"y0"),style:t.style,perSeries:!1!==t.perSeries,interactive:!0===t.interactive})}return e}import{scaleLinear as ze,scaleLog as Be,scaleSymlog as Fe,scaleTime as Ie}from"d3-scale";function Xe(t,e){return e?[e[0]??t[0],e[1]??t[1]]:t}function $e(t,e,i){if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return Be().domain(t).range(i).clamp(!0)}return"symlog"===t?Fe().domain(e).range(i):"time"===t?Ie().domain([new Date(e[0]),new Date(e[1])]).range(i):ze().domain(e).range(i)}var Ge=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ve=["scene-style","data-paint","accessibility","evidence"],He=(t,e)=>({retainedData:t,invalidations:e}),je=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],qe=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ue=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ke=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Je=["scene-geometry","data-paint","accessibility","evidence"],Ze=["scene-style","data-paint","accessibility","evidence"],Qe=[],ti={chartType:He("rebuild",je),runtimeMode:He("rebuild",je),xAccessor:He("rebuild",je),yAccessor:He("rebuild",je),timeAccessor:He("rebuild",je),valueAccessor:He("rebuild",je),y0Accessor:He("rebuild",je),boundsAccessor:He("rebuild",je),band:He("rebuild",je),openAccessor:He("rebuild",je),highAccessor:He("rebuild",je),lowAccessor:He("rebuild",je),closeAccessor:He("rebuild",je),candlestickRangeMode:He("rebuild",je),accessorRevision:He("rebuild",je),groupAccessor:He("rebuild",qe),categoryAccessor:He("rebuild",qe),lineDataAccessor:He("rebuild",qe),colorAccessor:He("rebuild",Ze),sizeAccessor:He("rebuild",Je),symbolAccessor:He("rebuild",Je),pointIdAccessor:He("rebuild",Je),xScaleType:He("preserve",Ue),yScaleType:He("preserve",Ue),xExtent:He("preserve",Ue),yExtent:He("preserve",Ue),extentPadding:He("preserve",Ue),scalePadding:He("preserve",Ue),axisExtent:He("preserve",Ue),binSize:He("preserve",Ue),normalize:He("preserve",Ue),heatmapAggregation:He("preserve",Ue),heatmapXBins:He("preserve",Ue),heatmapYBins:He("preserve",Ue),arrowOfTime:He("preserve",Ke),baseline:He("preserve",Ke),stackOrder:He("preserve",Ke),sizeRange:He("preserve",Ke),curve:He("preserve",Ke),areaGroups:He("preserve",Ke),customLayout:He("preserve",Ke),layoutConfig:He("preserve",Ke),layoutMargin:He("preserve",Ke),symbolMap:He("preserve",Je),showValues:He("preserve",Je),heatmapValueFormat:He("preserve",Je),lineStyle:He("preserve",Ze),pointStyle:He("preserve",Ze),areaStyle:He("preserve",Ze),barStyle:He("preserve",Ze),swarmStyle:He("preserve",Ze),waterfallStyle:He("preserve",Ze),candlestickStyle:He("preserve",Ze),boundsStyle:He("preserve",Ze),gradientFill:He("preserve",Ze),lineGradient:He("preserve",Ze),colorScheme:He("preserve",Ze),themeCategorical:He("preserve",Ze),themeSemantic:He("preserve",Ze),themeSequential:He("preserve",Ze),themeDiverging:He("preserve",Ze),barColors:He("preserve",Ze),decay:He("preserve",Ze),pulse:He("preserve",Ze),staleness:He("preserve",Ze),layoutSelection:He("preserve",Ze),annotations:He("preserve",["overlay","accessibility","evidence"]),windowSize:He("preserve",Qe),windowMode:He("preserve",Qe),maxCapacity:He("preserve",Qe),clock:He("preserve",Qe),transition:He("preserve",Qe),introAnimation:He("preserve",Qe),onLayoutError:He("preserve",Qe)},ei=He("preserve",Ke),ii=class{constructor(){this.tracker=new Mt}get last(){return this.tracker.last}subscribe(t){return this.tracker.subscribe(t)}recordData(t,e){return this.tracker.record({kind:t,...void 0===e?{}:{count:e}},Ge)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},Ve):this.recordNoop("restyle")}recordConfig(t){const e=function(t){let e="preserve";const i=new Set;for(const o of t){const t=ti[o]??ei;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)i.add(e)}return{retainedData:e,invalidations:i}}(t);return this.tracker.record({kind:"config",keys:t},e.invalidations)}};import{quadtree as oi}from"d3-quadtree";var si=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(t,e){if("scatter"!==t&&"bubble"!==t&&"custom"!==t)return void this.clear();let i=0,o=0;for(const t of e)"point"===t.type&&(i++,t.r>o&&(o=t.r));if(this.maxRadius=o,500>=i)return void(this.tree=null);const s=Array(i);let n=0;for(const t of e)"point"===t.type&&(s[n++]=t);this.tree=oi().x(t=>t.x).y(t=>t.y).addAll(s)}},ni=class i{constructor(t){if(this.xExtent=new n,this.yExtent=new n,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new ii,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new si,this._lastBoundedInsertsRef=null,this.applyPulse=(t,e,i)=>!(!this.config.pulse||!this.timestampBuffer)&&M(this.config.pulse,t,e,this.timestampBuffer,this.getDatumIndexMap(e),i),this.config=t,this.buffer=new S(t.windowSize),this.growingCap=t.windowSize,["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode?(this.getX=x(t.timeAccessor||t.xAccessor,"time"),this.getY=x(t.valueAccessor||t.yAccessor,"value")):(this.getX=x(t.xAccessor,"x"),this.getY=x(t.yAccessor,"y")),this.getGroup=w(t.groupAccessor),this.getCategory=w(t.categoryAccessor),this.getSize=t.sizeAccessor?x(t.sizeAccessor,"size"):void 0,this.getColor=w(t.colorAccessor),this.getSymbol=w(t.symbolAccessor),this.getY0=t.y0Accessor?x(t.y0Accessor,"y0"):void 0,this.resolvedRibbons=Le(t),this.getPointId=w(t.pointIdAccessor),"candlestick"===t.chartType){const e=null!=t.openAccessor,i=null!=t.closeAccessor;this.getOpen=e?x(t.openAccessor,"open"):void 0,this.getHigh=x(t.highAccessor,"high"),this.getLow=x(t.lowAccessor,"low"),this.getClose=i?x(t.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!i}t.pulse&&(this.timestampBuffer=new S(t.windowSize))}currentTime(){return this.config.clock?.()??Vt()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=T(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(t)),void this.yExtent.push(this.getLow(t));this.yExtent.push(this.getY(t)),this.getY0&&this.yExtent.push(this.getY0(t));for(const e of this.resolvedRibbons){const i=e.getTop(t),o=e.getBottom(t);Number.isFinite(i)&&this.yExtent.push(i),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(t)),void this.yExtent.evict(this.getLow(t));this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t));for(const e of this.resolvedRibbons){const i=e.getTop(t),o=e.getBottom(t);Number.isFinite(i)&&this.yExtent.evict(i),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const t of this.buffer)this.pushDatumYExtent(t)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const t of this.buffer)this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t)}ingest(i){if(i.bounded&&this._lastBoundedInsertsRef===i.inserts)return this.updateResults.recordNoop("replace"),!1;const o=this.currentTime();if(this.lastIngestTime=o,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i.bounded){this._lastBoundedInsertsRef=i.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const s=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=s?x(this.config.timeAccessor||this.config.xAccessor,"time"):x(this.config.xAccessor,"x"),this.xIsDate=!1,i.inserts.length>0){const o=i.inserts[0],s=this.config.xAccessor,n="function"==typeof s?s(o):o[s||"x"],r=n instanceof Date,a="string"==typeof n&&Number.isFinite(e(n));if(this.xIsDate=r||a,a){const e="string"==typeof s?s:void 0;this.getX=e?i=>t(i[e]):e=>t(s(e))}}N(this.buffer,i.totalSize||i.inserts.length,this.timestampBuffer);for(const t of i.inserts)L(this.buffer,t,this.timestampBuffer,o),this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t)}else for(const t of i.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const t=this.config.maxCapacity??1e5;t>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,t),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${t}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=L(this.buffer,t,this.timestampBuffer,o);this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}return this.updateResults.recordData(i.bounded?"replace":"ingest",i.inserts.length),!0}ingestWithResult(t){return this.ingest(t),this.updateResults.last}computeScene(t){const{config:e,buffer:i}=this,o=this.scales,s=this.lastLayout;if(!this.needsFullRebuild&&!e.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==t.width||this.lastLayout.height!==t.height))return void this.remapScene(t);this.xExtent.dirty&&this.xExtent.recalculate(i,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const n=this.getBufferArray(),r=this.yExtent.extent;let a=Xe(this.xExtent.extent,e.xExtent),l=Xe(r,e.yExtent);const c=!(!(h=e.yExtent)||null==h[0]||null==h[1]);var h;const u="exact"===e.axisExtent;if("stackedarea"===e.chartType&&!c&&i.size>0){const t=function(t){const{config:e,groups:i,getX:o,getY:s}=t,n="exact"===e.axisExtent;if(e.normalize){const i=[0,n?1:1+e.extentPadding];return{yDomain:i,stackExtentCache:{key:`${t.bufferSize}:${t.ingestVersion}:norm`,yDomain:i}}}const r=`${t.bufferSize}:${t.ingestVersion}:${e.baseline??"zero"}:${e.stackOrder??"key"}`;if(t.stackExtentCache&&t.stackExtentCache.key===r)return{yDomain:t.stackExtentCache.yDomain,stackExtentCache:t.stackExtentCache};const a=new Map,l=new Set;let c=0;const h=new Map,u=new Map;for(const t of i){const e=new Map;let i=0;for(const n of t.data){const t=o(n),r=s(n);if(!Number.isFinite(t)||!Number.isFinite(r))continue;e.set(t,(e.get(t)||0)+r),l.add(t),i+=r;const a=(h.get(t)||0)+r;h.set(t,a),a>c&&(c=a)}a.set(t.key,e),u.set(t.key,i)}const g=e.stackOrder??"key",d=(t,e)=>e>t?-1:t>e?1:0;let f,p;if("input"===g)f=i.map(t=>t.key);else if("insideOut"===g){const t=[...i].map(t=>t.key).sort((t,e)=>{const i=(u.get(e)??0)-(u.get(t)??0);return 0!==i?i:d(t,e)}),e=[],o=[];let s=0,n=0;for(const i of t)n>s?(e.push(i),s+=u.get(i)??0):(o.push(i),n+=u.get(i)??0);f=[...o.reverse(),...e]}else f="asc"===g?i.map(t=>t.key).sort((t,e)=>{const i=(u.get(t)??0)-(u.get(e)??0);return 0!==i?i:d(t,e)}):"desc"===g?i.map(t=>t.key).sort((t,e)=>{const i=(u.get(e)??0)-(u.get(t)??0);return 0!==i?i:d(t,e)}):i.map(t=>t.key).sort(d);if("wiggle"===e.baseline||"silhouette"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),i=m(t,f,(t,e)=>a.get(t)?.get(e)||0,e.baseline);let o=1/0,s=-1/0;for(const e of t){const t=i.get(e)??0,n=h.get(e)??0;o>t&&(o=t),t+n>s&&(s=t+n)}Number.isFinite(o)&&Number.isFinite(s)||(o=0,s=0);const r=s-o,c=n?0:r>0?r*e.extentPadding:1;p=[o-c,s+c]}else if("diverging"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),[i,o]=y(t,f,(t,e)=>a.get(t)?.get(e)||0),s=o-i,r=n?0:s>0?s*e.extentPadding:1;p=[i-r,o+r]}else p=[0,c+(n?0:c>0?c*e.extentPadding:1)];return{yDomain:p,stackExtentCache:{key:r,yDomain:p}}}({config:e,groups:this.groupData(n),getX:this.getX,getY:this.getY,bufferSize:i.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=t.yDomain,this._stackExtentCache=t.stackExtentCache}else"bar"===e.chartType&&e.binSize&&!c&&i.size>0?l=function(t,e,i,o,s,n,r){const[,a]=function(t,e,i,o,s){const n=De(t,e,i,o,s);if(0===n.size)return[0,0];let r=0;for(const t of n.values())t.total>r&&(r=t.total);return[0,r]}(t,e,i,o,s);return[0,r?a:a+a*n]}(i,this.getX,this.getY,e.binSize,this.getCategory,e.extentPadding,u):"waterfall"===e.chartType&&!c&&i.size>0?l=function(t,e,i,o){const[s,n]=function(t,e){let i=0,o=0,s=0;for(const n of t){const t=e(n);null==t||Number.isNaN(t)||(s+=t,i>s&&(i=s),s>o&&(o=s))}return[i,o]}(t,e),r=n-s,a=o?0:r>0?r*i:1;return[Math.min(0,s-Math.abs(a)),Math.max(0,n+Math.abs(a))]}(i,this.getY,e.extentPadding,u):c||l[0]===1/0||(l=function(t,e,i){if(!i.length)return t;let[o,s]=t;for(const t of e)for(const e of i){const i=e.getTop(t),n=e.getBottom(t);Number.isFinite(i)&&(o>i&&(o=i),i>s&&(s=i)),Number.isFinite(n)&&(o>n&&(o=n),n>s&&(s=n))}return[o,s]}(l,n,this.resolvedRibbons),l=function(t,e){const i=t[1]-t[0],o=e.exactMode?0:i>0?i*e.extentPadding:1,s=[null!=e.userMin?t[0]:t[0]-o,null!=e.userMax?t[1]:t[1]+o];return"log"!==e.yScaleType||s[0]>0||0>=e.dataYDomain[0]||e.exactMode||null==e.userMin&&(s[0]=e.dataYDomain[0]/(1+e.extentPadding)),s}(l,{exactMode:u,extentPadding:e.extentPadding,userMin:e.yExtent?.[0],userMax:e.yExtent?.[1],yScaleType:e.yScaleType,dataYDomain:r}));l=function(t,e,i){if(!e||i)return t;const o=e[0],s=e[1];return null==o&&null==s?t:[null!=o?o:t[0],null!=s?s:t[1]]}(l,e.yExtent,!!c),({xDomain:a,yDomain:l}=function(t,e,i){let o=t,s=e;if(o[0]===1/0||o[1]===-1/0)if("time"===i){const t=Date.now();o=[t-864e5,t]}else o=[0,1];return s[0]!==1/0&&s[1]!==-1/0||(s=[0,1]),{xDomain:o,yDomain:s}}(a,l,e.xScaleType)),this.scales=function(t){const{config:e,layout:i,xDomain:o,yDomain:s}=t,n="streaming"===e.runtimeMode,r=Math.max(0,Math.min(e.scalePadding||0,Math.min(i.width,i.height)/2-1));if(n){if("x"==("up"===(a=e.arrowOfTime)||"down"===a?"y":"x")){const t="right"===e.arrowOfTime?[r,i.width-r]:[i.width-r,r];return{x:ze().domain(o).range(t),y:$e(e.yScaleType,s,[i.height-r,r])}}const t="down"===e.arrowOfTime?[r,i.height-r]:[i.height-r,r];return{x:$e(e.yScaleType,s,[r,i.width-r]),y:ze().domain(o).range(t)}}var a;return{x:$e(e.xScaleType,o,[r,i.width-r]),y:$e(e.yScaleType,s,[i.height-r,r])}}({config:e,layout:t,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const g=this.buildSceneNodes(t,n);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=s):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=g,this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:t.width,height:t.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(t){const e=t.width/this.lastLayout.width,i=t.height/this.lastLayout.height;for(const t of this.scene)switch(t.type){case"line":for(const o of t.path)o[0]*=e,o[1]*=i;break;case"area":for(const o of t.topPath)o[0]*=e,o[1]*=i;for(const o of t.bottomPath)o[0]*=e,o[1]*=i;t.clipRect&&(t.clipRect={x:t.clipRect.x*e,y:t.clipRect.y*i,width:t.clipRect.width*e,height:t.clipRect.height*i});break;case"point":case"glyph":t.x*=e,t.y*=i;break;case"rect":case"heatcell":t.x*=e,t.y*=i,t.w*=e,t.h*=i;break;case"candlestick":t.x*=e,t.openY*=i,t.closeY*=i,t.highY*=i,t.lowY*=i}const o=this.scales.x.domain(),s=this.scales.y.domain(),n=this.scales.x.range(),r=this.scales.y.range(),a=$e,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(t.width,t.height)/2-1)),c=r[1]>r[0];this.scales={x:a(this.config.xScaleType,o,n[0]>n[1]?[t.width-l,l]:[l,t.width-l]),y:a(this.config.yScaleType,s,c?[l,t.height-l]:[t.height-l,l])},this.lastLayout={width:t.width,height:t.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(t,e){const{config:i,scales:o}=this;if(!o)return[];if(i.customLayout){const s={data:e,scales:o,dimensions:{width:t.width,height:t.height,margin:i.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:i.themeSemantic??{},categorical:i.themeCategorical??kt},resolveColor:(t,e)=>{const o=this.resolveGroupColor(t);if(o)return o;const s=this.resolveLineStyle(t,e);return s.stroke?s.stroke:"string"==typeof s.fill?s.fill:i.themeSemantic?.primary??"#4e79a7"},config:i.layoutConfig??{},selection:i.layoutSelection??null};let n;try{n=i.customLayout(s)}catch(t){const e=null!==this.lastCustomLayoutResult,o=J("xy",t,e,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",t);try{i.onLayoutError?.(o)}catch(t){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",t)}return e?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;const r=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const t of r)t.style&&this._baseStyles.set(t,t.style);this.applyCustomRestyle(r,i.layoutSelection??null)}return dt({label:"customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===e.length)return[];const s={scales:o,config:i,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(t,e)=>this.resolveLineStyle(t,e),resolveAreaStyle:(t,e)=>this.resolveAreaStyle(t,e),resolveBoundsStyle:(t,e)=>this.resolveBoundsStyle(t,e),resolveColorMap:t=>this.resolveColorMap(t),resolveGroupColor:t=>this.resolveGroupColor(t),groupData:t=>this.groupData(t),barCategoryCache:this._barCategoryCache};switch(i.chartType){case"line":return function(t,e){const i=t.groupData(e),o=[],s=t.config.annotations?.filter(Re).map(t=>({value:t.value,color:t.color,thresholdType:t.thresholdType||"greater"}));if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=D(t.ribbons);if(n.length>0&&o.push(...P(t,e,n)),s.length>0)for(const e of i)o.push(...Y(t,e.data,e.key,s))}for(const e of i){const i=t.resolveLineStyle(e.key,e.data[0]),n=u(e.data,t.scales,t.getX,t.getY,i,e.key);s&&s.length>0&&(n.colorThresholds=s),t.config.curve&&"linear"!==t.config.curve&&(n.curve=t.config.curve),t.config.lineGradient&&(n.strokeGradient=t.config.lineGradient),o.push(n)}return Ye(t,i,o),o}(s,e);case"area":return function(t,e){const i=t.groupData(e),o=[];if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=D(t.ribbons);if(n.length>0&&o.push(...P(t,e,n)),s.length>0)for(const e of i)o.push(...Y(t,e.data,e.key,s))}const s=t.scales.y.domain()[0],n=t.getY0?e=>{const i=t.getY0(e);return null==i?s:i}:void 0;for(const e of i){const i=t.resolveAreaStyle(e.key,e.data[0]),r=l(e.data,t.scales,t.getX,t.getY,s,i,e.key,n),a=We(t.config.gradientFill);a&&(r.fillGradient=a),t.config.curve&&"linear"!==t.config.curve&&(r.curve=t.config.curve),t.config.lineGradient&&(r.strokeGradient=t.config.lineGradient),o.push(r)}return Ye(t,i,o),o}(s,e);case"mixed":return function(t,e){const i=t.groupData(e),o=[],s=t.config.areaGroups||new Set;if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=D(t.ribbons);if(n.length>0&&o.push(...P(t,e,n)),s.length>0)for(const e of i)o.push(...Y(t,e.data,e.key,s))}const n=t.scales.y.domain()[0],r=t.getY0?e=>{const i=t.getY0(e);return null==i?n:i}:void 0;for(const e of i)if(s.has(e.key)){const i=t.resolveAreaStyle(e.key,e.data[0]),s=l(e.data,t.scales,t.getX,t.getY,n,i,e.key,r),a=We(t.config.gradientFill);a&&(s.fillGradient=a),t.config.curve&&"linear"!==t.config.curve&&(s.curve=t.config.curve),t.config.lineGradient&&(s.strokeGradient=t.config.lineGradient),o.push(s)}else{const i=t.resolveLineStyle(e.key,e.data[0]),s=u(e.data,t.scales,t.getX,t.getY,i,e.key);t.config.curve&&"linear"!==t.config.curve&&(s.curve=t.config.curve),t.config.lineGradient&&(s.strokeGradient=t.config.lineGradient),o.push(s)}return Ye(t,i,o),o}(s,e);case"stackedarea":return function(t,e){const i=t.groupData(e),o=t.config.stackOrder??"key",s=()=>i.sort((t,e)=>e.key>t.key?-1:t.key>e.key?1:0);if("input"===o);else if("key"===o)s();else if("asc"===o||"desc"===o||"insideOut"===o){const e=new Map;for(const o of i){let i=0;for(const e of o.data){const o=t.getX(e),s=t.getY(e);Number.isFinite(o)&&Number.isFinite(s)&&(i+=s)}e.set(o.key,i)}const s=(t,e)=>e>t?-1:t>e?1:0;if("asc"===o)i.sort((t,i)=>{const o=(e.get(t.key)??0)-(e.get(i.key)??0);return 0!==o?o:s(t.key,i.key)});else if("desc"===o)i.sort((t,i)=>{const o=(e.get(i.key)??0)-(e.get(t.key)??0);return 0!==o?o:s(t.key,i.key)});else{const t=[...i].sort((t,i)=>{const o=(e.get(i.key)??0)-(e.get(t.key)??0);return 0!==o?o:s(t.key,i.key)}),o=[],n=[];let r=0,a=0;for(const i of t)a>r?(o.push(i),r+=e.get(i.key)??0):(n.push(i),a+=e.get(i.key)??0);i.length=0,i.push(...n.reverse(),...o)}}else s();const n=t.config.curve&&"linear"!==t.config.curve?t.config.curve:void 0,r=t.config.normalize?"zero":t.config.baseline??"zero",{nodes:a,stackedTops:l}=f(i,t.scales,t.getX,t.getY,(e,i)=>t.resolveAreaStyle(e,i),t.config.normalize,n,r),c=a;if(t.config.pointStyle){const e=new WeakMap;for(const o of i){const i=l.get(o.key);if(i)for(const s of o.data){const o=t.getX(s),n=t.getY(s);null==o||Number.isNaN(o)||null==n||Number.isNaN(n)||!i.has(o)||e.set(s,i.get(o))}}const o=i=>e.get(i)??t.getY(i);Ye(t,i,c,o)}return c}(s,e);case"scatter":case"bubble":return function(t,e){const i=[],o="bubble"===t.config.chartType?10:5,s=t.config.sizeRange||[3,15];let n=null;if(t.getSize&&!t.config.pointStyle){const i=e.map(e=>t.getSize(e)).filter(t=>null!=t&&!Number.isNaN(t));if(i.length>0){let t=1/0,e=-1/0;for(const o of i)t>o&&(t=o),o>e&&(e=o);n=i=>t===e?(s[0]+s[1])/2:s[0]+(i-t)/(e-t)*(s[1]-s[0])}}const r=t.getColor?t.resolveColorMap(e):null,a=t.config.themeSemantic?.primary||"#4e79a7",l=t.getSymbol,c=t.config.symbolMap,h=new Map;let u=0;const d=t=>{const e=c?.[t];if(e)return e;let i=h.get(t);return i||(i=wt[u%wt.length],u++,h.set(t,i)),i};for(const s of e){let e=t.config.pointStyle?t.config.pointStyle(s):{fill:a,opacity:.8},c=e.r||o;if(n&&t.getSize){const e=t.getSize(s);null==e||Number.isNaN(e)||(c=n(e))}if(r&&t.getColor&&!e.fill){const i=t.getColor(s);i&&r.has(i)&&(e={...e,fill:r.get(i)})}const h=t.getPointId?t.getPointId(s)+"":void 0;if(l){const o=d(l(s)+""),n=p(s,t.scales,t.getX,t.getY,Math.PI*c*c,o,e,h);n&&i.push(n)}else{const o=g(s,t.scales,t.getX,t.getY,c,e,h);o&&i.push(o)}}return i}(s,e);case"heatmap":return function(t,e,i){if(t.config.heatmapAggregation)return function(t,e,i){const o=Math.max(1,Math.floor(t.config.heatmapXBins??20)),s=Math.max(1,Math.floor(t.config.heatmapYBins??20)),n=t.config.heatmapAggregation??"count",r=x(t.config.valueAccessor,"value");if(!t.scales||0===e.length)return[];const[a,l]=t.scales.x.domain(),[c,u]=t.scales.y.domain(),g=(l-a||1)/o,d=(u-c||1)/s,f=o*s;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let i=0;e.length>i;i++){const n=e[i],l=t.getX(n),h=t.getY(n);if(!isFinite(l)||!isFinite(h))continue;const u=Math.min(Math.floor((l-a)/g),o-1),f=Math.min(Math.floor((h-c)/d),s-1);if(0>u||0>f)continue;const m=f*o+u;p[m]++;const x=r(n);y[m]+=isFinite(x)?x:0}let m=1/0,v=-1/0;for(let t=0;f>t;t++){if(0===p[t])continue;let e;switch(n){case"sum":e=y[t];break;case"mean":e=y[t]/p[t];break;default:e=p[t]}m>e&&(m=e),e>v&&(v=e)}if(!isFinite(m))return[];const b=v-m||1,k=i.width/o,w=i.height/s,A=t.config.showValues,_=t.config.heatmapValueFormat,C=[];for(let e=0;s>e;e++){const i=e*o;for(let r=0;o>r;r++){const o=i+r;if(0===p[o])continue;let l;switch(n){case"sum":l=y[o];break;case"mean":l=y[o]/p[o];break;default:l=p[o]}const u=(l-m)/b,f={xi:r,yi:e,value:l,count:p[o],sum:y[o],xCenter:a+(r+.5)*g,yCenter:c+(e+.5)*d,agg:n};C.push(Oe(h(r*k,(s-1-e)*w,k,w,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,A?{value:l,showValues:!0,valueFormat:_}:void 0),f,t))}}return C}(t,e,i);if(0===e.length)return[];const o=x(t.config.valueAccessor,"value"),s=k(t.config.xAccessor,"x"),n=k(t.config.yAccessor,"y"),r=new Map,a=new Map,l=Array(e.length),c=Array(e.length);for(let t=0;e.length>t;t++){const i=e[t],o=s(i),h=n(i);l[t]=o,c[t]=h,r.has(o)||r.set(o,r.size),a.has(h)||a.set(h,a.size)}const u=r.size,g=a.size;if(0===u||0===g)return[];const d=Array.from(r.keys()),f=Array.from(a.keys()),p=d.every(t=>"number"==typeof t&&!isNaN(t)),y=f.every(t=>"number"==typeof t&&!isNaN(t));if(p){d.sort((t,e)=>Number(t)-Number(e)),r.clear();for(let t=0;d.length>t;t++)r.set(d[t],t)}if(y){f.sort((t,e)=>Number(t)-Number(e)),a.clear();for(let t=0;f.length>t;t++)a.set(f[t],t)}const m=new Float64Array(e.length),v=new Float64Array(e.length),b=Array(e.length),w=new Map;let A=0;for(let t=0;e.length>t;t++){const i=e[t],s=r.get(l[t]),n=a.get(c[t]);if(void 0===s||void 0===n)continue;const h=o(i),g=n*u+s,d=w.get(g);let f;void 0!==d?f=d:(f=A++,w.set(g,f)),m[f]=g,v[f]=h,b[f]=i}let _=1/0,C=-1/0;for(let t=0;A>t;t++){const e=v[t];isFinite(e)&&(_>e&&(_=e),e>C&&(C=e))}if(!isFinite(_)||!isFinite(C))return[];const S=function(t){const e=t in bt?t:"blues";let i=Ne.get(e);if(i)return i;i=Array(256);const o=It(e);for(let t=0;256>t;t++)i[t]=o(t/255);return Ne.set(e,i),i}("string"==typeof t.config.colorScheme?t.config.colorScheme:t.config.themeSequential||"blues"),M=255/(C-_||1),P=i.width/u,Y=i.height/g,R=t.config.showValues,T=t.config.heatmapValueFormat,W=[];for(let e=0;A>e;e++){const i=v[e];if(!isFinite(i))continue;const o=m[e],s=o%u,n=b[e];W.push(Oe(h(s*P,(g-1-(o-s)/u)*Y,P,Y,S[Math.min((i-_)*M+.5|0,255)],n,R?{value:i,showValues:!0,valueFormat:T}:void 0),n,t))}return W}(s,e,t);case"bar":{const t=function(t,e){if(!t.config.binSize)return{nodes:[],binBoundaries:[]};const i=De(e,t.getX,t.getY,t.config.binSize,t.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let o=null;if(t.getCategory){const e=new Set;for(const t of i.values())for(const i of t.categories.keys())e.add(i);const s=t.config.barColors?Object.keys(t.config.barColors):[],n=new Set(s),r=Array.from(e).filter(t=>!n.has(t)).sort(),a=s.filter(t=>e.has(t)),l=a.join("\0")+""+r.join("\0");t.barCategoryCache&&t.barCategoryCache.key===l?o=t.barCategoryCache.order:(o=[...a,...r],t.barCategoryCache={key:l,order:o})}const s=[],n=t.scales,[r,a]=n.x.domain(),l=t.config.barStyle,c=t.config.themeSemantic?.primary,h=l?.gap,u="number"!=typeof h||0>h?1:h,g={};l?.stroke&&(g.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(g.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(g.opacity=l.opacity);for(const e of i.values()){const i=Math.max(e.start,r),h=Math.min(e.end,a);if(i>=h)continue;const f=n.x(i),p=n.x(h),y=Math.abs(p-f),m=y>u+1?u:0,x=Math.min(f,p)+m/2,v=Math.max(y-m,1);if(v>0)if(o&&e.categories.size>0){let i=0;for(const r of o){const o=e.categories.get(r)||0;if(0===o)continue;const a=n.y(i),h=n.y(i+o);s.push(d(x,Math.min(a,h),v,Math.abs(a-h),{fill:t.config.barColors?.[r]||l?.fill||c||"#4e79a7",...g},{binStart:e.start,binEnd:e.end,total:e.total,category:r,categoryValue:o},r)),i+=o}}else{const t=n.y(0),i=n.y(e.total);s.push(d(x,Math.min(t,i),v,Math.abs(t-i),{fill:l?.fill||c||"#007bff",...g},{binStart:e.start,binEnd:e.end,total:e.total}))}}const f=new Set;for(const t of i.values())f.add(t.start),f.add(t.end);return{nodes:s,binBoundaries:Array.from(f).sort((t,e)=>t-e)}}(s,e);return this._barCategoryCache=s.barCategoryCache??null,this._binBoundaries=t.binBoundaries,t.nodes}case"swarm":return function(t,e){const i=[],o=t.config.swarmStyle||{},s=o.radius??3,n=o.fill??t.config.themeSemantic?.primary??"#007bff",r=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of e){const e=t.getX(o),c=t.getY(o);if(null==c||Number.isNaN(c))continue;const h=t.scales.x(e),u=t.scales.y(c);let g=n;if(t.getCategory){const e=t.getCategory(o);g=t.config.barColors?.[e]||g}const{r:d,...f}=t.config.pointStyle?.(o)??{},p={type:"point",x:h,y:u,r:d??s,style:{fill:g,opacity:r,stroke:a,strokeWidth:l,...f},datum:o};t.getPointId&&(p.pointId=t.getPointId(o)+""),i.push(p)}return i}(s,e);case"waterfall":return function(t,e,i){const o=[],s=t.scales,n=t.config.waterfallStyle,r=e.filter(e=>{const i=t.getY(e),o=t.getX(e);return null!=i&&!Number.isNaN(i)&&null!=o&&isFinite(o)});if(0===r.length)return o;const a=n?.positiveColor??t.config.themeSemantic?.success??"#28a745",l=n?.negativeColor??t.config.themeSemantic?.danger??"#dc3545",c=n?.gap??1,h=n?.stroke,u=n?.strokeWidth,g=n?.opacity;let f=0;for(let e=0;r.length>e;e++){const p=r[e],y=t.getX(p),m=t.getY(p),x=f+m;let v;v=r.length-1>e?t.getX(r[e+1])-y:e>0?y-t.getX(r[e-1]):0;const b=s.x(y),k=0!==v?s.x(y+v):b+i.width/10,w=Math.min(b,k)+c/2,A=Math.max(b,k)-c/2-w;if(0>=A){f=x;continue}const _=s.y(f),C=s.y(x),S=Math.min(_,C),M=Math.abs(_-C),P={fill:0>m?l:a,stroke:h,strokeWidth:u};null!=g&&(P.opacity=g),o.push(d(w,S,A,M,P,{...p,baseline:f,cumEnd:x,delta:m,_connectorStroke:n?.connectorStroke,_connectorWidth:n?.connectorWidth})),f=x}return o}(s,e,t);case"candlestick":return function(t,e,i){if(!t.getHigh||!t.getLow||!t.scales)return[];const o=t.config.candlestickRangeMode??!1;if(!(o||t.getOpen&&t.getClose))return[];const s=[],n=t.config.candlestickStyle||{},r=n.rangeColor||"#6366f1",a=o?r:n.upColor||"#28a745",l=o?r:n.downColor||"#dc3545",c=o?r:n.wickColor||"#333",h=n.wickWidth||(o?2:1),u=e.map(e=>t.getX(e)).filter(t=>null!=t&&!Number.isNaN(t)).sort((t,e)=>t-e);let g=n.bodyWidth??0;if(null==n.bodyWidth)if(u.length>1){let e=1/0;for(let i=1;u.length>i;i++){const o=Math.abs(t.scales.x(u[i])-t.scales.x(u[i-1]));o>0&&e>o&&(e=o)}g=e!==1/0?Math.max(2,Math.min(.6*e,20)):6}else g=6;for(const n of e){const e=t.getX(n);if(null==e||Number.isNaN(e))continue;const r=t.getHigh(n),u=t.getLow(n);if(null==r||Number.isNaN(r)||null==u||Number.isNaN(u))continue;const d=o?r:t.getOpen(n),f=o?u:t.getClose(n);if(!o&&[d,f].some(t=>null==t||Number.isNaN(t)))continue;const p=f>=d,y={type:"candlestick",x:t.scales.x(e),openY:t.scales.y(d),closeY:t.scales.y(f),highY:t.scales.y(r),lowY:t.scales.y(u),bodyWidth:g,upColor:a,downColor:l,wickColor:c,wickWidth:h,isUp:p,datum:n};o&&(y.isRange=!0,y.dotRadius=Math.max(2,Math.min(g/2,.12*i.height))),s.push(y)}return s}(s,e,t);default:return[]}}resolveBoundsStyle(t,e){return function(t,e,i,o){const s=t.boundsStyle;return"function"==typeof s?s(i||{},e):s&&"object"==typeof s?s:{fill:o(e,i).stroke||t.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,t,e,(t,e)=>this.resolveLineStyle(t,e))}computeDecayOpacity(t,e){const i=this.config.decay;return i&&e>1?K(i,t,e):1}getDatumIndexMap(t){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const e=q(t);return this._datumIndexCache={version:this._ingestVersion,map:e},e}applyDecay(t,e){this.config.decay&&H(this.config.decay,t,e,this.getDatumIndexMap(e))}refreshPulse(t){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),t)}hasActivePulsesAt(t){return!!this.config.pulse&&O(this.config.pulse,this.timestampBuffer,t)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(t,e,i,o){i.clear(),o.clear();for(let s=0;e.length>s;s++){const n=e[s],r=Pe(t,n,s);r&&("point"===n.type?i.set(r,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"glyph"===n.type?i.set(r,{x:n.x,y:n.y,r:n.size,opacity:n.style.opacity,glyph:n.glyph}):"rect"===n.type?i.set(r,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"heatcell"===n.type?i.set(r,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style?.opacity}):"candlestick"===n.type?i.set(r,{x:n.x,y:n.openY,w:n.bodyWidth,openY:n.openY,closeY:n.closeY,highY:n.highY,lowY:n.lowY,opacity:n.style?.opacity}):"line"===n.type?o.set(r,{path:n.path.map(t=>[t[0],t[1]]),opacity:n.style?.opacity}):"area"===n.type&&o.set(r,{topPath:n.topPath.map(t=>[t[0],t[1]]),bottomPath:n.bottomPath.map(t=>[t[0],t[1]]),opacity:n.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const t=this.scales?.y(0)??0;for(let e=0;this.scene.length>e;e++){const i=this.scene[e],o=Pe(this.transitionContext,i,e);o&&("point"===i.type?this.prevPositionMap.set(o,{x:i.x,y:i.y,r:0,opacity:0}):"rect"===i.type?this.prevPositionMap.set(o,{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}):"heatcell"===i.type?this.prevPositionMap.set(o,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:0}):"line"===i.type?(i._introClipFraction=0,this.prevPathMap.set(o,{path:i.path.map(t=>[t[0],t[1]]),opacity:i.style.opacity})):"area"===i.type&&(i._introClipFraction=0,this.prevPathMap.set(o,{topPath:i.topPath.map(t=>[t[0],t[1]]),bottomPath:i.bottomPath.map(t=>[t[0],t[1]]),opacity:i.style.opacity})))}}startTransition(){if(!this.config.transition)return;const t=function(t,e,i,o,s,n=Vt()){if(0===o.size&&0===s.size)return i;const r=e.duration??300;if(i.exitNodes.length>0){const t=new Set(i.exitNodes);i.scene=i.scene.filter(e=>!t.has(e)),i.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let e=0;i.scene.length>e;e++){const n=i.scene[e],r=Pe(t,n,e);if(!r)continue;if(n._transitionKey=r,"line"===n.type||"area"===n.type){const t=s.get(r);if(t){if(c.add(r),"line"===n.type&&t.path&&t.path.length===n.path.length){n._targetPath=n.path.map(t=>[t[0],t[1]]),n._prevPath=t.path;for(let e=0;n.path.length>e;e++)n.path[e]=[t.path[e][0],t.path[e][1]];a=!0}else if("area"===n.type&&t.topPath&&t.bottomPath&&t.topPath.length===n.topPath.length&&t.bottomPath.length===n.bottomPath.length){n._targetTopPath=n.topPath.map(t=>[t[0],t[1]]),n._targetBottomPath=n.bottomPath.map(t=>[t[0],t[1]]),n._prevTopPath=t.topPath,n._prevBottomPath=t.bottomPath;for(let e=0;n.topPath.length>e;e++)n.topPath[e]=[t.topPath[e][0],t.topPath[e][1]];for(let e=0;n.bottomPath.length>e;e++)n.bottomPath[e]=[t.bottomPath[e][0],t.bottomPath[e][1]];a=!0}n._targetOpacity=n.style.opacity??1,n._startOpacity=t.opacity??n.style.opacity??1}else n._targetOpacity=n.style.opacity??1,n._startOpacity=0,n.style={...n.style,opacity:0},a=!0;continue}const h=o.get(r);if("point"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,r:n.r};n._targetOpacity=n.style.opacity??1,h.x===t.x&&h.y===t.y&&h.r===t.r||(n._targetX=t.x,n._targetY=t.y,n._targetR=t.r,n.x=h.x,n.y=h.y,n.r=h.r??n.r,a=!0)}else n._targetOpacity=n.style.opacity??1,n.style={...n.style,opacity:0},a=!0;else if("glyph"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,size:n.size};n._targetOpacity=n.style.opacity??1,h.x===t.x&&h.y===t.y&&h.r===t.size||(n._targetX=t.x,n._targetY=t.y,n._targetR=t.size,n.x=h.x,n.y=h.y,n.size=h.r??n.size,a=!0)}else n._targetOpacity=n.style.opacity??1,n.style={...n.style,opacity:0},a=!0;else if("rect"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,w:n.w,h:n.h};n._targetOpacity=n.style.opacity??1,h.x===t.x&&h.y===t.y&&h.w===t.w&&h.h===t.h||(n._targetX=t.x,n._targetY=t.y,n._targetW=t.w,n._targetH=t.h,n.x=h.x,n.y=h.y,n.w=h.w??n.w,n.h=h.h??n.h,a=!0)}else n._targetOpacity=n.style.opacity??1,n.style={...n.style,opacity:0},a=!0;else if("heatcell"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,w:n.w,h:n.h};n._targetOpacity=n.style?.opacity??1,h.x===t.x&&h.y===t.y&&h.w===t.w&&h.h===t.h||(n._targetX=t.x,n._targetY=t.y,n._targetW=t.w,n._targetH=t.h,n.x=h.x,n.y=h.y,n.w=h.w??n.w,n.h=h.h??n.h,a=!0)}else n._targetOpacity=n.style?.opacity??1,n.style={...n.style||{},opacity:0},a=!0;else if("candlestick"===n.type)if(h&&null!=h.openY){l.add(r);const t={x:n.x,openY:n.openY,closeY:n.closeY,highY:n.highY,lowY:n.lowY};n._targetOpacity=n.style?.opacity??1,(h.x!==t.x||h.openY!==t.openY||h.closeY!==t.closeY||h.highY!==t.highY||h.lowY!==t.lowY)&&(n._targetX=t.x,n._targetOpenY=t.openY,n._targetCloseY=t.closeY,n._targetHighY=t.highY,n._targetLowY=t.lowY,n.x=h.x,n.openY=h.openY,n.closeY=h.closeY??n.closeY,n.highY=h.highY??n.highY,n.lowY=h.lowY??n.lowY,a=!0)}else n._targetOpacity=n.style?.opacity??1,n.style={...n.style||{},opacity:0},a=!0}for(const[t,e]of s)if(!c.has(t))if(t.startsWith("l:")&&e.path){const o={type:"line",path:e.path.map(t=>[t[0],t[1]]),group:t.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t,datum:null};i.exitNodes.push(o),a=!0}else if(t.startsWith("a:")&&e.topPath&&e.bottomPath){const o={type:"area",topPath:e.topPath.map(t=>[t[0],t[1]]),bottomPath:e.bottomPath.map(t=>[t[0],t[1]]),group:t.slice(2),style:{fill:"#999",opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t,datum:null};i.exitNodes.push(o),a=!0}for(const[t,e]of o)if(!l.has(t)){if(t.startsWith("p:"))i.exitNodes.push({type:"point",x:e.x,y:e.y,r:e.r??3,style:{opacity:e.opacity??1},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("g:")&&e.glyph)i.exitNodes.push({type:"glyph",x:e.x,y:e.y,size:e.r??12,glyph:e.glyph,color:"#999",accent:"#999",style:{opacity:e.opacity??1},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("r:"))i.exitNodes.push({type:"rect",x:e.x,y:e.y,w:e.w??0,h:e.h??0,style:{opacity:e.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("h:"))i.exitNodes.push({type:"heatcell",x:e.x,y:e.y,w:e.w??0,h:e.h??0,fill:"#999",datum:null,style:{opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t});else if(t.startsWith("c:")){const o=e.openY??e.y;i.exitNodes.push({type:"candlestick",x:e.x,openY:o,closeY:e.closeY??o,highY:e.highY??o,lowY:e.lowY??o,bodyWidth:e.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t})}a=!0}return i.exitNodes.length>0&&(i.scene=[...i.scene,...i.exitNodes]),a&&(i.activeTransition={startTime:n,duration:r}),i}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition}advanceTransition(t){if(!this.activeTransition||!this.config.transition)return!1;const e={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},i=function(t,e,i,o){if(!i.activeTransition)return!1;const s=Ot(t,i.activeTransition),n=Nt(s,"linear"===e.easing?"linear":"ease-out-cubic");for(const t of i.scene){const e=t._transitionKey;if("point"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=Gt(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Gt(i.x,t._targetX,n),t.y=Gt(i.y,t._targetY,n),void 0!==t._targetR&&void 0!==i.r&&(t.r=Gt(i.r,t._targetR,n))}else if("glyph"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=Gt(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Gt(i.x,t._targetX,n),t.y=Gt(i.y,t._targetY,n),void 0!==t._targetR&&void 0!==i.r&&(t.size=Gt(i.r,t._targetR,n))}else if("rect"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=Gt(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Gt(i.x,t._targetX,n),t.y=Gt(i.y,t._targetY,n),void 0!==i.w&&(t.w=Gt(i.w,t._targetW,n)),void 0!==i.h&&(t.h=Gt(i.h,t._targetH,n))}else if("heatcell"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style={...t.style||{},opacity:Gt(i?i.opacity??1:0,t._targetOpacity,n)}}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Gt(i.x,t._targetX,n),t.y=Gt(i.y,t._targetY,n),void 0!==i.w&&(t.w=Gt(i.w,t._targetW,n)),void 0!==i.h&&(t.h=Gt(i.h,t._targetH,n))}else if("candlestick"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style={...t.style||{},opacity:Gt(i?i.opacity??1:0,t._targetOpacity,n)}}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Gt(i.x,t._targetX,n),void 0!==i.openY&&(t.openY=Gt(i.openY,t._targetOpenY,n)),void 0!==i.closeY&&(t.closeY=Gt(i.closeY,t._targetCloseY,n)),void 0!==i.highY&&(t.highY=Gt(i.highY,t._targetHighY,n)),void 0!==i.lowY&&(t.lowY=Gt(i.lowY,t._targetLowY,n))}else if("line"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:Gt(t._startOpacity??0,t._targetOpacity,n)}),void 0!==t._introClipFraction&&(t._introClipFraction=n);const e=t._prevPath,i=t._targetPath;if(e&&i&&e.length===t.path.length)for(let o=0;t.path.length>o;o++)t.path[o][0]=Gt(e[o][0],i[o][0],n),t.path[o][1]=Gt(e[o][1],i[o][1],n)}else if("area"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:Gt(t._startOpacity??0,t._targetOpacity,n)}),void 0!==t._introClipFraction&&(t._introClipFraction=n);const e=t._prevTopPath,i=t._prevBottomPath,o=t._targetTopPath,s=t._targetBottomPath;if(e&&o&&e.length===t.topPath.length)for(let i=0;t.topPath.length>i;i++)t.topPath[i][0]=Gt(e[i][0],o[i][0],n),t.topPath[i][1]=Gt(e[i][1],o[i][1],n);if(i&&s&&i.length===t.bottomPath.length)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e][0]=Gt(i[e][0],s[e][0],n),t.bottomPath[e][1]=Gt(i[e][1],s[e][1],n)}}if(s>=1){for(const t of i.scene){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style="line"===t.type||"area"===t.type?{...t.style,opacity:0===e?0:e}:{...t.style||{},opacity:0===e?0:e},t._targetOpacity=void 0}if("point"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("glyph"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.size=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("rect"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("heatcell"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("candlestick"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,void 0!==t._targetOpenY&&(t.openY=t._targetOpenY),void 0!==t._targetCloseY&&(t.closeY=t._targetCloseY),void 0!==t._targetHighY&&(t.highY=t._targetHighY),void 0!==t._targetLowY&&(t.lowY=t._targetLowY),t._targetX=void 0,t._targetOpenY=void 0,t._targetCloseY=void 0,t._targetHighY=void 0,t._targetLowY=void 0}else if("line"===t.type){const e=t._targetPath;if(e)for(let i=0;t.path.length>i;i++)t.path[i]=e[i];t._prevPath=void 0,t._targetPath=void 0,t._introClipFraction=void 0}else if("area"===t.type){const e=t._targetTopPath,i=t._targetBottomPath;if(e)for(let i=0;t.topPath.length>i;i++)t.topPath[i]=e[i];if(i)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=i[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0,t._introClipFraction=void 0}}if(i.exitNodes.length>0){const t=new Set(i.exitNodes);i.scene=i.scene.filter(e=>!t.has(e)),i.exitNodes=[]}return i.activeTransition=null,!1}return!0}(t,this.config.transition,e,this.prevPositionMap);return this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition,i}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const t of this.scene)"line"!==t.type&&"area"!==t.type||(t._introClipFraction=void 0)}groupData(t){const{result:e,cache:i}=function(t,e,i,o){if(o&&o.version===i&&o.group===e&&o.data===t)return{result:o.result,cache:o};let s;if(e){const i=new Map;for(const o of t){const t=e(o);i.has(t)||i.set(t,[]),i.get(t).push(o)}s=Array.from(i.entries()).map(([t,e])=>({key:t,data:e}))}else s=[{key:"_default",data:t}];return{result:s,cache:{version:i,group:e,data:t,result:s}}}(t,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=i,e}resolveColorMap(t){const{map:e,cache:i}=function(t,e,i,o,s){if(s&&s.version===o)return{map:s.map,cache:s};const n=new Set;if(e)for(const i of t){const t=e(i);t&&n.add(t)}const r=Array.from(n).sort(),a=r.join("\0");if(s&&s.key===a){const t={...s,version:o};return{map:t.map,cache:t}}const l=Array.isArray(i.colorScheme)?i.colorScheme:i.themeCategorical||kt,c=new Map;for(let t=0;r.length>t;t++)c.set(r[t],l[t%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(t,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=i,e}resolveLineStyle(t,e){return function(t,e,i,o){const s=t.lineStyle;if("function"==typeof s){const t=s(i||{},e);if(t&&!t.stroke&&e){const i=o(e);if(i)return{...t,stroke:i}}return t}const n=t.themeSemantic?.primary;return s&&"object"==typeof s?{stroke:s.stroke||n||"#007bff",strokeWidth:s.strokeWidth||2,strokeDasharray:s.strokeDasharray,fill:s.fill,fillOpacity:s.fillOpacity,opacity:s.opacity}:{stroke:o(e)||n||"#007bff",strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveAreaStyle(t,e){return function(t,e,i,o){if(t.areaStyle){const s=t.areaStyle(i||{});if(s&&!s.fill&&e){const t=o(e);if(t)return{...s,fill:t,stroke:s.stroke||t}}return s}const s=t.lineStyle;if("function"==typeof s){const t=s(i||{},e);if(t&&!t.fill&&e){const i=o(e);if(i)return{...t,fill:i,stroke:t.stroke||i}}return t}const n=t.themeSemantic?.primary;if(s&&"object"==typeof s)return{fill:s.fill||s.stroke||n||"#4e79a7",fillOpacity:s.fillOpacity??.7,stroke:s.stroke||n||"#4e79a7",strokeWidth:s.strokeWidth||2};const r=o(e)||n||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveGroupColor(t){const{color:e,groupColorCounter:o}=function(t){const{group:e,colorMapCache:i,groupColorMap:o,groupColorMapCap:s,config:n}=t;let{groupColorCounter:r}=t;if(i){const t=i.map.get(e);if(t)return{color:t,groupColorCounter:r}}const a=o.get(e);if(a)return{color:a,groupColorCounter:r};const l=(Array.isArray(n.colorScheme)&&n.colorScheme.length>0?n.colorScheme:null)||(Array.isArray(n.themeCategorical)&&n.themeCategorical.length>0?n.themeCategorical:null)||kt;if(0===l.length)return{color:null,groupColorCounter:r};const c=l[r%l.length];if(r++,o.set(e,c),o.size>s){const t=o.keys().next().value;void 0!==t&&o.delete(t)}return{color:c,groupColorCounter:r}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:i.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,e}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(t){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const e=C(t),i=this.getPointId,o=t=>e.has(i(t));R(this.buffer,this.timestampBuffer,o);const s=this.buffer.remove(o);if(0===s.length)return this.updateResults.recordNoop("remove"),s;for(const t of s)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",s.length),s}update(t,e){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const i=C(t),o=this.getPointId,s=new Set;this.buffer.forEach((t,e)=>{i.has(o(t))&&s.add(e)});const n=this.buffer.update(t=>i.has(o(t)),e);if(0===n.length)return this.updateResults.recordNoop("update"),n;for(const t of n)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.buffer.forEach((t,e)=>{s.has(e)&&(this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",n.length),n}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(t,e){const i=this._customRestyle;if(i)for(const o of t){const t=this._baseStyles.get(o)??o.style??{},s=i(o,e);o.style=s?{...t,...s}:t}}restyleScene(t){this._customRestyle?(this.applyCustomRestyle(this.scene,t),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(t){const e={...this.config},i=Object.keys(t).filter(i=>t[i]!==e[i]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in t&&t.windowSize!==e.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${e.windowSize} → ${t.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in t||"themeCategorical"in t||"colorAccessor"in t)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in t||"colorScheme"in t)&&(this._barCategoryCache=null),("normalize"in t||"extentPadding"in t||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t||"boundsAccessor"in t||"band"in t||"y0Accessor"in t||"openAccessor"in t||"highAccessor"in t||"lowAccessor"in t||"closeAccessor"in t||"groupAccessor"in t||"categoryAccessor"in t||"chartType"in t||"runtimeMode"in t)&&(this._stackExtentCache=null);let o=!1,s=!1;Object.assign(this.config,t),"pulse"in t&&this.syncPulseTimestampBuffer();const n="chartType"in t&&t.chartType!==e.chartType||"runtimeMode"in t&&t.runtimeMode!==e.runtimeMode;if(n||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t){const t=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,i=t&&this.config.valueAccessor||this.config.yAccessor,a=t&&e.valueAccessor||e.yAccessor,l=n||!r(t&&this.config.timeAccessor||this.config.xAccessor,t&&e.timeAccessor||e.xAccessor),c=n||!r(i,a);(l||c)&&(t?(this.getX=x(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=x(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=x(this.config.xAccessor,"x"),this.getY=x(this.config.yAccessor,"y")),c&&this.resolvedRibbons.some(t=>"bounds"===t.kind)&&(this.resolvedRibbons=Le(this.config)),o=!0,s=!0)}if("groupAccessor"in t&&!r(t.groupAccessor,e.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?w(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in t&&!r(t.categoryAccessor,e.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?w(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in t&&!r(t.sizeAccessor,e.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?x(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in t&&!r(t.symbolAccessor,e.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?w(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in t&&!r(t.colorAccessor,e.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?w(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in t&&!r(t.y0Accessor,e.y0Accessor)&&(this.getY0=this.config.y0Accessor?x(this.config.y0Accessor,"y0"):void 0,o=!0,s=!0),("boundsAccessor"in t&&!r(t.boundsAccessor,e.boundsAccessor)||"band"in t&&t.band!==e.band||"boundsStyle"in t&&t.boundsStyle!==e.boundsStyle)&&(this.resolvedRibbons=Le(this.config),o=!0,s=!0),"pointIdAccessor"in t&&!r(t.pointIdAccessor,e.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?w(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(n||"openAccessor"in t&&!r(t.openAccessor,e.openAccessor)||"closeAccessor"in t&&!r(t.closeAccessor,e.closeAccessor)||"highAccessor"in t&&!r(t.highAccessor,e.highAccessor)||"lowAccessor"in t&&!r(t.lowAccessor,e.lowAccessor))){const t=null!=this.config.openAccessor,e=null!=this.config.closeAccessor;this.getOpen=t?x(this.config.openAccessor,"open"):void 0,this.getHigh=x(this.config.highAccessor,"high"),this.getLow=x(this.config.lowAccessor,"low"),this.getClose=e?x(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e,o=!0,s=!0}if("accessorRevision"in t&&t.accessorRevision!==e.accessorRevision&&(o=!0,s=!0),!o){const i=Object.keys(t).filter(t=>!t.endsWith("Accessor")&&"timeAccessor"!==t&&"valueAccessor"!==t);for(const s of i)if(t[s]!==e[s]){o=!0;break}}o&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(i)}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}};ni.GROUP_COLOR_MAP_CAP=1e3;var ri=ni;j(ri);import{line as ai}from"d3-shape";var li=new WeakMap;function ci(t,e){const i=Zt(e);if(!i)return t;const o=li.get(t);if(o)return o;const s=function(t,e,i=8){if(!e||2>t.length)return t.map(([t,e])=>[t,e]);const o=[];let s=null;const n={moveTo(t,e){s=[t,e],o.push([t,e])},lineTo(t,e){s=[t,e],o.push([t,e])},bezierCurveTo(t,e,n,r,a,l){if(!s)return s=[a,l],void o.push([a,l]);const[c,h]=s;for(let s=1;i>=s;s++){const u=s/i,g=1-u;o.push([g*g*g*c+3*g*g*u*t+3*g*u*u*n+u*u*u*a,g*g*g*h+3*g*g*u*e+3*g*u*u*r+u*u*u*l])}s=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(t,e,i,n){s=[i,n],o.push([i,n])}};return ai().x(t=>t[0]).y(t=>t[1]).curve(e).context(n)(t),o}(t,i);return li.set(t,s),s}function hi(t,e,i,o=30,s,n=0){let r=null;if(s){const t=Q(s,e,i,o,n);t&&(r={node:t.node,datum:t.node.datum,x:t.node.x,y:t.node.y,distance:t.distance})}for(const n of t){let t=null;switch(n.type){case"point":if(s)break;t=gi(n,e,i,o);break;case"symbol":t=di(n,e,i,o);break;case"glyph":t=fi(n,e,i,o);break;case"line":t=pi(n,e,i,o);break;case"rect":if(null==n.datum)break;t=mi(n,e,i);break;case"heatcell":t=xi(n,e,i);break;case"area":if(!1===n.interactive)break;t=bi(n,e,i);break;case"candlestick":t=vi(n,e,i)}t&&o>t.distance&&(r&&t.distance>=r.distance||(r=t))}return r}function ui(t,e,i){if(0===t.length)return null;if(t[0][0]>e||e>t[t.length-1][0])return null;const o=ki(t,e);if(0>o)return null;if(Math.abs(t[o][0]-e)>i)return null;let s=o,n=o;o>0&&t[o][0]>=e?(s=o-1,n=o):t.length-1>o&&(s=o,n=o+1);const[r,a]=t[s],[l,c]=t[n];return l===r?a:a+Math.max(0,Math.min(1,(e-r)/(l-r)))*(c-a)}function gi(t,e,i,o=30){const s=e-t.x,n=i-t.y,r=Math.sqrt(s*s+n*n);return r>tt(t.r,o)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:r}}function di(t,e,i,o=30){const s=e-t.x,n=i-t.y,r=Math.sqrt(s*s+n*n);return r>tt(te(t.size),o)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:r}}function fi(t,e,i,o=30){if(null==t.datum)return null;const s=he(t.glyph,t.size),n=t.x+s.centerDx,r=t.y+s.centerDy,a=e-n,l=i-r,c=Math.sqrt(a*a+l*l);return c>tt(s.radius,o)?null:{node:t,datum:t.datum,x:n,y:r,distance:c}}function pi(t,e,i,o=30){if(0===t.path.length)return null;const s=ki(t.path,e);if(0>s)return null;const[n,r]=t.path[s];let a;if(t.path.length>1){let o=1/0;const n=Math.max(0,s-1),r=Math.min(t.path.length-2,s);for(let s=n;r>=s;s++){const[n,r]=t.path[s],[a,l]=t.path[s+1],c=yi(e,i,n,r,a,l);o>c&&(o=c)}a=o}else{const t=e-n,o=i-r;a=Math.sqrt(t*t+o*o)}const l=t.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:t,datum:Array.isArray(t.datum)&&t.datum[s]?t.datum[s]:t.datum,x:n,y:r,distance:a}}function yi(t,e,i,o,s,n){const r=s-i,a=n-o,l=r*r+a*a;if(0===l)return Math.sqrt((t-i)**2+(e-o)**2);let c=((t-i)*r+(e-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((t-(i+c*r))**2+(e-(o+c*a))**2)}function mi(t,e,i){const o=it(e,i,t);return o.hit?{node:t,datum:t.datum,x:o.cx,y:o.cy,distance:0}:null}function xi(t,e,i){const o=it(e,i,t);return o.hit?{node:t,datum:t.datum,x:o.cx,y:o.cy,distance:0}:null}function vi(t,e,i){const o=t.bodyWidth/2,s=Math.min(t.openY,t.closeY);if(!(t.x-o-3>e||e>t.x+o+3||t.highY-3>i||i>t.lowY+3)){const o=s+Math.max(Math.max(t.openY,t.closeY)-s,1)/2,n=e-t.x,r=i-o;return{node:t,datum:t.datum,x:t.x,y:o,distance:Math.sqrt(n*n+r*r)}}return null}function bi(t,e,i){if(0===t.topPath.length)return null;const o=ki(t.topPath,e);if(0>o)return null;const[s,n]=t.topPath[o],r=e-s,a=i-n,l=Math.sqrt(r*r+a*a);return{node:t,datum:Array.isArray(t.datum)&&t.datum[o]?t.datum[o]:t.datum,x:s,y:n,distance:l}}function ki(t,e){if(0===t.length)return-1;let i=0,o=t.length-1;for(;o>i;){const s=i+o>>1;e>t[s][0]?i=s+1:o=s}return i>0&&Math.abs(t[i][0]-e)>=Math.abs(t[i-1][0]-e)?i-1:i}import{useMemo as wi,useRef as Ai,useEffect as _i}from"react";import{useMemo as Ci}from"react";import{bin as Si}from"d3-array";import{jsx as Mi,jsxs as Pi}from"react/jsx-runtime";function Yi(t){return"string"==typeof t?{type:t}:t}function Ri({orient:t,config:e,values:i,scale:o,size:s,length:n}){const r=function(t){return{type:t.type,bins:t.bins??20,fill:t.fill??"#4e79a7",fillOpacity:t.fillOpacity??.5,stroke:t.stroke??"none",strokeWidth:t.strokeWidth??1}}(e),a="top"===t||"bottom"===t,l=Ci(()=>{if(0===i.length)return null;const e=o.domain(),l=s-8;if("boxplot"===r.type){const e=function(t){const e=[...t].sort((t,e)=>t-e),i=e.length;if(0===i)return null;const o=e[Math.floor(.25*i)],s=e[Math.floor(.5*i)],n=e[Math.floor(.75*i)],r=n-o;return{q1:o,median:s,q3:n,whiskerLow:Math.max(e[0],o-1.5*r),whiskerHigh:Math.min(e[i-1],n+1.5*r)}}(i);if(!e)return null;const{q1:s,median:n,q3:c,whiskerLow:h,whiskerHigh:u}=e,g=Math.min(.5*l,20),d=(l-g)/2+4;if(a){const e=o(s),i=o(c),a=o(n),l=o(h),f=o(u),p="top"===t?-1:1,y=0;return Pi("g",{"data-testid":"marginal-boxplot-"+t,children:[Mi("line",{x1:l,y1:y+p*(d+g/2),x2:f,y2:y+p*(d+g/2),stroke:r.fill,strokeWidth:r.strokeWidth}),Mi("line",{x1:l,y1:y+p*d,x2:l,y2:y+p*(d+g),stroke:r.fill,strokeWidth:r.strokeWidth}),Mi("line",{x1:f,y1:y+p*d,x2:f,y2:y+p*(d+g),stroke:r.fill,strokeWidth:r.strokeWidth}),Mi("rect",{x:Math.min(e,i),y:"top"===t?y-d-g:y+d,width:Math.abs(i-e),height:g,fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth}),Mi("line",{x1:a,y1:"top"===t?y-d-g:y+d,x2:a,y2:"top"===t?y-d:y+d+g,stroke:r.fill,strokeWidth:2})]})}{const e=o(s),i=o(c),a=o(n),l=o(h),f=o(u),p="left"===t?-1:1,y=0;return Pi("g",{"data-testid":"marginal-boxplot-"+t,children:[Mi("line",{x1:y+p*(d+g/2),y1:l,x2:y+p*(d+g/2),y2:f,stroke:r.fill,strokeWidth:r.strokeWidth}),Mi("line",{x1:y+p*d,y1:l,x2:y+p*(d+g),y2:l,stroke:r.fill,strokeWidth:r.strokeWidth}),Mi("line",{x1:y+p*d,y1:f,x2:y+p*(d+g),y2:f,stroke:r.fill,strokeWidth:r.strokeWidth}),Mi("rect",{x:"left"===t?y-d-g:y+d,y:Math.min(e,i),width:g,height:Math.abs(i-e),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth}),Mi("line",{x1:"left"===t?y-d-g:y+d,y1:a,x2:"left"===t?y-d:y+d+g,y2:a,stroke:r.fill,strokeWidth:2})]})}}const c=Si().domain(e).thresholds(r.bins)(i);if(0===c.length)return null;const h=le(c.map(t=>t.length));if(0===h)return null;if("histogram"===r.type)return Mi("g",{"data-testid":"marginal-histogram-"+t,children:c.map((e,i)=>{if(null==e.x0||null==e.x1)return null;const s=e.length/h*l;if(a){const n=o(e.x0),a=o(e.x1)-o(e.x0);return Mi("rect",{x:n,y:"top"===t?-4-s:4,width:Math.max(a,.5),height:s,fill:r.fill,fillOpacity:r.fillOpacity,stroke:r.stroke,strokeWidth:r.strokeWidth},i)}{const n=o(e.x0),a=o(e.x1)-o(e.x0);return Mi("rect",{x:"left"===t?-4-s:4,y:Math.min(n,n+a),width:s,height:Math.abs(a),fill:r.fill,fillOpacity:r.fillOpacity,stroke:r.stroke,strokeWidth:r.strokeWidth},i)}})});if("violin"===r.type){const e=l/2+4,i=[];for(const s of c){if(null==s.x0||null==s.x1)continue;const n=s.length/h*(l/2),r=o((s.x0+s.x1)/2);i.push(a?`${r},${"top"===t?-(e-n):e-n}`:`${"left"===t?-(e-n):e-n},${r}`)}for(let s=c.length-1;s>=0;s--){const n=c[s];if(null==n.x0||null==n.x1)continue;const r=n.length/h*(l/2),u=o((n.x0+n.x1)/2);i.push(a?`${u},${"top"===t?-(e+r):e+r}`:`${"left"===t?-(e+r):e+r},${u}`)}return Mi("g",{"data-testid":"marginal-violin-"+t,children:Mi("polygon",{points:i.join(" "),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth})})}if("ridgeline"===r.type){const e=[];if(a){const i=0,s=null!=c[0].x0?o(c[0].x0):0;e.push(`M${s},${i}`);for(const i of c){if(null==i.x0||null==i.x1)continue;const s=i.length/h*l,n=o((i.x0+i.x1)/2);e.push(`L${n},${"top"===t?-s-4:s+4}`)}const r=null!=c[c.length-1].x1?o(c[c.length-1].x1):n;e.push(`L${r},${i}`),e.push("Z")}else{const i=0,s=null!=c[0].x0?o(c[0].x0):0;e.push(`M${i},${s}`);for(const i of c){if(null==i.x0||null==i.x1)continue;const s=i.length/h*l,n=o((i.x0+i.x1)/2);e.push(`L${"left"===t?-s-4:s+4},${n}`)}const r=null!=c[c.length-1].x1?o(c[c.length-1].x1):n;e.push(`L${i},${r}`),e.push("Z")}return Mi("g",{"data-testid":"marginal-ridgeline-"+t,children:Mi("path",{d:e.join(" "),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth})})}return null},[i,o,r,s,n,t,a,4]);return l?Mi("g",{className:"marginal-"+t,"data-testid":"marginal-"+t,children:l}):null}function Ti(t,e,i){if("edges"===t){if(e)return"start";if(i)return"end"}return"middle"}function Wi(t,e,i){if("edges"===t){if(e)return"hanging";if(i)return"auto"}return"middle"}function Ni(t){if(0===t.length)return{min:null,max:null};let e=1/0,i=-1/0;for(const o of t)e>o.pixel&&(e=o.pixel),o.pixel>i&&(i=o.pixel);return{min:e,max:i}}function Oi(t){if(t)return"dashed"===t?"6,4":"dotted"===t?"2,4":t}function Di(t,e,i){if("left"===t||"right"===t){const o="left"===t?i:0,s="left"===t?-1:1,n=Math.ceil(e/8);let r="M0,"+o;for(let t=0;n>t;t++){const i=8*(t+1);r+=`L${Math.min(8*t+4,e)},${o+4*s}`,r+=`L${Math.min(i,e)},${o}`}return r}const o="bottom"===t?0:e,s="bottom"===t?1:-1,n=Math.ceil(i/8);let r=`M${o},0`;for(let t=0;n>t;t++){const e=8*(t+1);r+=`L${o+4*s},${Math.min(8*t+4,i)}`,r+=`L${o},${Math.min(e,i)}`}return r}import{Fragment as Ei,jsx as Li,jsxs as zi}from"react/jsx-runtime";function Bi(t){const{width:e,height:i,totalWidth:o,totalHeight:s,margin:n,scales:r,showAxes:a,axes:l,showGrid:c,xFormat:h,yFormat:u,axisExtent:g}=t,d=wi(()=>{if(!r)return[];const t=l?.find(t=>"bottom"===t.orient),i=t?.tickFormat||h||Fi,o=Math.max(2,Math.floor(e/70)),s=t?.ticks??5,n="exact"===g?Math.max(2,s):Math.min(s,o),a=t?.tickValues??_(r.x,n,g),c=a.map(t=>t.valueOf()),u=a.map((t,e)=>({value:t,pixel:r.x(t),label:i(t,e,c)})),d=u.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0);return Ii(u,Math.max(55,d+8))},[r,l,h,e,g]),f=wi(()=>{if(!r)return[];const t=l?.find(t=>"left"===t.orient),e=t?.tickFormat||u||Fi,o=Math.max(2,Math.floor(i/30)),s=t?.ticks??5,n="exact"===g?Math.max(2,s):Math.min(s,o);return Ii((t?.tickValues??_(r.y,n,g)).map(t=>({value:t,pixel:r.y(t),label:e(t)})),22)},[r,l,u,i,g]),p=c&&r,y=a&&r;if(!p&&!y)return null;const m=l?.find(t=>"bottom"===t.orient),x=l?.find(t=>"left"===t.orient),v=y&&(!m||!1!==m.baseline),b=y&&(!x||!1!==x.baseline),k=m?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return Li("svg",{width:o,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:zi("g",{transform:`translate(${n.left},${n.top})`,children:[p&&(()=>{const t=Oi(l?.find(t=>"bottom"===t.orient)?.gridStyle),o=Oi(l?.find(t=>"left"===t.orient)?.gridStyle);return zi("g",{className:"stream-grid",children:[d.map((e,o)=>Li("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+o)),f.map((t,i)=>Li("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+i))]})})(),v&&!k&&Li("line",{x1:0,y1:i,x2:e,y2:i,stroke:A,strokeWidth:1}),k&&Li("path",{d:Di("bottom",e,i),fill:"none",stroke:A,strokeWidth:1}),b&&!w&&Li("line",{x1:0,y1:0,x2:0,y2:i,stroke:A,strokeWidth:1}),w&&Li("path",{d:Di("left",e,i),fill:"none",stroke:A,strokeWidth:1})]})})}function Fi(t,e,i){return t instanceof Date?`${t.toLocaleString("en",{month:"short"})} ${t.getDate()}`:"number"==typeof t?Math.round(100*t)/100+"":t+""}function Ii(t,e){if(2>=t.length)return t;const i=[t[0]];for(let o=1;t.length-1>o;o++)e>Math.abs(t[o].pixel-i[i.length-1].pixel)||i.push(t[o]);const o=t[t.length-1];return e>Math.abs(o.pixel-i[i.length-1].pixel)?i[i.length-1]=o:i.push(o),i}function Xi(t){const{width:e,height:i,totalWidth:o,totalHeight:s,margin:n,scales:r,showAxes:a,axes:l,xLabel:c,yLabel:h,yLabelRight:u,xFormat:g,yFormat:d,axisExtent:f,showGrid:p,title:y,legend:m,legendHoverBehavior:x,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:A,foregroundGraphics:C,marginalGraphics:S,xValues:M,yValues:P,annotations:Y,onAnnotationActivate:R,onObservation:T,chartId:W,chartType:N,autoPlaceAnnotations:O,svgAnnotationRules:D,xAccessor:E,yAccessor:L,annotationData:z,pointNodes:B,curve:F,underlayRendered:I,canvasObscuresUnderlay:X=!0,linkedCrosshairName:$,linkedCrosshairSourceId:G,children:V}=t,H=ie({onAnnotationActivate:R,onObservation:T,chartId:W,chartType:N}),j=wi(()=>{if(!a||!r)return[];const t=l?.find(t=>"bottom"===t.orient),i=t?.tickFormat||g||Fi,o=Math.max(2,Math.floor(e/70)),s=t?.ticks??5,n="exact"===f?Math.max(2,s):Math.min(s,o),c=t?.tickValues??_(r.x,n,f),h=c.map(t=>t.valueOf()),u=c.map((t,e)=>({value:t,pixel:r.x(t),label:i(t,e,h)})),d=u.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0),p=t?.autoRotate?Math.max(20,Math.min(d+8,55)):Math.max(55,d+8);let y=Ii(u,p);if(y.length>1&&(y=y.filter((t,e)=>0===e||t.label+""!=y[e-1].label+"")),t?.includeMax&&y.length>0&&"exact"!==f&&!t?.tickValues){const t=r.x.domain()[1],e=r.x(t),o=y[y.length-1].pixel;if(Math.abs(e-o)>1){const s=i(t,y.length,h);p>e-o&&y.length>1&&(y=y.slice(0,-1)),y.push({value:t,pixel:e,label:s})}}return y},[a,r,l,g,e,f]),q=wi(()=>{if(!a||!r)return[];const t=l?.find(t=>"left"===t.orient),e=t?.tickFormat||d||Fi,o=Math.max(2,Math.floor(i/30)),s=t?.ticks??5,n="exact"===f?Math.max(2,s):Math.min(s,o);let c=Ii((t?.tickValues??_(r.y,n,f)).map(t=>({value:t,pixel:r.y(t),label:e(t)})),22);if(c.length>1&&(c=c.filter((t,e)=>0===e||t.label+""!=c[e-1].label+"")),t?.includeMax&&c.length>0&&"exact"!==f&&!t?.tickValues){const t=r.y.domain()[1],i=r.y(t),o=c[c.length-1].pixel;if(Math.abs(i-o)>1){const s=e(t);22>Math.abs(i-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:t,pixel:i,label:s})}}return c},[a,r,l,d,i,f]),U=wi(()=>{if(!a||!r)return[];const t=l?.find(t=>"right"===t.orient);if(!t)return[];const e=t.tickFormat||d||Fi,o=Math.max(2,Math.floor(i/30)),s=t.ticks??5;return Ii((t.tickValues??_(r.y,"exact"===f?Math.max(2,s):Math.min(s,o),f)).map(t=>({value:t,pixel:r.y(t),label:e(t)})),22)},[a,r,l,d,i,f]),K=Ai(new Map),J=Ai(Y?.length??0),Q=Y?.length??0;J.current!==Q&&(J.current=Q,K.current=new Map);const tt=wi(()=>{if(!Y||0===Y.length)return null;const t=Z(Y),o=Dt("xy",H),s={scales:r?{x:r.x,y:r.y,time:r.x,value:r.y}:null,timeAxis:"x",xAccessor:E,yAccessor:L,width:e,height:i,data:z,frameType:"xy",pointNodes:B,curve:F,stickyPositionCache:K.current},n=O?Pt({annotations:t,context:s,..."object"==typeof O?O:{}}):t;return qt(n,o,D,s)},[Y,O,D,e,i,E,L,z,r,B,F,H]),et=oe($);return _i(()=>{if(!et?.locked||!$)return;const t=t=>{"Escape"===t.key&&ee($)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[et?.locked,$]),a||y||m||C||S||tt&&tt.length>0||p||V||et?zi("svg",{role:"img",width:o,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Li("title",{children:"string"==typeof y?y:"XY Chart"}),Li("desc",{children:"string"==typeof y?y+" (XY data visualization)":"XY data visualization"}),zi("g",{transform:`translate(${n.left},${n.top})`,children:[p&&r&&(!I||X)&&(()=>{const t=Oi(l?.find(t=>"bottom"===t.orient)?.gridStyle),o=Oi(l?.find(t=>"left"===t.orient)?.gridStyle);return zi("g",{className:"stream-grid",children:[j.map((e,o)=>Li("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+o)),q.map((t,i)=>Li("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+i))]})})(),a&&r&&(()=>{const t=l?.find(t=>"left"===t.orient),o=l?.find(t=>"bottom"===t.orient),s=!t||!1!==t.baseline,r=!o||!1!==o.baseline,a=t?.jaggedBase||!1,g=o?.jaggedBase||!1,d=o?.landmarkTicks,f=t?.landmarkTicks,p="var(--semiotic-border, #ccc)",y="var(--semiotic-text-secondary, var(--semiotic-text, #666))",m="var(--semiotic-text, #333)",x=!!o?.autoRotate&&j.length>1&&(()=>{const t=e/Math.max(j.length-1,1);return j.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:60),0)+8>t})(),v=x?12:18,b=i+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},_=o?.tickAnchor,C=t?.tickAnchor,S=Ni(j),M=Ni(q);return zi("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[zi("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!I||X)&&r&&!g&&Li("line",{x1:0,y1:i,x2:e,y2:i,stroke:p,strokeWidth:1}),(!I||X)&&g&&Li("path",{d:Di("bottom",e,i),fill:"none",stroke:p,strokeWidth:1}),j.map((t,e)=>{const o=!!d&&("function"==typeof d?d(t.value,e):ot(t.value,e>0?j[e-1].value:void 0));return zi("g",{transform:`translate(${t.pixel},${i})`,children:[Li("line",{y2:5,stroke:p,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Li("text",{y:v,textAnchor:x?"end":Ti(_,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},transform:x?"rotate(-45)":void 0,children:t.label}):Li("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:Li("div",{style:{textAlign:"center",userSelect:"none",...k},children:t.label})})]},"xtick-"+e)}),c&&Li("text",{x:e/2,y:b,textAnchor:"middle",fill:m,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),zi("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!I||X)&&s&&!a&&Li("line",{x1:0,y1:0,x2:0,y2:i,stroke:p,strokeWidth:1}),(!I||X)&&a&&Li("path",{d:Di("left",e,i),fill:"none",stroke:p,strokeWidth:1}),q.map((t,e)=>{const i=!!f&&("function"==typeof f?f(t.value,e):ot(t.value,e>0?q[e-1].value:void 0));return zi("g",{transform:`translate(0,${t.pixel})`,children:[Li("line",{x2:-5,stroke:p,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Li("text",{x:-8,textAnchor:"end",dominantBaseline:Wi(C,t.pixel===M.min,t.pixel===M.max),fontWeight:i?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...i?w:k},children:t.label}):Li("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:Li("div",{style:{textAlign:"right",userSelect:"none",...k},children:t.label})})]},"ytick-"+e)}),(()=>{const e=t?.label||h;return e?Li("text",{x:15-n.left,y:i/2,textAnchor:"middle",fill:m,transform:`rotate(-90, ${15-n.left}, ${i/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:e}):null})()]}),(()=>{const t=l?.find(t=>"right"===t.orient);if(!t||0===U.length)return null;const o=!1!==t.baseline,s=t.landmarkTicks,r=t.label||u,a=t.tickAnchor,c=Ni(U);return zi("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&Li("line",{x1:e,y1:0,x2:e,y2:i,stroke:p,strokeWidth:1}),U.map((t,i)=>{const o=!!s&&("function"==typeof s?s(t.value,i):ot(t.value,i>0?U[i-1].value:void 0));return zi("g",{transform:`translate(${e},${t.pixel})`,children:[Li("line",{x2:5,stroke:p,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Li("text",{x:8,textAnchor:"start",dominantBaseline:Wi(a,t.pixel===c.min,t.pixel===c.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:t.label}):Li("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:Li("div",{style:{textAlign:"left",userSelect:"none",...k},children:t.label})})]},"ytick-r-"+i)}),r&&Li("text",{x:e+n.right-15,y:i/2,textAnchor:"middle",fill:m,transform:`rotate(90, ${e+n.right-15}, ${i/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:r})]})})()]})})(),tt,S&&r&&M&&P&&zi(Ei,{children:[S.top&&Li("g",{transform:"translate(0, 0)",children:Li(Ri,{orient:"top",config:Yi(S.top),values:M,scale:r.x,size:n.top,length:e})}),S.bottom&&Li("g",{transform:`translate(0, ${i})`,children:Li(Ri,{orient:"bottom",config:Yi(S.bottom),values:M,scale:r.x,size:n.bottom,length:e})}),S.left&&Li("g",{transform:"translate(0, 0)",children:Li(Ri,{orient:"left",config:Yi(S.left),values:P,scale:r.y,size:n.left,length:i})}),S.right&&Li("g",{transform:`translate(${e}, 0)`,children:Li(Ri,{orient:"right",config:Yi(S.right),values:P,scale:r.y,size:n.right,length:i})})]}),C,et&&et.sourceId!==G&&r?.x&&(()=>{const t=r.x(et.xValue);if(null==t||0>t||t>e)return null;const o=et.locked;return Li("line",{x1:t,y1:0,x2:t,y2:i,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),V]}),y&&"string"==typeof y?Li("text",{x:o/2,y:St,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:y}):y?Li("foreignObject",{x:0,y:0,width:o,height:n.top,children:y}):null,Ut({legend:m,totalWidth:o,totalHeight:s,margin:n,legendPosition:w,title:y,legendLayout:A,legendHoverBehavior:x,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:k})]}):null}var $i={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",primary:"#007bff",background:""};function Gi(t,e){const i=t.trim();if(/^#[0-9a-f]{3}$/i.test(i)){const t=i[1],o=i[2],s=i[3];return`#${t}${t}${o}${o}${s}${s}${e}`}if(/^#[0-9a-f]{6}$/i.test(i))return`${i}${e}`;const o=i.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(e,16)/255).toFixed(3)})`:i}var Vi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Hi=3156e7;function ji(t){const e=t[1]-t[0];return 864e5>e?t=>{const e=new Date(t);return`${(e.getUTCHours()+"").padStart(2,"0")}:${(e.getUTCMinutes()+"").padStart(2,"0")}`}:Hi>e?t=>{const e=new Date(t);return`${Vi[e.getUTCMonth()]} ${e.getUTCDate()}`}:5*Hi>e?t=>{const e=new Date(t);return`${Vi[e.getUTCMonth()]} ${e.getUTCFullYear()}`}:t=>new Date(t).getUTCFullYear()+""}function qi(t){if(!t)return;const e=[];for(const i of t)if("point"===i.type)e.push(i);else if("symbol"===i.type)e.push({pointId:i.pointId,x:i.x,y:i.y,r:te(i.size)});else if("glyph"===i.type){const t=he(i.glyph,i.size);e.push({pointId:i.pointId,x:i.x+t.centerDx,y:i.y+t.centerDy,r:t.radius})}return e}import{area as Ui,line as Ki}from"d3-shape";function Ji(t,e){const i=Zt(e.curve);if(!i||2>e.topPath.length||2>e.bottomPath.length){t.beginPath(),t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let i=1;e.topPath.length>i;i++)t.lineTo(e.topPath[i][0],e.topPath[i][1]);for(let i=e.bottomPath.length-1;i>=0;i--)t.lineTo(e.bottomPath[i][0],e.bottomPath[i][1]);t.closePath()}else{const o=Ui().x(t=>t[0]).y0((t,i)=>e.bottomPath[i][1]).y1(t=>t[1]).curve(i).context(t);t.beginPath(),o(e.topPath)}}var Zi=(t,e,i,o)=>{const s=e.filter(t=>"area"===t.type);for(const e of s){if(2>e.topPath.length)continue;let i=!1;e.clipRect&&(t.save(),t.beginPath(),t.rect(e.clipRect.x,e.clipRect.y,e.clipRect.width,e.clipRect.height),t.clip(),i=!0);const s=e._introClipFraction;void 0!==s&&1>s&&(t.save(),t.beginPath(),t.rect(0,0,o.width*s,o.height),t.clip());const n=Jt(t,e.style.fill,"#4e79a7"),r=e._decayOpacities;if(r&&r.length===e.topPath.length){const i=e.style.fillOpacity??.7;t.fillStyle=n;for(let o=0;e.topPath.length-1>o;o++)t.globalAlpha=.5*(r[o]+r[o+1])*i,t.beginPath(),t.moveTo(e.topPath[o][0],e.topPath[o][1]),t.lineTo(e.topPath[o+1][0],e.topPath[o+1][1]),t.lineTo(e.bottomPath[o+1][0],e.bottomPath[o+1][1]),t.lineTo(e.bottomPath[o][0],e.bottomPath[o][1]),t.closePath(),t.fill();if(e.style.stroke&&"none"!==e.style.stroke){t.strokeStyle=Kt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);for(let i=0;e.topPath.length-1>i;i++)t.globalAlpha=.5*(r[i]+r[i+1]),t.beginPath(),t.moveTo(e.topPath[i][0],e.topPath[i][1]),t.lineTo(e.topPath[i+1][0],e.topPath[i+1][1]),t.stroke()}t.globalAlpha=1;continue}const a=e.style.opacity??1;if(Ji(t,e),e.fillGradient&&("colorStops"in e.fillGradient&&e.fillGradient.colorStops.length>=2||"topOpacity"in e.fillGradient)&&e.fillGradient){let i=1/0;for(const t of e.topPath)i>t[1]&&(i=t[1]);let o=-1/0;for(const t of e.bottomPath)t[1]>o&&(o=t[1]);const s=Tt(t,e.fillGradient,"string"==typeof n?n:"#4e79a7",0,i,0,o);t.fillStyle=s||n,t.globalAlpha=a}else t.globalAlpha=(e.style.fillOpacity??.7)*a,t.fillStyle=n;if(t.fill(),e._pulseIntensity&&e._pulseIntensity>0&&(Ji(t,e),nt(t,e)),e.style.stroke&&"none"!==e.style.stroke){t.globalAlpha=a;const i=e.strokeGradient&&e.topPath.length>=2?Yt(t,e.strokeGradient,e.topPath[0][0],0,e.topPath[e.topPath.length-1][0],0):null;t.strokeStyle=i||Kt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);const o=Zt(e.curve);if(t.beginPath(),o)Ki().x(t=>t[0]).y(t=>t[1]).curve(o).context(t)(e.topPath);else{t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let i=1;e.topPath.length>i;i++)t.lineTo(e.topPath[i][0],e.topPath[i][1])}t.stroke()}void 0!==s&&1>s&&t.restore(),i&&t.restore(),t.globalAlpha=1}};function Qi(t){const[e,i,o]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*i+.114*o>128?"#000":"#fff"}function to(t){return Number.isInteger(t)?t+"":100>Math.abs(t)?1>Math.abs(t)?t.toPrecision(3):t.toFixed(1):t.toFixed(0)}var eo=(t,e,i,o)=>{const s=e.filter(t=>"heatcell"===t.type);t.save();try{for(const e of s){const i=e.style;null!=i?.opacity&&(t.globalAlpha=i.opacity),t.fillStyle=e.fill,t.fillRect(e.x,e.y,e.w,e.h);const o=Math.max(0,i?.strokeWidth??1);if(o>0&&(t.strokeStyle=Kt(t,i?.stroke??"var(--semiotic-surface, #fff)"),t.lineWidth=o,t.strokeRect(e.x,e.y,e.w,e.h)),rt(t,e),t.globalAlpha=1,e.showValues&&null!=e.value){if(20>e.w||20>e.h)continue;const i=e.valueFormat?e.valueFormat(e.value):to(e.value),o=Math.max(10,Math.min(16,.3*Math.min(e.w,e.h))),s=e.x+e.w/2,n=e.y+e.h/2;t.fillStyle=Qi(e.fill),t.font=o+"px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(i,s,n)}}}finally{t.restore()}},io=(t,e,i,o)=>{for(const i of e){if("candlestick"!==i.type)continue;const e=i;t.save();const s=(e._decayOpacity??1)*(e.style?.opacity??1);1!==s&&(t.globalAlpha=s);const n=Kt(t,e.wickColor)||e.wickColor,r=60>o.height,a=r?Math.max(e.wickWidth,2):e.wickWidth,l=()=>{t.beginPath(),t.moveTo(e.x,e.highY),t.lineTo(e.x,e.lowY),t.strokeStyle=n,t.lineWidth=a,t.stroke()};if(r||l(),e.isRange){const i=e.dotRadius??Math.max(2,Math.min(e.bodyWidth/2,.12*o.height));t.fillStyle=n,t.beginPath(),t.arc(e.x,e.highY,i,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(e.x,e.lowY,i,0,2*Math.PI),t.fill()}else if(e.bodyWidth>0){const i=Math.min(e.openY,e.closeY),o=Math.abs(e.openY-e.closeY),s=e.isUp?e.upColor:e.downColor,n=Kt(t,s)||s;t.fillStyle=n,t.fillRect(e.x-e.bodyWidth/2,i,e.bodyWidth,Math.max(o,1)),t.strokeStyle=n,t.lineWidth=1,t.strokeRect(e.x-e.bodyWidth/2,i,e.bodyWidth,Math.max(o,1))}r&&l(),t.restore()}},oo={line:[Zi,i,E],area:[Zi,E],stackedarea:[Zi,E],scatter:[E,A],bubble:[E,A],heatmap:[eo],bar:[a],swarm:[E],waterfall:[(t,e,i,o)=>{a(t,e,i,o);const s=e.filter(t=>"rect"===t.type);if(2>s.length)return;const n=s[0].datum,r=n?._connectorStroke;if(r){t.save(),t.strokeStyle=Kt(t,r)||r,t.lineWidth=n?._connectorWidth??1,t.setLineDash([]);for(let e=0;s.length-1>e;e++){const o=s[e],n=s[e+1],r=o.datum,a=n.datum;if(null==r?.cumEnd||null==a?.baseline)continue;const l=i.y(r.cumEnd),c=o.x+o.w,h=n.x;t.beginPath(),t.moveTo(c,l),t.lineTo(h,l),t.stroke()}t.restore()}}],candlestick:[io],mixed:[Zi,i,E],custom:[Zi,a,eo,i,E,A,et,io]};import{jsx as so,jsxs as no}from"react/jsx-runtime";function ro(t){return null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+""}function ao({hover:t}){const e=t.data??{},i=e.y??e.value,o=e.x??e.time;if(void 0===i&&void 0===o){const t=Qt(e);if(null!=t.title||t.entries.length>0)return no("div",{className:"semiotic-tooltip",style:Et,children:[null!=t.title&&so("div",{style:{fontWeight:600,marginBottom:t.entries.length?2:0},children:t.title+""}),t.entries.map(t=>no("div",{style:{opacity:.7,fontSize:11},children:[t.key,":"," ",so("span",{style:{fontWeight:600},children:ro(t.value)})]},t.key))]})}return no("div",{className:"semiotic-tooltip",style:Et,children:[so("div",{style:{fontWeight:600,marginBottom:2},children:ro(i)}),so("div",{style:{opacity:.7,fontSize:11},children:ro(o)})]})}ao.ownsChrome=!0;import{jsx as lo,jsxs as co}from"react/jsx-runtime";var ho={top:20,right:20,bottom:30,left:40},uo=$i;function go(t){if(t)return"x"===t.dimension?"pan-y":"y"===t.dimension?"pan-x":"none"}var fo=we(ke(function(t,e){const{chartType:i,runtimeMode:n,data:r,chunkThreshold:a,chunkSize:l,xAccessor:h,yAccessor:u,accessorRevision:g,colorAccessor:d,sizeAccessor:f,symbolAccessor:p,symbolMap:y,groupAccessor:m,lineDataAccessor:x,curve:k,normalize:w,baseline:A,stackOrder:_,binSize:C,valueAccessor:S,arrowOfTime:M="right",windowMode:P="sliding",windowSize:Y=200,timeAccessor:R,xExtent:T,yExtent:N,extentPadding:O=.1,scalePadding:D,sizeRange:E,size:L=[500,300],responsiveWidth:H,responsiveHeight:j,margin:q,className:K,background:J,renderMode:Z,lineStyle:Q,pointStyle:tt,areaStyle:et,barStyle:it,waterfallStyle:ot,swarmStyle:nt,barColors:rt,colorScheme:dt,boundsAccessor:bt,boundsStyle:kt,y0Accessor:wt,band:St,gradientFill:Mt,lineGradient:Pt,areaGroups:Yt,openAccessor:Tt,highAccessor:Nt,lowAccessor:Ot,closeAccessor:Dt,candlestickStyle:Et,showAxes:It=!0,axes:Gt,xLabel:Vt,yLabel:qt,yLabelRight:Ut,xFormat:Kt,yFormat:Jt,axisExtent:Zt,tickFormatTime:Qt,tickFormatValue:te,hoverAnnotation:ee,tooltipContent:ie,customHoverBehavior:oe,customClickBehavior:le,onObservation:he,annotationObservationCallback:ke,chartId:we,enableHover:Ae,hoverRadius:_e=30,tooltipMode:Ce,annotations:Se,onAnnotationActivate:Pe,autoPlaceAnnotations:Ye,svgAnnotationRules:Re,showGrid:Te,legend:We,legendHoverBehavior:Ne,legendClickBehavior:Oe,legendHighlightedCategory:De,legendIsolatedCategories:Ee,legendPosition:Le,legendLayout:ze,legendCategoryAccessor:Be,onCategoriesChange:Fe,backgroundGraphics:Ie,foregroundGraphics:Xe,canvasPreRenderers:$e,svgPreRenderers:Ge,title:Ve,categoryAccessor:He,brush:je,onBrush:qe,decay:Ue,pulse:Ke,transition:Je,animate:Ze,staleness:Qe,frameScheduler:ti,clock:ei,random:ii,seed:oi,paused:si=!1,suspendWhenHidden:ni=!0,heatmapAggregation:ai,heatmapXBins:li,heatmapYBins:gi,showValues:di,heatmapValueFormat:fi,marginalGraphics:pi,pointIdAccessor:yi,xScaleType:mi,yScaleType:xi,accessibleTable:vi=!0,description:bi,summary:wi,linkedCrosshairName:Ai,linkedCrosshairSourceId:_i,customLayout:Ci,onLayoutError:Si,layoutConfig:Mi,layoutSelection:Pi}=t,{customHoverBehavior:Yi,customClickBehavior:Ri,hasClickBehavior:Ti}=F({customHoverBehavior:oe,customClickBehavior:le,onObservation:he,chartId:we,chartType:"StreamXYFrame"}),Wi=be().replace(/:/g,""),Ni=fe(!1),Oi=fe({w:-1,h:-1}),Di=fe(!1),Ei=se({sizeProp:L,responsiveWidth:H,responsiveHeight:j,userMargin:q,marginDefault:ho,title:Ve,legend:We,legendPosition:Le,animate:Ze,transitionProp:Je,frameScheduler:ti,clock:ei,random:ii,seed:oi,paused:si,suspendWhenHidden:ni,themeDirtyRef:Ni}),Li=ue(),zi=ge(),{reducedMotionRef:Fi,responsiveRef:Ii,size:Vi,currentTheme:Hi,transition:Ui,introEnabled:Ki,tableId:Ji,rafRef:Zi,renderFnRef:Qi,scheduleRender:to,frameRuntime:eo}=Ei;let io=Ei.margin;if(pi){const t=60,e={...Ei.margin};pi.top&&t>e.top&&(e.top=t),pi.bottom&&t>e.bottom&&(e.bottom=t),pi.left&&t>e.left&&(e.left=t),pi.right&&t>e.right&&(e.right=t),io=e}const so=Vi[0]-io.left-io.right,no=Vi[1]-io.top-io.bottom,ro=me(()=>Lt(r),[r]),fo=ee??Ae,[po,yo]=pe(0),mo=fe(0),[xo,vo]=pe(null),bo=b(Xe,Vi,io,xo),ko=b(Ie,Vi,io,xo),wo=fe(null),Ao=fe(null),_o=fe(void 0),[Co,So]=pe(null),Mo=fe(uo.primary),Po=fe(function(){let t=-1,e=$i;return{resolve(i){if(!i)return $i;const o=zt();return o===t||(e=function(t){if(!t)return $i;const e=getComputedStyle(t),i=e.getPropertyValue("--semiotic-border").trim(),o=e.getPropertyValue("--semiotic-text-secondary").trim(),s=e.getPropertyValue("--semiotic-bg").trim(),n=e.getPropertyValue("--semiotic-primary").trim(),r=o||e.getPropertyValue("--text-secondary").trim(),a=e.getPropertyValue("--text-primary").trim(),l=i||e.getPropertyValue("--surface-3").trim(),c=s||e.getPropertyValue("--surface-0").trim();return r||a||i||n?{axisStroke:l||$i.axisStroke,tickText:r||$i.tickText,crosshair:r?Gi(r,"66"):$i.crosshair,hoverFill:c?Gi(c,"4D"):$i.hoverFill,hoverStroke:r?Gi(r,"99"):$i.hoverStroke,pointRing:c||$i.pointRing,primary:n||$i.primary,background:c||$i.background}:$i}(i),t=o),e},invalidate(){t=-1}}}()),Yo=fe(!1),Ro=re("StreamXYFrame"),[To,Wo]=pe(!1),[No,Oo]=pe([]),[Do,Eo]=pe([]),Lo="streaming"===n||["bar","swarm","waterfall"].includes(i),zo=me(()=>({chartType:i,runtimeMode:Lo?"streaming":"bounded",windowSize:Y,windowMode:P,arrowOfTime:Lo?M:"right",extentPadding:O,scalePadding:D,axisExtent:Zt,xAccessor:h,yAccessor:u,accessorRevision:g,timeAccessor:Lo?R:void 0,valueAccessor:S,colorAccessor:d,sizeAccessor:f,symbolAccessor:p,symbolMap:y,groupAccessor:m||(x?"_lineGroup":void 0),categoryAccessor:He,lineDataAccessor:x,xScaleType:mi,yScaleType:xi,xExtent:T,yExtent:N,sizeRange:E,binSize:C,normalize:w,baseline:A,stackOrder:_,boundsAccessor:bt,boundsStyle:kt,y0Accessor:wt,band:St,gradientFill:!0===Mt?{topOpacity:.8,bottomOpacity:.05}:!1===Mt?void 0:Mt,areaGroups:Yt?new Set(Yt):void 0,lineGradient:Pt,openAccessor:Tt,highAccessor:Nt,lowAccessor:Ot,closeAccessor:Dt,candlestickStyle:Et,lineStyle:Q,pointStyle:tt,areaStyle:et,swarmStyle:nt,waterfallStyle:ot,colorScheme:dt,barColors:rt,barStyle:it,annotations:Se,decay:Ue,pulse:Ke,transition:Ui,introAnimation:Ki,staleness:Qe,clock:eo.now,heatmapAggregation:ai,heatmapXBins:li,heatmapYBins:gi,showValues:di,heatmapValueFormat:fi,pointIdAccessor:yi,curve:k,themeCategorical:Hi?.colors?.categorical,themeSemantic:ce(Hi),themeSequential:Hi?.colors?.sequential,themeDiverging:Hi?.colors?.diverging,customLayout:Ci,onLayoutError:Si,layoutConfig:Mi,layoutMargin:io}),[i,Lo,Y,P,M,O,D,Zt,h,u,g,R,S,d,f,p,y,m,x,He,mi,xi,T,N,E,C,w,A,_,bt,kt,wt,St,Mt,Yt,Pt,Tt,Nt,Ot,Dt,Et,Q,tt,et,nt,ot,dt,rt,it,Se,Ue,Ke,Ui,Ki,Qe,eo.now,ai,li,gi,di,fi,yi,k,Hi,Ci,Si,Mi,io]),Bo=ut(zo),Fo=fe(null);Fo.current||(Fo.current=new ri(Bo));const Io=B(Fo,Be,Fe,t=>t.getData());ct(Fo,Bo,Ni,to),ht(Fo,Pi,Ni,to);const Xo=fe(null);Xo.current||(Xo.current=new s(t=>{const e=Fo.current;e&&e.ingest(t)&&(Ni.current=!0,to())},{chunkThreshold:a,chunkSize:l})),ye(()=>{Xo.current?.updateChunkOptions({chunkThreshold:a,chunkSize:l})},[a,l]);const $o=xe(t=>{Xo.current?.push(t)},[]),Go=xe(t=>{Xo.current?.pushMany(t)},[]),Vo=xe(()=>{Xo.current?.clear(),Fo.current?.clear(),Ni.current=!0,to()},[to]);ve(e,()=>({push:$o,pushMany:Go,remove:t=>{Xo.current?.flush();const e=Fo.current?.remove(t)??[];return e.length>0&&(wo.current&&e.some(t=>t===wo.current?.data)&&(wo.current=null,So(null)),Ni.current=!0,to()),e},update:(t,e)=>{Xo.current?.flush();const i=Fo.current?.update(t,e)??[];return i.length>0&&(Ni.current=!0,to()),i},clear:Vo,getData:()=>(Xo.current?.flush(),Fo.current?.getData()??[]),getScales:()=>Fo.current?.scales??null,getExtents:()=>Fo.current?.getExtents()??null,getCustomLayout:()=>Fo.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Fo.current?.lastCustomLayoutFailure??null}),[$o,Go,Vo,to]),ye(()=>{if(r){if(x&&ro.length>0&&"object"==typeof ro[0]&&null!==ro[0]){const t="string"==typeof x?x:"coordinates";if(Array.isArray(ro[0][t])){const e=[];for(const i of ro){const o=i[t];if(Array.isArray(o)){const t=i.label||i.id||i.key;if(null!=t)for(const i of o)e.push({...i,_lineGroup:t});else for(const t of o)e.push(t)}}return void Xo.current?.setBoundedData(e)}}Xo.current?.setBoundedData(ro)}},[r,ro,x]);const{canvasRef:Ho,interactionCanvasRef:jo}=ne(Ei,{storeRef:Fo,dirtyRef:Ni,hydrated:Li,wasHydratingFromSSR:zi,cleanup:()=>Xo.current?.clear(),canvasPaintDependencies:[i,so,no,It,J,Ie,Q,Z,$e,to]}),{hoverHandlerRef:qo,hoverLeaveRef:Uo,onPointerMove:Ko,onPointerLeave:Jo}=Ei;qo.current=t=>{if(!fo)return;const e=Ho.current;if(!e)return;const o=e.getBoundingClientRect(),s=t.clientX-o.left-io.left,n=t.clientY-o.top-io.top;if(0>s||s>so||0>n||n>no)return void(wo.current&&(wo.current=null,Ao.current=null,So(null),Yi&&(Yi(null),Ni.current=!0),to()));const r=Fo.current;if(!r||0===r.scene.length)return;const a=Ft(_e,t.pointerType),l=hi(r.scene,s,n,a,r.quadtree,r.maxPointRadius),c="multi"===Ce,u=()=>{wo.current&&(wo.current=null,Ao.current=null,So(null),Yi&&Yi(null),to())};if(!l&&!c)return void u();const g=c||!l?s:l.x,d=c||!l?n:l.y,f=l?.datum?W(l.datum,r.resolvedRibbons):{},p=r.scales?.x?.invert,y="function"==typeof p?p(g):void 0;let m=Rt(f,g,d,null!=y?{xValue:y,xPx:g}:void 0);if(c&&r.scene.length>0&&r.scales){const t=function(t,e,i=30){const o=[];for(const s of t)if("line"===s.type){const t=s;if(2>t.path.length)continue;const n=ui(ci(t.path,t.curve),e,i);if(null===n)continue;const r=ki(t.path,e);o.push({node:s,datum:Array.isArray(t.datum)&&t.datum[r]?t.datum[r]:t.datum,x:t.path[r][0],y:n,group:t.group,color:t.style.stroke})}else if("area"===s.type){const t=s;if(!1===t.interactive)continue;if(2>t.topPath.length)continue;const n=ci(t.topPath,t.curve),r=ci(t.bottomPath,t.curve),a=ui(n,e,i);if(null===a)continue;const l=ui(r,e,i),c=ki(t.topPath,e);o.push({node:s,datum:Array.isArray(t.datum)&&t.datum[c]?t.datum[c]:t.datum,x:t.topPath[c][0],y:a,y0:l??void 0,group:t.group,color:"string"==typeof t.style.stroke?t.style.stroke:"string"==typeof t.style.fill?t.style.fill:void 0})}return o}(r.scene,g,Math.max(a,so));if(t.length>0){const e=r.scales.y.invert,o=Mo.current,s=p?p(g):g;if(l)m.xValue=s,m.xPx=g;else{const t={xValue:s};"string"==typeof h&&(t[h]=s),m=Rt(t,g,d,{xValue:s,xPx:g})}m.allSeries=t.map(t=>{const s=e?e(t.y):t.y,n=null!=t.y0?e?e(t.y0):t.y0:void 0;return{group:t.group||"",value:"stackedarea"===i&&null!=n?s-n:s,valuePx:t.y,color:t.color||o,datum:W(t.datum,r.resolvedRibbons)}})}}l||m.allSeries?.length?(wo.current=m,Ao.current=l?.node??null,So(m),Yi&&(Yi(m),Ni.current=!0),to()):u()},Uo.current=()=>{wo.current&&(wo.current=null,Ao.current=null,So(null),Yi&&(Yi(null),Ni.current=!0),to())};const Zo=fe(()=>{});Zo.current=t=>{if(Xt(t.target))return;if(!Ri)return;const e=Ho.current;if(!e)return;const i=e.getBoundingClientRect(),o=t.clientX-i.left-io.left,s=t.clientY-i.top-io.top;if(0>o||o>so||0>s||s>no)return void Ri(null);const n=Fo.current;if(!n||0===n.scene.length)return void Ri(null);const r=Ft(_e,_o.current),a=hi(n.scene,o,s,r,n.quadtree,n.maxPointRadius);if(!a)return void Ri(null);const l=a.datum||{},c=n.scales?.x?.invert,h="function"==typeof c?c(a.x):void 0;Ri(Rt(l,a.x,a.y,null!=h?{xValue:h,xPx:a.x}:void 0),{type:"activate",inputType:Ht(_o.current)})};const Qo=xe(t=>Zo.current(t),[]),{kbFocusIndexRef:ts,focusedNavPointRef:es,onKeyDown:is}=I({storeRef:Fo,hoverRef:wo,hoveredNodeRef:Ao,setHoverPoint:So,customHoverBehavior:Yi,customClickBehavior:Ri,scheduleRender:to}),os=xe(t=>{_o.current=t.pointerType,ts.current=-1,es.current=null,Ko(t)},[es,ts,Ko]),ss=xe(t=>{_o.current="mouse",ts.current=-1,es.current=null,Ko({clientX:t.clientX,clientY:t.clientY,pointerType:"mouse"})},[es,ts,Ko]),ns=xe(t=>{_o.current=t.pointerType},[]);Qi.current=()=>{if(Zi.current=null,!eo.isActive)return;const t=Ho.current,e=jo.current;if(!t||!e)return;const s=Fo.current;if(!s)return;const n=eo.now(),r=s.advanceTransition(Fi.current?n+1e6:n),a=!Fi.current&&r,l=Oi.current.w!==so||Oi.current.h!==no,c=Ni.current||r||l,g=s.consumeStylePaintPending();let d=!1;const f=s.getLastUpdateResult(),p=Ro.current.beforeCompute(f,a);!c||a&&!l||(s.computeScene({width:so,height:no}),Oi.current={w:so,h:no},d=!0,Io()),Ro.current.afterCompute(p,d,l);const y=z(s,n,d,Di),m=Bt(),x=Po.current.resolve(t);Mo.current=x.primary;const v=lt(Qe,s.lastIngestTime>0?n-s.lastIngestTime:0),b=Qe&&v.isStale;if(c||g||y.changed){const e=jt(t,Vi,io,m);if(e){if(e.clearRect(-io.left,-io.top,Vi[0],Vi[1]),Qe&&1>v.alpha&&(e.globalAlpha=v.alpha),$(e,{background:J,hasBackgroundGraphics:!!Ie,themeBackground:x.background,x:-io.left,y:-io.top,width:Vi[0],height:Vi[1]}),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,so,no),e.clip()),$e&&s.scales)for(const t of $e)e.save(),t(e,s.scene,s.scales,{width:so,height:no}),e.restore();const t=Ci?oo.custom:oo[i];st({context:e,nodes:s.scene,renderMode:Z,pixelRatio:m,paintBuiltIn:i=>{if(t&&s.scales)for(const o of t)o(e,i,s.scales,{width:so,height:no})}}),e.restore(),Qe&&1>v.alpha&&(e.globalAlpha=1)}}const k=!!(fo&&wo.current&&s.scales),w=!!(Ao.current&&Array.isArray(ee)&&ee.some(t=>t&&"object"==typeof t&&"highlight"===t.type)),A=k||w;if(X(A,Yo.current)){const t=jt(e,Vi,io,m);if(t&&(t.clearRect(-io.left,-io.top,Vi[0],Vi[1]),k&&wo.current&&function(t,e,i,s,n,r,a){if(!1===n.crosshair)return;const l=e.allSeries,c=l&&l.length>0,h=e.xPx??e.x;t.save();const u="object"==typeof n.crosshair?n.crosshair:{};if(t.strokeStyle=u.stroke||a.crosshair,t.lineWidth=u.strokeWidth||1,t.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),t.beginPath(),t.moveTo(c?h:e.x,0),t.lineTo(c?h:e.x,s),t.stroke(),c||(t.beginPath(),t.moveTo(0,e.y),t.lineTo(i,e.y),t.stroke()),t.restore(),c){t.lineWidth=2,t.strokeStyle=a.pointRing;for(const e of l)null!=e.valuePx&&(t.beginPath(),t.arc(h,e.valuePx,4,0,2*Math.PI),t.fillStyle=e.color||a.primary,t.fill(),t.stroke())}else{const i=n.pointColor||o(r)||a.primary;t.beginPath(),t.arc(e.x,e.y,4,0,2*Math.PI),t.fillStyle=i,t.fill(),t.strokeStyle=a.pointRing,t.lineWidth=2,t.stroke()}}(t,wo.current,so,no,"object"==typeof fo?fo:{},Ao.current,x),w&&Ao.current&&Array.isArray(ee))){const e=ee.find(t=>t&&"object"==typeof t&&"highlight"===t.type);e&&function(t,e,i,o,s){if(!i)return;const n="group"in i?i.group:void 0;if(void 0!==n)for(const i of e){if("line"!==i.type)continue;if(i.group!==n)continue;if(2>i.path.length)continue;const e="function"==typeof o.style?i.datum?o.style(i.datum):{}:o.style||{};t.save(),t.beginPath(),t.moveTo(i.path[0][0],i.path[0][1]);for(let e=1;i.path.length>e;e++)t.lineTo(i.path[e][0],i.path[e][1]);t.strokeStyle=e.stroke||i.style.stroke||s.primary,t.lineWidth=e.strokeWidth||(i.style.strokeWidth||2)+2,t.globalAlpha=e.opacity??1,t.stroke(),t.restore()}}(t,s.scene,Ao.current,e,x)}Yo.current=A}c&&t&&t.setAttribute("aria-label",Wt(s.scene,i+" chart"));const _=Ni.current;if(Ni.current=_&&a&&!d,_&&s.scales){const t=t=>"object"==typeof t&&null!==t&&"function"==typeof t.valueOf?t.valueOf():t;if((!xo||t(xo.x.domain()[0])!==t(s.scales.x.domain()[0])||t(xo.x.domain()[1])!==t(s.scales.x.domain()[1])||t(xo.y.domain()[0])!==t(s.scales.y.domain()[0])||t(xo.y.domain()[1])!==t(s.scales.y.domain()[1])||xo.x.range()[0]!==s.scales.x.range()[0]||xo.x.range()[1]!==s.scales.x.range()[1]||xo.y.range()[0]!==s.scales.y.range()[0]||xo.y.range()[1]!==s.scales.y.range()[1])&&vo(s.scales),pi){const t=s.getData(),e="function"==typeof h?h:t=>t[h||"x"],i="function"==typeof u?u:t=>t[u||"y"];Oo(t.map(t=>e(t)).filter(t=>"number"==typeof t&&isFinite(t))),Eo(t.map(t=>i(t)).filter(t=>"number"==typeof t&&isFinite(t)))}}!((Se&&Se.length>0||Ci)&&(d||a))||!d&&33>n-mo.current||(yo(t=>t+1),mo.current=n),Qe?.showBadge&&Wo(!!b),(a||null!=s.activeTransition||y.pending)&&to()},gt(Qe,Fo,Ni,to,To,Wo);const rs=me(()=>{if(Kt||Qt)return;const t=Fo.current;return t?.xIsDate&&xo?ji(xo.x.domain()):void 0},[Kt,Qt,xo]),as=Kt||Qt||rs,ls=fo&&Co?ie?ie(Co):lo(ao,{hover:Co}):null,cs=ls?lo(xt,{x:Co.x,y:Co.y,containerWidth:so,containerHeight:no,margin:io,className:"stream-frame-tooltip",children:ls}):null,hs=es.current,us=lo(vt,{active:ts.current>=0,hoverPoint:Co,margin:io,size:Vi,shape:hs?.shape,width:hs?.w,height:hs?.h}),gs=v(h,R,"__semiotic_resolvedX","__semiotic_resolvedTime"),ds=v(u,S,"__semiotic_resolvedY","__semiotic_resolvedValue"),fs=gs.key,ps=ds.key,ys=c(gs,ds,Se&&Se.length>0||!1);if($t||!Li&&zi){const t=Fo.current;t&&r&&(t.ingest({inserts:ro,bounded:!0}),t.computeScene({width:so,height:no}));const e=t?.scene??[],i=t?.scales??null,o=b(Xe,Vi,io,i),s=b(Ie,Vi,io,i),n=as||(()=>{if(t?.xIsDate&&i)return ji(i.x.domain())})();return co("div",{ref:Ii,className:"stream-xy-frame"+(K?" "+K:""),role:"img","aria-label":bi||("string"==typeof Ve?Ve:"XY chart"),style:{position:"relative",width:H?"100%":Vi[0],height:j?"100%":Vi[1]},children:[lo(_t,{summary:wi}),co("svg",{xmlns:"http://www.w3.org/2000/svg",width:Vi[0],height:Vi[1],style:{position:"absolute",left:0,top:0},children:[lo("g",{transform:`translate(${io.left},${io.top})`,children:s}),co("g",{transform:`translate(${io.left},${io.top})`,children:[J&&lo("rect",{x:0,y:0,width:so,height:no,fill:J}),Ge&&i&&Ge.map((t,o)=>lo(de.Fragment,{children:t(e,i,{width:so,height:no})},"svgpre-"+o)),e.map((t,e)=>at({node:t,index:e,renderMode:Z,fallback:()=>ae(t,e,Wi)})).filter(Boolean)]})]}),lo(Xi,{width:so,height:no,totalWidth:Vi[0],totalHeight:Vi[1],margin:io,scales:i,showAxes:It,axes:Gt,xLabel:Vt,yLabel:qt,yLabelRight:Ut,xFormat:n,yFormat:Jt||te,axisExtent:Zt,showGrid:Te,title:Ve,legend:We,legendHoverBehavior:Ne,legendClickBehavior:Oe,legendHighlightedCategory:De,legendIsolatedCategories:Ee,legendPosition:Le,legendLayout:ze,foregroundGraphics:U(o,ft(Fo.current?.customLayoutOverlays,Pi??null)),marginalGraphics:pi,xValues:[],yValues:[],annotations:Se,onAnnotationActivate:Pe,onObservation:ke??he,chartId:we,chartType:"StreamXYFrame",autoPlaceAnnotations:Ye,svgAnnotationRules:Re,annotationFrame:0,xAccessor:fs,yAccessor:ps,annotationData:ys(Fo.current?.getData()),pointNodes:qi(Fo.current?.scene),curve:"string"==typeof k?k:void 0,linkedCrosshairName:Ai,linkedCrosshairSourceId:_i})]})}return co("div",{ref:Ii,className:"stream-xy-frame"+(K?" "+K:""),role:"group","aria-label":bi||("string"==typeof Ve?Ve:"XY chart"),tabIndex:0,style:{position:"relative",width:H?"100%":Vi[0],height:j?"100%":Vi[1],overflow:"visible",touchAction:go(je)},onKeyDown:is,children:["production"!==process.env.NODE_ENV&&Fo.current&&lo(At,{store:Fo.current,diagnostics:Ro.current}),vi&&lo(Ct,{tableId:Ji}),vi&&lo(pt,{scene:Fo.current?.scene??[],chartType:i+" chart",tableId:Ji,chartTitle:"string"==typeof Ve?Ve:void 0}),lo(_t,{summary:wi}),lo(yt,{hoverPoint:Co}),co("div",{role:"img","aria-label":bi||("string"==typeof Ve?Ve:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:fo?os:void 0,onMouseMove:fo?ss:void 0,onPointerLeave:fo?Jo:void 0,onMouseLeave:fo?Jo:void 0,onPointerDown:fo||Ti?ns:void 0,onClick:Ti?Qo:void 0,children:[lo(mt,{size:Vi,margin:io,children:ko}),lo(Bi,{width:so,height:no,totalWidth:Vi[0],totalHeight:Vi[1],margin:io,scales:xo,showAxes:It,axes:Gt,showGrid:Te,xFormat:as,yFormat:Jt||te,axisExtent:Zt}),lo("canvas",{ref:Ho,"aria-label":Wt(Fo.current?.scene??[],i+" chart"),style:{position:"absolute",left:0,top:0}}),lo("canvas",{ref:jo,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),lo(Xi,{width:so,height:no,totalWidth:Vi[0],totalHeight:Vi[1],margin:io,scales:xo,showAxes:It,axes:Gt,xLabel:Vt,yLabel:qt,yLabelRight:Ut,xFormat:as,yFormat:Jt||te,axisExtent:Zt,showGrid:Te,title:Ve,legend:We,legendHoverBehavior:Ne,legendClickBehavior:Oe,legendHighlightedCategory:De,legendIsolatedCategories:Ee,legendPosition:Le,legendLayout:ze,foregroundGraphics:U(bo,ft(Fo.current?.customLayoutOverlays,Pi??null)),marginalGraphics:pi,xValues:No,yValues:Do,annotations:Se,onAnnotationActivate:Pe,onObservation:ke??he,chartId:we,chartType:"StreamXYFrame",autoPlaceAnnotations:Ye,svgAnnotationRules:Re,annotationFrame:po,xAccessor:fs,yAccessor:ps,annotationData:ys(Fo.current?.getData()),pointNodes:qi(Fo.current?.scene),curve:"string"==typeof k?k:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!G({background:J,hasBackgroundGraphics:!!Ie,themeBackground:Hi?.colors.background}),linkedCrosshairName:Ai,linkedCrosshairSourceId:_i}),(je||qe)&&lo(Me,{width:so,height:no,totalWidth:Vi[0],totalHeight:Vi[1],margin:io,dimension:je?.dimension??"xy",scales:xo,onBrush:qe??(()=>{}),binSize:C,snap:je?.snap,binBoundaries:je?.binBoundaries??("bar"===i?Fo.current?.getBinBoundaries():void 0),snapDuring:je?.snapDuring,streaming:"streaming"===n}),Qe?.showBadge&&lo(V,{isStale:To,position:Qe.badgePosition}),us,cs]})]})}));fo.displayName="StreamXYFrame";var po=fo;export{po as StreamXYFrame_default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createStore as e}from"./chunk-chunk-DSNGDNJY.module.min.js";var t={fresh:1,aging:1.5,stale:3};function n(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}function r(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var o=null;function i(e={},t){const{background:n="transparent",stroke:i="#000",lineWidth:a=1.5,spacing:s=6,angle:l=45}=e,c={background:n,stroke:i,lineWidth:a,spacing:s,angle:l},u=Math.max(8,Math.ceil(2*s));let f;try{f=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(o||(o=document.createElement("canvas")),o.width=e,o.height=e,o)}(u)}catch{return r(c)}const d=f.getContext("2d");if(!d)return r(c);n&&"transparent"!==n?(d.fillStyle=n,d.fillRect(0,0,u,u)):d.clearRect(0,0,u,u),d.strokeStyle=i,d.lineWidth=a,d.lineCap="square";const p=l*Math.PI/180;if(45===l||-45===l){const e=l>0?1:-1;for(let t=-u;2*u>=t;t+=s)d.beginPath(),d.moveTo(t,0),d.lineTo(t+e*u,u),d.stroke()}else{d.save(),d.translate(u/2,u/2),d.rotate(p);const e=2*u;for(let t=-e;e>=t;t+=s)d.beginPath(),d.moveTo(-e,t),d.lineTo(e,t),d.stroke();d.restore()}return(t||d).createPattern(f,"repeat")}import{jsx as a,jsxs as s}from"react/jsx-runtime";function l(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function c(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function u(e,t){let n=2166136261;const r=c(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var f=new Map;function d(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${c(e)}@${n}`,o=f.get(r);if(void 0!==o)return o;const a=i({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),s=l(a)?null:a;return f.set(r,s),s}function p(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:l=45,lineOpacity:c=1}=e,u=Math.max(8,Math.ceil(2*i));return s("pattern",{id:t,width:u,height:u,patternUnits:"userSpaceOnUse",patternTransform:0!==l?`rotate(${l})`:void 0,children:[n&&"transparent"!==n&&a("rect",{width:u,height:u,fill:n}),a("line",{x1:0,y1:0,x2:0,y2:u,stroke:r,strokeWidth:o,strokeOpacity:c}),a("line",{x1:i,y1:0,x2:i,y2:u,stroke:r,strokeWidth:o,strokeOpacity:c})]},t)}function h(e,t,n="#4e79a7"){if(l(e)){const n=u(t,e);return{fill:`url(#${n})`,def:p(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}function m(e,t){return"touch"===t?Math.max(e,24):e}function y(e){return Array.isArray(e)?e[0]:e}function b(e,t,n,r){return{data:y(e),x:t,y:n,__semioticHoverData:!0,...r}}var g=["name","label","title"],v=["type","kind","category","group","class","status","role","shape"],k=["value","amount","total","count","weight","score"],x=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function w(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function N(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&x.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>g.includes(e.lower));const a=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:o[i];let l=o.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=w(l,v),u=w(l,k),f=new Set(v),d=new Set(k),p=[];c&&p.push({key:c.key,value:c.value}),u&&p.push({key:u.key,value:u.value});for(const e of l){if(p.length>=n)break;e!==c&&e!==u&&(f.has(e.lower)||d.has(e.lower)||p.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:p}}import{jsx as A,jsxs as W}from"react/jsx-runtime";var O={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 S(e,t){return"function"==typeof t?t(e):e[t]}function j(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 C(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=S(e,n);a=j(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const a=S(e,o);s.push({label:n,value:j(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=j(e[n],r);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=j(e[t[0]],r))}}const l={...O,...o};return W("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&A("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>W("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&W("span",{children:[e.label,": "]}),e.value]},t))]})}}function I(){return e=>{const t=e.allSeries;if(!t||0===t.length)return A("div",{className:"semiotic-tooltip",style:O,children:A("div",{children:j(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return W("div",{className:"semiotic-tooltip",style:O,children:[null!=n&&A("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:j(n)}),t.map((e,t)=>W("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[A("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),A("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),A("span",{style:{fontWeight:500,fontSize:"0.85em"},children:j(e.value)})]},t))]})}}function T(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=y(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const r=t(n);return null==r?null:A("div",{className:"semiotic-tooltip",style:O,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?C(e):"multi"===e?("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip — prefer charts that set tooltipMode (LineChart, AreaChart, StackedAreaChart, DifferenceChart). Rendering MultiLineTooltip content as a fallback.'),function(e={}){const{fields:t=[],title:n,format:r,style:o={},className:i="",showLabels:a=!0,separator:s=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=S(e,n);l.push({value:j(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const s=j(S(e,o),i);l.push({label:a?n:void 0,value:s})});else{const t=N(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:j(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:a?e.key:void 0,value:j(e.value,r)})})}const c={...O,...o};return Array.isArray(l)&&0!==l.length?A("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>W("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&W("strong",{children:[e.label,s]}),e.value]},t))}):null}}()):C())}}function D(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function E(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),a=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}function R(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>E(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])D(e[r])&&D(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}function M(e,t){return e===t}function _(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function P(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function F(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var $=/^\d{4}-\d{1,2}$/;function L(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=$.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const r=Date.parse(n);return Number.isFinite(r)?r:NaN}function z(e){return e instanceof Date?e.getTime():"string"==typeof e?L(e):+e}function H(e,t){if(!e||!t)return{data:e,failed:!1};let n=!1,r=!1;const o=e.map(e=>{const o=e[t];if("string"!=typeof o)return e;const i=L(o);return n=!0,Number.isFinite(i)?{...e,[t]:i}:(r=!0,{...e,[t]:NaN})});return{data:n?o:e,failed:r}}import*as B from"react";var[V,J]=e(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 U(e){const t=J(e=>e.pushObservation),n=B.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return B.useMemo(()=>({...e,onObservation:n}),[n,e])}function q(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}function G(e,t={}){const n=q(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function K(e){return e instanceof Element&&null!=e.closest("[data-semiotic-annotation-widget]")}function Y(e,t={}){const n=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,o=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&o.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&o.has(t)&&!r)})}function Q(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function X(e){return e&&"object"==typeof e?e:{}}function Z(e){return X(e.accessibility).tableFields??e.accessibleDatum??e.datum}function ee(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:Q(Z(r))});break;case"line":case"area":{const e=Z(r),n=Array.isArray(e)?e:[],o="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:o,values:Q(e)});break}case"rect":{const e=Z(r),n=null!=e&&"object"==typeof e?e:{},o=n.category??r.group??"",i=n.value??n.__aggregateValue??n.total,a=Q(n);null==a.category&&""!==o&&(a.category=o+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=Q(Z(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Z(r),n=Q(e);if(null==n.category){const t=X(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Q(Z(r))});break;case"arc":t.push({label:"Arc",values:Q(Z(r))});break;case"candlestick":t.push({label:"Candlestick",values:Q(Z(r))});break;case"geoarea":{const e=X(Z(r)),n=Q(e);if(null==n.name){const t=X(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}export{M as accessorsEquivalent,_ as resolveAccessor,P as resolveRawAccessor,F as resolveStringAccessor,L as parseDateLikeString,z as coerceDateLikeValue,H as coerceTemporalStringRows,t as DEFAULT_LIFECYCLE_THRESHOLDS,n as bandFromAge,i as createHatchPattern,l as isHatchFill,c as hatchFillKey,u as hatchFillId,d as resolveHatchCanvasPattern,p as hatchPatternDef,h as resolveSvgFill,J as useObservationSelector,U as useAnnotationActivationOptions,q as annotationStableId,G as annotationActivationProps,K as isAnnotationActivationTarget,Y as filterAnnotationsByStatus,ee as extractAllRows,m as getPointerHitRadius,b as buildHoverData,N as smartTooltipEntries,O as defaultTooltipStyle,I as MultiPointTooltip,T as normalizeTooltip,E as responsiveRuleMatches,R as resolveResponsiveRules};
|