semiotic 3.8.1 → 3.8.2
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 +3 -1
- package/README.md +53 -52
- package/ai/behaviorContracts.cjs +9 -0
- package/ai/dist/mcp-server.js +142 -13
- package/ai/schema.json +616 -42
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +5 -2
- package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
- package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
- package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
- package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
- package/dist/chunk-chunk-27HVVXS6.module.min.js +1 -0
- package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
- package/dist/chunk-chunk-2UN3ANRN.module.min.js +2 -0
- package/dist/chunk-chunk-2VUEY5TH.module.min.js +1 -0
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
- package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
- package/dist/chunk-chunk-5WEFWNUW.module.min.js +2 -0
- package/dist/chunk-chunk-6F6GEAQU.module.min.js +1 -0
- package/dist/chunk-chunk-7LHMKRKE.module.min.js +2 -0
- package/dist/chunk-chunk-BHYTYMY2.module.min.js +2 -0
- package/dist/chunk-chunk-C6EJ4IOD.module.min.js +2 -0
- package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
- package/dist/chunk-chunk-CYIML3AV.module.min.js +2 -0
- package/dist/chunk-chunk-DNY43POY.module.min.js +1 -0
- package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
- package/dist/chunk-chunk-E7MIQX7D.module.min.js +2 -0
- package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
- package/dist/chunk-chunk-ES4DCG3L.module.min.js +1 -0
- package/dist/chunk-chunk-FAKO3RGQ.module.min.js +2 -0
- package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
- package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
- package/dist/chunk-chunk-H4PPRW6N.module.min.js +1 -0
- package/dist/chunk-chunk-IFYPMWKY.module.min.js +1 -0
- package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
- package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
- package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
- package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
- package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
- package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
- package/dist/chunk-chunk-L6D3I3V7.module.min.js +2 -0
- package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
- package/dist/chunk-chunk-NO4MCQVD.module.min.js +1 -0
- package/dist/chunk-chunk-ODUZEEBH.module.min.js +2 -0
- package/dist/chunk-chunk-P6UBCMSQ.module.min.js +2 -0
- package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
- package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
- package/dist/chunk-chunk-RH5TSQPH.module.min.js +1 -0
- package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
- package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
- package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
- package/dist/chunk-chunk-STZFFTAN.module.min.js +2 -0
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-T27ZEV6A.module.min.js +1 -0
- package/dist/chunk-chunk-U3AGQ5EF.module.min.js +2 -0
- package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
- package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
- package/dist/chunk-chunk-W3DB2MN4.module.min.js +2 -0
- package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
- package/dist/chunk-chunk-WDIN4LRC.module.min.js +1 -0
- package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
- package/dist/chunk-chunk-XOYX77KF.module.min.js +2 -0
- package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
- package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
- package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
- package/dist/chunk-chunk-Z5KXAVQD.module.min.js +2 -0
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
- package/dist/chunk-chunk-ZLKRTF5N.module.min.js +2 -0
- package/dist/chunk-chunk-ZTNVDWAK.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
- package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
- package/dist/components/server/staticSVGChrome.d.ts +3 -2
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
- package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
- package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- 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.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +1 -1
- package/dist/physics-rapier.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/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.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-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-realtime-react.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-recipes-react.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-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.min.js +1 -1
- package/dist/semiotic-utils-react.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-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +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.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +4 -4
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
- package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var e=["value","threshold","partition-boundary","time-window","range-boundary"];function t({controlType:e,controlId:t,chartId:n,chartType:a="VisualizationControl",onObservation:o}){return(i,r,l)=>{o?.({type:i,controlType:e,value:r,chartType:a,timestamp:Date.now(),...t?{controlId:t}:{},...n?{chartId:n}:{},...l?{source:l}:{}})}}function n(e,t,n,a,o){return{id:e,...t?{controlId:t}:{},status:n,message:a,...o?{remediation:o}:{}}}function a({controls:t=[],minimumTargetSize:a=24}){const o=[],i=new Set;for(const r of t){const t=r?.id,l="controls."+(t||"unknown"),s=r?.domain,d=Array.isArray(s)&&2===s.length&&Number.isFinite(s[0])&&Number.isFinite(s[1])&&s[1]>s[0],u=e.includes(r?.type),c="string"==typeof r?.target&&r.target.trim().length>0,m=["slider","buttons","native-range"].includes(r?.keyboard??""),p=r?.minimumTargetSize;o.push(n(l+".semantic-type",t,u?"pass":"fail",u?`Control uses the semantic type "${r.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),o.push(n(l+".state-binding",t,c?"pass":"fail",c?`Control is bound to "${r.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),o.push(n(l+".domain",t,d?"pass":"fail",d?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),o.push(n(l+".keyboard",t,m?"pass":"fail",m?`Control declares a ${r.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),o.push(n(l+".value-text",t,"string"==typeof r?.valueText&&r.valueText.trim().length>0?"pass":"fail","string"==typeof r?.valueText&&r.valueText.trim().length>0?"Control declares human-readable value text.":"Control does not declare human-readable value text.","Provide valueText, typically with a {value} placeholder.")),o.push(n(l+".target-size",t,"number"!=typeof p||a>p?"fail":"pass","number"!=typeof p||a>p?`Control target is below the ${a}px minimum or undeclared.`:`Control declares a ${p}px target.`,`Declare minimumTargetSize of at least ${a}.`)),null!=r?.step&&o.push(n(l+".step",t,Number.isFinite(r.step)&&r.step>0?"pass":"fail",Number.isFinite(r.step)&&r.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),r?.observations?.length&&o.push(n(l+".observations",t,r.observations.includes("control-change")?"pass":"warn",r.observations.includes("control-change")?"Control declares control-change observation coverage.":"Control declares observations but omits control-change.","Include control-change so observable state changes are represented.")),t&&!i.has(t)||o.push(n(l+".identity",t,"fail",t?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),t&&i.add(t)}return{ok:o.every(e=>"fail"!==e.status),findings:o}}import*as o from"react";import{jsx as i,jsxs as r}from"react/jsx-runtime";function l(e,t,n=0){const a=Math.min(t[0],t[1]),o=Math.max(t[0],t[1]),i=Math.max(a,Math.min(o,e[0])),r=Math.max(a,Math.min(o,e[1])),l=i>r?[r,i]:[i,r];if(l[1]-l[0]>=n)return l;const s=(l[0]+l[1])/2,d=n/2;return[Math.max(a,Math.min(o-n,s-d)),Math.min(o,Math.max(a+n,s+d))]}function s(e,t,n,a=1,o=a){const i="in"===n?a:-a;return l([e[0]+i,e[1]-i],t,o)}function d(e){const{domain:t,initialValue:n=t,step:a=1,minSpan:i=a,label:r,formatValue:d,onChange:u}=e,[c,m]=o.useState(()=>l(n,t,i)),p=l(c,t,i),h=o.useCallback(e=>{const n=l(e,t,i);m(n),u?.(n)},[t,i,u]),b=o.useMemo(()=>({label:r,domain:t,value:p,step:a,formatValue:d,onChange:h,onClear:()=>h(t)}),[t,d,r,h,a,p]),g=o.useMemo(()=>({onZoomIn:()=>h(s(p,t,"in",a,i)),onZoomOut:()=>h(s(p,t,"out",a,i)),onReset:()=>h(t)}),[t,i,h,a,p]);return{value:p,setValue:h,xExtent:p,brush:b,zoom:g}}var u={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},c={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function m(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-on-primary, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function p(e){return"function"==typeof e}function h({brush:e,targetSize:t}){const n=e?.value,a=e?.domain,o=!!n&&!!a,l=!0===e?.disabled,s=e?.formatValue??(e=>e),d=!!e?.onChange&&o&&!l,h=a?.[0]??0,b=a?.[1]??1,g=n?.[0]??h,y=n?.[1]??b,f=e?.step??((b-h)/100||1);return r("section",{style:u,"aria-label":"Brush controls",children:[i("div",{style:c,children:e?.label??"Filter range"}),o?r("div",{style:{display:"grid",gap:8},children:[r("label",{style:{display:"grid",gap:4,fontSize:12},children:[r("span",{children:["Start: ",s(g)]}),i("input",{type:"range",min:h,max:b,step:f,value:g,disabled:!d,style:{minHeight:t},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([Math.min(n,y),y])}})]}),r("label",{style:{display:"grid",gap:4,fontSize:12},children:[r("span",{children:["End: ",s(y)]}),i("input",{type:"range",min:h,max:b,step:f,value:y,disabled:!d,style:{minHeight:t},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([g,Math.max(n,g)])}})]})]}):i("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),i("button",{type:"button",disabled:l||!p(e?.onClear),onClick:e?.onClear,style:m(t),children:"Clear range"})]})}function b({zoom:e,targetSize:t}){const n=!0===e?.disabled;return r("section",{style:u,"aria-label":"Zoom controls",children:[i("div",{style:c,children:e?.label??"Zoom"}),r("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[i("button",{type:"button","aria-label":"Zoom out",disabled:n||!p(e?.onZoomOut),onClick:e?.onZoomOut,style:m(t),children:"-"}),i("button",{type:"button","aria-label":"Reset zoom",disabled:n||!p(e?.onReset),onClick:e?.onReset,style:m(t),children:"Reset"}),i("button",{type:"button","aria-label":"Zoom in",disabled:n||!p(e?.onZoomIn),onClick:e?.onZoomIn,style:m(t),children:"+"})]})]})}function g({legend:e,targetSize:t}){const n=!0===e?.disabled,a=e?.items??[];return r("section",{style:u,"aria-label":"Legend controls",children:[i("div",{style:c,children:e?.label??"Series"}),a.length>0&&i("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:a.map(a=>{const o=!1!==a.active;return r("button",{type:"button",disabled:n||a.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(a.id,!o),style:m(t,o),"aria-pressed":o,children:[a.color&&i("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:a.color}}),a.label??a.id]},a.id)})}),r("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[i("button",{type:"button",disabled:n||!p(e?.onShowAll),onClick:e?.onShowAll,style:m(t),children:"Show all"}),i("button",{type:"button",disabled:n||!p(e?.onHideAll),onClick:e?.onHideAll,style:m(t),children:"Hide all"})]})]})}function y({controls:e,targetSize:t=44,compact:n=!1,className:a,style:o,ariaLabel:l="Mobile chart controls",brush:s,zoom:d,legend:u}){const c=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const n=[];return t.brush&&n.push("brush"),t.zoom&&n.push("zoom"),t.legend&&n.push("legend"),n}(e,{brush:s,zoom:d,legend:u});return 0===c.length?null:r("div",{className:a,role:"group","aria-label":l,style:{display:"grid",gridTemplateColumns:n?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...o},children:[c.includes("brush")&&i(h,{brush:s,targetSize:t}),c.includes("zoom")&&i(b,{zoom:d,targetSize:t}),c.includes("legend")&&i(g,{legend:u,targetSize:t})]})}export{e as VISUALIZATION_CONTROL_TYPES,t as createControlObservationAdapter,a as auditVisualizationControls,l as clampMobileRange,s as zoomMobileRange,d as useMobileRangeControls,y as MobileStandardControls};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{commonJsWorkerModuleUrl as e}from"./chunk-chunk-SV4XAZ3Q.module.min.js";import{resolveNodeSizeFn as r}from"./chunk-chunk-H4PPRW6N.module.min.js";import*as t from"react";import{jsx as n}from"react/jsx-runtime";var o={isActive:!1,predicate:()=>!0},i=t.createContext(null);function s({value:e,children:r}){return n(i.Provider,{value:e,children:r})}function a(){return t.useContext(i)??o}function u(e,r){return null!=e?n(s,{value:r,children:e}):e}function c(e,r,t,n,o=4e4){return"sync"!==e&&("worker"===e||n*(r+t)>=o)}function d(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function l(e,t,n,o,i){const s=r(n.nodeSize,n.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const r=i?.get(e.id);return{id:e.id,x:0!==e.x||0!==e.y?e.x:r?.x??0,y:0!==e.x||0!==e.y?e.y:r?.y??0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:e.value,__forceRadius:s(e)}}),edges:t.map(e=>{const r="string"==typeof e.source?e.source:e.source.id,t="string"==typeof e.target?e.target:e.target.id,n=e.data?.weight,o="number"==typeof n&&Number.isFinite(n)?n:e.value;return{source:r,target:t,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:o}}),config:{chartType:"force",iterations:n.iterations,forceStrength:n.forceStrength,seed:n.seed},size:o}}function m(){if("undefined"!=typeof DOMException)return new DOMException("Force layout aborted","AbortError");const e=Error("Force layout aborted");return e.name="AbortError",e}var h=class{constructor(r=function(){const r="string"==typeof import.meta.url&&import.meta.url?new URL("./forceLayoutWorker.js",import.meta.url):e("forceLayoutWorker.js");return new Worker(r,{type:"module",name:"semiotic-force-layout"})}()){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.worker=r,this.worker.onmessage=e=>{const r=e.data,t=r.requestId,n=null!=t?this.pending.get(t):this.pending.values().next().value;if(n){if(null!=t?this.pending.delete(t):this.pending.clear(),n.cleanup(),r.error){const e=Error(r.error.message);return e.name=r.error.name??"Error",r.error.stack&&(e.stack=r.error.stack),void n.reject(e)}n.resolve({positions:r.positions??{}})}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||"Force layout worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,r){if(this.dead)return Promise.reject(Error("Force layout worker session is closed"));if(r?.aborted)return Promise.reject(m());const t=this.nextRequestId;this.nextRequestId+=1;const n={requestId:t,request:e};return new Promise((e,o)=>{const i=()=>{this.pending.delete(t),r?.removeEventListener("abort",i),o(m())},s=()=>r?.removeEventListener("abort",i);this.pending.set(t,{cleanup:s,reject:o,resolve:e}),r?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(n)}catch(e){this.pending.delete(t),s(),o(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error("Force layout worker terminated")),this.worker.terminate())}rejectAll(e){for(const r of this.pending.values())r.cleanup(),r.reject(e);this.pending.clear()}},f=null;function p(e,r){return d()?r?.aborted?Promise.reject(m()):(f&&!f.isDead||(f=new h),f).request(e,r):Promise.reject(Error("Web Workers are unavailable"))}export{s as CustomLayoutSelectionProvider,a as useCustomLayoutSelection,u as wrapWithCustomLayoutSelection,c as shouldUseForceWorker,d as canUseForceWorker,l as createFrameForceWorkerRequest,p as runForceLayoutWorker};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{useCallback as e,useEffect as r,useMemo as n,useRef as t,useState as u}from"react";var s=Symbol("semiotic.useStreamStatus.wrapped");function o(o={}){const{staleThresholdMs:a=5e3,pollIntervalMs:l=1e3}=o,i=t(null),[c,h]=u("idle"),[f,p]=u(null),m=e(()=>{const e="undefined"!=typeof performance?performance.now():Date.now();i.current=e,p(e),h(e=>"active"===e?e:"active")},[]),_=n(()=>{const e={_frame:null,_origPush:null,_origPushMany:null};return{get current(){return e._frame},set current(r){const n=e._frame;if(n&&n!==r&&e._origPush&&e._origPushMany&&(n.push=e._origPush,n.pushMany=e._origPushMany,delete n[s]),e._frame=r,!r)return e._origPush=null,void(e._origPushMany=null);if(r[s])return;r[s]=!0;const t=r.push,u=r.pushMany,o=t.bind(r),a=u.bind(r);e._origPush=t,e._origPushMany=u,r.push=e=>(m(),o(e)),r.pushMany=e=>(e&&e.length>0&&m(),a(e))}}},[m]);return r(()=>{const e=setInterval(()=>{const e=i.current;if(null==e)return;const r=("undefined"!=typeof performance?performance.now():Date.now())-e>a;h(e=>{const n=r?"stale":"active";return e===n?e:n})},l);return()=>clearInterval(e)},[a,l]),{ref:_,status:c,lastPushTime:f}}export{o as useStreamStatus};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as e from"react";function r({label:r="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:i}={}){const n=e.useId().replace(/:/g,""),o=e.useRef(i);return o.current=i,{description:t,descriptionId:"semiotic-brush-description-"+n,svgProps:{role:"region",tabIndex:0,"aria-label":r,"aria-describedby":"semiotic-brush-description-"+n,onKeyDown:e.useCallback(e=>{const r=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);r&&(e.preventDefault(),o.current?.(r))},[])}}}export{r as useBrushAccessibility};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){let n=t>>>0;return function(){n=n+1831565813|0;let t=Math.imul(n^n>>>15,1|n);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}export{t as mulberry32};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{COLOR_SCHEMES as r,resolveExplicitColor as t}from"./chunk-chunk-ODUZEEBH.module.min.js";function e(t,e,n){if(t&&"object"==typeof t&&!Array.isArray(t)){const r=Object.values(t).filter(r=>"string"==typeof r&&r.length>0);if(r.length>0)return r}if(Array.isArray(t)&&t.length>0)return t;if("string"==typeof t){const e=r[t];if(Array.isArray(e)&&e.length>0)return e}return e&&e.length>0?e:n}function n(r,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:void 0;return 0===r.length?r=>n&&t(n,r)||"#4e79a7":e=>{if(n){const r=t(n,e);if(r)return r}let i=0;for(let r=0;e.length>r;r++)i=31*i+e.charCodeAt(r)|0;return r[Math.abs(i)%r.length]??"#4e79a7"}}export{e as resolveCustomLayoutPalette,n as buildResolveColor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){if("undefined"!=typeof __filename){const r=__filename.replace(/\\/g,"/"),n=r.startsWith("/")?r:"/"+r;return new URL("./"+e,"file:"+n)}throw Error("Cannot resolve module worker asset: "+e)}export{e as commonJsWorkerModuleUrl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{IncrementalExtent as t,RingBuffer as e}from"./chunk-chunk-VVCA3DB7.module.min.js";import{forceLayoutPlugin as r,wrapWithDataHint as i}from"./chunk-chunk-H4PPRW6N.module.min.js";import{STREAMING_PALETTE as n,coerceDateLikeValue as o,computeEasing as a,computeRawProgress as s,lerp as c,now as l,parseDateLikeString as u}from"./chunk-chunk-ES4DCG3L.module.min.js";import{accessorsEquivalent as h,resolveAccessor as f,resolveRawAccessor as y,resolveStringAccessor as g}from"./chunk-chunk-2WVCH4PL.module.min.js";import{SEQUENTIAL_INTERPOLATORS as p,SYMBOL_SEQUENCE as d,UpdateResultTracker as m,getSequentialInterpolator as v,schemeCategory10 as x}from"./chunk-chunk-NO4MCQVD.module.min.js";function b(t,e,r){if(null!=t)return"function"==typeof t?t(e,r):"object"==typeof t&&null!==t&&"constant"in t?t.constant:e[t]}function k(t){const{data:e,encoding:r}=t,i=[],n=new Map;return e.forEach((t,e)=>{const o=b(r.id,t,e);if(null==o||""===o)throw Error(`[semiotic] Motion encoding row ${e} resolved an empty id.`);const a=o+"";if(n.has(a))throw Error(`[semiotic] Duplicate motion encoding id "${a}".`);const s=b(r.process?.group,t,e),c=b(r.process?.stage,t,e),l=b(r.accessible?.group,t,e)??(null!=s?s+"":null!=c?c+"":void 0),u={};for(const i of Object.keys(r.evidence??{}))u[i]=b(r.evidence?.[i],t,e);const h={id:a,datum:t,time:{arrival:b(r.time?.arrival,t,e),basis:r.time?.basis,unit:r.time?.unit},placement:{x:b(r.placement?.x,t,e),y:b(r.placement?.y,t,e),lane:b(r.placement?.lane,t,e),space:r.placement?.space},kinematics:{velocityX:b(r.kinematics?.velocityX,t,e),velocityY:b(r.kinematics?.velocityY,t,e),space:r.kinematics?.space},process:{group:s,stage:c,target:b(r.process?.target,t,e),work:b(r.process?.work,t,e)},evidence:u,accessible:{description:b(r.accessible?.description,t,e),group:l,label:b(r.accessible?.label,t,e)??a}};i.push(h),n.set(a,h)}),{rows:i,byId:n}}function w(t){const e=Math.max(0,Math.min(1,t.minOpacity??.1));if(Number.isNaN(t.age))return 1;if(t.age===1/0)return e;if(!Number.isFinite(t.extent)||0>=t.extent)return 1;const r=Math.max(0,t.age);if("step"===t.type)return(t.threshold??.5*t.extent)>r?1:e;if("exponential"===t.type){const i=t.halfLife??t.extent/2;return e+Math.pow(.5,r/(i>0?i:t.extent/2))*(1-e)}return e+Math.max(0,Math.min(1,1-r/t.extent))*(1-e)}function _(t,e){const r=Number.isFinite(t)?t:0,i=Number.isFinite(e)?e:0;return{velocityX:r,velocityY:i,speed:Math.hypot(r,i),direction:Math.atan2(i,r)}}function A(t,e,r){return Number.isFinite(r)&&r>0?_((e.x-t.x)/r,(e.y-t.y)/r):_(0,0)}function P(t,e,r,i){return"function"==typeof e.style?e.style(i||{},r):e.style&&"object"==typeof e.style?e.style:t.resolveBoundsStyle(r,i)}function L(t,e,r,i){if(!t.scales)return null;const n=[],o=[];for(const r of e){const e=t.getX(r);if(!Number.isFinite(e))continue;const a=i.getTop(r),s=i.getBottom(r);if(!Number.isFinite(a)||!Number.isFinite(s))continue;const c=t.scales.x(e),l=t.scales.y(a),u=t.scales.y(s);Number.isFinite(c)&&Number.isFinite(l)&&Number.isFinite(u)&&(n.push([c,l]),o.push([c,u]))}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:P(t,i,r,e[0]),datum:e,group:r,interactive:i.interactive}}function S(t){const e=[],r=[];if(!t)return{perSeries:e,aggregate:r};for(const i of t)i.perSeries?e.push(i):r.push(i);return{perSeries:e,aggregate:r}}function C(t,e,r){const i=[];for(const n of r){const r=L(t,e,"__ribbon_aggregate",n);r&&i.push(r)}return i}function M(t,e,r,i){const n=[];for(const o of i){const i=L(t,e,r,o);i&&n.push(i)}return n}function D(t,e){if(!t)return{};if(!e||0===e.length)return t;const r=[];for(const i of e){if("band"!==i.kind)continue;const e=i.getTop(t),n=i.getBottom(t);Number.isFinite(n)&&Number.isFinite(e)&&r.push({y0:n,y1:e})}return 0===r.length?t:{...t,band:r[0],bands:r}}function E(t){return new Set(Array.isArray(t)?t:[t])}function Y(t,e,r){if(1>=r)return 1;const i=r-1;return w({age:i-e,extent:i,type:t.type,halfLife:t.halfLife??r/2,threshold:t.stepThreshold??.5*r,minOpacity:t.minOpacity??.1})}function N(t){const e=new Map;for(let r=0;t.length>r;r++)e.set(t[r],r);return e}function R(t,e,r){const i=t.duration??500,n=r-e;return i>n?1-n/i:0}function T(t,e,r,i){let n=!1;return e>0?(t._pulseIntensity!==e&&(t._pulseIntensity=e,n=!0),t._pulseColor!==r&&(t._pulseColor=r,n=!0),t._pulseGlowRadius!==i&&(t._pulseGlowRadius=i,n=!0),n):(0!==t._pulseIntensity&&(t._pulseIntensity=0,n=!0),void 0!==t._pulseColor&&(t._pulseColor=void 0,n=!0),void 0!==t._pulseGlowRadius&&(t._pulseGlowRadius=void 0,n=!0),n)}function $(t,e,r=("undefined"!=typeof performance?performance.now():Date.now())){if(!e||0===e.size)return!1;const i=t.duration??500,n=e.peek();return null!=n&&i>r-n}function O(t,e,r){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 r=t.getX(e.datum),i=t.getY(e.datum);if(t.getCategory)return`p:${t.getCategory(e.datum)}:${r}:${i}`;if(null!=r&&null!=i)return`p:${r}:${i}`}return"p:"+r;case"glyph":return e.pointId?"g:"+e.pointId:"g:"+r;case"rect":return`r:${e.group||""}:${e.datum?.binStart??e.datum?.category??r}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+r:"c:"+t.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}function F(t,e,r,i,n,o){const a=[];for(const n of t){const t=r(n),o=i(n);Number.isFinite(t)&&Number.isFinite(o)&&a.push({px:e.x(t),py:e.y(o),rawY:o,d:n})}a.sort((t,e)=>t.px-e.px);const s=Array(a.length),c=Array(a.length),l=Array(a.length);for(let t=0;a.length>t;t++){const e=a[t];s[t]=[e.px,e.py],c[t]=e.rawY,l[t]=e.d}return{type:"line",path:s,rawValues:c,style:n,datum:l,group:o}}function I(t,e,r,i,n,o,a,s){const c=[];for(const o of t){const t=r(o),a=i(o);if(!Number.isFinite(t)||!Number.isFinite(a))continue;const l=e.x(t),u=s?s(o):n;c.push({px:l,topY:e.y(a),botY:e.y(u)})}c.sort((t,e)=>t.px-e.px);const l=Array(c.length),u=Array(c.length);for(let t=0;c.length>t;t++){const e=c[t];l[t]=[e.px,e.topY],u[t]=[e.px,e.botY]}return{type:"area",topPath:l,bottomPath:u,style:o,datum:t,group:a}}function W(t,e,r,i){const n=new Map;if("silhouette"===i)for(const i of t){let t=0;for(const n of e)t+=r(n,i)||0;n.set(i,-t/2)}else if("wiggle"===i){t.length>0&&n.set(t[0],0);for(let i=1;t.length>i;i++){const o=t[i-1],a=t[i];let s=0,c=0,l=0;for(const t of e){const e=r(t,a)||0;s+=(2*l+e)*(e-(r(t,o)||0)),c+=e,l+=e}const u=n.get(o)??0;n.set(a,u-(c>0?s/(2*c):0))}if(t.length>0){let i=0;for(const o of t){let t=0;for(const i of e)t+=r(i,o)||0;i+=(n.get(o)??0)+t/2}const o=i/t.length;for(const e of t)n.set(e,(n.get(e)??0)-o)}}else for(const e of t)n.set(e,0);return n}function z(t,e,r,i,n,o,a){const s=r(t),c=i(t);if(!Number.isFinite(s)||!Number.isFinite(c))return null;const l={type:"point",x:e.x(s),y:e.y(c),r:n,style:o,datum:t};return void 0!==a&&(l.pointId=a),l}function X(t,e,r,i,n,o,a,s){const c=r(t),l=i(t);if(!Number.isFinite(c)||!Number.isFinite(l))return null;const u={type:"symbol",x:e.x(c),y:e.y(l),size:n,symbolType:o,style:a,datum:t};return void 0!==s&&(u.pointId=s),u}function B(t,e,r,i,n,o,a){return{type:"rect",x:t,y:e,w:r,h:i,style:n,datum:o,group:a}}function G(t,e,r,i,n,o,a){const s={type:"heatcell",x:t,y:e,w:r,h:i,fill:n,datum:o};return a?.showValues&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function j(t,e,r,i){if(!t.config.pointStyle)return;const n=i??t.getY;for(const i of e){const e=t.resolveGroupColor(i.key);for(const o of i.data){let i=t.config.pointStyle(o);!i.fill&&e&&(i={...i,fill:e});const a=i.r??3,s=t.getPointId?t.getPointId(o)+"":void 0,c=z(o,t.scales,t.getX,n,a,i,s);c&&r.push(c)}}}function V(t){return"threshold"===t.type&&"string"==typeof t.color&&"number"==typeof t.value}var H={topOpacity:.8,bottomOpacity:.05};function K(t){if(t)return!0===t?H:"colorStops"in t?t:{topOpacity:t.topOpacity??H.topOpacity,bottomOpacity:t.bottomOpacity??H.bottomOpacity}}var q=new Map;function U(t,e,r,i,n){const o=new Map;for(const a of t){const t=e(a),s=r(a);if(null==t||null==s||Number.isNaN(t)||Number.isNaN(s))continue;const c=Math.floor(t/i)*i;let l=o.get(c);if(l||(l={start:c,end:c+i,total:0,categories:new Map},o.set(c,l)),l.total+=s,n){const t=n(a);l.categories.set(t,(l.categories.get(t)||0)+s)}}return o}function Z(t){if("production"===process.env.NODE_ENV)return;const{label:e,nodes:r,overlays:i,warned:n}=t;Q(i)&&0===r.length&&J(n,"overlay-only",`[semiotic] ${e} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),r.length>0&&r.every(t=>null==t.datum)&&J(n,"null-datums",`[semiotic] ${e} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function Q(t){return null!=t&&!1!==t&&""!==t&&(!Array.isArray(t)||t.some(Q))}function J(t,e,r){t.has(e)||(t.add(e),console.warn(r))}function tt(t,e,r,i){const n=function(t){if(t instanceof Error)return{name:t.name||"Error",message:t.message||"Custom layout threw."};if("string"==typeof t)return{name:"Error",message:t};if(null==t)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:t+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(e),o="network"===t?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:t,source:o,message:`Semiotic ${t} ${o} failed: ${n.message}`,error:n,recovery:r?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:r,affectedRevision:i}}function et(t,e){const r="function"==typeof t?t:r=>r[t||e];return t=>{const e=r(t);return null==e?NaN:+e}}function rt(t){const e=[],r=["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode,i=et(r&&t.valueAccessor||t.yAccessor,r?"value":"y");if(t.boundsAccessor){const r=f(t.boundsAccessor,"bounds");e.push({kind:"bounds",getTop:t=>{const e=i(t);if(!Number.isFinite(e))return NaN;const n=r(t);return Number.isFinite(n)&&0!==n?e+n:e},getBottom:t=>{const e=i(t);if(!Number.isFinite(e))return NaN;const n=r(t);return Number.isFinite(n)&&0!==n?e-n:e},style:t.boundsStyle,perSeries:!0,interactive:!1})}if(t.band){const r=Array.isArray(t.band)?t.band:[t.band];for(const t of r)e.push({kind:"band",getTop:et(t.y1Accessor,"y1"),getBottom:et(t.y0Accessor,"y0"),style:t.style,perSeries:!1!==t.perSeries,interactive:!0===t.interactive})}return e}import{scaleLinear as it,scaleLog as nt,scaleSymlog as ot,scaleTime as at}from"d3-scale";function st(t,e){return e?[e[0]??t[0],e[1]??t[1]]:t}function ct(t,e,r){if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return nt().domain(t).range(r).clamp(!0)}return"symlog"===t?ot().domain(e).range(r):"time"===t?at().domain([new Date(e[0]),new Date(e[1])]).range(r):it().domain(e).range(r)}function lt(t,e,r){e>t.capacity&&(t.resize(e),r&&e>r.capacity&&r.resize(e))}function ut(t,r){const i=new e(t.capacity);return t.forEach(()=>i.push(r)),i}function ht(t,e,r,i){const n=t.push(e);return r&&r.push(i),n}function ft(t,e,r){if(!e||0===e.size)return;const i=new Set;if(t.forEach((t,e)=>{r(t)&&i.add(e)}),0===i.size)return;const n=e.toArray();e.clear();for(let t=0;n.length>t;t++)i.has(t)||e.push(n[t])}var yt=new WeakMap;function gt(){return this.updateResults.last}function pt(){return this.updateResults.last}function dt(t){return this.updateResults.subscribe(t)}function mt(t){this.config.layoutSelection=t}function vt(){yt.set(this,!0)}function xt(){const t=!0===yt.get(this);return yt.delete(this),t}function bt(t){Object.assign(t.prototype,{getLastUpdateResult:gt,getUpdateSnapshot:pt,subscribeUpdateResult:dt,setLayoutSelection:mt,markStylePaintPending:vt,consumeStylePaintPending:xt})}var kt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],wt=["scene-style","data-paint","accessibility","evidence"],_t=(t,e)=>({retainedData:t,invalidations:e}),At=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Pt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Lt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],St=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ct=["scene-geometry","data-paint","accessibility","evidence"],Mt=["scene-style","data-paint","accessibility","evidence"],Dt=[],Et={chartType:_t("rebuild",At),runtimeMode:_t("rebuild",At),xAccessor:_t("rebuild",At),yAccessor:_t("rebuild",At),timeAccessor:_t("rebuild",At),valueAccessor:_t("rebuild",At),y0Accessor:_t("rebuild",At),boundsAccessor:_t("rebuild",At),band:_t("rebuild",At),openAccessor:_t("rebuild",At),highAccessor:_t("rebuild",At),lowAccessor:_t("rebuild",At),closeAccessor:_t("rebuild",At),candlestickRangeMode:_t("rebuild",At),accessorRevision:_t("rebuild",At),groupAccessor:_t("rebuild",Pt),categoryAccessor:_t("rebuild",Pt),lineDataAccessor:_t("rebuild",Pt),colorAccessor:_t("rebuild",Mt),sizeAccessor:_t("rebuild",Ct),symbolAccessor:_t("rebuild",Ct),pointIdAccessor:_t("rebuild",Ct),xScaleType:_t("preserve",Lt),yScaleType:_t("preserve",Lt),xExtent:_t("preserve",Lt),yExtent:_t("preserve",Lt),extentPadding:_t("preserve",Lt),scalePadding:_t("preserve",Lt),axisExtent:_t("preserve",Lt),binSize:_t("preserve",Lt),normalize:_t("preserve",Lt),heatmapAggregation:_t("preserve",Lt),heatmapXBins:_t("preserve",Lt),heatmapYBins:_t("preserve",Lt),arrowOfTime:_t("preserve",St),baseline:_t("preserve",St),stackOrder:_t("preserve",St),sizeRange:_t("preserve",St),curve:_t("preserve",St),areaGroups:_t("preserve",St),customLayout:_t("preserve",St),layoutConfig:_t("preserve",St),layoutMargin:_t("preserve",St),symbolMap:_t("preserve",Ct),showValues:_t("preserve",Ct),heatmapValueFormat:_t("preserve",Ct),lineStyle:_t("preserve",Mt),pointStyle:_t("preserve",Mt),areaStyle:_t("preserve",Mt),barStyle:_t("preserve",Mt),swarmStyle:_t("preserve",Mt),waterfallStyle:_t("preserve",Mt),candlestickStyle:_t("preserve",Mt),boundsStyle:_t("preserve",Mt),gradientFill:_t("preserve",Mt),lineGradient:_t("preserve",Mt),colorScheme:_t("preserve",Mt),themeCategorical:_t("preserve",Mt),themeSemantic:_t("preserve",Mt),themeSequential:_t("preserve",Mt),themeDiverging:_t("preserve",Mt),barColors:_t("preserve",Mt),decay:_t("preserve",Mt),pulse:_t("preserve",Mt),staleness:_t("preserve",Mt),layoutSelection:_t("preserve",Mt),annotations:_t("preserve",["overlay","accessibility","evidence"]),windowSize:_t("preserve",Dt),windowMode:_t("preserve",Dt),maxCapacity:_t("preserve",Dt),clock:_t("preserve",Dt),transition:_t("preserve",Dt),introAnimation:_t("preserve",Dt),onLayoutError:_t("preserve",Dt)},Yt=_t("preserve",St),Nt=class{constructor(){this.tracker=new m}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}},kt)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},wt):this.recordNoop("restyle")}recordConfig(t){const e=function(t){let e="preserve";const r=new Set;for(const i of t){const t=Et[i]??Yt;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)r.add(e)}return{retainedData:e,invalidations:r}}(t);return this.tracker.record({kind:"config",keys:t},e.invalidations)}};import{quadtree as Rt}from"d3-quadtree";var Tt=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 r=0,i=0;for(const t of e)"point"===t.type&&(r++,t.r>i&&(i=t.r));if(this.maxRadius=i,500>=r)return void(this.tree=null);const n=Array(r);let o=0;for(const t of e)"point"===t.type&&(n[o++]=t);this.tree=Rt().x(t=>t.x).y(t=>t.y).addAll(n)}},$t=class r{constructor(r){if(this.xExtent=new t,this.yExtent=new t,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 Nt,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 Tt,this._lastBoundedInsertsRef=null,this.applyPulse=(t,e,r)=>!(!this.config.pulse||!this.timestampBuffer)&&function(t,e,r,i,n,o=("undefined"!=typeof performance?performance.now():Date.now())){const a=t.color??"rgba(255,255,255,0.6)",s=t.glowRadius??4;let c=!1;const l=n??(()=>{const t=new Map;for(let e=0;r.length>e;e++)t.set(r[e],e);return t})();for(const r of e){if("line"===r.type)continue;if("area"===r.type){const e=Array.isArray(r.datum)?r.datum:[r.datum];let n=0,s=!1;for(const r of e){const e=l.get(r);if(null==e)continue;s=!0;const a=i.get(e);if(null==a)continue;const c=R(t,a,o);c>n&&(n=c)}s&&(c=T(r,n,a)||c);continue}const e=l.get(r.datum);if(null==e)continue;const n=i.get(e);c=T(r,null==n?0:R(t,n,o),a,s)||c}return c}(this.config.pulse,t,e,this.timestampBuffer,this.getDatumIndexMap(e),r),this.config=r,this.buffer=new e(r.windowSize),this.growingCap=r.windowSize,["bar","swarm","waterfall"].includes(r.chartType)||"streaming"===r.runtimeMode?(this.getX=f(r.timeAccessor||r.xAccessor,"time"),this.getY=f(r.valueAccessor||r.yAccessor,"value")):(this.getX=f(r.xAccessor,"x"),this.getY=f(r.yAccessor,"y")),this.getGroup=g(r.groupAccessor),this.getCategory=g(r.categoryAccessor),this.getSize=r.sizeAccessor?f(r.sizeAccessor,"size"):void 0,this.getColor=g(r.colorAccessor),this.getSymbol=g(r.symbolAccessor),this.getY0=r.y0Accessor?f(r.y0Accessor,"y0"):void 0,this.resolvedRibbons=rt(r),this.getPointId=g(r.pointIdAccessor),"candlestick"===r.chartType){const t=null!=r.openAccessor,e=null!=r.closeAccessor;this.getOpen=t?f(r.openAccessor,"open"):void 0,this.getHigh=f(r.highAccessor,"high"),this.getLow=f(r.lowAccessor,"low"),this.getClose=e?f(r.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e}r.pulse&&(this.timestampBuffer=new e(r.windowSize))}currentTime(){return this.config.clock?.()??l()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=ut(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 r=e.getTop(t),i=e.getBottom(t);Number.isFinite(r)&&this.yExtent.push(r),Number.isFinite(i)&&this.yExtent.push(i)}}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 r=e.getTop(t),i=e.getBottom(t);Number.isFinite(r)&&this.yExtent.evict(r),Number.isFinite(i)&&this.yExtent.evict(i)}}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(t){if(t.bounded&&this._lastBoundedInsertsRef===t.inserts)return this.updateResults.recordNoop("replace"),!1;const e=this.currentTime();if(this.lastIngestTime=e,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,t.bounded){this._lastBoundedInsertsRef=t.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const r=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=r?f(this.config.timeAccessor||this.config.xAccessor,"time"):f(this.config.xAccessor,"x"),this.xIsDate=!1,t.inserts.length>0){const e=t.inserts[0],r=this.config.xAccessor,i="function"==typeof r?r(e):e[r||"x"],n=i instanceof Date,a="string"==typeof i&&Number.isFinite(u(i));if(this.xIsDate=n||a,a){const t="string"==typeof r?r:void 0;this.getX=t?e=>o(e[t]):t=>o(r(t))}}lt(this.buffer,t.totalSize||t.inserts.length,this.timestampBuffer);for(const r of t.inserts)ht(this.buffer,r,this.timestampBuffer,e),this.xExtent.push(this.getX(r)),this.pushDatumYExtent(r)}else for(const r of t.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 t=ht(this.buffer,r,this.timestampBuffer,e);this.xExtent.push(this.getX(r)),this.pushDatumYExtent(r),null!=t&&(this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t))}return this.updateResults.recordData(t.bounded?"replace":"ingest",t.inserts.length),!0}ingestWithResult(t){return this.ingest(t),this.updateResults.last}computeScene(t){const{config:e,buffer:r}=this,i=this.scales,n=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(r,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const o=this.getBufferArray(),a=this.yExtent.extent;let s=st(this.xExtent.extent,e.xExtent),c=st(a,e.yExtent);const l=!(!(u=e.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===e.axisExtent;if("stackedarea"===e.chartType&&!l&&r.size>0){const t=function(t){const{config:e,groups:r,getX:i,getY:n}=t,o="exact"===e.axisExtent;if(e.normalize){const r=[0,o?1:1+e.extentPadding];return{yDomain:r,stackExtentCache:{key:`${t.bufferSize}:${t.ingestVersion}:norm`,yDomain:r}}}const a=`${t.bufferSize}:${t.ingestVersion}:${e.baseline??"zero"}:${e.stackOrder??"key"}`;if(t.stackExtentCache&&t.stackExtentCache.key===a)return{yDomain:t.stackExtentCache.yDomain,stackExtentCache:t.stackExtentCache};const s=new Map,c=new Set;let l=0;const u=new Map,h=new Map;for(const t of r){const e=new Map;let r=0;for(const o of t.data){const t=i(o),a=n(o);if(!Number.isFinite(t)||!Number.isFinite(a))continue;e.set(t,(e.get(t)||0)+a),c.add(t),r+=a;const s=(u.get(t)||0)+a;u.set(t,s),s>l&&(l=s)}s.set(t.key,e),h.set(t.key,r)}const f=e.stackOrder??"key",y=(t,e)=>e>t?-1:t>e?1:0;let g,p;if("input"===f)g=r.map(t=>t.key);else if("insideOut"===f){const t=[...r].map(t=>t.key).sort((t,e)=>{const r=(h.get(e)??0)-(h.get(t)??0);return 0!==r?r:y(t,e)}),e=[],i=[];let n=0,o=0;for(const r of t)o>n?(e.push(r),n+=h.get(r)??0):(i.push(r),o+=h.get(r)??0);g=[...i.reverse(),...e]}else g="asc"===f?r.map(t=>t.key).sort((t,e)=>{const r=(h.get(t)??0)-(h.get(e)??0);return 0!==r?r:y(t,e)}):"desc"===f?r.map(t=>t.key).sort((t,e)=>{const r=(h.get(e)??0)-(h.get(t)??0);return 0!==r?r:y(t,e)}):r.map(t=>t.key).sort(y);if("wiggle"===e.baseline||"silhouette"===e.baseline){const t=Array.from(c).sort((t,e)=>t-e),r=W(t,g,(t,e)=>s.get(t)?.get(e)||0,e.baseline);let i=1/0,n=-1/0;for(const e of t){const t=r.get(e)??0,o=u.get(e)??0;i>t&&(i=t),t+o>n&&(n=t+o)}Number.isFinite(i)&&Number.isFinite(n)||(i=0,n=0);const a=n-i,l=o?0:a>0?a*e.extentPadding:1;p=[i-l,n+l]}else if("diverging"===e.baseline){const t=Array.from(c).sort((t,e)=>t-e),[r,i]=function(t,e,r){let i=0,n=0;for(const o of t){let t=0,a=0;for(const i of e){const e=r(i,o)||0;0>e?a+=e:t+=e}i>a&&(i=a),t>n&&(n=t)}return[i,n]}(t,g,(t,e)=>s.get(t)?.get(e)||0),n=i-r,a=o?0:n>0?n*e.extentPadding:1;p=[r-a,i+a]}else p=[0,l+(o?0:l>0?l*e.extentPadding:1)];return{yDomain:p,stackExtentCache:{key:a,yDomain:p}}}({config:e,groups:this.groupData(o),getX:this.getX,getY:this.getY,bufferSize:r.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});c=t.yDomain,this._stackExtentCache=t.stackExtentCache}else"bar"===e.chartType&&e.binSize&&!l&&r.size>0?c=function(t,e,r,i,n,o,a){const[,s]=function(t,e,r,i,n){const o=U(t,e,r,i,n);if(0===o.size)return[0,0];let a=0;for(const t of o.values())t.total>a&&(a=t.total);return[0,a]}(t,e,r,i,n);return[0,a?s:s+s*o]}(r,this.getX,this.getY,e.binSize,this.getCategory,e.extentPadding,h):"waterfall"===e.chartType&&!l&&r.size>0?c=function(t,e,r,i){const[n,o]=function(t,e){let r=0,i=0,n=0;for(const o of t){const t=e(o);null==t||Number.isNaN(t)||(n+=t,r>n&&(r=n),n>i&&(i=n))}return[r,i]}(t,e),a=o-n,s=i?0:a>0?a*r:1;return[Math.min(0,n-Math.abs(s)),Math.max(0,o+Math.abs(s))]}(r,this.getY,e.extentPadding,h):l||c[0]===1/0||(c=function(t,e,r){if(!r.length)return t;let[i,n]=t;for(const t of e)for(const e of r){const r=e.getTop(t),o=e.getBottom(t);Number.isFinite(r)&&(i>r&&(i=r),r>n&&(n=r)),Number.isFinite(o)&&(i>o&&(i=o),o>n&&(n=o))}return[i,n]}(c,o,this.resolvedRibbons),c=function(t,e){const r=t[1]-t[0],i=e.exactMode?0:r>0?r*e.extentPadding:1,n=[null!=e.userMin?t[0]:t[0]-i,null!=e.userMax?t[1]:t[1]+i];return"log"!==e.yScaleType||n[0]>0||0>=e.dataYDomain[0]||e.exactMode||null==e.userMin&&(n[0]=e.dataYDomain[0]/(1+e.extentPadding)),n}(c,{exactMode:h,extentPadding:e.extentPadding,userMin:e.yExtent?.[0],userMax:e.yExtent?.[1],yScaleType:e.yScaleType,dataYDomain:a}));c=function(t,e,r){if(!e||r)return t;const i=e[0],n=e[1];return null==i&&null==n?t:[null!=i?i:t[0],null!=n?n:t[1]]}(c,e.yExtent,!!l),({xDomain:s,yDomain:c}=function(t,e,r){let i=t,n=e;if(i[0]===1/0||i[1]===-1/0)if("time"===r){const t=Date.now();i=[t-864e5,t]}else i=[0,1];return n[0]!==1/0&&n[1]!==-1/0||(n=[0,1]),{xDomain:i,yDomain:n}}(s,c,e.xScaleType)),this.scales=function(t){const{config:e,layout:r,xDomain:i,yDomain:n}=t,o="streaming"===e.runtimeMode,a=Math.max(0,Math.min(e.scalePadding||0,Math.min(r.width,r.height)/2-1));if(o){if("x"==("up"===(s=e.arrowOfTime)||"down"===s?"y":"x")){const t="right"===e.arrowOfTime?[a,r.width-a]:[r.width-a,a];return{x:it().domain(i).range(t),y:ct(e.yScaleType,n,[r.height-a,a])}}const t="down"===e.arrowOfTime?[a,r.height-a]:[r.height-a,a];return{x:ct(e.yScaleType,n,[a,r.width-a]),y:it().domain(i).range(t)}}var s;return{x:ct(e.xScaleType,i,[a,r.width-a]),y:ct(e.yScaleType,n,[r.height-a,a])}}({config:e,layout:t,xDomain:s,yDomain:c}),this._customLayoutFailedThisBuild=!1;const f=this.buildSceneNodes(t,o);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=i,this.lastLayout=n):(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=f,this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o,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,r=t.height/this.lastLayout.height;for(const t of this.scene)switch(t.type){case"line":for(const i of t.path)i[0]*=e,i[1]*=r;break;case"area":for(const i of t.topPath)i[0]*=e,i[1]*=r;for(const i of t.bottomPath)i[0]*=e,i[1]*=r;t.clipRect&&(t.clipRect={x:t.clipRect.x*e,y:t.clipRect.y*r,width:t.clipRect.width*e,height:t.clipRect.height*r});break;case"point":case"glyph":t.x*=e,t.y*=r;break;case"rect":case"heatcell":t.x*=e,t.y*=r,t.w*=e,t.h*=r;break;case"candlestick":t.x*=e,t.openY*=r,t.closeY*=r,t.highY*=r,t.lowY*=r}const i=this.scales.x.domain(),n=this.scales.y.domain(),o=this.scales.x.range(),a=this.scales.y.range(),s=ct,c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(t.width,t.height)/2-1)),l=a[1]>a[0];this.scales={x:s(this.config.xScaleType,i,o[0]>o[1]?[t.width-c,c]:[c,t.width-c]),y:s(this.config.yScaleType,n,l?[c,t.height-c]:[t.height-c,c])},this.lastLayout={width:t.width,height:t.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(t,e){const{config:r,scales:i}=this;if(!i)return[];if(r.customLayout){const o={data:e,scales:i,dimensions:{width:t.width,height:t.height,margin:r.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:r.themeSemantic??{},categorical:r.themeCategorical??n},resolveColor:(t,e)=>{const i=this.resolveGroupColor(t);if(i)return i;const n=this.resolveLineStyle(t,e);return n.stroke?n.stroke:"string"==typeof n.fill?n.fill:r.themeSemantic?.primary??"#4e79a7"},config:r.layoutConfig??{},selection:r.layoutSelection??null};let a;try{a=r.customLayout(o)}catch(t){const e=null!==this.lastCustomLayoutResult,i=tt("xy",t,e,this.version);this.lastCustomLayoutFailure=i,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",t);try{r.onLayoutError?.(i)}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=a.overlays??null,this.lastCustomLayoutResult=a,this.lastCustomLayoutFailure=null;const s=a.nodes??[];if(this._customRestyle=a.restyle,this.hasCustomRestyle=!!a.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const t of s)t.style&&this._baseStyles.set(t,t.style);this.applyCustomRestyle(s,r.layoutSelection??null)}return Z({label:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===e.length)return[];const o={scales:i,config:r,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(r.chartType){case"line":return function(t,e){const r=t.groupData(e),i=[],n=t.config.annotations?.filter(V).map(t=>({value:t.value,color:t.color,thresholdType:t.thresholdType||"greater"}));if(t.ribbons&&t.ribbons.length>0){const{perSeries:n,aggregate:o}=S(t.ribbons);if(o.length>0&&i.push(...C(t,e,o)),n.length>0)for(const e of r)i.push(...M(t,e.data,e.key,n))}for(const e of r){const r=t.resolveLineStyle(e.key,e.data[0]),o=F(e.data,t.scales,t.getX,t.getY,r,e.key);n&&n.length>0&&(o.colorThresholds=n),t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),i.push(o)}return j(t,r,i),i}(o,e);case"area":return function(t,e){const r=t.groupData(e),i=[];if(t.ribbons&&t.ribbons.length>0){const{perSeries:n,aggregate:o}=S(t.ribbons);if(o.length>0&&i.push(...C(t,e,o)),n.length>0)for(const e of r)i.push(...M(t,e.data,e.key,n))}const n=t.scales.y.domain()[0],o=t.getY0?e=>{const r=t.getY0(e);return null==r?n:r}:void 0;for(const e of r){const r=t.resolveAreaStyle(e.key,e.data[0]),a=I(e.data,t.scales,t.getX,t.getY,n,r,e.key,o),s=K(t.config.gradientFill);s&&(a.fillGradient=s),t.config.curve&&"linear"!==t.config.curve&&(a.curve=t.config.curve),t.config.lineGradient&&(a.strokeGradient=t.config.lineGradient),i.push(a)}return j(t,r,i),i}(o,e);case"mixed":return function(t,e){const r=t.groupData(e),i=[],n=t.config.areaGroups||new Set;if(t.ribbons&&t.ribbons.length>0){const{perSeries:n,aggregate:o}=S(t.ribbons);if(o.length>0&&i.push(...C(t,e,o)),n.length>0)for(const e of r)i.push(...M(t,e.data,e.key,n))}const o=t.scales.y.domain()[0],a=t.getY0?e=>{const r=t.getY0(e);return null==r?o:r}:void 0;for(const e of r)if(n.has(e.key)){const r=t.resolveAreaStyle(e.key,e.data[0]),n=I(e.data,t.scales,t.getX,t.getY,o,r,e.key,a),s=K(t.config.gradientFill);s&&(n.fillGradient=s),t.config.curve&&"linear"!==t.config.curve&&(n.curve=t.config.curve),t.config.lineGradient&&(n.strokeGradient=t.config.lineGradient),i.push(n)}else{const r=t.resolveLineStyle(e.key,e.data[0]),n=F(e.data,t.scales,t.getX,t.getY,r,e.key);t.config.curve&&"linear"!==t.config.curve&&(n.curve=t.config.curve),t.config.lineGradient&&(n.strokeGradient=t.config.lineGradient),i.push(n)}return j(t,r,i),i}(o,e);case"stackedarea":return function(t,e){const r=t.groupData(e),i=t.config.stackOrder??"key",n=()=>r.sort((t,e)=>e.key>t.key?-1:t.key>e.key?1:0);if("input"===i);else if("key"===i)n();else if("asc"===i||"desc"===i||"insideOut"===i){const e=new Map;for(const i of r){let r=0;for(const e of i.data){const i=t.getX(e),n=t.getY(e);Number.isFinite(i)&&Number.isFinite(n)&&(r+=n)}e.set(i.key,r)}const n=(t,e)=>e>t?-1:t>e?1:0;if("asc"===i)r.sort((t,r)=>{const i=(e.get(t.key)??0)-(e.get(r.key)??0);return 0!==i?i:n(t.key,r.key)});else if("desc"===i)r.sort((t,r)=>{const i=(e.get(r.key)??0)-(e.get(t.key)??0);return 0!==i?i:n(t.key,r.key)});else{const t=[...r].sort((t,r)=>{const i=(e.get(r.key)??0)-(e.get(t.key)??0);return 0!==i?i:n(t.key,r.key)}),i=[],o=[];let a=0,s=0;for(const r of t)s>a?(i.push(r),a+=e.get(r.key)??0):(o.push(r),s+=e.get(r.key)??0);r.length=0,r.push(...o.reverse(),...i)}}else n();const o=t.config.curve&&"linear"!==t.config.curve?t.config.curve:void 0,a=t.config.normalize?"zero":t.config.baseline??"zero",{nodes:s,stackedTops:c}=function(t,e,r,i,n,o,a,s="zero"){const c=new Set;for(const e of t)for(const t of e.data){const e=r(t);Number.isFinite(e)&&c.add(e)}const l=Array.from(c).sort((t,e)=>t-e),u=new Map;for(const e of t){const t=new Map;for(const n of e.data){const e=r(n),o=i(n);Number.isFinite(e)&&Number.isFinite(o)&&t.set(e,(t.get(e)||0)+o)}u.set(e.key,t)}let h;if(o){h=new Map;for(const e of l){let r=0;for(const i of t)r+=u.get(i.key)?.get(e)||0;h.set(e,r||1)}}const f=W(l,t.map(t=>t.key),(t,e)=>u.get(t)?.get(e)||0,s),y="diverging"===s&&!o,g=[],p=new Map,d=new Map,m=new Map,v=new Map;for(const t of l)d.set(t,f.get(t)??0),m.set(t,0),v.set(t,0);for(const r of t){const t=u.get(r.key),i=new Map;let s=[],c=[];const f=()=>{if(s.length>=2){const t={type:"area",topPath:s,bottomPath:c,style:n(r.key,r.data[0]),datum:r.data,group:r.key};a&&(t.curve=a),g.push(t)}s=[],c=[]};for(const r of l){const n=t.has(r);let a,l,u=n?t.get(r):0;if(o&&n&&(u/=h.get(r)),!n||!Number.isFinite(u)||0===u){f();continue}y?u>0?(a=m.get(r),l=a+u,m.set(r,l)):(a=v.get(r),l=a+u,v.set(r,l)):(a=d.get(r),l=a+u,d.set(r,l));const g=e.x(r);c.push([g,e.y(a)]),s.push([g,e.y(l)]),i.set(r,l)}f(),p.set(r.key,i)}return{nodes:g,stackedTops:p}}(r,t.scales,t.getX,t.getY,(e,r)=>t.resolveAreaStyle(e,r),t.config.normalize,o,a),l=s;if(t.config.pointStyle){const e=new WeakMap;for(const i of r){const r=c.get(i.key);if(r)for(const n of i.data){const i=t.getX(n),o=t.getY(n);null==i||Number.isNaN(i)||null==o||Number.isNaN(o)||!r.has(i)||e.set(n,r.get(i))}}const i=r=>e.get(r)??t.getY(r);j(t,r,l,i)}return l}(o,e);case"scatter":case"bubble":return function(t,e){const r=[],i="bubble"===t.config.chartType?10:5,n=t.config.sizeRange||[3,15];let o=null;if(t.getSize&&!t.config.pointStyle){const r=e.map(e=>t.getSize(e)).filter(t=>null!=t&&!Number.isNaN(t));if(r.length>0){let t=1/0,e=-1/0;for(const i of r)t>i&&(t=i),i>e&&(e=i);o=r=>t===e?(n[0]+n[1])/2:n[0]+(r-t)/(e-t)*(n[1]-n[0])}}const a=t.getColor?t.resolveColorMap(e):null,s=t.config.themeSemantic?.primary||"#4e79a7",c=t.getSymbol,l=t.config.symbolMap,u=new Map;let h=0;const f=t=>{const e=l?.[t];if(e)return e;let r=u.get(t);return r||(r=d[h%d.length],h++,u.set(t,r)),r};for(const n of e){let e=t.config.pointStyle?t.config.pointStyle(n):{fill:s,opacity:.8},l=e.r||i;if(o&&t.getSize){const e=t.getSize(n);null==e||Number.isNaN(e)||(l=o(e))}if(a&&t.getColor&&!e.fill){const r=t.getColor(n);r&&a.has(r)&&(e={...e,fill:a.get(r)})}const u=t.getPointId?t.getPointId(n)+"":void 0;if(c){const i=f(c(n)+""),o=X(n,t.scales,t.getX,t.getY,Math.PI*l*l,i,e,u);o&&r.push(o)}else{const i=z(n,t.scales,t.getX,t.getY,l,e,u);i&&r.push(i)}}return r}(o,e);case"heatmap":return function(t,e,r){if(t.config.heatmapAggregation)return function(t,e,r){const i=Math.max(1,Math.floor(t.config.heatmapXBins??20)),n=Math.max(1,Math.floor(t.config.heatmapYBins??20)),o=t.config.heatmapAggregation??"count",a=f(t.config.valueAccessor,"value");if(!t.scales||0===e.length)return[];const[s,c]=t.scales.x.domain(),[l,u]=t.scales.y.domain(),h=(c-s||1)/i,y=(u-l||1)/n,g=i*n;if(g>1e6)return[];const p=new Int32Array(g),d=new Float64Array(g);for(let r=0;e.length>r;r++){const o=e[r],c=t.getX(o),u=t.getY(o);if(!isFinite(c)||!isFinite(u))continue;const f=Math.min(Math.floor((c-s)/h),i-1),g=Math.min(Math.floor((u-l)/y),n-1);if(0>f||0>g)continue;const m=g*i+f;p[m]++;const v=a(o);d[m]+=isFinite(v)?v:0}let m=1/0,v=-1/0;for(let t=0;g>t;t++){if(0===p[t])continue;let e;switch(o){case"sum":e=d[t];break;case"mean":e=d[t]/p[t];break;default:e=p[t]}m>e&&(m=e),e>v&&(v=e)}if(!isFinite(m))return[];const x=v-m||1,b=r.width/i,k=r.height/n,w=t.config.showValues,_=t.config.heatmapValueFormat,A=[];for(let t=0;n>t;t++){const e=t*i;for(let r=0;i>r;r++){const i=e+r;if(0===p[i])continue;let a;switch(o){case"sum":a=d[i];break;case"mean":a=d[i]/p[i];break;default:a=p[i]}const c=(a-m)/x;A.push(G(r*b,(n-1-t)*k,b,k,`rgb(${220-(180*c+.5)|0},${220-(100*c+.5)|0},${255-(50*c+.5)|0})`,{xi:r,yi:t,value:a,count:p[i],sum:d[i],xCenter:s+(r+.5)*h,yCenter:l+(t+.5)*y,agg:o},w?{value:a,showValues:!0,valueFormat:_}:void 0))}}return A}(t,e,r);if(0===e.length)return[];const i=f(t.config.valueAccessor,"value"),n=y(t.config.xAccessor,"x"),o=y(t.config.yAccessor,"y"),a=new Map,s=new Map,c=Array(e.length),l=Array(e.length);for(let t=0;e.length>t;t++){const r=e[t],i=n(r),u=o(r);c[t]=i,l[t]=u,a.has(i)||a.set(i,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,h=s.size;if(0===u||0===h)return[];const g=Array.from(a.keys()),d=Array.from(s.keys()),m=g.every(t=>"number"==typeof t&&!isNaN(t)),x=d.every(t=>"number"==typeof t&&!isNaN(t));if(m){g.sort((t,e)=>Number(t)-Number(e)),a.clear();for(let t=0;g.length>t;t++)a.set(g[t],t)}if(x){d.sort((t,e)=>Number(t)-Number(e)),s.clear();for(let t=0;d.length>t;t++)s.set(d[t],t)}const b=new Float64Array(e.length),k=new Float64Array(e.length),w=Array(e.length),_=new Map;let A=0;for(let t=0;e.length>t;t++){const r=e[t],n=a.get(c[t]),o=s.get(l[t]);if(void 0===n||void 0===o)continue;const h=i(r),f=o*u+n,y=_.get(f);let g;void 0!==y?g=y:(g=A++,_.set(f,g)),b[g]=f,k[g]=h,w[g]=r}let P=1/0,L=-1/0;for(let t=0;A>t;t++){const e=k[t];isFinite(e)&&(P>e&&(P=e),e>L&&(L=e))}if(!isFinite(P)||!isFinite(L))return[];const S=function(t){const e=t in p?t:"blues";let r=q.get(e);if(r)return r;r=Array(256);const i=v(e);for(let t=0;256>t;t++)r[t]=i(t/255);return q.set(e,r),r}("string"==typeof t.config.colorScheme?t.config.colorScheme:t.config.themeSequential||"blues"),C=255/(L-P||1),M=r.width/u,D=r.height/h,E=t.config.showValues,Y=t.config.heatmapValueFormat,N=[];for(let t=0;A>t;t++){const e=k[t];if(!isFinite(e))continue;const r=b[t],i=r%u;N.push(G(i*M,(h-1-(r-i)/u)*D,M,D,S[Math.min((e-P)*C+.5|0,255)],w[t],E?{value:e,showValues:!0,valueFormat:Y}:void 0))}return N}(o,e,t);case"bar":{const t=function(t,e){if(!t.config.binSize)return{nodes:[],binBoundaries:[]};const r=U(e,t.getX,t.getY,t.config.binSize,t.getCategory);if(0===r.size)return{nodes:[],binBoundaries:[]};let i=null;if(t.getCategory){const e=new Set;for(const t of r.values())for(const r of t.categories.keys())e.add(r);const n=t.config.barColors?Object.keys(t.config.barColors):[],o=new Set(n),a=Array.from(e).filter(t=>!o.has(t)).sort(),s=n.filter(t=>e.has(t)),c=s.join("\0")+""+a.join("\0");t.barCategoryCache&&t.barCategoryCache.key===c?i=t.barCategoryCache.order:(i=[...s,...a],t.barCategoryCache={key:c,order:i})}const n=[],o=t.scales,[a,s]=o.x.domain(),c=t.config.barStyle,l=t.config.themeSemantic?.primary,u=c?.gap,h="number"!=typeof u||0>u?1:u,f={};c?.stroke&&(f.stroke=c.stroke),"number"==typeof c?.strokeWidth&&(f.strokeWidth=c.strokeWidth),"number"==typeof c?.opacity&&(f.opacity=c.opacity);for(const e of r.values()){const r=Math.max(e.start,a),u=Math.min(e.end,s);if(r>=u)continue;const y=o.x(r),g=o.x(u),p=Math.abs(g-y),d=p>h+1?h:0,m=Math.min(y,g)+d/2,v=Math.max(p-d,1);if(v>0)if(i&&e.categories.size>0){let r=0;for(const a of i){const i=e.categories.get(a)||0;if(0===i)continue;const s=o.y(r),u=o.y(r+i);n.push(B(m,Math.min(s,u),v,Math.abs(s-u),{fill:t.config.barColors?.[a]||c?.fill||l||"#4e79a7",...f},{binStart:e.start,binEnd:e.end,total:e.total,category:a,categoryValue:i},a)),r+=i}}else{const t=o.y(0),r=o.y(e.total);n.push(B(m,Math.min(t,r),v,Math.abs(t-r),{fill:c?.fill||l||"#007bff",...f},{binStart:e.start,binEnd:e.end,total:e.total}))}}const y=new Set;for(const t of r.values())y.add(t.start),y.add(t.end);return{nodes:n,binBoundaries:Array.from(y).sort((t,e)=>t-e)}}(o,e);return this._barCategoryCache=o.barCategoryCache??null,this._binBoundaries=t.binBoundaries,t.nodes}case"swarm":return function(t,e){const r=[],i=t.config.swarmStyle||{},n=i.radius??3,o=i.fill??t.config.themeSemantic?.primary??"#007bff",a=i.opacity??.7,s=i.stroke,c=i.strokeWidth;for(const i of e){const e=t.getX(i),l=t.getY(i);if(null==l||Number.isNaN(l))continue;const u=t.scales.x(e),h=t.scales.y(l);let f=o;if(t.getCategory){const e=t.getCategory(i);f=t.config.barColors?.[e]||f}const{r:y,...g}=t.config.pointStyle?.(i)??{},p={type:"point",x:u,y:h,r:y??n,style:{fill:f,opacity:a,stroke:s,strokeWidth:c,...g},datum:i};t.getPointId&&(p.pointId=t.getPointId(i)+""),r.push(p)}return r}(o,e);case"waterfall":return function(t,e,r){const i=[],n=t.scales,o=t.config.waterfallStyle,a=e.filter(e=>{const r=t.getY(e),i=t.getX(e);return null!=r&&!Number.isNaN(r)&&null!=i&&isFinite(i)});if(0===a.length)return i;const s=o?.positiveColor??t.config.themeSemantic?.success??"#28a745",c=o?.negativeColor??t.config.themeSemantic?.danger??"#dc3545",l=o?.gap??1,u=o?.stroke,h=o?.strokeWidth,f=o?.opacity;let y=0;for(let e=0;a.length>e;e++){const g=a[e],p=t.getX(g),d=t.getY(g),m=y+d;let v;v=a.length-1>e?t.getX(a[e+1])-p:e>0?p-t.getX(a[e-1]):0;const x=n.x(p),b=0!==v?n.x(p+v):x+r.width/10,k=Math.min(x,b)+l/2,w=Math.max(x,b)-l/2-k;if(0>=w){y=m;continue}const _=n.y(y),A=n.y(m),P=Math.min(_,A),L=Math.abs(_-A),S={fill:0>d?c:s,stroke:u,strokeWidth:h};null!=f&&(S.opacity=f),i.push(B(k,P,w,L,S,{...g,baseline:y,cumEnd:m,delta:d,_connectorStroke:o?.connectorStroke,_connectorWidth:o?.connectorWidth})),y=m}return i}(o,e,t);case"candlestick":return function(t,e){if(!t.getHigh||!t.getLow||!t.scales)return[];const r=t.config.candlestickRangeMode??!1;if(!(r||t.getOpen&&t.getClose))return[];const i=[],n=t.config.candlestickStyle||{},o=n.rangeColor||"#6366f1",a=r?o:n.upColor||"#28a745",s=r?o:n.downColor||"#dc3545",c=r?o:n.wickColor||"#333",l=n.wickWidth||(r?2:1),u=e.map(e=>t.getX(e)).filter(t=>null!=t&&!Number.isNaN(t)).sort((t,e)=>t-e);let h=n.bodyWidth??0;if(null==n.bodyWidth)if(u.length>1){let e=1/0;for(let r=1;u.length>r;r++){const i=Math.abs(t.scales.x(u[r])-t.scales.x(u[r-1]));i>0&&e>i&&(e=i)}h=e!==1/0?Math.max(2,Math.min(.6*e,20)):6}else h=6;for(const n of e){const e=t.getX(n);if(null==e||Number.isNaN(e))continue;const o=t.getHigh(n),u=t.getLow(n);if(null==o||Number.isNaN(o)||null==u||Number.isNaN(u))continue;const f=r?o:t.getOpen(n),y=r?u:t.getClose(n);if(!r&&[f,y].some(t=>null==t||Number.isNaN(t)))continue;const g=y>=f,p={type:"candlestick",x:t.scales.x(e),openY:t.scales.y(f),closeY:t.scales.y(y),highY:t.scales.y(o),lowY:t.scales.y(u),bodyWidth:h,upColor:a,downColor:s,wickColor:c,wickWidth:l,isUp:g,datum:n};r&&(p.isRange=!0),i.push(p)}return i}(o,e);default:return[]}}resolveBoundsStyle(t,e){return function(t,e,r,i){const n=t.boundsStyle;return"function"==typeof n?n(r||{},e):n&&"object"==typeof n?n:{fill:i(e,r).stroke||t.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,t,e,(t,e)=>this.resolveLineStyle(t,e))}computeDecayOpacity(t,e){const r=this.config.decay;return r&&e>1?Y(r,t,e):1}getDatumIndexMap(t){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const e=N(t);return this._datumIndexCache={version:this._ingestVersion,map:e},e}applyDecay(t,e){this.config.decay&&function(t,e,r,i=N(r)){const n=r.length;if(n>1)for(const r of e){if("line"===r.type){const e=Array.isArray(r.datum)?r.datum:[];if(2>e.length)continue;const o=Array(e.length);let a=!1;for(let r=0;e.length>r;r++){const s=i.get(e[r]);null!=s?(o[r]=Y(t,s,n),1>o[r]&&(a=!0)):o[r]=1}a&&(r._decayOpacities=o);continue}if("area"===r.type){const e=Array.isArray(r.datum)?r.datum:[],o=r.topPath?r.topPath.length:e.length;if(2>o)continue;if(e.length===o){const a=Array(o);let s=!1;for(let r=0;e.length>r;r++){const o=i.get(e[r]);null!=o?(a[r]=Y(t,o,n),1>a[r]&&(s=!0)):a[r]=1}s&&(r._decayOpacities=a)}else{let a=1;for(const r of e){const e=i.get(r);if(null!=e){const r=Y(t,e,n);a>r&&(a=r)}}if(1>a){const t=Array(o);t.fill(a),r._decayOpacities=t}}continue}const e=i.get(r.datum);if(null==e)continue;const o=Y(t,e,n);"heatcell"===r.type?r.style={opacity:o}:"candlestick"===r.type?r._decayOpacity=o:r.style={...r.style,opacity:(r.style?.opacity??1)*o}}}(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&&$(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,r,i){r.clear(),i.clear();for(let n=0;e.length>n;n++){const o=e[n],a=O(t,o,n);a&&("point"===o.type?r.set(a,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"glyph"===o.type?r.set(a,{x:o.x,y:o.y,r:o.size,opacity:o.style.opacity,glyph:o.glyph}):"rect"===o.type?r.set(a,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"heatcell"===o.type?r.set(a,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style?.opacity}):"candlestick"===o.type?r.set(a,{x:o.x,y:o.openY,w:o.bodyWidth,openY:o.openY,closeY:o.closeY,highY:o.highY,lowY:o.lowY,opacity:o.style?.opacity}):"line"===o.type?i.set(a,{path:o.path.map(t=>[t[0],t[1]]),opacity:o.style?.opacity}):"area"===o.type&&i.set(a,{topPath:o.topPath.map(t=>[t[0],t[1]]),bottomPath:o.bottomPath.map(t=>[t[0],t[1]]),opacity:o.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 r=this.scene[e],i=O(this.transitionContext,r,e);i&&("point"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,r:0,opacity:0}):"rect"===r.type?this.prevPositionMap.set(i,{x:r.x,y:t,w:r.w,h:0,opacity:r.style.opacity??1}):"heatcell"===r.type?this.prevPositionMap.set(i,{x:r.x,y:r.y,w:r.w,h:r.h,opacity:0}):"line"===r.type?(r._introClipFraction=0,this.prevPathMap.set(i,{path:r.path.map(t=>[t[0],t[1]]),opacity:r.style.opacity})):"area"===r.type&&(r._introClipFraction=0,this.prevPathMap.set(i,{topPath:r.topPath.map(t=>[t[0],t[1]]),bottomPath:r.bottomPath.map(t=>[t[0],t[1]]),opacity:r.style.opacity})))}}startTransition(){if(!this.config.transition)return;const t=function(t,e,r,i,n,o=l()){if(0===i.size&&0===n.size)return r;const a=e.duration??300;if(r.exitNodes.length>0){const t=new Set(r.exitNodes);r.scene=r.scene.filter(e=>!t.has(e)),r.exitNodes=[]}let s=!1;const c=new Set,u=new Set;for(let e=0;r.scene.length>e;e++){const o=r.scene[e],a=O(t,o,e);if(!a)continue;if(o._transitionKey=a,"line"===o.type||"area"===o.type){const t=n.get(a);if(t){if(u.add(a),"line"===o.type&&t.path&&t.path.length===o.path.length){o._targetPath=o.path.map(t=>[t[0],t[1]]),o._prevPath=t.path;for(let e=0;o.path.length>e;e++)o.path[e]=[t.path[e][0],t.path[e][1]];s=!0}else if("area"===o.type&&t.topPath&&t.bottomPath&&t.topPath.length===o.topPath.length&&t.bottomPath.length===o.bottomPath.length){o._targetTopPath=o.topPath.map(t=>[t[0],t[1]]),o._targetBottomPath=o.bottomPath.map(t=>[t[0],t[1]]),o._prevTopPath=t.topPath,o._prevBottomPath=t.bottomPath;for(let e=0;o.topPath.length>e;e++)o.topPath[e]=[t.topPath[e][0],t.topPath[e][1]];for(let e=0;o.bottomPath.length>e;e++)o.bottomPath[e]=[t.bottomPath[e][0],t.bottomPath[e][1]];s=!0}o._targetOpacity=o.style.opacity??1,o._startOpacity=t.opacity??o.style.opacity??1}else o._targetOpacity=o.style.opacity??1,o._startOpacity=0,o.style={...o.style,opacity:0},s=!0;continue}const l=i.get(a);if("point"===o.type)if(l){c.add(a);const t={x:o.x,y:o.y,r:o.r};o._targetOpacity=o.style.opacity??1,l.x===t.x&&l.y===t.y&&l.r===t.r||(o._targetX=t.x,o._targetY=t.y,o._targetR=t.r,o.x=l.x,o.y=l.y,o.r=l.r??o.r,s=!0)}else o._targetOpacity=o.style.opacity??1,o.style={...o.style,opacity:0},s=!0;else if("glyph"===o.type)if(l){c.add(a);const t={x:o.x,y:o.y,size:o.size};o._targetOpacity=o.style.opacity??1,l.x===t.x&&l.y===t.y&&l.r===t.size||(o._targetX=t.x,o._targetY=t.y,o._targetR=t.size,o.x=l.x,o.y=l.y,o.size=l.r??o.size,s=!0)}else o._targetOpacity=o.style.opacity??1,o.style={...o.style,opacity:0},s=!0;else if("rect"===o.type)if(l){c.add(a);const t={x:o.x,y:o.y,w:o.w,h:o.h};o._targetOpacity=o.style.opacity??1,l.x===t.x&&l.y===t.y&&l.w===t.w&&l.h===t.h||(o._targetX=t.x,o._targetY=t.y,o._targetW=t.w,o._targetH=t.h,o.x=l.x,o.y=l.y,o.w=l.w??o.w,o.h=l.h??o.h,s=!0)}else o._targetOpacity=o.style.opacity??1,o.style={...o.style,opacity:0},s=!0;else if("heatcell"===o.type)if(l){c.add(a);const t={x:o.x,y:o.y,w:o.w,h:o.h};o._targetOpacity=o.style?.opacity??1,l.x===t.x&&l.y===t.y&&l.w===t.w&&l.h===t.h||(o._targetX=t.x,o._targetY=t.y,o._targetW=t.w,o._targetH=t.h,o.x=l.x,o.y=l.y,o.w=l.w??o.w,o.h=l.h??o.h,s=!0)}else o._targetOpacity=o.style?.opacity??1,o.style={...o.style||{},opacity:0},s=!0;else if("candlestick"===o.type)if(l&&null!=l.openY){c.add(a);const t={x:o.x,openY:o.openY,closeY:o.closeY,highY:o.highY,lowY:o.lowY};o._targetOpacity=o.style?.opacity??1,(l.x!==t.x||l.openY!==t.openY||l.closeY!==t.closeY||l.highY!==t.highY||l.lowY!==t.lowY)&&(o._targetX=t.x,o._targetOpenY=t.openY,o._targetCloseY=t.closeY,o._targetHighY=t.highY,o._targetLowY=t.lowY,o.x=l.x,o.openY=l.openY,o.closeY=l.closeY??o.closeY,o.highY=l.highY??o.highY,o.lowY=l.lowY??o.lowY,s=!0)}else o._targetOpacity=o.style?.opacity??1,o.style={...o.style||{},opacity:0},s=!0}for(const[t,e]of n)if(!u.has(t))if(t.startsWith("l:")&&e.path){const i={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};r.exitNodes.push(i),s=!0}else if(t.startsWith("a:")&&e.topPath&&e.bottomPath){const i={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};r.exitNodes.push(i),s=!0}for(const[t,e]of i)if(!c.has(t)){if(t.startsWith("p:"))r.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)r.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:"))r.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:"))r.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 i=e.openY??e.y;r.exitNodes.push({type:"candlestick",x:e.x,openY:i,closeY:e.closeY??i,highY:e.highY??i,lowY:e.lowY??i,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})}s=!0}return r.exitNodes.length>0&&(r.scene=[...r.scene,...r.exitNodes]),s&&(r.activeTransition={startTime:o,duration:a}),r}(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},r=function(t,e,r,i){if(!r.activeTransition)return!1;const n=s(t,r.activeTransition),o=a(n,"linear"===e.easing?"linear":"ease-out-cubic");for(const t of r.scene){const e=t._transitionKey;if("point"===t.type){if(void 0!==t._targetOpacity){const r=e?i.get(e):void 0;t.style.opacity=c(r?r.opacity??1:0,t._targetOpacity,o)}if(void 0===t._targetX)continue;if(!e)continue;const r=i.get(e);if(!r)continue;t.x=c(r.x,t._targetX,o),t.y=c(r.y,t._targetY,o),void 0!==t._targetR&&void 0!==r.r&&(t.r=c(r.r,t._targetR,o))}else if("glyph"===t.type){if(void 0!==t._targetOpacity){const r=e?i.get(e):void 0;t.style.opacity=c(r?r.opacity??1:0,t._targetOpacity,o)}if(void 0===t._targetX)continue;if(!e)continue;const r=i.get(e);if(!r)continue;t.x=c(r.x,t._targetX,o),t.y=c(r.y,t._targetY,o),void 0!==t._targetR&&void 0!==r.r&&(t.size=c(r.r,t._targetR,o))}else if("rect"===t.type){if(void 0!==t._targetOpacity){const r=e?i.get(e):void 0;t.style.opacity=c(r?r.opacity??1:0,t._targetOpacity,o)}if(void 0===t._targetX)continue;if(!e)continue;const r=i.get(e);if(!r)continue;t.x=c(r.x,t._targetX,o),t.y=c(r.y,t._targetY,o),void 0!==r.w&&(t.w=c(r.w,t._targetW,o)),void 0!==r.h&&(t.h=c(r.h,t._targetH,o))}else if("heatcell"===t.type){if(void 0!==t._targetOpacity){const r=e?i.get(e):void 0;t.style={...t.style||{},opacity:c(r?r.opacity??1:0,t._targetOpacity,o)}}if(void 0===t._targetX)continue;if(!e)continue;const r=i.get(e);if(!r)continue;t.x=c(r.x,t._targetX,o),t.y=c(r.y,t._targetY,o),void 0!==r.w&&(t.w=c(r.w,t._targetW,o)),void 0!==r.h&&(t.h=c(r.h,t._targetH,o))}else if("candlestick"===t.type){if(void 0!==t._targetOpacity){const r=e?i.get(e):void 0;t.style={...t.style||{},opacity:c(r?r.opacity??1:0,t._targetOpacity,o)}}if(void 0===t._targetX)continue;if(!e)continue;const r=i.get(e);if(!r)continue;t.x=c(r.x,t._targetX,o),void 0!==r.openY&&(t.openY=c(r.openY,t._targetOpenY,o)),void 0!==r.closeY&&(t.closeY=c(r.closeY,t._targetCloseY,o)),void 0!==r.highY&&(t.highY=c(r.highY,t._targetHighY,o)),void 0!==r.lowY&&(t.lowY=c(r.lowY,t._targetLowY,o))}else if("line"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:c(t._startOpacity??0,t._targetOpacity,o)}),void 0!==t._introClipFraction&&(t._introClipFraction=o);const e=t._prevPath,r=t._targetPath;if(e&&r&&e.length===t.path.length)for(let i=0;t.path.length>i;i++)t.path[i][0]=c(e[i][0],r[i][0],o),t.path[i][1]=c(e[i][1],r[i][1],o)}else if("area"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:c(t._startOpacity??0,t._targetOpacity,o)}),void 0!==t._introClipFraction&&(t._introClipFraction=o);const e=t._prevTopPath,r=t._prevBottomPath,i=t._targetTopPath,n=t._targetBottomPath;if(e&&i&&e.length===t.topPath.length)for(let r=0;t.topPath.length>r;r++)t.topPath[r][0]=c(e[r][0],i[r][0],o),t.topPath[r][1]=c(e[r][1],i[r][1],o);if(r&&n&&r.length===t.bottomPath.length)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e][0]=c(r[e][0],n[e][0],o),t.bottomPath[e][1]=c(r[e][1],n[e][1],o)}}if(n>=1){for(const t of r.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 r=0;t.path.length>r;r++)t.path[r]=e[r];t._prevPath=void 0,t._targetPath=void 0,t._introClipFraction=void 0}else if("area"===t.type){const e=t._targetTopPath,r=t._targetBottomPath;if(e)for(let r=0;t.topPath.length>r;r++)t.topPath[r]=e[r];if(r)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=r[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0,t._introClipFraction=void 0}}if(r.exitNodes.length>0){const t=new Set(r.exitNodes);r.scene=r.scene.filter(e=>!t.has(e)),r.exitNodes=[]}return r.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,r}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:r}=function(t,e,r,i){if(i&&i.version===r&&i.group===e&&i.data===t)return{result:i.result,cache:i};let n;if(e){const r=new Map;for(const i of t){const t=e(i);r.has(t)||r.set(t,[]),r.get(t).push(i)}n=Array.from(r.entries()).map(([t,e])=>({key:t,data:e}))}else n=[{key:"_default",data:t}];return{result:n,cache:{version:r,group:e,data:t,result:n}}}(t,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=r,e}resolveColorMap(t){const{map:e,cache:r}=function(t,e,r,i,o){if(o&&o.version===i)return{map:o.map,cache:o};const a=new Set;if(e)for(const r of t){const t=e(r);t&&a.add(t)}const s=Array.from(a).sort(),c=s.join("\0");if(o&&o.key===c){const t={...o,version:i};return{map:t.map,cache:t}}const l=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical||n,u=new Map;for(let t=0;s.length>t;t++)u.set(s[t],l[t%l.length]);return{map:u,cache:{key:c,map:u,version:i}}}(t,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=r,e}resolveLineStyle(t,e){return function(t,e,r,i){const n=t.lineStyle;if("function"==typeof n){const t=n(r||{},e);if(t&&!t.stroke&&e){const r=i(e);if(r)return{...t,stroke:r}}return t}const o=t.themeSemantic?.primary;return n&&"object"==typeof n?{stroke:n.stroke||o||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:i(e)||o||"#007bff",strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveAreaStyle(t,e){return function(t,e,r,i){if(t.areaStyle){const n=t.areaStyle(r||{});if(n&&!n.fill&&e){const t=i(e);if(t)return{...n,fill:t,stroke:n.stroke||t}}return n}const n=t.lineStyle;if("function"==typeof n){const t=n(r||{},e);if(t&&!t.fill&&e){const r=i(e);if(r)return{...t,fill:r,stroke:t.stroke||r}}return t}const o=t.themeSemantic?.primary;if(n&&"object"==typeof n)return{fill:n.fill||n.stroke||o||"#4e79a7",fillOpacity:n.fillOpacity??.7,stroke:n.stroke||o||"#4e79a7",strokeWidth:n.strokeWidth||2};const a=i(e)||o||"#4e79a7";return{fill:a,fillOpacity:.7,stroke:a,strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveGroupColor(t){const{color:e,groupColorCounter:i}=function(t){const{group:e,colorMapCache:r,groupColorMap:i,groupColorMapCap:o,config:a}=t;let{groupColorCounter:s}=t;if(r){const t=r.map.get(e);if(t)return{color:t,groupColorCounter:s}}const c=i.get(e);if(c)return{color:c,groupColorCounter:s};const l=(Array.isArray(a.colorScheme)&&a.colorScheme.length>0?a.colorScheme:null)||(Array.isArray(a.themeCategorical)&&a.themeCategorical.length>0?a.themeCategorical:null)||n;if(0===l.length)return{color:null,groupColorCounter:s};const u=l[s%l.length];if(s++,i.set(e,u),i.size>o){const t=i.keys().next().value;void 0!==t&&i.delete(t)}return{color:u,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:r.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=i,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=E(t),r=this.getPointId,i=t=>e.has(r(t));ft(this.buffer,this.timestampBuffer,i);const n=this.buffer.remove(i);if(0===n.length)return this.updateResults.recordNoop("remove"),n;for(const t of n)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",n.length),n}update(t,e){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const r=E(t),i=this.getPointId,n=new Set;this.buffer.forEach((t,e)=>{r.has(i(t))&&n.add(e)});const o=this.buffer.update(t=>r.has(i(t)),e);if(0===o.length)return this.updateResults.recordNoop("update"),o;for(const t of o)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.buffer.forEach((t,e)=>{n.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",o.length),o}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 r=this._customRestyle;if(r)for(const i of t){const t=this._baseStyles.get(i)??i.style??{},n=r(i,e);i.style=n?{...t,...n}: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},r=Object.keys(t).filter(r=>t[r]!==e[r]);"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 i=!1,n=!1;Object.assign(this.config,t),"pulse"in t&&this.syncPulseTimestampBuffer();const o="chartType"in t&&t.chartType!==e.chartType||"runtimeMode"in t&&t.runtimeMode!==e.runtimeMode;if(o||"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,r=t&&this.config.valueAccessor||this.config.yAccessor,a=t&&e.valueAccessor||e.yAccessor,s=o||!h(t&&this.config.timeAccessor||this.config.xAccessor,t&&e.timeAccessor||e.xAccessor),c=o||!h(r,a);(s||c)&&(t?(this.getX=f(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=f(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=f(this.config.xAccessor,"x"),this.getY=f(this.config.yAccessor,"y")),c&&this.resolvedRibbons.some(t=>"bounds"===t.kind)&&(this.resolvedRibbons=rt(this.config)),i=!0,n=!0)}if("groupAccessor"in t&&!h(t.groupAccessor,e.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?g(this.config.groupAccessor):void 0,i=!0),"categoryAccessor"in t&&!h(t.categoryAccessor,e.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?g(this.config.categoryAccessor):void 0,i=!0),"sizeAccessor"in t&&!h(t.sizeAccessor,e.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?f(this.config.sizeAccessor,"size"):void 0,i=!0),"symbolAccessor"in t&&!h(t.symbolAccessor,e.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?g(this.config.symbolAccessor):void 0,i=!0),"colorAccessor"in t&&!h(t.colorAccessor,e.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?g(this.config.colorAccessor):void 0,i=!0),"y0Accessor"in t&&!h(t.y0Accessor,e.y0Accessor)&&(this.getY0=this.config.y0Accessor?f(this.config.y0Accessor,"y0"):void 0,i=!0,n=!0),("boundsAccessor"in t&&!h(t.boundsAccessor,e.boundsAccessor)||"band"in t&&t.band!==e.band||"boundsStyle"in t&&t.boundsStyle!==e.boundsStyle)&&(this.resolvedRibbons=rt(this.config),i=!0,n=!0),"pointIdAccessor"in t&&!h(t.pointIdAccessor,e.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?g(this.config.pointIdAccessor):void 0,i=!0),"candlestick"===this.config.chartType&&(o||"openAccessor"in t&&!h(t.openAccessor,e.openAccessor)||"closeAccessor"in t&&!h(t.closeAccessor,e.closeAccessor)||"highAccessor"in t&&!h(t.highAccessor,e.highAccessor)||"lowAccessor"in t&&!h(t.lowAccessor,e.lowAccessor))){const t=null!=this.config.openAccessor,e=null!=this.config.closeAccessor;this.getOpen=t?f(this.config.openAccessor,"open"):void 0,this.getHigh=f(this.config.highAccessor,"high"),this.getLow=f(this.config.lowAccessor,"low"),this.getClose=e?f(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e,i=!0,n=!0}if("accessorRevision"in t&&t.accessorRevision!==e.accessorRevision&&(i=!0,n=!0),!i){const r=Object.keys(t).filter(t=>!t.endsWith("Accessor")&&"timeAccessor"!==t&&"valueAccessor"!==t);for(const n of r)if(t[n]!==e[n]){i=!0;break}}i&&(n&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(r)}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}};$t.GROUP_COLOR_MAP_CAP=1e3;var Ot=$t;bt(Ot);var Ft=new Set;function It(t,e){const r="function"==typeof t?t(e.datum??null,e):t;return(i=r)&&"object"==typeof i&&"string"==typeof i.id&&"function"==typeof i.cacheKey&&"function"==typeof i.drawCanvas&&"function"==typeof i.renderStaticSVG?r:void 0;var i}function Wt(t,e){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const r=`${t}:${e}`;Ft.has(r)||(Ft.add(r),console.warn(`[Semiotic] Render backend "${t}" does not support scene node "${e}"; using the built-in renderer.`))}function zt(t){const{context:e,nodes:r,renderMode:i,pixelRatio:n,paintBuiltIn:o}=t;if(!i||"sketchy"===i)return void o(r);let a=[];const s=()=>{a.length&&(o(a),a=[])};for(const t of r){const r=It(i,t);if(!r){a.push(t);continue}let c;s(),e.save();try{c=r.drawCanvas({context:e,node:t,style:t.style??{},pixelRatio:n})}finally{e.restore()}c||(Wt(r.id,t.type??"unknown"),o([t]))}s()}function Xt(t){const{node:e,index:r,renderMode:i,fallback:n}=t,o=It(i,e);if(!o)return n();const a=o.renderStaticSVG({node:e,style:e.style??{},key:`${o.id}-${r}`});return null!=a?a:(Wt(o.id,e.type??"unknown"),n())}function Bt(t,e,r){return"exact"===r?function(t,e){const r=t.domain(),i=r[0],n=r[r.length-1],o=i instanceof Date,a=i instanceof Date?i.getTime():i,s=n instanceof Date?n.getTime():n;if(2>e||a===s)return o?[new Date(a),new Date(s)]:[a,s];const c=(s-a)/(e-1),l=Array(e);for(let t=0;e>t;t++){const r=t===e-1?s:a+t*c;l[t]=o?new Date(r):r}return l}(t,e):t.ticks(e)}function Gt(t,e){var r=t.get(e);if(!r)throw Error("missing: "+e);return r}function jt(t,e){var r,i=[],n=[],o=[],a={},s=[];function c(t){o[t]=!1,a.hasOwnProperty(t)&&Object.keys(a[t]).forEach(function(e){delete a[t][e],o[e]&&c(e)})}function l(t){var e,i,h=!1;for(n.push(t),o[t]=!0,e=0;s[t].length>e;e++)(i=s[t][e])===r?(u(r,n),h=!0):o[i]||(h=l(i));if(h)c(t);else for(e=0;s[t].length>e;e++){var f=a[i=s[t][e]];f||(a[i]=f={}),f[i]=!0}return n.pop(),h}function u(t,r){var n=[].concat(r).concat(t);e?e(n):i.push(n)}function h(e){!function(e){for(var r=0;t.length>r;r++)r>=e&&t[r]||(t[r]=[]),t[r]=t[r].filter(function(t){return t>=e})}(e);for(var r,i=function(t){for(var e=t.length,r=Array(e),i=Array(e),n=Array(e),o=Array(e),a=Array(e),s=Array(e),c=0;e>c;++c)r[c]=-1,i[c]=0,n[c]=!1,o[c]=0,a[c]=-1,s[c]=[];var l,u=0,h=[],f=[];function y(e){var c=[e],l=[e];for(r[e]=i[e]=u,n[e]=!0,u+=1;l.length>0;){var y=t[e=l[l.length-1]];if(y.length>o[e]){for(var g=o[e];y.length>g;++g){var p=y[g];if(0>r[p]){r[p]=i[p]=u,n[p]=!0,u+=1,c.push(p),l.push(p);break}n[p]&&(i[e]=0|Math.min(i[e],i[p])),0>a[p]||s[e].push(a[p])}o[e]=g}else{if(i[e]===r[e]){var d=[],m=[],v=0;for(g=c.length-1;g>=0;--g){var x=c[g];if(n[x]=!1,d.push(x),m.push(s[x]),v+=s[x].length,a[x]=h.length,x===e){c.length=g;break}}h.push(d);var b=Array(v);for(g=0;m.length>g;g++)for(var k=0;m[g].length>k;k++)b[--v]=m[g][k];f.push(b)}l.pop()}}}for(c=0;e>c;++c)0>r[c]&&y(c);for(c=0;f.length>c;c++){var g=f[c];if(0!==g.length){g.sort(function(t,e){return t-e}),l=[g[0]];for(var p=1;g.length>p;p++)g[p]!==g[p-1]&&l.push(g[p]);f[c]=l}}return{components:h,adjacencyList:f}}(t),n=i.components.filter(function(t){return t.length>1}),o=1/0,a=0;n.length>a;a++)for(var s=0;n[a].length>s;s++)o>n[a][s]&&(o=n[a][s],r=a);var c=n[r];return!!c&&{leastVertex:o,adjList:t.map(function(t,e){return-1===c.indexOf(e)?[]:t.filter(function(t){return-1!==c.indexOf(t)})})}}r=0;for(var f=t.length;f>r;){var y=h(r);if(r=y.leastVertex,s=y.adjList){for(var g=0;s.length>g;g++)for(var p=0;s[g].length>p;p++){var d=s[g][p];o[+d]=!1,a[d]={}}l(r),r+=1}else r=f}return e?void 0:i}function Vt(t){return t.y0-t.y1>0?"up":"down"}function Ht(t,e){return e(t.source)==e(t.target)}function Kt(t){var e=0;t.source.sourceLinks.forEach(function(t){e=t.circular?e+1:e});var r=0;return t.target.targetLinks.forEach(function(t){r=t.circular?r+1:r}),1>=e&&1>=r}function qt(t){return t.target.x0-t.source.x1}function Ut(t,e){var r=Qt(t),i=qt(e)/Math.tan(r);return"up"==Vt(t)?t.y1-i:t.y1+i}function Zt(t,e){var r=Qt(t),i=qt(e)/Math.tan(r);return"up"==Vt(t)?t.y1+i:t.y1-i}function Qt(t){var e=Math.abs(t.y1-t.y0);return Math.atan(Math.abs(t.target.x0-t.source.x1)/e)}function Jt(t,e){return e(t)}function te(t){return re(t.source)}function ee(t){return re(t.target)}function re(t){return(t.y0+t.y1)/2}function ie(t){return t.virtual?0:t.value}function ne(t,e){var r=0;t.sourceLinks.forEach(function(t){r=t.circular&&!Ht(t,e)?r+1:r});var i=0;return t.targetLinks.forEach(function(t){i=t.circular&&!Ht(t,e)?i+1:i}),r+i}function oe(t){return t.target.depth}function ae(t,e){return t.sourceLinks.length?t.depth:e-1}function se(t,e){return t.y0-e.y0}function ce(t,e){return e.y0-t.y0}function le(t,e){return t.y1-e.y1}function ue(t,e){return e.y1-t.y1}function he(t,e){return ye(t.source,e.source)||t.index-e.index}function fe(t,e){return ye(t.target,e.target)||t.index-e.index}function ye(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function ge(t,e){return pe(t)==pe(e)?"bottom"==t.circularLinkType?ce(t,e):se(t,e):pe(e)-pe(t)}function pe(t){return t.target.column-t.source.column}function de(t,e){return me(t)==me(e)}function me(t){return t.y0-t.y1>0?"up":"down"}import{min as ve}from"d3-array";function xe(t,e,r,i,n){let o=t;var a=Math.max(8,.15*(o.y1-o.y0));o.links.forEach(function(t){t.circular&&(t._circularWidth=Math.min(t.width,a))});var s=ve(o.links,function(t){return t.source.y0});o.links.forEach(function(t){t.circular&&(t.circularPathData={})});var c=o.links.filter(function(t){return t.circular});return c.sort(function(t,e){return e.value-t.value}),c.forEach(function(t,e){t._circularStub=e>=4}),be(o.links.filter(function(t){return"top"==t.circularLinkType}),e,r),be(o.links.filter(function(t){return"bottom"==t.circularLinkType}),e,r),o.links.forEach(function(t){if(t.circular){if(t.circularPathData.arcRadius=t._circularWidth+i,t.circularPathData.rightNodeBuffer=5,t.circularPathData.leftNodeBuffer=5,t.circularPathData.sourceWidth=t.source.x1-t.source.x0,t.circularPathData.sourceX=t.source.x0+t.circularPathData.sourceWidth,t.circularPathData.targetX=t.target.x0,t.circularPathData.sourceY=t.y0,t.circularPathData.targetY=t.y1,Ht(t,e)&&Kt(t))t.circularPathData.rightSmallArcRadius=i+t._circularWidth/2,t.circularPathData.rightLargeArcRadius=i+t._circularWidth/2,t.circularPathData.leftSmallArcRadius=i+t._circularWidth/2,t.circularPathData.leftLargeArcRadius=i+t._circularWidth/2,"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=t.source.y1+n+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=t.source.y0-n-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius);else{var a=t.source.column,c=t.circularLinkType,l=o.links.filter(function(t){return t.source.column==a&&t.circularLinkType==c});l.sort("bottom"==t.circularLinkType?ce:se);var u=0;l.forEach(function(e,n){e.circularLinkID==t.circularLinkID&&(t.circularPathData.rightSmallArcRadius=i+t._circularWidth/2+u,t.circularPathData.rightLargeArcRadius=i+t._circularWidth/2+n*r+u),u+=e._circularWidth||e.width}),a=t.target.column,(l=o.links.filter(function(t){return t.target.column==a&&t.circularLinkType==c})).sort("bottom"==t.circularLinkType?ue:le),u=0,l.forEach(function(e,n){e.circularLinkID==t.circularLinkID&&(t.circularPathData.leftSmallArcRadius=i+t._circularWidth/2+u,t.circularPathData.leftLargeArcRadius=i+t._circularWidth/2+n*r+u),u+=e._circularWidth||e.width}),"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=Math.max(o.y1,t.source.y1,t.target.y1)+n+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=s-n-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius)}t.circularPathData.rightInnerExtent=t.circularPathData.sourceX+t.circularPathData.rightNodeBuffer,t.circularPathData.leftInnerExtent=t.circularPathData.targetX-t.circularPathData.leftNodeBuffer,t.circularPathData.rightFullExtent=t.circularPathData.sourceX+t.circularPathData.rightLargeArcRadius+t.circularPathData.rightNodeBuffer,t.circularPathData.leftFullExtent=t.circularPathData.targetX-t.circularPathData.leftLargeArcRadius-t.circularPathData.leftNodeBuffer}t.path=t.circular?function(t){return"top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY}(t):function(t){var e=t.source.x1,r=t.y0,i=t.target.x0,n=t.y1,o=(e+i)/2;return"M"+e+","+r+"C"+o+","+r+" "+o+","+n+" "+i+","+n}(t)}),o}function be(t,e,r){t.sort(ge);var i=t.filter(function(t){return!t._circularStub});return t.forEach(function(t,n){var o=0;if(t._circularStub)t.circularPathData.verticalBuffer=0;else if(Ht(t,e)&&Kt(t))t.circularPathData.verticalBuffer=o+t._circularWidth/2;else{for(var a=0;i.length>a;a++){var s=i[a];if(s!==t&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&ke(t,s)){var c=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+r;o=c>o?c:o}}t.circularPathData.verticalBuffer=o+t._circularWidth/2}}),t}function ke(t,e){return t.source.column>=e.target.column&&e.source.column>=t.target.column}import{min as we,max as _e,sum as Ae,mean as Pe,group as Le,groups as Se}from"d3-array";function Ce(t){return function(){return t}}function Me(t){return t.index}function De(t){return t.nodes}function Ee(t){return t.links}function Ye(t,e,r){var i=Se(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});i.forEach(function(n,o){var a=n.length;if(e)n.sort(e);else if(o>0){var s=new Map;n.forEach(function(t,e){var r,i,n,o=(i=0,n=0,(r=t).targetLinks.forEach(function(t){if(!t.circular){var e=t.value||1;n+=re(t.source)*e,i+=e}}),r.sourceLinks.forEach(function(t){if(!t.circular){var e=t.value||1;n+=re(t.target)*e,i+=e}}),i>0?n/i:NaN);s.set(t,{bc:o,idx:e})}),n.sort(function(t,e){var r=s.get(t),i=s.get(e),n=r.bc,o=i.bc;if(t.circularLinkType!==e.circularLinkType){if("top"==t.circularLinkType&&"bottom"==e.circularLinkType)return-1;if("bottom"==t.circularLinkType&&"top"==e.circularLinkType)return 1;if("top"==t.circularLinkType)return-1;if("top"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return-1}return isNaN(n)||isNaN(o)?isNaN(n)?isNaN(o)?r.idx-i.idx:1:-1:n-o})}else n.sort(function(t,e){return t.circularLinkType==e.circularLinkType?ne(e,r)-ne(t,r):"top"==t.circularLinkType&&"bottom"==e.circularLinkType||"top"==t.circularLinkType&&0==e.partOfCycle||0==t.partOfCycle&&"bottom"==e.circularLinkType?-1:0});n.forEach(function(e,n){e.depth==i.length-1&&1==a||0==e.depth&&1==a?(e.y0=t.y1/2-e.value*t.ky,e.y1=e.y0+e.value*t.ky):e.partOfCycle?0==ne(e,r)?(e.y0=t.y1/2+n,e.y1=e.y0+e.value*t.ky):"top"==e.circularLinkType?(e.y0=t.y0+n,e.y1=e.y0+e.value*t.ky):(e.y0=t.y1-e.value*t.ky-n,e.y1=e.y0+e.value*t.ky):0==t.y0||0==t.y1?(e.y0=(t.y1-t.y0)/a*n,e.y1=e.y0+e.value*t.ky):(e.y0=(t.y1-t.y0)/2-a/2+n,e.y1=e.y0+e.value*t.ky)})})}function Ne(t,e,r,i,n,o){var a=Se(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});u();for(var s=1,c=o;c>0;--c)l(s*=.99,r),u();function l(e,r){var i=a.length;a.forEach(function(n){var o=n.length,a=n[0].depth;n.forEach(function(n){var s;if(n.sourceLinks.length||n.targetLinks.length)if(n.partOfCycle&&ne(n,r)>0){var c=Pe(n.sourceLinks,ee),l=Pe(n.targetLinks,te),u=c&&l?(c+l)/2:c||l;if(u){var h=(u-re(n))*e*.3;n.y0+=h,n.y1+=h}}else if(0==a&&1==o)n.y0=t.y1/2-(s=n.y1-n.y0)/2,n.y1=t.y1/2+s/2;else if(a==i-1&&1==o)n.y0=t.y1/2-(s=n.y1-n.y0)/2,n.y1=t.y1/2+s/2;else if(1==n.targetLinks.length&&1==n.targetLinks[0].source.sourceLinks.length)s=n.y1-n.y0,n.y0=n.targetLinks[0].source.y0,n.y1=n.y0+s;else{var f=Pe(n.sourceLinks,ee),y=Pe(n.targetLinks,te),g=((f&&y?(f+y)/2:f||y)-re(n))*e;n.y0+=g,n.y1+=g}})})}function u(){a.forEach(function(r){var o,a,s,c=t.y0,l=r.length;for(r.sort(e||ye),s=0;l>s;++s)(a=c-(o=r[s]).y0)>0&&(o.y0+=a,o.y1+=a),c=o.y1+i;if((a=c-i-t.y1)>0)for(c=o.y0-=a,o.y1-=a,s=l-2;s>=0;--s)(a=(o=r[s]).y1+n-c)>0&&(o.y0-=a,o.y1-=a),c=o.y0})}}function Re(t){t.nodes.forEach(function(t){t.sourceLinks.sort(fe),t.targetLinks.sort(he)}),t.nodes.forEach(function(t){var e=t.y0,r=e,i=t.y1,n=i;t.sourceLinks.forEach(function(t){t.circular?(t.y0=i-t.width/2,i-=t.width):(t.y0=e+t.width/2,e+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=n-t.width/2,n-=t.width):(t.y1=r+t.width/2,r+=t.width)})})}function Te(){var t=0,e=0,r=1,i=1,n=24,o=8,a=null,s=Me,c=ae,l=void 0,u=32,h=2,f=De,y=Ee;function g(){var g={nodes:f.apply(null,arguments),links:y.apply(null,arguments)};return function(f){f.x0=t,f.y0=e,f.x1=r,f.y1=i,f.py=0,function(t,e){t.nodes.forEach(function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]});var r=function(t,e){var r=new Map;return Le(t,e).forEach(function(t,e){r.set(e,t[0])}),r}(t.nodes,e);t.links.forEach(function(t,e){t.index=e;var i=t.source,n=t.target;"object"!=typeof i&&(i=t.source=Gt(r,i)),"object"!=typeof n&&(n=t.target=Gt(r,n)),i.sourceLinks.push(t),n.targetLinks.push(t)})}(f,s),function(t,e){var r=0;if(null==e){for(var i=[],n=0;t.links.length>n;n++){var o=t.links[n],a=o.source.index,s=o.target.index;i[a]||(i[a]=[]),i[s]||(i[s]=[]),-1===i[a].indexOf(s)&&i[a].push(s)}var c=jt(i);c.sort(function(t,e){return t.length-e.length});var l={};for(n=0;c.length>n;n++){var u=c[n].slice(-2);l[u[0]]||(l[u[0]]={}),l[u[0]][u[1]]=!0}t.links.forEach(function(t){var e=t.target.index,i=t.source.index;e===i||l[i]&&l[i][e]?(t.circular=!0,t.circularLinkID=r++):t.circular=!1})}else t.links.forEach(function(t){e(t.source)<e(t.target)?t.circular=!1:(t.circular=!0,t.circularLinkID=r++)})}(f,l),function(t,e){var r=0,i=0;t.links.forEach(function(n){n.circular&&(n.circularLinkType=n.source.circularLinkType||n.target.circularLinkType?n.source.circularLinkType?n.source.circularLinkType:n.target.circularLinkType:i>r?"top":"bottom","top"==n.circularLinkType?r++:i++,t.nodes.forEach(function(t){Jt(t,e)!=Jt(n.source,e)&&Jt(t,e)!=Jt(n.target,e)||(t.circularLinkType=n.circularLinkType)}))}),t.links.forEach(function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),Ht(t,e)&&(t.circularLinkType=t.source.circularLinkType))})}(f,s),function(t){t.nodes.forEach(function(t){t.partOfCycle=!1,t.value=Math.max(Ae(t.sourceLinks,ie),Ae(t.targetLinks,ie)),t.sourceLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}),t.targetLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})})}(f),function(t,e,r){var i,n,o;if(null!=e){t.nodes.sort(function(t,r){return e(t)<e(r)?-1:1});var a=0,s=e(t.nodes[0]);t.nodes.forEach(function(t){a=e(t)==s?a:a+1,s=e(t)==s?s:e(t),t.column=a})}for(i=t.nodes,n=[],o=0;i.length;++o,i=n,n=[])i.forEach(function(t){t.depth=o,t.sourceLinks.forEach(function(t){0>n.indexOf(t.target)&&!t.circular&&n.push(t.target)})});for(i=t.nodes,n=[],o=0;i.length;++o,i=n,n=[])i.forEach(function(t){t.height=o,t.targetLinks.forEach(function(t){0>n.indexOf(t.source)&&!t.circular&&n.push(t.source)})});t.nodes.forEach(function(t){t.column=null==e?r(t,o):t.column})}(f,l,c);var y=o;if(null!==a){var g=Se(f.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]}),p=_e(g,function(t){return t.length});p>1&&(y=Math.max(1,(i-e)*a/(p-1)))}(function(t,e,r){var i=Se(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});t.py=e;var n=we(i,function(e){return(t.y1-t.y0-(e.length-1)*t.py)/Ae(e,function(t){return t.value})});t.ky=n,t.links.forEach(function(e){e.width=e.value*t.ky});var o=_e(t.nodes,function(t){return t.column});t.nodes.forEach(o>0?function(e){e.x0=t.x0+e.column*((t.x1-t.x0-r)/o),e.x1=e.x0+r}:function(e){e.x0=t.x0,e.x1=e.x0+r})})(f,y,n),Ye(f,l,s),Ne(f,l,s,y,y,u),Re(f),xe(f,s,h,10,8),Ye(f,l,s),Ne(f,l,s,y,y,u),Re(f),xe(f,s,h,10,8),function(t,e){let r=t;r.nodes.forEach(function(t){t.y+(t.y1-t.y0)>r.y1&&(t.y=t.y-(t.y+(t.y1-t.y0)-r.y1));var i=r.links.filter(function(r){return Jt(r.source,e)==Jt(t,e)}),n=i.length;n>1&&i.sort(function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!de(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var r=Ut(e,t);return t.y1-r}if(e.target.column>t.target.column)return Ut(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0});var o=t.y0;i.forEach(function(t){t.y0=o+t.width/2,o+=t.width}),i.forEach(function(e,r){if("bottom"==e.circularLinkType){for(var o=r+1,a=0;n>o;o++)a+=i[o].width;e.y0=t.y1-a-e.width/2}})})}(f,s),function(t,e){let r=t;r.nodes.forEach(function(t){var i=r.links.filter(function(r){return Jt(r.target,e)==Jt(t,e)}),n=i.length;n>1&&i.sort(function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!de(t,e))return t.y0-e.y0;if(t.source.column>e.source.column){var r=Zt(e,t);return t.y0-r}if(e.source.column>t.source.column)return Zt(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0});var o=t.y0;i.forEach(function(t){t.y1=o+t.width/2,o+=t.width}),i.forEach(function(e,r){if("bottom"==e.circularLinkType){for(var o=r+1,a=0;n>o;o++)a+=i[o].width;e.y1=t.y1-a-e.width/2}})})}(f,s),function(t){var e=t.nodes,r=t.links,i=!1,n=!1;if(r.forEach(function(t){"top"==t.circularLinkType?i=!0:"bottom"==t.circularLinkType&&(n=!0)}),0==i||0==n){let i=function(e){return(e-o)/(a-o)*(t.y1-t.y0)+t.y0};var o=we(e,function(t){return t.y0}),a=_e(e,function(t){return t.y1}),s=(t.y1-t.y0)/(a-o);1>s?(e.forEach(function(t){t.y0=i(t.y0),t.y1=i(t.y1)}),r.forEach(function(t){t.y0=i(t.y0),t.y1=i(t.y1),t.width=t.width*s})):e.forEach(function(t){var e=t.y1-t.y0,r=i(t.y0)-t.y0;t.y0=i(t.y0),t.y1=t.y0+e,t.sourceLinks.forEach(function(t){t.y0=t.y0+r}),t.targetLinks.forEach(function(t){t.y1=t.y1+r})})}}(f),xe(f,s,h,10,8)}(g),g}return g.update=function(t){return Re(t),xe(t,s,h,10,8),t},g.nodeWidth=function(t){return arguments.length?(n=+t,g):n},g.nodePadding=function(t){return arguments.length?(o=+t,g):o},g.nodePaddingRatio=function(t){return arguments.length?(a=+t,g):a},g.nodes=function(t){return arguments.length?(f="function"==typeof t?t:Ce(t),g):f},g.links=function(t){return arguments.length?(y="function"==typeof t?t:Ce(t),g):y},g.nodeId=function(t){return arguments.length?(s="function"==typeof t?t:Ce(t),g):s},g.nodeAlign=function(t){return arguments.length?(c="function"==typeof t?t:Ce(t),g):c},g.nodeSort=function(t){return arguments.length?(l=t,g):l},g.iterations=function(t){return arguments.length?(u=+t,g):u},g.circularLinkGap=function(t){return arguments.length?(h=+t,g):h},g.extent=function(n){return arguments.length?(t=+n[0][0],e=+n[0][1],r=+n[1][0],i=+n[1][1],g):[[t,e],[r,i]]},g.size=function(n){return arguments.length?(t=e=0,r=+n[0],i=+n[1],g):[r-t,i-e]},g}import{interpolateNumber as $e}from"d3-interpolate";import{line as Oe,curveLinearClosed as Fe}from"d3-shape";function Ie(t){const{sx:e,sTop:r,sBot:i,tx:n,tTop:o,tBot:a,cp1X:s,cp2X:c}=t,l=(r+i)/2,u=(o+a)/2;return{pathD:[`M${e},${r}`,`C${s},${r} ${c},${o} ${n},${o}`,`L${n},${a}`,`C${c},${a} ${s},${i} ${e},${i}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:e,y:l},{x:s,y:l},{x:c,y:u},{x:n,y:u}],halfWidth:(i-r)/2}}}var We=t=>{let e,r,i,n,o,a,s,c,l;if("down"===t.direction)return e=t.y0-t.sankeyWidth/2,r=t.y1-t.sankeyWidth/2,i=t.y1+t.sankeyWidth/2,n=t.y0+t.sankeyWidth/2,o=t.source.x1,a=t.target.x0,s=$e(o,a),c=s(.5),l=s(.5),`M${e},${o}C${e},${c} ${r},${l} ${r},${a}L${i},${a}C${i},${l} ${n},${c} ${n},${o}Z`;const u=t.sankeyWidth/2,h=$e(t.source.x1,t.target.x0),{pathD:f}=Ie({sx:t.source.x1,sTop:t.y0-u,sBot:t.y0+u,tx:t.target.x0,tTop:t.y1-u,tBot:t.y1+u,cp1X:h(.5),cp2X:h(.5)});return f};function ze(t){const e=t.sankeyWidth/2,r=(t._circularWidth??t.sankeyWidth)/2,i=t.circularPathData;if(!i)return null;if("down"===t.direction)return null;if(t._circularStub){const r=i.sourceX,n=i.sourceY,o=i.targetX,a=i.targetY;if("object"!=typeof t.source||!t.source||"object"!=typeof t.target||!t.target)return null;const s=Math.max(15,Math.min(40,.33*(i.rightFullExtent-r))),c=Math.max(15,Math.min(40,.33*(o-i.leftFullExtent)));return`M${r},${n-e}L${r+s},${n-e}L${r+s},${n+e}L${r},${n+e}ZM${o},${a-e}L${o-c},${a-e}L${o-c},${a+e}L${o},${a+e}Z`}const n=i.sourceX,o=i.sourceY,a=i.targetX,s=i.targetY,c=i.rightFullExtent,l=i.leftFullExtent,u=i.verticalFullExtent,h="bottom"===t.circularLinkType?1:-1,f=Math.max(4,Math.min(r,15));return`M${n},${o-h*e}L${c},${o-h*e}L${c+r},${o-h*e+h*f}L${c+r},${u+h*r-h*f}L${c+r-f},${u+h*r}L${l-r+f},${u+h*r}L${l-r},${u+h*r-h*f}L${l-r},${s-h*e+h*f}L${l-r+f},${s-h*e}L${a},${s-h*e}L${a},${s+h*e}L${l+r},${s+h*e}L${l+r},${u-h*r}L${c-r},${u-h*r}L${c-r},${o+h*e}L${n},${o+h*e}Z`}var Xe={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?Math.min.apply(Math,t.sourceLinks.map(oe))-1:0},justify:ae};function Be(t){return"string"==typeof t?t:t.id}var Ge={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,r,i){if(0===t.length)return;const n="vertical"===r.orientation?"down":"right",o=r.nodeAlign||"justify",a=r.nodeWidth??15,s=r.nodePaddingRatio??.05,c=r.iterations??100,l=t.map(t=>({...t})),u=e.map(t=>({...t,source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id,value:Math.sqrt(Math.max(1,t.value||1))}));let h;h="down"===n?[[0,0],[i[1],i[0]]]:[[0,0],[i[0],i[1]]];const f=Te().extent(h).links(u).nodes(l).nodeAlign(Xe[o]||ae).nodeId(t=>t.id).nodeWidth(a).iterations(c);f.nodePaddingRatio&&f.nodePaddingRatio(s),f();{let t=1/0,e=-1/0,r=1/0,n=-1/0;for(const i of l)t>i.x0&&(t=i.x0),i.x1>e&&(e=i.x1),r>i.y0&&(r=i.y0),i.y1>n&&(n=i.y1);for(const i of u){if(!i.circular||!i.circularPathData)continue;const o=i.circularPathData,a=(i._circularWidth??i.width??0)/2;t>o.leftFullExtent-a&&(t=o.leftFullExtent-a),o.rightFullExtent+a>e&&(e=o.rightFullExtent+a),r>o.verticalFullExtent-a&&(r=o.verticalFullExtent-a),o.verticalFullExtent+a>n&&(n=o.verticalFullExtent+a)}const o=e-t,a=n-r,s=i[0],c=i[1];if(o>0&&a>0&&(0>t||0>r||e>s||n>c)){const e=Math.min(s/o,c/a),i=-t*e+(s-o*e)/2,n=-r*e+(c-a*e)/2;for(const t of l)t.x0=t.x0*e+i,t.x1=t.x1*e+i,t.y0=t.y0*e+n,t.y1=t.y1*e+n;for(const t of u)if(t.y0=t.y0*e+n,t.y1=t.y1*e+n,t.width=(t.width??0)*e,t._circularWidth&&(t._circularWidth*=e),t.circular&&t.circularPathData){const r=t.circularPathData;r.sourceX=r.sourceX*e+i,r.targetX=r.targetX*e+i,r.sourceY=r.sourceY*e+n,r.targetY=r.targetY*e+n,r.rightFullExtent=r.rightFullExtent*e+i,r.leftFullExtent=r.leftFullExtent*e+i,r.verticalFullExtent=r.verticalFullExtent*e+n,r.rightInnerExtent=r.rightInnerExtent*e+i,r.leftInnerExtent=r.leftInnerExtent*e+i,r.verticalRightInnerExtent=r.verticalRightInnerExtent*e+n,r.verticalLeftInnerExtent=r.verticalLeftInnerExtent*e+n,r.rightSmallArcRadius*=e,r.rightLargeArcRadius*=e,r.leftSmallArcRadius*=e,r.leftLargeArcRadius*=e,r.sourceWidth*=e,r.rightNodeBuffer*=e,r.leftNodeBuffer*=e,r.arcRadius*=e}}}const y=new Map;for(const e of t)y.set(e.id,e);for(const t of l){const e=y.get(t.id);e&&(e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.value=t.value,e.depth=t.depth,e.sourceLinks=t.sourceLinks,e.targetLinks=t.targetLinks,e.width=t.x1-t.x0,e.height=t.y1-t.y0,e.x=t.x0+(t.x1-t.x0)/2,e.y=t.y0+(t.y1-t.y0)/2)}const g=new Map;for(const t of e)g.set(t._edgeKey?t._edgeKey:`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const t of u){const e=Be(t.source),r=Be(t.target),i=g.get(t._edgeKey?t._edgeKey:`${e}\0${r}`);if(i){i.y0=t.y0,i.y1=t.y1,i.sankeyWidth=t.width??0,i.circular=!!t.circular,i.circularPathData=t.circularPathData,i._circularWidth=t._circularWidth,i._circularStub=t._circularStub,i.path=t.path,i.circularLinkType=t.circularLinkType,i.direction=n;const o=y.get(e),a=y.get(r);o&&(i.source=o),a&&(i.target=a)}}},buildScene(t,e,r,n){const o="vertical"===r.orientation?"down":"right",a=r.nodeStyle,s=r.edgeStyle,c=r.edgeOpacity??.5,l=r.edgeColorBy||"source",u=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:x,h=new Map;t.forEach((t,e)=>{h.set(t.id,u[e%u.length])});const f=[],y=[],g=[],p=new Map;for(const e of t){const t=e.x1-e.x0,r=e.y1-e.y0;if(0>=t||0>=r)continue;const n=a?a(i(e,"nodeStyle")):{},s={fill:n.fill||h.get(e.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};p.set(e.id,("string"==typeof s.fill?s.fill:null)||h.get(e.id)||"#4d430c"),f.push("down"===o?{type:"rect",x:e.y0,y:e.x0,w:r,h:t,style:s,datum:e,id:e.id,label:e.id}:{type:"rect",x:e.x0,y:e.y0,w:t,h:r,style:s,datum:e,id:e.id,label:e.id})}const d=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(const t of d){if(!t.sankeyWidth||0>=t.sankeyWidth)continue;const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;if(!e||!n)continue;let o=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999";o="function"==typeof l?l(t)||o:"target"===l?p.get(n.id)||h.get(n.id)||o:p.get(e.id)||h.get(e.id)||o;const a=s?s(i(t,"edgeStyle")):{};if(t._circularStub&&t.circular&&t.circularPathData){const e=t.circularPathData,r=t.sankeyWidth/2,i=Math.max(15,Math.min(40,.33*(e.rightFullExtent-e.sourceX))),n=Math.max(15,Math.min(40,.33*(e.targetX-e.leftFullExtent))),s=a.fill||o;y.push({type:"bezier",pathD:`M${e.sourceX},${e.sourceY-r}L${e.sourceX+i},${e.sourceY-r}L${e.sourceX+i},${e.sourceY+r}L${e.sourceX},${e.sourceY+r}Z`,style:{fill:s,fillOpacity:a.fillOpacity??c,stroke:"none",opacity:a.opacity},datum:t,_gradient:{direction:"right",from:1,to:0,x0:e.sourceX,x1:e.sourceX+i}}),y.push({type:"bezier",pathD:`M${e.targetX},${e.targetY-r}L${e.targetX-n},${e.targetY-r}L${e.targetX-n},${e.targetY+r}L${e.targetX},${e.targetY+r}Z`,style:{fill:s,fillOpacity:a.fillOpacity??c,stroke:"none",opacity:a.opacity},datum:t,_gradient:{direction:"left",from:0,to:1,x0:e.targetX-n,x1:e.targetX}});continue}let u;(u=t.circular&&t.circularPathData?ze(t):We(t),u)&&y.push({type:"bezier",pathD:u,bezierCache:t.bezier,style:{fill:a.fill||o,fillOpacity:a.fillOpacity??c,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity},datum:t})}if(!1!==r.showLabels){const e=(m=r.nodeLabel)?"function"==typeof m?m:t=>t[m]||t.id:null;for(const r of t){const t=r.x1-r.x0,i=r.y1-r.y0;if(0>=t||0>=i)continue;const a=e?e(r):r.id;if(!a)continue;let s,c,l;"down"===o?(s=r.y0+(r.y1-r.y0)/2,c=r.x1+14,l="start"):(n[0]/2>r.x0+t/2?(s=r.x0-6,l="end"):(s=r.x1+6,l="start"),c=r.y0+i/2),g.push({x:s,y:c,text:a+"",anchor:"down"===o?"middle":l,baseline:"middle",fontSize:11})}}var m;return{sceneNodes:f,sceneEdges:y,labels:g}}};import{chord as je,ribbon as Ve}from"d3-chord";import{arc as He}from"d3-shape";var Ke=x,qe={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,r,i){if(0===t.length)return;const{padAngle:n=.01,groupWidth:o=20,sortGroups:a}=r,s=Math.min(i[0],i[1])/2,c=s-o,l=i[0]/2,u=i[1]/2,h=(f=r.valueAccessor)?"function"==typeof f?f:t=>t[f]??1:t=>t.value??1;var f;const y=new Map;for(let e=0;t.length>e;e++)y.set(t[e].id,e);const g=t.length,p=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,r=y.get("string"==typeof t.source?t.source:t.source.id),i=y.get(e);if(void 0===r||void 0===i)continue;const n=h(t);p[r][i]=n}const d=je().padAngle(n);a&&d.sortGroups(a);const m=d(p),v=m.groups,x=He().innerRadius(c).outerRadius(s);for(const e of v){const r=t[e.index],i=x.centroid({innerRadius:c,outerRadius:s,startAngle:e.startAngle,endAngle:e.endAngle});r.x=i[0]+l,r.y=i[1]+u,r.__arcData={startAngle:e.startAngle,endAngle:e.endAngle}}const b=new Map;for(const e of t)b.set(e.id,e);for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,r=b.get("string"==typeof t.source?t.source:t.source.id),i=b.get(e);r&&(t.source=r),i&&(t.target=i)}const k=new Map;for(const t of e)k.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const e of m){const r=t[e.source.index].id,i=t[e.target.index].id,n=k.get(`${r}\0${i}`)||k.get(`${i}\0${r}`);n&&(n.__chordData=e)}},buildScene(t,e,r,n){const{groupWidth:o=20,edgeOpacity:a=.5}=r,s=Math.min(n[0],n[1])/2,c=s-o,l=n[0]/2,u=n[1]/2,h=r.nodeStyle,f=r.edgeStyle,y=r.edgeColorBy||"source",g=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:Ke,p=new Map;t.forEach((t,e)=>{p.set(t.id,g[e%g.length])});const d=Ve().radius(c),m=[],v=[],x=[];for(let e=0;t.length>e;e++){const r=t[e],n=r.__arcData;if(!n)continue;let o;o=h?h(i(r,"nodeStyle")).fill||p.get(r.id)||g[e%g.length]:p.get(r.id)||g[e%g.length];const a=h?h(i(r,"nodeStyle")):{};m.push({type:"arc",cx:l,cy:u,innerR:c,outerR:s,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:{fill:o,stroke:a.stroke||"black",strokeWidth:a.strokeWidth??1,opacity:a.opacity},datum:r,id:r.id,label:r.id})}for(const t of e){const e=t.__chordData;if(!e)continue;const n=d(e);if(!n)continue;const o=Ue(n,l,u);let s=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999";if(f)s=f(i(t,"edgeStyle")).fill||s;else{const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;"target"===y&&r?s=p.get(r.id)||s:e&&(s=p.get(e.id)||s)}const c=f?f(i(t,"edgeStyle")):{};v.push({type:"ribbon",pathD:o,style:{fill:s,fillOpacity:c.fillOpacity??a,stroke:c.stroke||"none",strokeWidth:c.strokeWidth,opacity:c.opacity},datum:t})}if(!1!==r.showLabels){const e=(b=r.nodeLabel)?"function"==typeof b?b:t=>t[b]||t.id:null,i=s+12;for(const r of t){const t=r.__arcData;if(!t)continue;const n=e?e(r):r.id;if(!n)continue;const o=(t.startAngle+t.endAngle)/2,a=o-Math.PI/2;x.push({x:l+Math.cos(a)*i,y:u+Math.sin(a)*i,text:n+"",anchor:o>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var b;return{sceneNodes:m,sceneEdges:v,labels:x}}};function Ue(t,e,r){const i=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!i)return t;const n=[];let o=0;for(;i.length>o;){const t=i[o];if("M"===t||"L"===t)for(n.push(t),o++;i.length>o&&!isNaN(Number(i[o]));)n.push(Number(i[o])+e+""),o++,i.length>o&&!isNaN(Number(i[o]))&&(n.push(Number(i[o])+r+""),o++);else if("C"===t)for(n.push(t),o++;i.length>o&&!isNaN(Number(i[o]));)for(let t=0;3>t&&i.length>o&&!isNaN(Number(i[o]));t++)n.push(Number(i[o])+e+""),o++,i.length>o&&!isNaN(Number(i[o]))&&(n.push(Number(i[o])+r+""),o++);else if("Q"===t)for(n.push(t),o++;i.length>o&&!isNaN(Number(i[o]));)for(let t=0;2>t&&i.length>o&&!isNaN(Number(i[o]));t++)n.push(Number(i[o])+e+""),o++,i.length>o&&!isNaN(Number(i[o]))&&(n.push(Number(i[o])+r+""),o++);else if("A"===t)for(n.push(t),o++;i.length>o&&!isNaN(Number(i[o]));)n.push(i[o++]),i.length>o&&n.push(i[o++]),i.length>o&&n.push(i[o++]),i.length>o&&n.push(i[o++]),i.length>o&&n.push(i[o++]),i.length>o&&(n.push(Number(i[o])+e+""),o++),i.length>o&&(n.push(Number(i[o])+r+""),o++);else"Z"===t||"z"===t?(n.push(t),o++):(n.push(i[o]),o++)}return n.join(" ")}import{hierarchy as Ze,tree as Qe,cluster as Je,treemap as tr,pack as er,partition as rr,treemapBinary as ir}from"d3-hierarchy";var nr=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function or(t){const[e,r,i]=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*r+.114*i>150?"#222":"#fff"}function ar(t,e,r){const i=e.nodeIDAccessor;return"function"==typeof i?i(t.data)+"":"string"==typeof i&&void 0!==t.data[i]?t.data[i]+"":void 0!==t.data.name?t.data.name+"":void 0!==t.data.id?t.data.id+"":"node-"+r}function sr(t){if(!t)return null;if("function"==typeof t){const e=t;return t=>e(t.data??t)}return e=>e.data?.[t]||e[t]||e.id}function cr(t){return Array.isArray(t.colorScheme)?t.colorScheme:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical:nr}function lr(t){return Array.isArray(t.colorScheme)&&t.colorScheme.length>0?t.colorScheme[0]:t.themeSemantic?.primary?t.themeSemantic.primary:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical[0]:"#4d430c"}function ur(t,e,r,i,n){if("horizontal"===n){const n=(t+r)/2;return`M ${t},${e} C ${n},${e} ${n},${i} ${r},${i}`}if("radial"===n){const n=(t+r)/2;return`M ${t},${e} Q ${n},${e} ${n},${(e+i)/2} T ${r},${i}`}{const n=(e+i)/2;return`M ${t},${e} C ${t},${n} ${r},${n} ${r},${i}`}}var hr={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,r,i){const n=r.__hierarchyRoot;if(!n)return;const o=r.chartType,a=function(t){if(t)return"function"==typeof t?t:e=>e[t]}(r.childrenAccessor),s=r.hierarchySum,c="function"==typeof s?s:"string"==typeof s?t=>Number(t[s])||0:t=>Number(t.value)||0,l=Ze(n,a);l.sum(c),l.sort((t,e)=>(e.value??0)-(t.value??0));const[u,h]=i;switch(o){case"tree":!function(t,e,r,i){const n=e.treeOrientation||"vertical",o=Qe();o.size("horizontal"===n?[i,r]:"radial"===n?[2*Math.PI,Math.min(r,i)/2*.8]:[r,i]),o(t)}(l,r,u,h);break;case"cluster":!function(t,e,r,i){const n=e.treeOrientation||"vertical",o=Je();o.size("horizontal"===n?[i,r]:"radial"===n?[2*Math.PI,Math.min(r,i)/2*.8]:[r,i]),o(t)}(l,r,u,h);break;case"treemap":!function(t,e,r,i){const n=e.padding??4,o=e.paddingTop??0,a=tr().size([r,i]).tile(ir).padding(n);o>0&&a.paddingTop(o),a(t)}(l,r,u,h);break;case"circlepack":!function(t,e,r,i){const n=e.padding??4;er().size([r,i]).padding(n)(t)}(l,r,u,h);break;case"partition":!function(t,e,r,i){rr().size([r,i]).padding(e.padding??1)(t)}(l,r,u,h)}const f=l.descendants();t.length=0,e.length=0;const y=new Map;for(let e=0;f.length>e;e++){const i=f[e],n={id:ar(i,r,e),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:i.value??0,depth:i.depth,data:i.data,createdByFrame:!0};"tree"===o||"cluster"===o?fr(n,i,r):"treemap"===o||"partition"===o?yr(n,i):"circlepack"===o&&gr(n,i),n.__hierarchyNode=i,t.push(n),y.set(i,n)}if("tree"===o||"cluster"===o)for(const t of f)if(t.parent){const r=y.get(t.parent),i=y.get(t);r&&i&&e.push({source:r,target:i,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,r,n){const o=r.nodeStyle||(()=>({})),a=r.edgeStyle||(()=>({}));switch(r.chartType){case"tree":case"cluster":return function(t,e,r,n,o,a){const s=[],c=[],l=[],u=r.treeOrientation||"vertical",h="radial"===u,f=n[0]/2,y=n[1]/2,g="number"==typeof(p=r.nodeSize)?p:5;var p;for(const e of t){let t=e.x,n=e.y;h&&(t+=f,n+=y);const a=o(i(e,"nodeStyle"));let c=a.fill||lr(r);if(r.colorByDepth&&void 0!==e.depth){const t=cr(r);c=t[e.depth%t.length]}s.push({type:"circle",cx:t,cy:n,r:g,style:{fill:c,stroke:a.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity},datum:e,id:e.id,label:e.id,depth:e.depth})}const d=r.edgeOpacity??.5;for(const t of e){const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;if(!e||!n)continue;let o=e.x,s=e.y,l=n.x,g=n.y;h&&(o+=f,s+=y,l+=f,g+=y);const p=ur(o,s,l,g,u),m=a(i(t,"edgeStyle"));c.push({type:"curved",pathD:p,style:{fill:"none",stroke:m.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:m.strokeWidth??1.5,opacity:m.opacity??d},datum:t})}if(!1!==r.showLabels){const e=sr(r.nodeLabel);for(const r of t){const t=e?e(r):r.id;if(!t)continue;let i,n,o,a=r.x,s=r.y;if(h&&(a+=f,s+=y),h){const t=a-f,e=s-y,r=Math.sqrt(t*t+e*e);r>0?(i=a+t/r*10,n=s+e/r*10,o=0>t?"end":"start"):(i=a,n=s-12,o="middle")}else"horizontal"===u?(r.data?.children&&0!==r.data.children.length?(i=a-g-6,o="end"):(i=a+g+6,o="start"),n=s):(i=a,n=s+g+14,o="middle");l.push({x:i,y:n,text:t+"",anchor:o,baseline:"middle",fontSize:11})}}return{sceneNodes:s,sceneEdges:c,labels:l}}(t,e,r,n,o,a);case"treemap":case"partition":return function(t,e,r,n){const o=[],a=[];for(const r of t){const t=r.x1-r.x0,a=r.y1-r.y0;if(0>=t||0>=a)continue;const s=n(i(r,"nodeStyle"));let c=s.fill||lr(e);if(e.colorByDepth&&void 0!==r.depth){const t=cr(e);c=t[r.depth%t.length]}o.push({type:"rect",x:r.x0,y:r.y0,w:t,h:a,style:{fill:c,stroke:s.stroke||e.themeSemantic?.surface||"#fff",strokeWidth:s.strokeWidth??1,opacity:s.opacity},datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==e.showLabels){const r=sr(e.nodeLabel),o=e.labelMode||"leaf",s="partition"===e.chartType;for(const c of t){const t=c.x1-c.x0,l=c.y1-c.y0;if(0>=t||0>=l)continue;const u=!(c.data?.children&&c.data.children.length>0);if(!s){if("leaf"===o&&!u)continue;if("parent"===o&&u)continue}const h=r?r(c):c.id;if(!h)continue;if((u?30:40)>t||(u?16:14)>l)continue;let f=n(i(c,"nodeStyle")).fill||lr(e);if(e.colorByDepth&&void 0!==c.depth){const t=cr(e);f=t[c.depth%t.length]}const y="string"==typeof f?or(f):e.themeSemantic?.text??"#000";a.push(u?{x:c.x0+t/2,y:c.y0+l/2,text:h+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,l)/6)),fill:y}:{x:c.x0+4,y:c.y0+12,text:h+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:y})}}return{sceneNodes:o,sceneEdges:[],labels:a}}(t,r,0,o);case"circlepack":return function(t,e,r,n){const o=[],a=[];for(const r of t){const t=r.__radius??5;if(0>=t)continue;const a=n(i(r,"nodeStyle"));let s=a.fill||lr(e);if(e.colorByDepth&&void 0!==r.depth){const t=cr(e);s=t[r.depth%t.length]}o.push({type:"circle",cx:r.x,cy:r.y,r:t,style:{fill:s,stroke:a.stroke||e.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity??.7},datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==e.showLabels){const r=sr(e.nodeLabel);for(const o of t){const t=o.__radius??5,s=r?r(o):o.id;if(!s)continue;if(15>t)continue;const c=!(o.data?.children&&o.data.children.length>0);let l=n(i(o,"nodeStyle")).fill||lr(e);if(e.colorByDepth&&void 0!==o.depth){const t=cr(e);l=t[o.depth%t.length]}if(c){const r="string"==typeof l?or(l):e.themeSemantic?.text??"#000";a.push({x:o.x,y:o.y,text:s+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,t/3)),fill:r})}else a.push({x:o.x,y:o.y-t+14,text:s+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,t/3)),fill:e.themeSemantic?.text||"#000",stroke:e.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:o,sceneEdges:[],labels:a}}(t,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function fr(t,e,r){const i=r.treeOrientation||"vertical";if("radial"===i){const r=e.x,i=e.y;t.x=i*Math.cos(r-Math.PI/2),t.y=i*Math.sin(r-Math.PI/2)}else"horizontal"===i?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);t.x0=t.x-5,t.x1=t.x+5,t.y0=t.y-5,t.y1=t.y+5,t.width=10,t.height=10}function yr(t,e){t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.x=(e.x0+e.x1)/2,t.y=(e.y0+e.y1)/2,t.width=e.x1-e.x0,t.height=e.y1-e.y0}function gr(t,e){const r=e.r??0;t.x=e.x,t.y=e.y,t.x0=e.x-r,t.x1=e.x+r,t.y0=e.y-r,t.y1=e.y+r,t.width=2*r,t.height=2*r,t.__radius=r}import{pie as pr}from"d3-shape";function dr(t){let e=t.__orbitState;return e||(e={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},t.__orbitState=e),e}var mr={sankey:Ge,force:r,chord:qe,tree:hr,cluster:hr,treemap:hr,circlepack:hr,partition:hr,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(t,e,r,i){const n=r.__hierarchyRoot;n&&function(t,e,r,i,n){const o=function(t){if("function"==typeof t)return t;const e=t||"children";return t=>t[e]||null}(r.childrenAccessor),a=function(t){if("function"==typeof t)return t;const e=t||"name";return t=>(t[e]??"")+""}(r.nodeIDAccessor),s=function(t){if(Array.isArray(t))return t;switch(t){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),c=r.orbitSize??2.95,l=r.orbitEccentricity??1,u="number"==typeof c?()=>c:c,h="number"==typeof l?()=>l:l,f=dr(r);f.metaMap.clear(),i.length=0,n.length=0;const y=new Map;function g(t){const e=y.get(t)??0;return y.set(t,e+1),0===e?t:`${t}__${e}`}const p=e[0]/2,d=e[1]/2,m=Math.min(e[0],e[1])/2*.85,v=g(a(t));i.push({id:v,x:p,y:d,x0:p,x1:p,y0:d,y1:d,width:0,height:0,value:0,depth:0,data:t}),f.metaMap.set(v,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function t(e,r,c,l,y,p,d){const m=o(e);if(!m?.length)return;const v=m.length;let x=0,b=0,k=0;for(;v>b;)b+=s[Math.min(k,s.length-1)],k++,x++;let w=0;for(let v=0;x>v;v++){const b=s[Math.min(v,s.length-1)],k=m.slice(w,w+b);if(!k.length)break;const _=(v+1)/x,A={id:r,depth:p,data:e,parentId:r},P=d?y/u(A)*_:y*_,L=pr().value(t=>{const e=o(t)?.length;return e?4:1}).sort(null)(k),S=h(A);for(let e=0;k.length>e;e++){const o=(L[e].startAngle+L[e].endAngle)/2,s=k[e],u=g(a(s)),h=c+P*Math.sin(o),y=l+P*Math.cos(o)*S;i.push({id:u,x:h,y:y,x0:h,x1:h,y0:y,y1:y,width:0,height:0,value:0,depth:p,data:s}),f.metaMap.set(u,{ring:P,angle:o,depth:p,parentId:r,eccentricity:S}),n.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),t(s,u,h,y,P,p+1,!0)}w+=b}}(t,v,p,d,m,1,!1)}(n,i,r,t,e)},buildScene(t,e,r,n){const o=r.nodeStyle,a=r.nodeSize,s="number"==typeof a?()=>a:"function"==typeof a?a:()=>6,c=[],l=[],u=[];if(!1!==r.orbitShowRings){const e=dr(r),i=new Map;for(const e of t)i.set(e.id,e);const n=new Map;for(const[,t]of e.metaMap){if(!t.parentId)continue;const e=i.get(t.parentId);if(!e)continue;const r=`${t.parentId}:${t.ring}`;n.has(r)||n.set(r,{parentX:e.x,parentY:e.y,ring:t.ring,ecc:t.eccentricity})}const o=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:t,parentY:e,ring:r,ecc:i}]of n)for(let n=0;o>n;n++){const s=n/o*Math.PI*2,c=(n+1)/o*Math.PI*2;l.push({type:"line",x1:t+r*Math.sin(s),y1:e+r*Math.cos(s)*i,x2:t+r*Math.sin(c),y2:e+r*Math.cos(c)*i,style:a,datum:null})}}for(const e of t){if(null==e.x||null==e.y)continue;const t=s(i(e,"nodeSize")),n=o?o(i(e,"nodeStyle")):{};c.push({type:"circle",cx:e.x,cy:e.y,r:t,style:{fill:n.fill||r.themeSemantic?.primary||"#6366f1",stroke:n.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??1,opacity:n.opacity??(0===(e.depth??0)?1:.85)},datum:e,id:e.id,label:e.id,depth:e.depth})}const h=new Map;for(const e of t)h.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:h.get(t.source),r="object"==typeof t.target?t.target:h.get(t.target);e&&r&&(null!=e.x&&null!=r.x&&l.push({type:"line",x1:e.x,y1:e.y,x2:r.x,y2:r.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:t}))}if(r.showLabels){const e=r.nodeLabel;for(const r of t){const t=s(i(r,"nodeSize"));if(4>=t)continue;const n="function"==typeof e?e(r):e?r.data?.[e]??r.id:r.id;u.push({x:r.x,y:r.y+t+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:c,sceneEdges:l,labels:u}},tick:(t,e,r,i,n)=>!1!==r.orbitAnimated&&(function(t,e){const r=dr(e),i=e.orbitSpeed??.25,n=e.orbitRevolution??function(t){switch(t){case"decay":return t=>Math.pow(.6,t.depth??0);case"alternate":return t=>{const e=t.depth??0;return(e%2==0?1:-1)/(e+1)};default:return t=>1/((t.depth??0)+1)}}(e.orbitRevolutionStyle),o=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,a=i*(Math.PI/6),s=new Map;for(const e of t)s.set(e.id,e);for(const e of t){const t=r.metaMap.get(e.id);if(!t||!t.parentId)continue;const i=s.get(t.parentId);if(!i)continue;const c=t.angle+o*a*n({id:e.id,depth:t.depth,data:e.data,parentId:t.parentId});e.x=i.x+t.ring*Math.sin(c),e.y=i.y+t.ring*Math.cos(c)*t.eccentricity,e.x0=e.x,e.x1=e.x,e.y0=e.y,e.y1=e.y}}(t,r),!0)}};function vr(t){return mr[t]}export{E as toIdSet,b as resolveMotionAccessor,k as compileMotionEncoding,w as opacityFromAge,_ as resolveMotionVector,A as deriveMotionVector,Y as computeDecayOpacity,N as buildDatumIndexMap,R as computePulseIntensity,T as setPulseState,$ as hasActivePulses,B as buildRectNode,D as enrichDatumWithBand,Z as warnCustomLayoutDiagnostics,tt as createCustomLayoutFailureDiagnostic,lt as ensureRingBufferCapacity,ut as createTimestampBufferForData,ht as pushWithTimestamp,ft as compactTimestampBufferForRemoval,bt as attachUpdateResultStore,Ot as PipelineStore,Bt as ticksForMode,zt as paintSceneWithBackend,Xt as renderSceneWithBackend,Ie as buildRibbonGeometry,vr as getLayoutPlugin};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{buildRegressionAnnotation as e}from"./chunk-chunk-YCQYG6J5.module.min.js";import{validateArrayData as t}from"./chunk-chunk-JCG72SGW.module.min.js";import{mergeShapeStyle as o,normalizePartialMargin as n,useChartSetup as i,useCustomChartSetup as r,useFrameImperativeHandle as a,useResolvedSelection as s}from"./chunk-chunk-BHYTYMY2.module.min.js";import{StreamXYFrame_default as l}from"./chunk-chunk-L6D3I3V7.module.min.js";import{accessorName as c,bandTooltipFields as h,buildBaseMetadataProps as d,buildCustomBehaviorProps as u,buildDefaultTooltip as m,buildTooltipProps as p}from"./chunk-chunk-FAKO3RGQ.module.min.js";import{makeXYRuleContext as f,resolveStyleRules as y}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as g,DEFAULT_COLOR as b,DEFAULT_COLORS as v,DEFAULT_SELECTION_OPACITY as x,LinkedCharts as A,MultiPointTooltip as w,defaultTooltipStyle as k,filterSparseArray as S,getColor as C,getCrosshairProps as L,getSequentialInterpolator as H,getSize as I,interpolateViridis as B,normalizeLinkedBrush as F,normalizeTooltip as R,resolveMobileInteraction as _,useBrushSelection as N,useChartLegendAndMargin as P,useChartMode as W,useChartSelection as E,useColorScale as D,useLegendInteraction as M,useSelection as T,useSelectionSelector as O,useThemeCategorical as G,useThemeSequential as z,wrapStyleWithSelection as j}from"./chunk-chunk-ODUZEEBH.module.min.js";import{getMax as $,getMinMax as Q}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartError as Y,SafeRender as V,renderEmptyState as X,renderLoadingState as q,warnMissingField as J}from"./chunk-chunk-ZCNBUZPL.module.min.js";import*as K from"react";import{useMemo as U,useCallback as Z,forwardRef as ee,useRef as te}from"react";import{useMemo as oe}from"react";function ne(e){const{colorBy:t,colorScale:n,color:i,pointRadius:r=5,radiusFn:a,fillOpacity:s=1,fallbackFill:l,baseStyleExtras:c,stroke:h,strokeWidth:d,opacity:u,effectiveSelectionHook:m,resolvedSelection:p,colorDatumAccessor:f,styleRules:g,ruleContext:v}=e,x=oe(()=>e=>{const o="function"==typeof c?c(e):c,h=o?{...o}:{};if(void 0===h.fillOpacity&&(h.fillOpacity=s),void 0===h.fill)if(t){if(n){const o=f?f(e):e;h.fill=C(o,t,n)}}else h.fill=l?l(e):i||b;return void 0===h.r&&(h.r=a?a(e):r),g&&g.length>0&&Object.assign(h,y(e,g,v?v(e):{value:void 0})),h},[t,n,i,r,a,s,l,c,f,g,v]),A=oe(()=>o(x,{stroke:h,strokeWidth:d,opacity:u}),[x,h,d,u]);return oe(()=>j(A,m??null,p),[A,m,p])}import{useCallback as ie,useMemo as re,useRef as ae,useState as se}from"react";function le(e){const{accessor:t,data:o,isPushMode:n}=e,i=ae(null),[r,a]=se(0),s=ie(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[t];if(null==e)continue;const r="number"==typeof e?e:Number(e);Number.isFinite(r)&&(i.current?(i.current[0]>r&&(i.current[0]=r,o=!0),r>i.current[1]&&(i.current[1]=r,o=!0)):(i.current=[r,r],o=!0))}o&&a(e=>e+1)},[n,t]),l=ie(()=>{n&&(i.current=null,a(e=>e+1))},[n]);return{domain:re(()=>{if(n)return i.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let r=1/0,a=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(r>n&&(r=n),n>a&&(a=n))}return Number.isFinite(r)&&Number.isFinite(a)?[r,a]:void 0},[o,t,n,r]),trackPushed:s,reset:l}}import{useEffect as ce,useMemo as he,useRef as de,useState as ue}from"react";var me="__forecastSegment",pe=null;async function fe(){return pe||(pe=await import("./chunk-statisticalOverlays-6MVAK5RW.module.min.js")),pe}var ye="__semiotic_resolvedX",ge="__semiotic_resolvedY";function be(e){const{data:t,xAccessor:o,yAccessor:n,forecast:i,anomaly:r,groupBy:a}=e,s="string"==typeof o?o:ye,l="string"==typeof n?n:ge,c=he(()=>{if(!i&&!r)return t;const e="function"==typeof o,a="function"==typeof n;return e||a?t.map(t=>{const i={...t};return e&&(i[ye]=o(t)),a&&(i[ge]=n(t)),i}):t},[t,i,r,o,n]),[h,d]=ue(null),[u,m]=ue([]),p=de(i),f=de(r);return ce(()=>{if(!i&&!r)return void((p.current||f.current)&&(d(null),m([]),p.current=i,f.current=r));let e=!1;const t=i!==p.current||r!==f.current;if(p.current=i,f.current=r,t&&(d(null),m([])),i){const t=a&&"string"==typeof a&&"object"==typeof i?{...i,_groupBy:a}:i;(async function(...e){return(await fe()).buildForecast(...e)})(c,s,l,t,r).then(t=>{e||(d(t),m(t.annotations))}).catch(()=>{e||(d(null),m([]))})}else r&&async function(...e){return(await fe()).buildAnomalyAnnotations(...e)}(r).then(t=>{e||(d(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[c,i,r,s,l,a]),{effectiveData:h?h.processedData:t,statisticalAnnotations:u,hasForecast:!!h,xAccessorKey:s,yAccessorKey:l}}import{jsx as ve}from"react/jsx-runtime";var xe=ee(function(o,n){const r=te(null),s=W(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:x="x",yAccessor:A="y",xScaleType:w,yScaleType:k,colorBy:C,colorScheme:L,styleRules:H,sizeBy:B,sizeRange:R=[3,15],symbolBy:_,symbolMap:P,pointRadius:E=5,pointOpacity:D=.8,tooltip:M,marginalGraphics:T,pointIdAccessor:O,annotations:G,regression:z,forecast:j,anomaly:$,xExtent:Q,yExtent:X,frameProps:q={},selection:ee,linkedHover:oe,linkedBrush:ie,onObservation:re,onClick:ae,hoverHighlight:se,chartId:ce,loading:he,loadingContent:de,emptyContent:ue,legendInteraction:me,legendPosition:pe,color:fe,stroke:ye,strokeWidth:ge,opacity:xe}=o,{width:Ae,height:we,enableHover:ke,showGrid:Se,showLegend:Ce,title:Le,description:He,summary:Ie,accessibleTable:Be,xLabel:Fe,yLabel:Re}=s,_e=U(()=>S(h),[h]),Ne=void 0===h,{domain:Pe,trackPushed:We,reset:Ee}=le({accessor:B,data:_e,isPushMode:Ne}),De=Z(e=>{We([e]),r.current?.push(e)},[We]),Me=Z(e=>{We(e),r.current?.pushMany(e)},[We]);a(n,{variant:"xy",frameRef:r,overrides:{push:De,pushMany:Me,clear:()=>{Ee(),r.current?.clear()}}});const Te=i({data:_e,rawData:h,colorBy:C,colorScheme:L,legendInteraction:me,legendPosition:pe,selection:ee,linkedHover:oe,fallbackFields:C?["string"==typeof C?C:""]:[],unwrapData:!1,onObservation:re,onClick:ae,hoverHighlight:se,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"Scatterplot",chartId:ce,showLegend:Ce,userMargin:y,marginDefaults:s.marginDefaults,loading:he,loadingContent:de,emptyContent:ue,width:Ae,height:we}),Oe=F(ie),Ge=N({name:Oe?.name||"__unused_brush__",xField:Oe?.xField||("string"==typeof x?x:void 0),yField:Oe?.yField||("string"==typeof A?A:void 0)}),ze=Oe?"xyBrush"===Ge.brushInteraction.brush?"xy":"xBrush"===Ge.brushInteraction.brush?"x":"y":void 0,je=K.useRef(Ge.brushInteraction);je.current=Ge.brushInteraction;const $e=Z(e=>{const t=je.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);J("Scatterplot",_e,"xAccessor",x),J("Scatterplot",_e,"yAccessor",A);const Qe=U(()=>B?Pe??[0,1]:void 0,[B,Pe]),Ye=U(()=>B?e=>I(e,B,R,Qe):void 0,[B,R,Qe]),Ve=U(()=>f(x,A),[x,A]),Xe=ne({colorBy:C,colorScale:Te.colorScale,color:fe,pointRadius:E,fillOpacity:D,radiusFn:Ye,stroke:ye,strokeWidth:ge,opacity:xe,styleRules:H,ruleContext:Ve,effectiveSelectionHook:Te.effectiveSelectionHook,resolvedSelection:Te.resolvedSelection}),qe=U(()=>m([{label:Fe||c(x),accessor:x,role:"x",format:b},{label:Re||c(A),accessor:A,role:"y",format:v},...C?[{label:c(C),accessor:C,role:"color"}]:[],...B?[{label:c(B),accessor:B,role:"size"}]:[]]),[x,A,Fe,Re,C,B,b,v]),{effectiveData:Je,statisticalAnnotations:Ke}=be({data:_e,xAccessor:x,yAccessor:A,forecast:j,anomaly:$}),Ue=U(()=>{const t=e(z);return t||0!==Ke.length?[...t?[t]:[],...G||[],...Ke]:G},[z,G,Ke]);if(Te.earlyReturn)return Te.earlyReturn;const Ze=t({componentName:"Scatterplot",data:h,accessors:{xAccessor:x,yAccessor:A}});if(Ze)return ve(Y,{componentName:"Scatterplot",message:Ze,width:Ae,height:we});const et={chartType:"scatter",...null!=h&&{data:Je},xAccessor:x,yAccessor:A,xScaleType:w,yScaleType:k,colorAccessor:C||void 0,sizeAccessor:B||void 0,..._&&{symbolAccessor:_},...P&&{symbolMap:P},sizeRange:R,pointStyle:Xe,colorScheme:L,size:[Ae,we],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Te.margin,showAxes:s.showAxes,xLabel:Fe,yLabel:Re,xFormat:b,yFormat:v,enableHover:ke,showGrid:Se,...Te.legendBehaviorProps,...d({title:Le,description:He,summary:Ie,accessibleTable:Be,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:M,defaultTooltipContent:qe}),...u({linkedHover:oe,selection:ee,onObservation:re,onClick:ae,hoverHighlight:se,mobileInteraction:Te.mobileInteraction,customHoverBehavior:Te.customHoverBehavior,customClickBehavior:Te.customClickBehavior}),...T&&{marginalGraphics:T},...O&&{pointIdAccessor:O},...Ue&&Ue.length>0&&{annotations:Ue},...Q&&{xExtent:Q},...X&&{yExtent:X},...Oe&&{brush:{dimension:ze},onBrush:$e},...Te.crosshairProps,...q};return ve(V,{componentName:"Scatterplot",width:Ae,height:we,children:ve(l,{ref:r,...et})})});xe.displayName="Scatterplot";import{useMemo as Ae,forwardRef as we,useRef as ke}from"react";import{Fragment as Se,jsx as Ce}from"react/jsx-runtime";function Le(e,t){return B(1===t?.5:e/(t-1))}var He=we(function(o,n){const r=ke(null);a(n,{variant:"xy",frameRef:r});const s=W(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:A="x",yAccessor:w="y",orderAccessor:k,orderLabel:S,styleRules:C,pointRadius:L=4,tooltip:H,pointIdAccessor:I,annotations:B,regression:F,forecast:R,anomaly:_,xExtent:N,yExtent:P,frameProps:E={},selection:D,linkedHover:M,onObservation:T,onClick:O,hoverHighlight:G,chartId:z,loading:j,loadingContent:$,emptyContent:Q,legendInteraction:X,stroke:q,strokeWidth:K,opacity:U}=o,{width:Z,height:ee,enableHover:te,showGrid:oe,title:ie,description:re,summary:ae,accessibleTable:se,xLabel:le,yLabel:ce}=s,{safeData:he,orderMap:de}=Ae(()=>{const e=h||[],t="function"==typeof A?A:e=>e[A],o="function"==typeof w?w:e=>e[w];let n=e;if(k&&e.length>0){const t="function"==typeof k?k:e=>e[k];n=[...e].sort((e,o)=>{const n=t(e),i=t(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const i=new WeakMap;let r=0;for(const e of n){const n=t(e),i=o(e);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let a=0;for(const e of n){const n=t(e),s=o(e);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&i.set(e,{idx:a++,total:r})}return{safeData:n,orderMap:i}},[h,k,A,w]);J("ConnectedScatterplot",he,"xAccessor",A),J("ConnectedScatterplot",he,"yAccessor",w);const ue=i({data:he,rawData:h,colorBy:void 0,colorScheme:void 0,legendInteraction:X,selection:D,linkedHover:M,fallbackFields:[],unwrapData:!1,onObservation:T,onClick:O,hoverHighlight:G,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"ConnectedScatterplot",chartId:z,showLegend:void 0,userMargin:y,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:j,loadingContent:$,emptyContent:Q,width:Z,height:ee}),me=ue.resolvedSelection?.unselectedOpacity??x,pe=Ae(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const n=ue.effectiveSelectionHook?.isActive,i=ue.effectiveSelectionHook?.predicate,r=100>o.length,a=o.length;e.lineCap="round";for(let t=0;a-1>t;t++){const s=o[t],l=o[t+1],c=Le(t,a),h=!n||!i||i(s.datum??s)||i(l.datum??l),d=n?h?1:me:1;r&&(e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=L+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=L,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[L,ue.effectiveSelectionHook,me]),fe=Ae(()=>[pe],[pe]),ye=Ae(()=>(e,t,o)=>{const n=e.filter(e=>"point"===e.type);if(2>n.length)return null;const i=n.length,r=100>i,a=[];for(let e=0;i-1>e;e++){const t=n[e],o=n[e+1],s=Le(e,i),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);r&&a.push(Ce("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:L+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),a.push(Ce("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:s,strokeWidth:L,strokeLinecap:"round",opacity:l},"seg-"+e))}return Ce(Se,{children:a})},[L]),ge=Ae(()=>[ye],[ye]),ve=ne({colorScale:void 0,baseStyleExtras:Ae(()=>e=>{const t=de.get(e),o=t?.idx??0,n=t?.total??1;return{fill:n>0?Le(o,n):"#6366f1",stroke:"white",strokeWidth:1,r:L,fillOpacity:1}},[L,de]),stroke:q,strokeWidth:K,opacity:U,styleRules:C,ruleContext:Ae(()=>f(A,w),[A,w]),effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection}),xe=S||("string"==typeof k?k:"Order"),we=Ae(()=>m([{label:le||c(A),accessor:A,role:"x",format:b},{label:ce||c(w),accessor:w,role:"y",format:v},...k?[{label:xe,accessor:k,role:"group"}]:[]]),[A,w,le,ce,k,xe,b,v]),He=t({componentName:"ConnectedScatterplot",data:h,accessors:{xAccessor:A,yAccessor:w}}),{effectiveData:Ie,statisticalAnnotations:Be}=be({data:he,xAccessor:A,yAccessor:w,forecast:R,anomaly:_});if(ue.earlyReturn)return ue.earlyReturn;const Fe=e(F),Re=Fe||Be.length>0?[...Fe?[Fe]:[],...B||[],...Be]:B,_e={chartType:"scatter",...null!=h&&{data:Ie},xAccessor:A,yAccessor:w,pointStyle:ve,size:[Z,ee],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue.margin,showAxes:s.showAxes,xLabel:le,yLabel:ce,xFormat:b,yFormat:v,enableHover:te,showGrid:oe,...d({title:ie,description:re,summary:ae,accessibleTable:se,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:H,defaultTooltipContent:we}),...u({linkedHover:M,selection:D,onObservation:T,onClick:O,hoverHighlight:G,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...I&&{pointIdAccessor:I},canvasPreRenderers:fe,svgPreRenderers:ge,...Re&&Re.length>0&&{annotations:Re},...N&&{xExtent:N},...P&&{yExtent:P},...ue.crosshairProps,...E};return He?Ce(Y,{componentName:"ConnectedScatterplot",message:He,width:Z,height:ee}):Ce(V,{componentName:"ConnectedScatterplot",width:Z,height:ee,children:Ce(l,{ref:r,..._e})})});He.displayName="ConnectedScatterplot";import{useMemo as Ie,useCallback as Be,useState as Fe,useEffect as Re,forwardRef as _e,useRef as Ne}from"react";import{useMemo as Pe}from"react";function We(e){const{lineWidth:t=2,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:h,opacity:d,effectiveSelectionHook:u,resolvedSelection:m,styleRules:p,ruleContext:f}=e,g=Pe(()=>(e,o)=>{const c={strokeWidth:t},h=!0===s||Array.isArray(s)&&null!=o&&s.includes(o);let d;return a?d=a(e,o):n?i&&(d=C(e,n,i)):d=r||b,void 0!==d&&(c.stroke=d,h&&(c.fill=d,c.fillOpacity=l)),p&&p.length>0&&Object.assign(c,y(e,p,f?f(e,o):{value:void 0,category:o})),c},[t,n,i,r,a,s,l,p,f]),v=Pe(()=>o(g,{stroke:c,strokeWidth:h,opacity:d}),[g,c,h,d]);return Pe(()=>j(v,u??null,m),[v,u,m])}import{jsx as Ee}from"react/jsx-runtime";var De="__lineObjectSeries",Me=_e(function(e,o){const n=Ne(null);a(o,{variant:"xy",frameRef:n});const r=W(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:d,className:p,xFormat:y,yFormat:g,axisExtent:v,xAccessor:x="x",yAccessor:A="y",lineBy:k,lineDataAccessor:L="coordinates",colorBy:H,colorScheme:I,styleRules:B,curve:F="linear",showPoints:_=!1,pointRadius:N=3,fillArea:P=!1,areaOpacity:E=.3,lineWidth:D=2,lineGradient:M,tooltip:T,pointIdAccessor:O,annotations:G,directLabel:z,gapStrategy:j="break",anomaly:$,forecast:Q,band:X,xExtent:q,yExtent:K,frameProps:U={},selection:Z,linkedHover:ee,onObservation:te,onClick:oe,hoverHighlight:ne,hoverRadius:ie,chartId:re,loading:ae,loadingContent:se,emptyContent:le,legendInteraction:ce,legendPosition:he,xScaleType:de,yScaleType:ue,color:pe,stroke:ye,strokeWidth:ge,opacity:ve}=e,{width:xe,height:Ae,enableHover:we,showGrid:ke,showLegend:Se,title:Ce,description:Le,summary:He,accessibleTable:_e,xLabel:Pe,yLabel:Me}=r,Te=Ie(()=>S(s),[s]),Oe=Array.isArray(Te[0]?.[L])?Te[0][L]:Te;J("LineChart",Oe,"xAccessor",x),J("LineChart",Oe,"yAccessor",A);const{effectiveData:Ge,statisticalAnnotations:ze}=be({data:Te,xAccessor:x,yAccessor:A,forecast:Q,anomaly:$,groupBy:k}),je="__compoundGroup",$e=!(!Q||!k),Qe=$e?je:Q?me:k,Ye=Ie(()=>{if(!$e)return Ge;const e="function"==typeof k?k:e=>e[k];return Ge.map(t=>{const o={...t};return o[je]=`${e(t)}__${t[me]||"observed"}`,o})},[Ge,$e,k]),Ve=$e?Ye:Ge,Xe=H||k,qe=Ie(()=>{if(!Q)return;const e=Q.upperBounds,t=Q.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const a=Ge;for(const e of a){const t="function"==typeof A?A(e):+e[A];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[Q,Ge,A]),Je=Be(e=>{const t="function"==typeof x?x(e):e[x],o="function"==typeof A?A(e):e[A];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[x,A]),Ke=void 0!==Ve[0]?.[L],Ue=Ke?De:Qe,Ze=Ie(()=>{if(Ke)return Ve.map((e,t)=>{const o="function"==typeof k?k(e):"string"==typeof k?e[k]:void 0,n=null==o?"line-"+t:o+"",i=Array.isArray(e[L])?e[L]:[];return{...e,[De]:n,[L]:i.map(t=>({...t,[De]:n,parentLine:e,..."string"==typeof k&&void 0!==e[k]?{[k]:e[k]}:{}}))}});if(Qe){const e=Ve.reduce((e,t)=>{const o="function"==typeof Qe?Qe(t):t[Qe];if(!e[o]){const n={[L]:[]};"string"==typeof Qe&&(n[Qe]=o),$e&&(n[me]=t[me],"string"==typeof k&&(n[k]=t[k])),e[o]=n}return e[o][L].push(t),e},{});return Object.values(e)}return[{[L]:Ve}]},[Ke,Qe,L,Ve,k,$e]),{gapProcessedLineData:et,hasGaps:tt}=Ie(()=>{if("interpolate"===j){let e=!1;const t=[];for(const o of Ze){const n=(o[L]||[]).filter(t=>!Je(t)||(e=!0,!1));n.length>0&&t.push({...o,[L]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===j){let e=!1;const t=[];for(const o of Ze){const n=o[L]||[];let i=[],r=0;const a=Ue&&"string"==typeof Ue?o[Ue]:void 0;for(const s of n)if(Je(s))e=!0,i.length>0&&(t.push({...o,[L]:i}),i=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;i.push({...s,_gapSegment:e})}i.length>0&&t.push({...o,[L]:i})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===j){let e=!1;const t="string"==typeof A?A:"y",o=[];for(const n of Ze){const i=n[L]||[],r=[];for(const o of i)Je(o)?(e=!0,r.push({...o,[t]:0})):r.push(o);o.push({...n,[L]:r})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Ze,hasGaps:!1}},[Ze,j,L,Je,Ue,A]),ot="object"==typeof z?z:{},nt=ot.position||"end",it=ot.fontSize||11,rt=Ie(()=>{if(!z||!Xe)return[];const e="function"==typeof Xe?Xe:e=>e[Xe],t=new Set;for(const o of et){const n=o[L]||[];if(0===n.length)continue;const i=e("end"===nt?n[n.length-1]:n[0])??e(o);if(null==i)continue;const r=i+"";""!==r&&t.add(r)}return Array.from(t)},[z,Xe,et,L,nt]),at=Ie(()=>{if(!z)return r.marginDefaults;const e=rt.reduce((e,t)=>Math.max(e,t.length*(.6*it)),0)+10,t="end"===nt?"right":"left";return{...r.marginDefaults,[t]:Math.max(r.marginDefaults[t]||0,e)}},[z,rt,it,nt,r.marginDefaults]),st=i({data:Ge,rawData:s,colorBy:Xe,colorScheme:I,legendInteraction:ce,legendPosition:he,selection:Z,linkedHover:ee,fallbackFields:Xe?["string"==typeof Xe?Xe:""]:[],unwrapData:!1,onObservation:te,onClick:oe,hoverHighlight:ne,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LineChart",chartId:re,showLegend:(!z||void 0!==Se)&&Se,userMargin:d,marginDefaults:at,loading:ae,loadingContent:se,emptyContent:le,width:xe,height:Ae}),lt=st.colorScale,ct=st.effectiveSelectionHook,ht=st.resolvedSelection,dt=st.customHoverBehavior,ut=st.customClickBehavior,mt=st.crosshairProps,pt=Ie(()=>{if(Xe)return Ke?e=>{const t=e.parentLine||e;return"function"==typeof Xe?Xe(t):t[Xe]}:Xe},[Xe,Ke]),ft=Ie(()=>f(x,A),[x,A]),yt=We({lineWidth:D,colorBy:pt,colorScale:lt,color:pe,fillArea:P,areaOpacity:E,stroke:ye,strokeWidth:ge,opacity:ve,effectiveSelectionHook:ct,resolvedSelection:ht,styleRules:B,ruleContext:ft}),[gt,bt]=Fe(null);Re(()=>{if(!Q)return void bt(null);let e=!1;return async function(...e){return(await fe()).createSegmentLineStyle(...e)}(yt,Q).then(t=>{e||bt(()=>t)}).catch(()=>{e||bt(null)}),()=>{e=!0}},[yt,Q]);const vt=gt||yt,xt=Ie(()=>{if(_)return e=>{const t={r:N,fillOpacity:1};return Xe?lt&&(t.fill=C(e.parentLine||e,Xe,lt)):t.fill=pe||b,t}},[_,N,Xe,lt,pe]),At=Array.isArray(P)?"mixed":P?"area":"line",wt=Ie(()=>{if(!z||!Xe)return[];const e="function"==typeof x?x:e=>e[x],t="function"==typeof A?A:e=>e[A],o="function"==typeof Xe?Xe:e=>e[Xe],n=new Map;for(const e of et){const t=e[L]||[];if(0===t.length)continue;const i="end"===nt?t[t.length-1]:t[0],r=o(i)??o(e);if(null==r)continue;const a=r+"";""===a||n.has(a)||n.set(a,i)}const i=Array.from(n.entries()).map(([o,n])=>({type:"text",label:o,["string"==typeof x?x:"x"]:e(n),["string"==typeof A?A:"y"]:t(n),dx:"end"===nt?6:-6,dy:0,color:lt?lt(o):b,fontSize:it}));i.sort((e,t)=>{const o="string"==typeof A?A:"y";return e[o]-t[o]});for(let e=1;i.length>e;e++){const t="string"==typeof A?A:"y",o=i[e-1],n=i[e];it+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=it+2)}return i},[z,Xe,lt,et,L,x,A,nt,it]),kt=st.margin,St=k||H,Ct=Ie(()=>m([{label:Pe||c(x),accessor:x,role:"x",format:y},{label:Me||c(A),accessor:A,role:"y",format:g},...St?[{label:c(St),accessor:St,role:"group"}]:[],...h(X,g)]),[x,A,Pe,Me,St,y,g,X]),Lt=t({componentName:"LineChart",data:Ke?Ge[0]?.[L]||[]:s,accessors:{xAccessor:x,yAccessor:A}}),Ht=Ie(()=>Ke||Ue||tt?et.flatMap(e=>{const t=e[L]||[];return Ue&&"string"==typeof Ue?t.map(t=>({...t,[Ue]:t[Ue]??e[Ue]})):t}):Ve,[et,L,Ke,Ue,Ve,tt]),It={chartType:At,...Array.isArray(P)&&{areaGroups:P},...M&&{lineGradient:M},...null!=s&&{data:Ht},xAccessor:x,yAccessor:A,xScaleType:de,yScaleType:ue,...q&&{xExtent:q},...!K||null==K[0]&&null==K[1]?qe?{yExtent:qe}:{}:{yExtent:K},groupAccessor:"break"===j&&tt?"_gapSegment":Ue||void 0,...X&&{band:X},curve:F,lineStyle:vt,..._&&{pointStyle:xt},size:[xe,Ae],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:kt,showAxes:r.showAxes,xLabel:Pe,yLabel:Me,xFormat:y,yFormat:g,...void 0!==v&&{axisExtent:v},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:we,showGrid:ke,...st.legendBehaviorProps,...Ce&&{title:Ce},...Le&&{description:Le},...He&&{summary:He},...void 0!==_e&&{accessibleTable:_e},...p&&{className:p},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===T?()=>null:"multi"===T?w():R(T)||Ct,..."multi"===T&&{tooltipMode:"multi"},...u({linkedHover:ee,selection:Z,onObservation:te,onClick:oe,hoverRadius:ie,hoverHighlight:ne,mobileInteraction:st.mobileInteraction,customHoverBehavior:dt,customClickBehavior:ut}),...O&&{pointIdAccessor:O},...(G?.length||ze.length||wt.length)&&{annotations:[...G||[],...ze,...wt]},...mt,...U};return st.earlyReturn?st.earlyReturn:Lt?Ee(Y,{componentName:"LineChart",message:Lt,width:xe,height:Ae}):Ee(V,{componentName:"LineChart",width:xe,height:Ae,children:Ee(l,{ref:n,...It})})});Me.displayName="LineChart";import{useMemo as Te,forwardRef as Oe,useRef as Ge}from"react";import{useMemo as ze}from"react";function je(e){const{safeData:t,data:n,areaBy:i,lineDataAccessor:r,colorBy:a,colorScale:s,color:l,stroke:d,strokeWidth:u,opacity:p,effectiveSelectionHook:f,resolvedSelection:g,areaOpacity:v,showLine:x,lineWidth:A,showPoints:w,pointRadius:k,xAccessor:S,yAccessor:L,xLabel:H,yLabel:I,xFormat:B,yFormat:F,groupField:R,styleRules:_,ruleContext:N}=e,P=void 0!==t[0]?.[r],W=ze(()=>{if(null==n)return[];if(!P&&!i)return t;let e;if(P)e=t;else{const o=i,n=t.reduce((e,t)=>{const n="function"==typeof o?o(t):t[o];if(!e[n]){const t={[r]:[]};"string"==typeof o&&(t[o]=n),e[n]=t}return e[n][r].push(t),e},{});e=Object.values(n)}return e.flatMap(e=>{const t=e[r]||[];return i&&"string"==typeof i?t.map(t=>({...t,[i]:e[i]})):t})},[n,t,i,r,P]),E=ze(()=>e=>{const t={};if(a){if(s){const o=C(e,a,s);t.fill=o,x?(t.stroke=o,t.strokeWidth=A):t.stroke="none"}}else{const e=l||b;t.fill=e,x?(t.stroke=e,t.strokeWidth=A):t.stroke="none"}return t.fillOpacity=v,_&&_.length>0&&Object.assign(t,y(e,_,N?N(e):{value:void 0})),t},[a,s,l,v,x,A,_,N]),D=ze(()=>o(E,{stroke:d,strokeWidth:u,opacity:p}),[E,d,u,p]);return{flattenedData:W,lineStyle:ze(()=>j(D,f??null,g),[D,f,g]),pointStyle:ze(()=>{if(w)return e=>{const t={r:k,fillOpacity:1};return a?s&&(t.fill=C(e.parentLine||e,a,s)):t.fill=l||b,t}},[w,k,a,s,l]),defaultTooltipContent:ze(()=>m([{label:H||c(S),accessor:S,role:"x",format:B},{label:I||c(L),accessor:L,role:"y",format:F},...R?[{label:c(R),accessor:R,role:"group"}]:[],...h(e.band,F)]),[S,L,H,I,R,B,F,e.band])}}import{jsx as $e}from"react/jsx-runtime";function Qe(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var Ye=Oe(function(e,o){const n=Ge(null);a(o,{variant:"xy",frameRef:n});const r=W(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:m,yFormat:y,xAccessor:g="x",yAccessor:b="y",areaBy:v,y0Accessor:x,gradientFill:A=!1,semanticGradient:k,lineDataAccessor:C="coordinates",colorBy:L,colorScheme:H,styleRules:I,curve:B="monotoneX",areaOpacity:F=.7,lineGradient:R,showLine:_=!0,lineWidth:N=2,showPoints:P=!1,pointRadius:E=3,tooltip:D,annotations:M,forecast:T,anomaly:O,band:G,xExtent:z,yExtent:j,frameProps:$={},selection:Q,linkedHover:X,onObservation:q,onClick:K,hoverHighlight:U,chartId:Z,loading:ee,loadingContent:te,emptyContent:oe,legendInteraction:ne,legendPosition:ie,color:re,stroke:ae,strokeWidth:se,opacity:le}=e,{width:ce,height:he,enableHover:de,showGrid:ue,showLegend:me,title:pe,description:fe,summary:ye,accessibleTable:ge,xLabel:ve,yLabel:xe}=r,Ae=Te(()=>S(s),[s]),we=L||v,ke=Te(()=>{return k&&k.length>0?{colorStops:(e=k,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Qe(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:A;var e},[k,A]);J("AreaChart",Ae,"xAccessor",g),J("AreaChart",Ae,"yAccessor",b);const Se=i({data:Ae,rawData:s,colorBy:we,colorScheme:H,legendInteraction:ne,legendPosition:ie,selection:Q,linkedHover:X,fallbackFields:we?["string"==typeof we?we:""]:[],unwrapData:!1,onObservation:q,onClick:K,hoverHighlight:U,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"AreaChart",chartId:Z,showLegend:me,userMargin:c,marginDefaults:r.marginDefaults,loading:ee,loadingContent:te,emptyContent:oe,width:ce,height:he}),{effectiveData:Ce,statisticalAnnotations:Le}=be({data:Ae,xAccessor:g,yAccessor:b,forecast:T,anomaly:O,groupBy:v}),He=Te(()=>f(g,b),[g,b]),{flattenedData:Ie,lineStyle:Be,pointStyle:Fe,defaultTooltipContent:Re}=je({safeData:Ce,data:s,areaBy:v,lineDataAccessor:C,colorBy:we,colorScale:Se.colorScale,color:re,stroke:ae,strokeWidth:se,opacity:le,effectiveSelectionHook:Se.effectiveSelectionHook,resolvedSelection:Se.resolvedSelection,areaOpacity:F,showLine:_,lineWidth:N,showPoints:P,pointRadius:E,xAccessor:g,yAccessor:b,xLabel:ve,yLabel:xe,xFormat:m,yFormat:y,groupField:v||L,band:G,styleRules:I,ruleContext:He}),_e=t({componentName:"AreaChart",data:s,accessors:{xAccessor:g,yAccessor:b}}),Ne={chartType:"area",...null!=s&&{data:Ie},xAccessor:g,yAccessor:b,groupAccessor:v||void 0,...x&&{y0Accessor:x},...G&&{band:G},...ke&&{gradientFill:ke},...R&&{lineGradient:R},curve:B,lineStyle:Be,...P&&Fe&&{pointStyle:Fe},size:[ce,he],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Se.margin,showAxes:r.showAxes,xLabel:ve,yLabel:xe,xFormat:m,yFormat:y,enableHover:de,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:ue,...Se.legendBehaviorProps,...d({title:pe,description:fe,summary:ye,accessibleTable:ge,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===D?{tooltipContent:w(),tooltipMode:"multi"}:p({tooltip:D,defaultTooltipContent:Re}),...u({linkedHover:X,selection:Q,onObservation:q,onClick:K,hoverHighlight:U,mobileInteraction:Se.mobileInteraction,customHoverBehavior:Se.customHoverBehavior,customClickBehavior:Se.customClickBehavior}),...(M&&M.length>0||Le.length>0)&&{annotations:[...M||[],...Le]},...z&&{xExtent:z},...j&&{yExtent:j},...Se.crosshairProps,...$};return Se.earlyReturn?Se.earlyReturn:_e?$e(Y,{componentName:"AreaChart",message:_e,width:ce,height:he}):$e(V,{componentName:"AreaChart",width:ce,height:he,children:$e(l,{ref:n,...Ne})})});Ye.displayName="AreaChart";import{useMemo as Ve,forwardRef as Xe,useRef as qe,useState as Je,useImperativeHandle as Ke,useCallback as Ue}from"react";import{jsx as Ze,jsxs as et}from"react/jsx-runtime";function tt(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var ot=Xe(function(e,t){const o=qe(null),n=W(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:a,className:s,xFormat:c,yFormat:h,xAccessor:m="x",seriesAAccessor:p="a",seriesBAccessor:f="b",seriesALabel:y="A",seriesBLabel:g="B",seriesAColor:b="var(--semiotic-danger, #dc2626)",seriesBColor:v="var(--semiotic-info, #2563eb)",showLines:x=!0,lineWidth:A=1.5,showPoints:w=!1,pointRadius:C=3,curve:L="linear",areaOpacity:H=.6,gradientFill:I,tooltip:B,annotations:F,xExtent:_,yExtent:N,frameProps:P={},selection:E,linkedHover:D,onObservation:M,onClick:T,hoverHighlight:O,chartId:G,loading:z,loadingContent:j,emptyContent:$,legendInteraction:Q,legendPosition:Y,pointIdAccessor:X,windowSize:q}=e,{width:J,height:K,enableHover:U,showGrid:Z,showLegend:ee,title:te,description:oe,summary:ne,accessibleTable:ie,xLabel:re,yLabel:ae}=n,se=Ve(()=>"function"==typeof m?e=>tt(m(e)):e=>tt(e[m]),[m]),le=Ve(()=>"function"==typeof p?e=>tt(p(e)):e=>tt(e[p]),[p]),ce=Ve(()=>"function"==typeof f?e=>tt(f(e)):e=>tt(e[f]),[f]),[he,de]=Je([]),ue=qe([]),me=null==r,pe=Ve(()=>S(me?he:r),[me,he,r]),fe=Ve(()=>function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let a=0,s=null,l=null,c=[];const h=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,u=e=>r.push(e),m=(e,t)=>{u({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],p=t(r),f=o(r),y=n(r);if(!Number.isFinite(p)||!Number.isFinite(f)||!Number.isFinite(y))continue;const g=h(f,y);if(null!==g)if(null!=s){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=f-l.a-(y-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(p-l.x),t=l.a+n*(f-l.a)}else e=l.x,t=l.a}u({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=g,u({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)m(c[e],s)}else for(const e of c)m(e,s);c=[],u({__x:p,__y:y>f?y:f,__y0:y>f?f:y,__diffSegment:d(s),__diffWinner:s,__valA:f,__valB:y,__sourceDatum:r}),l={x:p,a:f,b:y,w:g}}else{s=g;for(const e of c)m(e,s);c=[],u({__x:p,__y:y>f?y:f,__y0:y>f?f:y,__diffSegment:d(s),__diffWinner:s,__valA:f,__valB:y,__sourceDatum:r}),l={x:p,a:f,b:y,w:g}}else c.push({x:p,y:f,datum:r})}for(const e of c)m(e,s??"A");return r}(pe,se,le,ce),[pe,se,le,ce]),ye=Ve(()=>x?function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];for(const e of i){const i=t(e),a=o(e),s=n(e);Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-B"})}return r}(pe,se,le,ce):[],[x,pe,se,le,ce]),ge=Ve(()=>[...fe,...ye],[fe,ye]),be=Ve(()=>{const e=new Set;for(const t of fe)e.add(t.__diffSegment);return Array.from(e)},[fe]);Ke(t,()=>{const e=e=>{const t=q&&e.length>q?e.slice(e.length-q):e;ue.current=t,de(t)},t=X?"function"==typeof X?X:e=>e[X]:null;return{push:t=>e([...ue.current,t]),pushMany:t=>e([...ue.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of ue.current)n.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(o,n)=>{if(!t)return[];const i=Array.isArray(o)?o:[o],r=[],a=ue.current.map(e=>{if(i.includes(t(e))){const t=n(e);return r.push(t),t}return e});return e(a),r},clear:()=>e([]),getData:()=>me?ue.current:pe,getScales:()=>o.current?.getScales()??null}},[me,pe,X,q]);const ve=i({data:pe,rawData:r,colorBy:"__diffWinner",colorScheme:[b,v],legendInteraction:Q,legendPosition:Y,selection:E,linkedHover:D,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:M,onClick:T,hoverHighlight:O,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DifferenceChart",chartId:G,showLegend:ee,userMargin:a,marginDefaults:n.marginDefaults,loading:z,loadingContent:j,emptyContent:$,width:J,height:K}),xe=Ve(()=>{if(!1!==ee)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:y,color:b},{label:g,color:v}]}]}},[ee,y,g,b,v]),Ae=Ue(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?b:v,stroke:"none",fillOpacity:H}},[b,v,H]),we=Ue(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?b:v,strokeWidth:A,fill:"none"}),[b,v,A]),ke=Ue(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?b:v,r:C}),[b,v,C]),Se=Ue(e=>{const t=e.data,o=e.allSeries,n=e.xValue??t?.__x;let i=t?.__valA,r=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(i=e.value),null!=t?.value&&Number.isFinite(t.value)&&(r=t.value)}if(null!=n&&(null==i||null==r)){const e=pe.find(e=>se(e)===n);e&&(null==i&&(i=le(e)),null==r&&(r=ce(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",s=c&&null!=n?c(n):null!=n?n+"":"";return et("div",{className:"semiotic-tooltip",style:k,children:[s&&Ze("div",{style:{fontWeight:600,marginBottom:4},children:s}),et("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Ze("span",{style:{width:10,height:10,background:b,display:"inline-block",borderRadius:2}}),et("span",{children:[y,": ",a(i)]})]}),et("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Ze("span",{style:{width:10,height:10,background:v,display:"inline-block",borderRadius:2}}),et("span",{children:[g,": ",a(r)]})]}),null!=i&&null!=r&&Number.isFinite(i)&&Number.isFinite(r)&&et("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(i-r)]})]})},[pe,se,le,ce,c,b,v,y,g]),Ce="multi"===B,Le=Ve(()=>!1===B?()=>null:Ce?Se:R(B)||Se,[B,Ce,Se]);if(ve.earlyReturn)return ve.earlyReturn;const He={chartType:"mixed",data:ge,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:be,curve:L,areaStyle:Ae,lineStyle:we,...w&&{pointStyle:ke},size:[J,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve.margin,showAxes:n.showAxes,xLabel:re,yLabel:ae,xFormat:c,yFormat:h,enableHover:U,showGrid:Z,...I&&{gradientFill:!0===I?{topOpacity:.85,bottomOpacity:.15}:I},...xe&&{legend:xe,legendPosition:ve.legendPosition},...d({title:te,description:oe,summary:ne,accessibleTable:ie,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:Le,...Ce&&{tooltipMode:"multi"},...u({linkedHover:D,selection:E,onObservation:M,onClick:T,hoverHighlight:O,mobileInteraction:ve.mobileInteraction,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior}),...F&&F.length>0&&{annotations:F},..._&&{xExtent:_},...N&&{yExtent:N},...ve.crosshairProps,...P};return Ze(V,{componentName:"DifferenceChart",width:J,height:K,children:Ze(l,{ref:o,...He})})});"function"==typeof ot&&(ot.displayName="DifferenceChart");import{useMemo as nt,forwardRef as it,useRef as rt}from"react";import{jsx as at}from"react/jsx-runtime";var st=it(function(e,o){const n=rt(null),r=W(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:m,yFormat:y,xAccessor:g="x",yAccessor:b="y",areaBy:v,lineDataAccessor:x="coordinates",colorBy:A,colorScheme:k,styleRules:C,curve:L="monotoneX",areaOpacity:H=.7,showLine:I=!0,lineWidth:B=2,showPoints:F=!1,pointRadius:R=3,normalize:_=!1,baseline:N="zero",stackOrder:P,tooltip:E,annotations:D,xExtent:M,yExtent:T,frameProps:O={},selection:G,linkedHover:z,onObservation:j,onClick:$,hoverHighlight:Q,chartId:X,loading:q,loadingContent:J,emptyContent:K,legendInteraction:U,legendPosition:Z,color:ee,stroke:te,strokeWidth:oe,opacity:ne}=e,{width:ie,height:re,enableHover:ae,showGrid:se,showLegend:le,title:ce,description:he,summary:de,accessibleTable:ue,xLabel:me,yLabel:pe}=r,fe=nt(()=>S(s),[s]),ye=A||v;a(o,{variant:"xy",frameRef:n});const ge=i({data:fe,rawData:s,colorBy:ye,colorScheme:k,legendInteraction:U,legendPosition:Z,selection:G,linkedHover:z,fallbackFields:ye?["string"==typeof ye?ye:""]:[],unwrapData:!1,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedAreaChart",chartId:X,showLegend:le,userMargin:c,marginDefaults:r.marginDefaults,loading:q,loadingContent:J,emptyContent:K,width:ie,height:re}),be=nt(()=>f(g,b),[g,b]),{flattenedData:ve,lineStyle:xe,pointStyle:Ae,defaultTooltipContent:we}=je({safeData:fe,data:s,areaBy:v,lineDataAccessor:x,colorBy:ye,colorScale:ge.colorScale,color:ee,stroke:te,strokeWidth:oe,opacity:ne,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection,areaOpacity:H,showLine:I,lineWidth:B,showPoints:F,pointRadius:R,xAccessor:g,yAccessor:b,xLabel:me,yLabel:pe,xFormat:m,yFormat:y,groupField:v||A,styleRules:C,ruleContext:be}),ke=t({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:g,yAccessor:b}}),Se={chartType:"stackedarea",...null!=s&&{data:ve},xAccessor:g,yAccessor:b,groupAccessor:v||void 0,curve:L,normalize:_,baseline:_?"zero":N,stackOrder:P,lineStyle:xe,...F&&Ae&&{pointStyle:Ae},size:[ie,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:me,yLabel:pe,xFormat:m,yFormat:y,enableHover:ae,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:se,...ge.legendBehaviorProps,...d({title:ce,description:he,summary:de,accessibleTable:ue,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===E?{tooltipContent:w(),tooltipMode:"multi"}:p({tooltip:E,defaultTooltipContent:we}),...u({linkedHover:z,selection:G,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:ge.mobileInteraction,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior}),...D&&D.length>0&&{annotations:D},...M&&{xExtent:M},...T&&{yExtent:T},...ge.crosshairProps,...O};return ge.earlyReturn?ge.earlyReturn:ke?at(Y,{componentName:"StackedAreaChart",message:ke,width:ie,height:re}):at(V,{componentName:"StackedAreaChart",width:ie,height:re,children:at(l,{ref:n,...Se})})});st.displayName="StackedAreaChart";import{useMemo as lt,forwardRef as ct,useRef as ht}from"react";import{scaleSequential as dt}from"d3-scale";import{jsx as ut}from"react/jsx-runtime";var mt=ct(function(e,o){const n=ht(null);a(o,{variant:"xy",frameRef:n});const i=W(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:h,className:f,xAccessor:y="x",yAccessor:g="y",valueAccessor:b="value",xFormat:v,yFormat:x,colorScheme:A,customColorScale:w,showValues:k=!1,valueFormat:C,cellBorderColor:I="#fff",cellBorderWidth:B=1,tooltip:F,annotations:R,xExtent:_,yExtent:N,frameProps:D={},selection:T,linkedHover:O,onObservation:G,onClick:j,hoverHighlight:$,chartId:J,loading:K,loadingContent:U,emptyContent:Z,showLegend:ee,legendPosition:te,legendInteraction:oe}=e,{width:ne,height:ie,enableHover:re,title:ae,description:se,summary:le,accessibleTable:ce,xLabel:he,yLabel:de}=i,ue=q(K,ne,ie,U),me=ue?null:X(r,ne,ie,Z),pe=lt(()=>S(r),[r]),fe=z(),ye=A??fe??"blues",ge=ee??!1,be=te??"right",{margin:ve}=P({data:pe,colorBy:ge?"value":void 0,colorScale:void 0,showLegend:ge,legendPosition:be,userMargin:h,defaults:i.marginDefaults}),{customHoverBehavior:xe,customClickBehavior:Ae,crosshairSourceId:we}=E({selection:T,linkedHover:O,fallbackFields:[],onObservation:G,onClick:j,chartType:"Heatmap",chartId:J,hoverHighlight:$,colorByField:void 0,mobileInteraction:i.mobileInteraction});s(T);const ke=L(O,we);M(oe,void 0,[]);const Se=lt(()=>"function"==typeof b?e=>b(e):e=>e[b],[b]),Ce=lt(()=>{const e=pe.map(Se);return Q(e)},[pe,Se]),Le=lt(()=>{if("custom"===ye&&w)return w;const e=H(ye);return dt(e).domain(Ce)},[ye,w,Ce]),He=lt(()=>m([{label:he||c(y),accessor:y,role:"x",format:v},{label:de||c(g),accessor:g,role:"y",format:x},{label:c(b),accessor:b,role:"value",format:C}]),[y,g,he,de,b,v,x,C]),Ie=t({componentName:"Heatmap",data:r,accessors:{xAccessor:y,yAccessor:g,valueAccessor:b}}),Be=lt(()=>{if(ge)return{gradient:{colorFn:e=>Le(e),domain:Ce,label:"string"==typeof b?b:"value",format:C}}},[ge,Le,Ce,b,C]),Fe={chartType:"heatmap",...null!=r&&{data:pe},xAccessor:y,yAccessor:g,valueAccessor:b,colorScheme:"custom"!==ye?ye:void 0,showValues:k,heatmapValueFormat:C,size:[ne,ie],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,showAxes:i.showAxes,xLabel:he,yLabel:de,xFormat:v,yFormat:x,enableHover:re,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Be&&{legend:Be,legendPosition:be},...d({title:ae,description:se,summary:le,accessibleTable:ce,className:f,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...p({tooltip:F,defaultTooltipContent:He}),...u({linkedHover:O,selection:T,onObservation:G,onClick:j,hoverHighlight:$,mobileInteraction:i.mobileInteraction,customHoverBehavior:xe,customClickBehavior:Ae}),...R&&R.length>0&&{annotations:R},..._&&{xExtent:_},...N&&{yExtent:N},...ke,...D};return ue||me||(Ie?ut(Y,{componentName:"Heatmap",message:Ie,width:ne,height:ie}):ut(V,{componentName:"Heatmap",width:ne,height:ie,children:ut(l,{ref:n,...Fe})}))});mt.displayName="Heatmap";import{useMemo as pt,useCallback as ft,forwardRef as yt,useRef as gt}from"react";import{jsx as bt}from"react/jsx-runtime";var vt=yt(function(o,n){const r=gt(null),s=W(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:x="x",yAccessor:A="y",sizeBy:w,sizeRange:k=[5,40],colorBy:C,colorScheme:L,styleRules:H,bubbleOpacity:B=.6,bubbleStrokeWidth:R=1,bubbleStrokeColor:_="white",tooltip:P,marginalGraphics:E,pointIdAccessor:D,annotations:M,regression:T,xExtent:O,yExtent:G,frameProps:z={},selection:j,linkedHover:$,linkedBrush:Q,onObservation:X,onClick:q,hoverHighlight:J,chartId:K,loading:U,loadingContent:Z,emptyContent:ee,legendInteraction:te,legendPosition:oe,color:ie,stroke:re,strokeWidth:ae,opacity:se}=o,{width:ce,height:he,enableHover:de,showGrid:ue,showLegend:me,title:pe,description:fe,summary:ye,accessibleTable:ge,xLabel:be,yLabel:ve}=s,xe=pt(()=>S(h),[h]),Ae=void 0===h,we=i({data:xe,rawData:h,colorBy:C,colorScheme:L,legendInteraction:te,legendPosition:oe,selection:j,linkedHover:$,fallbackFields:C?["string"==typeof C?C:""]:[],unwrapData:!1,onObservation:X,onClick:q,hoverHighlight:J,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"BubbleChart",chartId:K,showLegend:me,userMargin:y,marginDefaults:s.marginDefaults,loading:U,loadingContent:Z,emptyContent:ee,width:ce,height:he}),{domain:ke,trackPushed:Se,reset:Ce}=le({accessor:w,data:xe,isPushMode:Ae}),Le=ft(e=>{Se([e]),r.current?.push(e)},[Se]),He=ft(e=>{Se(e),r.current?.pushMany(e)},[Se]);a(n,{variant:"xy",frameRef:r,overrides:{push:Le,pushMany:He,clear:()=>{Ce(),r.current?.clear()}}});const Ie=F(Q),Be=(N({name:Ie?.name||"__unused_brush__",xField:Ie?.xField||("string"==typeof x?x:void 0),yField:Ie?.yField||("string"==typeof A?A:void 0)}),pt(()=>({stroke:_,strokeWidth:R}),[_,R])),Fe=pt(()=>ke??[0,1],[ke]),Re=ft(e=>I(e,w,k,Fe),[w,k,Fe]),_e=pt(()=>f(x,A),[x,A]),Ne=ne({colorBy:C,colorScale:we.colorScale,color:ie,fillOpacity:B,radiusFn:Re,baseStyleExtras:Be,stroke:re,strokeWidth:ae,opacity:se,styleRules:H,ruleContext:_e,effectiveSelectionHook:we.effectiveSelectionHook,resolvedSelection:we.resolvedSelection}),Pe=pt(()=>m([{label:be||c(x),accessor:x,role:"x",format:b},{label:ve||c(A),accessor:A,role:"y",format:v},{label:c(w),accessor:w,role:"size"},...C?[{label:c(C),accessor:C,role:"color"}]:[]]),[x,A,be,ve,w,C,b,v]);if(we.earlyReturn)return we.earlyReturn;const We=t({componentName:"BubbleChart",data:h,accessors:{xAccessor:x,yAccessor:A},requiredProps:{sizeBy:w}});if(We)return bt(Y,{componentName:"BubbleChart",message:We,width:ce,height:he});const Ee=e(T),De=Ee?[Ee,...M||[]]:M,Me={chartType:"bubble",...null!=h&&{data:xe},xAccessor:x,yAccessor:A,colorAccessor:C||void 0,sizeAccessor:w,sizeRange:k,pointStyle:Ne,colorScheme:L,size:[ce,he],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:we.margin,showAxes:s.showAxes,xLabel:be,yLabel:ve,xFormat:b,yFormat:v,enableHover:de,showGrid:ue,...we.legendBehaviorProps,...d({title:pe,description:fe,summary:ye,accessibleTable:ge,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:P,defaultTooltipContent:Pe}),...u({linkedHover:$,selection:j,onObservation:X,onClick:q,hoverHighlight:J,mobileInteraction:we.mobileInteraction,customHoverBehavior:we.customHoverBehavior,customClickBehavior:we.customClickBehavior}),...E&&{marginalGraphics:E},...D&&{pointIdAccessor:D},...De&&De.length>0&&{annotations:De},...O&&{xExtent:O},...G&&{yExtent:G},...we.crosshairProps,...z};return bt(V,{componentName:"BubbleChart",width:ce,height:he,children:bt(l,{ref:r,...Me})})});vt.displayName="BubbleChart";import*as xt from"react";import{useMemo as At,useCallback as wt,useState as kt,useRef as St,useEffect as Ct}from"react";import{brush as Lt}from"d3-brush";import{select as Ht}from"d3-selection";import{jsx as It,jsxs as Bt}from"react/jsx-runtime";var Ft="__splomIdx",Rt={top:4,bottom:4,left:4,right:4};function _t({frameRef:e,cellSize:t,onBrush:o}){const n=St(null),i=t-Rt.left-Rt.right,r=t-Rt.top-Rt.bottom;return Ct(()=>{if(!n.current)return;const t=Ht(n.current).select(".brush-g"),a=Lt().extent([[0,0],[i,r]]).on("brush end",t=>{const n=e.current?.getScales();if(!n)return;if(!(i=t.selection)||!Array.isArray(i[0]))return void o(null);var i;const[[r,a],[s,l]]=t.selection,c=[[n.x.invert(r),n.y.invert(a)],[n.x.invert(s),n.y.invert(l)]];o(c)});return t.call(a),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{a.on("brush end",null)}},[i,r,e,o]),It("svg",{ref:n,width:t,height:t,style:{position:"absolute",top:0,left:0},children:It("g",{className:"brush-g",transform:`translate(${Rt.left},${Rt.top})`})})}function Nt({data:e,xField:t,yField:o,cellSize:n,pointRadius:i,pointOpacity:r,colorBy:a,colorScale:s,brushSelectionName:c,hoverSelectionName:h,unselectedOpacity:d,mobileInteraction:m,mode:p,onPointHover:f,onPointClick:y}){const g=St(null),v=T({name:c,clientId:`splom-${t}-${o}`,fields:[t,o]}),x=N({name:c,xField:t,yField:o}),A=T({name:h,clientId:"splom-hover-source",fields:[Ft]}),w=A.selectPoints,k=wt(e=>{e?x.brushInteraction.during(e):x.brushInteraction.end(null)},[x.brushInteraction]),S=wt(e=>{if(!e)return void f?.(null);const t=e.data,o=t?.[Ft];void 0!==o&&(w({[Ft]:[o]}),f?.(t,e.x+Rt.left,e.y+Rt.top))},[w,f]),L=wt(e=>{if(!e)return void y?.(null);const t=e.data;t&&y?.(t,e.x+Rt.left,e.y+Rt.top)},[y]),H=wt(e=>{const t={opacity:r,r:i};return t.fill=a?C(e,a,s):b,"hover"===p?A.isActive&&A.predicate(e)?(t.opacity=1,t.r=2.5*i,t.stroke="#333",t.strokeWidth=1.5):A.isActive&&(t.opacity=.6*r):v.isActive&&!v.predicate(e)&&(t.opacity=d),t},[r,i,a,p,s,A,v,d]);return Bt("div",{style:{position:"relative",width:n,height:n},children:[It(l,{ref:g,chartType:"scatter",data:e,size:[n,n],xAccessor:t,yAccessor:o,pointStyle:H,margin:Rt,showAxes:!1,enableHover:"hover"===p,...u({forceHoverBehavior:"hover"===p,forceClickBehavior:!!y,mobileInteraction:m,customHoverBehavior:S,customClickBehavior:L}),tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&It(_t,{frameRef:g,cellSize:n,xField:t,yField:o,onBrush:k})]})}function Pt({data:e,field:t,label:o,cellSize:n,bins:i,colorBy:r,colorScale:a,brushSelectionName:s,hoverSelectionName:l,mode:c}){const h=T({name:s,clientId:"splom-diag-"+t,fields:[t]}),d=T({name:l,clientId:`splom-diag-${t}-hover`,fields:[Ft]}),u="hover"===c?d:h,m=u.isActive,p=u.predicate,f=At(()=>{const o="string"==typeof r?r:null,a=[],s=new Set;for(const n of e){const e=n[t];if(null==e||isNaN(e)||a.push(Number(e)),o){const e=n[o];null!=e&&s.add(e+"")}}if(0===a.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=Q(a),h=(c-l)/i||1,d=Array.from(s),u=new Map(d.map((e,t)=>[e,t])),f=Array(i).fill(0),y=Array(i).fill(0),g=Array.from({length:i},()=>Array(d.length).fill(0)),b=Array.from({length:i},()=>Array(d.length).fill(0));for(const n of e){const e=n[t];if(null==e||isNaN(e))continue;const r=Math.min(Math.floor((e-l)/h),i-1);if(f[r]++,m&&!p(n)||y[r]++,o){const e=u.get(n[o]+"");void 0!==e&&(g[r][e]++,m&&!p(n)||b[r][e]++)}}const v=$(f,1),x=g.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/v*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})}),A=b.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/v*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})});return{bars:f.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/v*(n-24),count:e})),selectedBars:y.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/v*(n-24),count:e})),categoryBars:x,selectedCategoryBars:A,max:v,categories:d}},[e,t,i,n,m,p,r]);return Bt("svg",{width:n,height:n,style:{overflow:"hidden"},children:[It("text",{x:n/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),f.categories.length>0?f.categoryBars.map((e,t)=>e.map((e,o)=>It("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):b,opacity:m?.3:.6},`bg-${t}-${o}`))):f.bars.map((e,t)=>It("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:b,opacity:m?.3:.6},"bg-"+t)),m&&(f.categories.length>0?f.selectedCategoryBars.map((e,t)=>e.map((e,o)=>It("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):b,opacity:.7},`sel-${t}-${o}`))):f.selectedBars.map((e,t)=>It("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:b,opacity:.7},"sel-"+t)))]})}function Wt({label:e,cellSize:t}){return It("svg",{width:t,height:t,children:It("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Et(e){const{data:t,fields:o,fieldLabels:n={},colorBy:i,colorScheme:r,cellSize:a=150,cellGap:s=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:h="histogram",histogramBins:d=20,brushMode:u="crossfilter",hoverMode:m=!0,unselectedOpacity:p=.1,showGrid:f=!1,tooltip:y,showLegend:g,idAccessor:v,width:x,className:A,onObservation:w,onClick:k,chartId:S}=e,C="splom",L="splom-hover",H=_(e.mobileInteraction,{mode:e.mode,width:x??o.length*a,mobileSemantics:e.mobileSemantics}),I=m?"hover":u?"brush":"hover",B=O(e=>e.clearSelection),[F,R]=kt(null),N=wt(()=>{B(L),R(null)},[B,L]),P=At(()=>(t||[]).map((e,t)=>void 0!==e[Ft]?e:{...e,[Ft]:t}),[t]),W=D(P,i,r),E=wt((e,t,o,n)=>[40+e*(a+s)+(o??0),t*(a+s)+(n??0)],[40,a,s]),M=void 0!==g?g:!!i,T=At(()=>{if(!M||!i)return null;const e="string"==typeof i?i:null;return e?Array.from(new Set(P.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:W?W(e+""):b})):null},[M,i,P,W]),G=At(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>a+"px").join(" "),gridTemplateRows:o.map(()=>a+"px").join(" ")+" 40px",gap:s+"px",width:"fit-content"}),[o,a,s,40]);return Bt("div",{className:A,style:{position:"relative"},children:[T&&It("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:T.map(e=>Bt("div",{style:{display:"flex",alignItems:"center",gap:4},children:[It("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),It("span",{style:{fontSize:11},children:e.label})]},e.label))}),Bt("div",{style:G,onMouseLeave:"hover"===I?N:void 0,children:[o.map((e,t)=>Bt(xt.Fragment,{children:[It("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e}),o.map((o,r)=>t===r?"label"===h?It(Wt,{label:n[e]||e,cellSize:a},"diag-"+e):It(Pt,{data:P,field:e,label:n[e]||e,cellSize:a,bins:d,colorBy:i,colorScale:W,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,mode:I},"diag-"+e):It(Nt,{data:P,xField:o,yField:e,fieldLabels:n,cellSize:a,pointRadius:l,pointOpacity:c,colorBy:i,colorScale:W,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,showGrid:f,tooltip:y,mobileInteraction:H,mode:I,onPointHover:"hover"===I?(n,i,a)=>{if(n){if(R({datum:n,xField:o,yField:e,colIndex:r,rowIndex:t,px:i??0,py:a??0}),w){const[e,o]=E(r,t,i,a);w({type:"hover",datum:n,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else R(null),w&&w({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:k||w?(e,o,n)=>{if(!e)return;const[i,a]=E(r,t,o,n);k&&k(e,{x:i,y:a}),w&&w({type:"click",datum:e,x:i,y:a,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),It("div",{})," ",o.map(e=>It("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e},"col-label-"+e))]}),F&&"hover"===I&&(()=>{const e=F.datum,t=n[F.xField]||F.xField,o=n[F.yField]||F.yField,r=i?"function"==typeof i?i(e):e[i]:null,l=v?"function"==typeof v?v(e):e[v]:"Row "+e[Ft];return Bt("div",{style:{position:"absolute",left:40+F.colIndex*(a+s)+F.px,top:F.rowIndex*(a+s)+F.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[It("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),Bt("div",{children:[t,": ",null!=e[F.xField]?Number(e[F.xField]).toFixed(1):"–"]}),Bt("div",{children:[o,": ",null!=e[F.yField]?Number(e[F.yField]).toFixed(1):"–"]}),null!=r&&Bt("div",{style:{opacity:.8},children:["string"==typeof i?i:"group",": ",r+""]})]})})()]})}function Dt(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),It(A,{selections:n,children:It(Et,{...e})})}Dt.displayName="ScatterplotMatrix";import{useState as Mt,useRef as Tt,useEffect as Ot,useMemo as Gt,useCallback as zt}from"react";import{brushX as jt,brushY as $t}from"d3-brush";import{select as Qt}from"d3-selection";import{jsx as Yt,jsxs as Vt}from"react/jsx-runtime";function Xt({width:e,height:t,margin:o,scales:n,brushDirection:i,extent:r,onBrush:a}){const s=Tt(null),l=Tt(null),c=Tt(!1),h=e+o.left+o.right,d=t+o.top+o.bottom;return Ot(()=>{if(!s.current||!n)return;const o=Qt(s.current).select(".brush-group"),r="x"===i?jt().extent([[0,0],[e,t]]):$t().extent([[0,0],[e,t]]);return r.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void a(null);const o=("x"===i?n.x:n.y).invert;if(!o)return;const r=[o(t[0]),o(t[1])];a(r)}),o.call(r),l.current=e=>{o.call(r.move,e)},o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,r.on("brush end",null)}},[n,e,t,i,a]),Ot(()=>{if(!l.current||!n||!s.current)return;const e="x"===i?n.x:n.y;if(c.current=!0,r){const t=[e(r[0]),e(r[1])];l.current(t)}else l.current(null);c.current=!1},[r,n,i]),Yt("svg",{ref:s,width:h,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:Yt("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function qt(e){const{data:o,width:n=600,height:i=400,margin:r,className:a,title:s,description:h,summary:d,xLabel:u,yLabel:p,xFormat:f,yFormat:y,xAccessor:g="x",yAccessor:v="y",lineBy:x,lineDataAccessor:A="coordinates",colorBy:w,colorScheme:k,curve:L="linear",lineWidth:H=2,fillArea:I=!1,areaOpacity:B=.3,showPoints:F=!1,pointRadius:_=3,enableHover:N=!0,showGrid:W=!1,showLegend:E,legendPosition:M,tooltip:T,minimap:O={},renderBefore:G=!1,onBrush:z,brushExtent:j,yExtent:$,frameProps:Q={},loading:J,loadingContent:K,emptyContent:U}=e,Z=q(J,n,i,K),ee=Z?null:X(o,n,i,U),te=Gt(()=>S(o),[o]),[oe,ne]=Mt(null),ie=j??oe,re=zt(e=>{j||ne(e),z?.(e)},[j,z]),ae=Tt(null),[se,le]=Mt(null);Ot(()=>{let e=0,t=!1;const o=()=>{if(t)return;const n=ae.current?.getScales?.();n?le(n):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[o]);const ce=void 0!==te[0]?.[A],he=Gt(()=>{if(ce)return te;if(x){const e=te.reduce((e,t)=>{const o="function"==typeof x?x(t):t[x];if(!e[o]){const t={[A]:[]};"string"==typeof x&&(t[x]=o),e[o]=t}return e[o][A].push(t),e},{});return Object.values(e)}return[{[A]:te}]},[te,x,A,ce]),de=Gt(()=>ce||x?he.flatMap(e=>{const t=e[A]||[];return x&&"string"==typeof x?t.map(t=>({...t,[x]:e[x]})):t}):te,[he,A,ce,x,te]),ue=D(te,w,k),me=We({lineWidth:H,colorBy:w,colorScale:ue,fillArea:I,areaOpacity:B}),pe=Gt(()=>{if(O.lineStyle)return O.lineStyle},[O.lineStyle]),fe=We({lineWidth:1,colorBy:w,colorScale:ue}),ye=pe??fe,ge=Gt(()=>{if(F)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?C(e.parentLine||e,w,ue):b,t}},[F,_,w,ue]),{legend:be,margin:ve,legendPosition:xe}=P({data:he,colorBy:w,colorScale:ue,showLegend:E,legendPosition:M,userMargin:r}),Ae=O.height||60,we=Gt(()=>({top:O.margin?.top??0,bottom:O.margin?.bottom??20,left:O.margin?.left??ve.left,right:O.margin?.right??ve.right}),[O.margin,ve]),ke=O.brushDirection||"x",Se=Gt(()=>m([{label:u||c(g),accessor:g,role:"x",format:f},{label:p||c(v),accessor:v,role:"y",format:y}]),[g,v,u,p,f,y]),Ce=t({componentName:"MinimapChart",data:o,accessors:{xAccessor:g,yAccessor:v}});if(Ce)return Yt(Y,{componentName:"MinimapChart",message:Ce,width:n,height:i});const Le=I?"area":"line",He={chartType:Le,data:de,xAccessor:g,yAccessor:v,groupAccessor:x||void 0,curve:L,lineStyle:me,...F&&{pointStyle:ge},size:[n,i],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,showAxes:!0,xLabel:u,yLabel:p,xFormat:f,yFormat:y,enableHover:N,showGrid:W,...be&&{legend:be,legendPosition:xe},...s&&{title:s},...h&&{description:h},...d&&{summary:d},tooltipContent:!1===T?()=>null:R(T)||Se,...ie&&{xExtent:ie},...$&&{yExtent:$},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...Q},Ie={chartType:Le,data:de,xAccessor:g,yAccessor:v,groupAccessor:x||void 0,curve:L,lineStyle:ye,size:[n,Ae+we.top+we.bottom],margin:we,showAxes:O.showAxes??!1,background:O.background,enableHover:!1,...$&&{yExtent:$}},Be=Vt("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[Yt(l,{ref:ae,...Ie}),Yt(Xt,{width:n-we.left-we.right,height:Ae,margin:we,scales:se,brushDirection:ke,extent:ie,onBrush:re})]},"minimap"),Fe=Yt("div",{style:{overflow:"hidden"},children:Yt(l,{...He})},"main");return Z||ee||Yt(V,{componentName:"MinimapChart",width:n,height:i,children:Vt("div",{className:"minimap-chart"+(a?" "+a:""),children:[G?Be:Fe,G?Fe:Be]})})}qt.displayName="MinimapChart";import{useMemo as Jt,forwardRef as Kt,useRef as Ut}from"react";var Zt={topLeft:{label:"Low / High",color:"#E9C46A",opacity:.08},topRight:{label:"High / High",color:"#2A9D8F",opacity:.08},bottomLeft:{label:"Low / Low",color:"#E76F51",opacity:.08},bottomRight:{label:"High / Low",color:"#86BBD8",opacity:.08}};import{Fragment as eo,jsx as to,jsxs as oo}from"react/jsx-runtime";function no(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var io=Kt(function(e,o){const n=Ut(null);a(o,{variant:"xy",frameRef:n});const r=W(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:h,className:d,xFormat:p,yFormat:y,xAccessor:g="x",yAccessor:v="y",xCenter:x,yCenter:A,quadrants:w,centerlineStyle:k={},showQuadrantLabels:C=!0,quadrantLabelSize:L=12,colorBy:H,colorScheme:B,styleRules:F,sizeBy:_,sizeRange:N=[3,15],pointRadius:P=5,pointOpacity:E=.8,tooltip:D,pointIdAccessor:M,annotations:T,frameProps:O={},selection:G,linkedHover:z,onObservation:j,onClick:$,hoverHighlight:X,chartId:q,loading:K,loadingContent:U,emptyContent:Z,legendInteraction:ee,legendPosition:te,color:oe,stroke:ie,strokeWidth:re,opacity:ae}=e,{width:se,height:le,enableHover:ce,showGrid:he,showLegend:de,title:ue,description:me,summary:pe,accessibleTable:fe,xLabel:ye,yLabel:ge}=r,be=Jt(()=>({topLeft:no(Zt.topLeft,w?.topLeft),topRight:no(Zt.topRight,w?.topRight),bottomLeft:no(Zt.bottomLeft,w?.bottomLeft),bottomRight:no(Zt.bottomRight,w?.bottomRight)}),[w]),ve=Jt(()=>S(s),[s]),xe=i({data:ve,rawData:s,colorBy:H,colorScheme:B,legendInteraction:ee,legendPosition:te,selection:G,linkedHover:z,fallbackFields:"string"==typeof H?[H]:[],unwrapData:!1,onObservation:j,onClick:$,hoverHighlight:X,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"QuadrantChart",chartId:q,showLegend:de,userMargin:h,marginDefaults:r.marginDefaults,loading:K,loadingContent:U,emptyContent:Z,width:se,height:le});J("QuadrantChart",ve,"xAccessor",g),J("QuadrantChart",ve,"yAccessor",v);const Ae=Jt(()=>{if(!ve.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof v?v:e=>+e[v];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const a of ve){const s=e(a),l=t(a);isFinite(s)&&(o>s&&(o=s),s>n&&(n=s)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=x&&isFinite(x)&&(o>x&&(o=x),x>n&&(n=x)),null!=A&&isFinite(A)&&(i>A&&(i=A),A>r&&(r=A)),o===1/0)return;const a=.1*(n-o)||1,s=.1*(r-i)||1;return{xExtent:[o-a,n+a],yExtent:[i-s,r+s]}},[ve,g,v,x,A]),we=Jt(()=>{if(!_||0===ve.length)return;const e=ve.map(e=>"function"==typeof _?_(e):e[_]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?Q(e):void 0},[ve,_]),ke=Jt(()=>"function"==typeof g?g:e=>+e[g],[g]),Se=Jt(()=>"function"==typeof v?v:e=>+e[v],[v]),Ce=Jt(()=>e=>{const t=ke(e),o=Se(e),n=null!=x?t>=x:void 0,i=null!=A?o>=A:void 0;return void 0===i||void 0===n?oe||b:i&&n?be.topRight.color:i&&!n?be.topLeft.color:!i&&n?be.bottomRight.color:be.bottomLeft.color},[ke,Se,x,A,be,oe]),Le=Jt(()=>_?e=>I(e,_,N,we):void 0,[_,N,we]),He=Jt(()=>f(g,v),[g,v]),Ie=ne({colorBy:H,colorScale:xe.colorScale,color:oe,pointRadius:P,fillOpacity:E,radiusFn:Le,fallbackFill:Ce,stroke:ie,strokeWidth:re,opacity:ae,styleRules:F,ruleContext:He,effectiveSelectionHook:xe.effectiveSelectionHook,resolvedSelection:xe.resolvedSelection}),Be=Jt(()=>{if(!ve.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof v&&e.add(v),"string"==typeof H&&e.add(H),"string"==typeof _&&e.add(_);const t=ve[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ve,g,v,H,_]),Fe=Jt(()=>m([...Be?[{label:Be,accessor:Be,role:"title"}]:[],{label:ye||c(g),accessor:g,role:"x",format:p},{label:ge||c(v),accessor:v,role:"y",format:y},...H?[{label:c(H),accessor:H,role:"color"}]:[],..._?[{label:c(_),accessor:_,role:"size"}]:[]]),[Be,g,v,ye,ge,H,_,p,y]),Re=t({componentName:"QuadrantChart",data:s,accessors:{xAccessor:g,yAccessor:v}}),_e=Jt(()=>{const e={stroke:k.stroke||"#999",strokeWidth:k.strokeWidth??1,dashArray:k.strokeDasharray||[]};return[(t,o,n,i)=>{if(!n?.x||!n?.y)return;const r=i.width,a=i.height,s=null!=x?n.x(x):r/2,l=null!=A?n.y(A):a/2;if(null!=x&&!isFinite(s))return;if(null!=A&&!isFinite(l))return;const c=Math.max(0,Math.min(r,s)),h=Math.max(0,Math.min(a,l)),d=[{config:be.topLeft,x:0,y:0,w:c,h:h},{config:be.topRight,x:c,y:0,w:r-c,h:h},{config:be.bottomLeft,x:0,y:h,w:c,h:a-h},{config:be.bottomRight,x:c,y:h,w:r-c,h:a-h}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,a),t.stroke(),t.beginPath(),t.moveTo(0,h),t.lineTo(r,h),t.stroke(),t.setLineDash([])}]},[x,A,be,k]),Ne=Jt(()=>C?[..._e,(e,t,o,n)=>{if(!o?.x||!o?.y)return;const i=n.width,r=n.height,a=null!=x?o.x(x):i/2,s=null!=A?o.y(A):r/2;(null==x||isFinite(a))&&(null==A||isFinite(s))&&(e.font=`600 ${L}px sans-serif`,e.globalAlpha=.5,e.fillStyle=be.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(be.topLeft.label,8,8),e.fillStyle=be.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(be.topRight.label,i-8,8),e.fillStyle=be.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(be.bottomLeft.label,8,r-8),e.fillStyle=be.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(be.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:_e,[_e,C,L,be,x,A]),Pe=Jt(()=>{const e=O.canvasPreRenderers||[];return[...Ne,...e]},[Ne,O.canvasPreRenderers]),We=Jt(()=>{const e={stroke:k.stroke||"#999",strokeWidth:k.strokeWidth??1,dashArray:k.strokeDasharray?Array.isArray(k.strokeDasharray)?k.strokeDasharray.join(","):k.strokeDasharray:void 0};return[(t,o,n)=>{if(!o?.x||!o?.y)return null;const i=n.width,r=n.height,a=null!=x?o.x(x):i/2,s=null!=A?o.y(A):r/2;if(null!=x&&!isFinite(a))return null;if(null!=A&&!isFinite(s))return null;const l=Math.max(0,Math.min(i,a)),c=Math.max(0,Math.min(r,s));return oo(eo,{children:[[{config:be.topLeft,x:0,y:0,w:l,h:c},{config:be.topRight,x:l,y:0,w:i-l,h:c},{config:be.bottomLeft,x:0,y:c,w:l,h:r-c},{config:be.bottomRight,x:l,y:c,w:i-l,h:r-c}].map((e,t)=>e.w>0&&e.h>0?to("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),to("line",{x1:l,y1:0,x2:l,y2:r,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),to("line",{x1:0,y1:c,x2:i,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),C&&oo(eo,{children:[to("text",{x:8,y:8+L,fill:be.topLeft.color,fontWeight:600,fontSize:L,opacity:.5,children:be.topLeft.label}),to("text",{x:i-8,y:8+L,fill:be.topRight.color,fontWeight:600,fontSize:L,opacity:.5,textAnchor:"end",children:be.topRight.label}),to("text",{x:8,y:r-8,fill:be.bottomLeft.color,fontWeight:600,fontSize:L,opacity:.5,children:be.bottomLeft.label}),to("text",{x:i-8,y:r-8,fill:be.bottomRight.color,fontWeight:600,fontSize:L,opacity:.5,textAnchor:"end",children:be.bottomRight.label})]})]})}]},[x,A,be,k,C,L]);if(xe.earlyReturn)return xe.earlyReturn;const Ee={chartType:"scatter",...null!=s&&{data:ve},xAccessor:g,yAccessor:v,colorAccessor:H||void 0,sizeAccessor:_||void 0,sizeRange:N,pointStyle:Ie,colorScheme:B,size:[se,le],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe.margin,showAxes:r.showAxes,xLabel:ye,yLabel:ge,xFormat:p,yFormat:y,enableHover:ce,showGrid:he,...Ae&&{xExtent:Ae.xExtent,yExtent:Ae.yExtent},...xe.legendBehaviorProps,...ue&&{title:ue},...me&&{description:me},...pe&&{summary:pe},...void 0!==fe&&{accessibleTable:fe},...d&&{className:d},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===D?()=>null:!0===D||void 0===D?Fe:R(D)||Fe,...u({linkedHover:z,selection:G,onObservation:j,onClick:$,hoverHighlight:X,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior}),...M&&{pointIdAccessor:M},...T&&T.length>0&&{annotations:T},canvasPreRenderers:Pe,...xe.crosshairProps,...O,...Pe.length>0&&{canvasPreRenderers:Pe},svgPreRenderers:We};return Re?to(Y,{componentName:"QuadrantChart",message:Re,width:se,height:le}):to(V,{componentName:"QuadrantChart",width:se,height:le,children:to(l,{ref:n,...Ee})})});io.displayName="QuadrantChart";import*as ro from"react";import{useMemo as ao,useCallback as so,forwardRef as lo,useRef as co,useImperativeHandle as ho}from"react";import{jsx as uo}from"react/jsx-runtime";var mo="__ma_unitized",po="__ma_series";function fo(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function yo(e,t){return t[0]+e*(t[1]-t[0])}var go=lo(function(e,o){const n=co(null),r=co([]),a=co(e.series);a.current=e.series,ho(o,()=>{const e=()=>(a.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const o=e(),i=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],a=t.extent||r.current[e];if(!a)continue;const s=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=s&&isFinite(s)&&n.current.push({...i,[mo]:fo(s,a),[po]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const o=e(),i=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const n=o[t],a=n.extent||r.current[t];if(!a)continue;const s=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=s&&isFinite(s)&&i.push({...e,[mo]:fo(s,a),[po]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const s=W(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:c,margin:h,className:d,xFormat:m,xAccessor:p="x",series:f,colorScheme:y,curve:b="monotoneX",lineWidth:x=2,tooltip:A,annotations:w,frameProps:k={},selection:C,linkedHover:L,onObservation:H,onClick:I,hoverHighlight:B,chartId:F,loading:_,loadingContent:N,emptyContent:P,legendInteraction:E,legendPosition:D,stroke:M,strokeWidth:T,opacity:O}=e,{width:z,height:j,enableHover:$,showGrid:Q,showLegend:J=!0,title:K,description:U,summary:Z,accessibleTable:ee,xLabel:te}=s,oe=ao(()=>S(c),[c]),ne=ao(()=>S(f),[f]),ie=ne,re=2===ne.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||re||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${ne.length}. Rendering as a standard multi-line chart.`);const ae=q(_,z,j,N),se=ae?null:X(c,z,j,P),le=G(),ce=ao(()=>{let e;if(Array.isArray(y))e=y;else if(le&&le.length>0)e=le;else{const t=g[y];e=Array.isArray(t)?t:v}return ie.map((t,o)=>t.color||e[o%e.length])},[ie,y,le]),he=ao(()=>ne.map((e,t)=>e.label||"Series "+(t+1)),[ne]),{unitizedData:de,extents:ue}=ao(()=>{if(0===oe.length){const e=ne.map(e=>e.extent||null).filter(Boolean);return e.length===ne.length&&(r.current=e),{unitizedData:[],extents:e.length===ne.length?e:[]}}const e=ne.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(oe,e.yAccessor));if(r.current=e,!re){const t=[];for(const e of oe)for(let o=0;ne.length>o;o++){const n=ne[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push({...e,[mo]:i,[po]:he[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of oe)for(let n=0;2>n;n++){const i=ne[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push({...o,[mo]:fo(r,e[n]),[po]:he[n]})}return{unitizedData:t,extents:e}},[oe,ne,re,he]),me=ao(()=>{if(re&&ue.length>=2)return[{orient:"left",label:he[0],tickFormat:ne[0].format||(e=>{const t=yo(e,ue[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:he[1],tickFormat:ne[1].format||(e=>{const t=yo(e,ue[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[re,ue,ne,he]),pe=ao(()=>de.length>0?de:he.map(e=>({[po]:e})),[de,he]),fe=i({data:pe,rawData:c,colorBy:po,colorScheme:ce,legendInteraction:E,legendPosition:D,selection:C,linkedHover:L,fallbackFields:[po],unwrapData:!1,onObservation:H,onClick:I,hoverHighlight:B,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"MultiAxisLineChart",chartId:F,showLegend:J,userMargin:h,marginDefaults:re?{...s.marginDefaults,left:70,right:70}:s.marginDefaults,loading:_,loadingContent:N,emptyContent:P,width:z,height:j}),ye=ao(()=>{const e=new Map;return he.forEach((t,o)=>e.set(t,ce[o])),e},[he,ce]),ge=We({lineWidth:x,resolveStroke:so(e=>ye.get(e[po])||ce[0],[ye,ce]),stroke:M,strokeWidth:T,opacity:O,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),be=ao(()=>{if(!1===A)return()=>null;return R(A)||(e=>{const t=e.data||e,o=t[po],n=he.indexOf(o),i=t[mo],r=re&&n>=0&&ue[n]?yo(i,ue[n]):i,a=n>=0&&ne[n]?.format?ne[n].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),s="function"==typeof p?p(t):t[p];return ro.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},ro.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ce[n]||"inherit"}},o),ro.createElement("div",null,`${"string"==typeof p?p:"x"}: ${s}`),ro.createElement("div",null,`${o}: ${a(r)}`))})},[A,he,ce,ue,re,ne,p]);if(fe.earlyReturn)return fe.earlyReturn;const ve=t({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:p}}),xe=re?[0,1]:void 0,Ae={chartType:"line",...null!=c&&{data:de},xAccessor:p,yAccessor:mo,groupAccessor:po,lineStyle:ge,colorScheme:ce,size:[z,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:s.showAxes,...me&&{axes:me},xLabel:te,...re?{}:{yLabel:he[0]},xFormat:m,...re&&xe&&{yExtent:xe},enableHover:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Q,curve:b,...fe.legendBehaviorProps,...K&&{title:K},...U&&{description:U},...Z&&{summary:Z},...void 0!==ee&&{accessibleTable:ee},...d&&{className:d},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:be,...w&&{annotations:w},...u({linkedHover:L,selection:C,onObservation:H,onClick:I,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...fe.crosshairProps,...k};return ae||se||(ve?uo(Y,{componentName:"MultiAxisLineChart",message:ve,width:z,height:j}):uo(V,{componentName:"MultiAxisLineChart",width:z,height:j,children:uo(l,{ref:n,...Ae})}))});go.displayName="MultiAxisLineChart";import{useMemo as bo,forwardRef as vo,useRef as xo}from"react";import{jsx as Ao}from"react/jsx-runtime";var wo=vo(function(e,o){const i=xo(null);a(o,{variant:"xy",frameRef:i});const r=W(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:h,className:f,xFormat:y,yFormat:g,xAccessor:b="x",highAccessor:v="high",lowAccessor:x="low",openAccessor:A,closeAccessor:w,candlestickStyle:k,tooltip:C,annotations:H,xExtent:I,yExtent:B,frameProps:F={},selection:R,linkedHover:_,onObservation:N,onClick:P,chartId:D,loading:M,loadingContent:T,emptyContent:O}=e,{width:G,height:z,enableHover:j,showGrid:$,title:Q,description:K,summary:U,accessibleTable:Z,xLabel:ee,yLabel:te}=r,oe=q(M,G,z,T),ne=oe?null:X(s,G,z,O),ie=bo(()=>S(s),[s]),re=null==A||null==w;J("CandlestickChart",ie,"xAccessor",b),J("CandlestickChart",ie,"highAccessor",v),J("CandlestickChart",ie,"lowAccessor",x),re||(J("CandlestickChart",ie,"openAccessor",A),J("CandlestickChart",ie,"closeAccessor",w));const{customHoverBehavior:ae,customClickBehavior:se,crosshairSourceId:le}=E({selection:R,linkedHover:_,onObservation:N,onClick:P,chartType:"CandlestickChart",chartId:D,mobileInteraction:r.mobileInteraction}),ce=L(_,le),he=bo(()=>{const t=r.marginDefaults,o="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==h?o:{...o,...n(h)}},[h,r.marginDefaults,e.mode]),de=bo(()=>{const e=[{label:ee||c(b),accessor:b,role:"x",format:y}];return re?(e.push({label:"High",accessor:v,role:"y",format:g}),e.push({label:"Low",accessor:x,format:g})):(e.push({label:"Open",accessor:A,format:g}),e.push({label:"High",accessor:v,format:g}),e.push({label:"Low",accessor:x,format:g}),e.push({label:"Close",accessor:w,format:g})),m(e)},[b,ee,y,g,v,x,A,w,re]),ue=t({componentName:"CandlestickChart",data:s,accessors:{xAccessor:b,highAccessor:v,lowAccessor:x,...!re&&{openAccessor:A,closeAccessor:w}}}),me={chartType:"candlestick",...null!=s&&{data:ie},xAccessor:b,yAccessor:v,highAccessor:v,lowAccessor:x,...!re&&{openAccessor:A,closeAccessor:w},...k&&{candlestickStyle:k},scalePadding:Math.max(2,Math.min(12,Math.round(G/40))),extentPadding:G>200?.1:.02,size:[G,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:y,yFormat:g,enableHover:j,showGrid:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...d({title:Q,description:K,summary:U,accessibleTable:Z,className:f,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...p({tooltip:C,defaultTooltipContent:de}),...u({linkedHover:_,selection:R,onObservation:N,onClick:P,mobileInteraction:r.mobileInteraction,customHoverBehavior:ae,customClickBehavior:se}),...H&&H.length>0&&{annotations:H},...I&&{xExtent:I},...B&&{yExtent:B},...ce,...F};return oe||ne||(ue?Ao(Y,{componentName:"CandlestickChart",message:ue,width:G,height:z}):Ao(V,{componentName:"CandlestickChart",width:G,height:z,children:Ao(l,{ref:i,...me})}))});wo.displayName="CandlestickChart";import{forwardRef as ko,useMemo as So}from"react";import{jsx as Co}from"react/jsx-runtime";var Lo=ko(function(e,t){const{data:o,layout:n,layoutConfig:i,onLayoutError:a,xExtent:s,yExtent:c,showAxes:h=!1,margin:m,className:p,annotations:f,onObservation:y,onClick:g,selection:b,linkedHover:v,chartId:x,loading:A,loadingContent:w,emptyContent:k,colorBy:S,colorScheme:C,frameProps:L={}}=e,{frameRef:H,resolved:I,safeData:B,setup:F,earlyReturn:R}=r({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:S,colorScheme:C,selection:b,linkedHover:v,onObservation:y,onClick:g,chartId:x,loading:A,loadingContent:w,emptyContent:k,margin:m,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),_=F.effectiveSelectionHook,N=So(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]);if(R)return R;const{width:P,height:W,enableHover:E,showGrid:D,title:M,description:T,summary:O,accessibleTable:G,xLabel:z,yLabel:j}=I,$={chartType:"custom",...null!=o&&{data:B},customLayout:n,layoutConfig:i,onLayoutError:a,...N&&{layoutSelection:N},xExtent:s,yExtent:c,colorAccessor:S,colorScheme:C,size:[P,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:F.margin,showAxes:h,xLabel:z,yLabel:j,enableHover:E,showGrid:D,...F.legendBehaviorProps,...d({title:M,description:T,summary:O,accessibleTable:G,className:p,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...u({linkedHover:v,selection:b,onObservation:y,onClick:g,hoverHighlight:!1,mobileInteraction:F.mobileInteraction,customHoverBehavior:F.customHoverBehavior,customClickBehavior:F.customClickBehavior}),...f&&f.length>0&&{annotations:f},...F.crosshairProps,...L};return Co(V,{componentName:"XYCustomChart",width:P,height:W,children:Co(l,{ref:H,...$})})});Lo.displayName="XYCustomChart";export{xe as Scatterplot,He as ConnectedScatterplot,Me as LineChart,Ye as AreaChart,ot as DifferenceChart,st as StackedAreaChart,mt as Heatmap,vt as BubbleChart,Dt as ScatterplotMatrix,qt as MinimapChart,Zt as DEFAULT_QUADRANTS,io as QuadrantChart,go as MultiAxisLineChart,wo as CandlestickChart,Lo as XYCustomChart};
|