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.
Files changed (147) hide show
  1. package/CLAUDE.md +3 -1
  2. package/README.md +53 -52
  3. package/ai/behaviorContracts.cjs +9 -0
  4. package/ai/dist/mcp-server.js +142 -13
  5. package/ai/schema.json +616 -42
  6. package/ai/surface-manifest.json +1 -1
  7. package/ai/system-prompt.md +5 -2
  8. package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
  9. package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
  10. package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
  11. package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
  12. package/dist/chunk-chunk-27HVVXS6.module.min.js +1 -0
  13. package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
  14. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
  15. package/dist/chunk-chunk-2UN3ANRN.module.min.js +2 -0
  16. package/dist/chunk-chunk-2VUEY5TH.module.min.js +1 -0
  17. package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
  18. package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
  19. package/dist/chunk-chunk-5WEFWNUW.module.min.js +2 -0
  20. package/dist/chunk-chunk-6F6GEAQU.module.min.js +1 -0
  21. package/dist/chunk-chunk-7LHMKRKE.module.min.js +2 -0
  22. package/dist/chunk-chunk-BHYTYMY2.module.min.js +2 -0
  23. package/dist/chunk-chunk-C6EJ4IOD.module.min.js +2 -0
  24. package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
  25. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
  26. package/dist/chunk-chunk-CYIML3AV.module.min.js +2 -0
  27. package/dist/chunk-chunk-DNY43POY.module.min.js +1 -0
  28. package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
  29. package/dist/chunk-chunk-E7MIQX7D.module.min.js +2 -0
  30. package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
  31. package/dist/chunk-chunk-ES4DCG3L.module.min.js +1 -0
  32. package/dist/chunk-chunk-FAKO3RGQ.module.min.js +2 -0
  33. package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
  34. package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
  35. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
  36. package/dist/chunk-chunk-H4PPRW6N.module.min.js +1 -0
  37. package/dist/chunk-chunk-IFYPMWKY.module.min.js +1 -0
  38. package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
  39. package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
  40. package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
  41. package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
  42. package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
  43. package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
  44. package/dist/chunk-chunk-L6D3I3V7.module.min.js +2 -0
  45. package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
  46. package/dist/chunk-chunk-NO4MCQVD.module.min.js +1 -0
  47. package/dist/chunk-chunk-ODUZEEBH.module.min.js +2 -0
  48. package/dist/chunk-chunk-P6UBCMSQ.module.min.js +2 -0
  49. package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
  50. package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
  51. package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
  52. package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
  53. package/dist/chunk-chunk-RH5TSQPH.module.min.js +1 -0
  54. package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
  55. package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
  56. package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
  57. package/dist/chunk-chunk-STZFFTAN.module.min.js +2 -0
  58. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  59. package/dist/chunk-chunk-T27ZEV6A.module.min.js +1 -0
  60. package/dist/chunk-chunk-U3AGQ5EF.module.min.js +2 -0
  61. package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
  62. package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
  63. package/dist/chunk-chunk-W3DB2MN4.module.min.js +2 -0
  64. package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
  65. package/dist/chunk-chunk-WDIN4LRC.module.min.js +1 -0
  66. package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
  67. package/dist/chunk-chunk-XOYX77KF.module.min.js +2 -0
  68. package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
  69. package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
  70. package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
  71. package/dist/chunk-chunk-Z5KXAVQD.module.min.js +2 -0
  72. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
  73. package/dist/chunk-chunk-ZLKRTF5N.module.min.js +2 -0
  74. package/dist/chunk-chunk-ZTNVDWAK.module.min.js +2 -0
  75. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
  76. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
  77. package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
  78. package/dist/components/server/staticSVGChrome.d.ts +3 -2
  79. package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
  80. package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
  81. package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
  82. package/dist/controls.min.js +1 -1
  83. package/dist/controls.module.min.js +1 -1
  84. package/dist/geo.min.js +1 -1
  85. package/dist/geo.module.min.js +1 -1
  86. package/dist/network.min.js +1 -1
  87. package/dist/network.module.min.js +1 -1
  88. package/dist/ordinal.min.js +1 -1
  89. package/dist/ordinal.module.min.js +1 -1
  90. package/dist/physics-matter.min.js +1 -1
  91. package/dist/physics-matter.module.min.js +1 -1
  92. package/dist/physics-rapier.min.js +1 -1
  93. package/dist/physics-rapier.module.min.js +1 -1
  94. package/dist/physics.min.js +1 -1
  95. package/dist/physics.module.min.js +1 -1
  96. package/dist/realtime.min.js +1 -1
  97. package/dist/realtime.module.min.js +1 -1
  98. package/dist/rough.min.js +1 -1
  99. package/dist/rough.module.min.js +1 -1
  100. package/dist/semiotic-ai-core.min.js +1 -1
  101. package/dist/semiotic-ai-core.module.min.js +1 -1
  102. package/dist/semiotic-ai.min.js +1 -1
  103. package/dist/semiotic-ai.module.min.js +1 -1
  104. package/dist/semiotic-data.min.js +1 -1
  105. package/dist/semiotic-data.module.min.js +1 -1
  106. package/dist/semiotic-experimental.min.js +1 -1
  107. package/dist/semiotic-experimental.module.min.js +1 -1
  108. package/dist/semiotic-realtime-core.min.js +1 -1
  109. package/dist/semiotic-realtime-core.module.min.js +1 -1
  110. package/dist/semiotic-realtime-react.min.js +1 -1
  111. package/dist/semiotic-realtime-react.module.min.js +1 -1
  112. package/dist/semiotic-recipes-core.min.js +1 -1
  113. package/dist/semiotic-recipes-core.module.min.js +1 -1
  114. package/dist/semiotic-recipes-react.min.js +1 -1
  115. package/dist/semiotic-recipes-react.module.min.js +1 -1
  116. package/dist/semiotic-recipes.min.js +1 -1
  117. package/dist/semiotic-recipes.module.min.js +1 -1
  118. package/dist/semiotic-server-edge.min.js +1 -1
  119. package/dist/semiotic-server-edge.module.min.js +1 -1
  120. package/dist/semiotic-server-node.min.js +1 -1
  121. package/dist/semiotic-server-node.module.min.js +1 -1
  122. package/dist/semiotic-themes-core.min.js +1 -1
  123. package/dist/semiotic-themes-core.module.min.js +1 -1
  124. package/dist/semiotic-themes-react.min.js +1 -1
  125. package/dist/semiotic-themes-react.module.min.js +1 -1
  126. package/dist/semiotic-themes.min.js +1 -1
  127. package/dist/semiotic-themes.module.min.js +1 -1
  128. package/dist/semiotic-utils-core.min.js +1 -1
  129. package/dist/semiotic-utils-core.module.min.js +1 -1
  130. package/dist/semiotic-utils-react.min.js +1 -1
  131. package/dist/semiotic-utils-react.module.min.js +1 -1
  132. package/dist/semiotic-utils.min.js +1 -1
  133. package/dist/semiotic-utils.module.min.js +1 -1
  134. package/dist/semiotic-value.min.js +1 -1
  135. package/dist/semiotic-value.module.min.js +1 -1
  136. package/dist/semiotic.min.js +1 -1
  137. package/dist/semiotic.module.min.js +1 -1
  138. package/dist/server.min.js +1 -1
  139. package/dist/server.module.min.js +1 -1
  140. package/dist/xy.min.js +1 -1
  141. package/dist/xy.module.min.js +1 -1
  142. package/package.json +4 -4
  143. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
  144. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
  145. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
  146. package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
  147. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
@@ -0,0 +1 @@
1
+ var e=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),n=new Set(["label","callout","callout-circle","callout-rect"]);function t(e){return"string"==typeof e?.type?e.type:""}function a(n){return!!n&&"object"==typeof n&&e.has(t(n))}function i(e){return n.has(t(e))&&!function(e){return Array.isArray(e?.disable)&&e.disable.includes("connector")}(e)}var r=2e4;function o(e){return"primary"===e?.emphasis||!0===e?.defensive}function s(e,n,t={}){return"number"==typeof t.maxAnnotations&&Number.isFinite(t.maxAnnotations)?Math.max(0,Math.floor(t.maxAnnotations)):e>0&&n>0?Math.max(1,Math.round(e*n/(t.areaPerAnnotation&&t.areaPerAnnotation>0?t.areaPerAnnotation:2e4))):1/0}function c(e){let n;const t=e?.emphasis;n="primary"===t?100:"secondary"===t?10:50;const a=e?.provenance?.confidence;switch("number"==typeof a&&Number.isFinite(a)&&(n+=15*Math.max(0,Math.min(1,a))),e?.lifecycle?.freshness){case"fresh":n+=8;break;case"aging":n+=4;break;case"stale":n+=1;break;case"expired":n-=200}return n}function l(e){const{annotations:n,width:t,height:i}=e,r=Math.max(0,e.minVisible??1),l=s(t,i,e),u=n.map((e,n)=>{return{annotation:e,index:n,note:(t=e,a(t))};var t}),h=u.filter(e=>e.note);if(0===h.length||l>=h.length)return{visible:n.slice(),deferred:[],budget:l};const f=h.filter(e=>o(e.annotation)),m=h.filter(e=>!o(e.annotation)).sort((e,n)=>c(n.annotation)-c(e.annotation)||e.index-n.index),d=Math.min(m.length,Math.max(Math.max(0,l-f.length),Math.max(0,r-f.length))),x=new Set([...f.map(e=>e.index),...m.slice(0,d).map(e=>e.index)]),p=[],b=[];for(const{annotation:e,index:n,note:t}of u)!t||x.has(n)?p.push(e):b.push(e);return{visible:p,deferred:b,budget:l}}export{t as annotationType,a as isNoteAnnotation,i as annotationDrawsConnector,r as DEFAULT_AREA_PER_ANNOTATION,s as annotationBudget,l as annotationDensity};
@@ -0,0 +1 @@
1
+ var t=class{constructor(t){if(this._capacity=t,this.head=0,this._size=0,1>t)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(t)}push(t){let i;return this._size===this._capacity?i=this.buffer[this.head]:this._size++,this.buffer[this.head]=t,this.head=(this.head+1)%this._capacity,i}pushMany(t){const i=[];for(const s of t){const t=this.push(s);void 0!==t&&i.push(t)}return i}get(t){if(t>=0&&this._size>t)return this.buffer[(this.head-this._size+t+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let t=0;return{next:()=>this._size>t?{done:!1,value:this.get(t++)}:{done:!0,value:void 0}}}forEach(t){const i=(this.head-this._size+this._capacity)%this._capacity;for(let s=0;this._size>s;s++)t(this.buffer[(i+s)%this._capacity],s)}toArray(){const t=Array(this._size),i=(this.head-this._size+this._capacity)%this._capacity;for(let s=0;this._size>s;s++)t[s]=this.buffer[(i+s)%this._capacity];return t}resize(t){if(1>t)throw Error("RingBuffer capacity must be at least 1");const i=this.toArray();let s=0,h=[];i.length>t&&(s=i.length-t,h=i.slice(0,s)),this._capacity=t,this.buffer=Array(t),this.head=0,this._size=0;for(let t=s;i.length>t;t++)this.push(i[t]);return h}update(t,i){const s=[],h=(this.head-this._size+this._capacity)%this._capacity;for(let e=0;this._size>e;e++){const r=(h+e)%this._capacity,a=this.buffer[r];if(t(a)){let t;t="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},s.push(t),this.buffer[r]=i(a)}}return s}remove(t){const i=[],s=[];if(this.forEach(h=>{t(h)?s.push(h):i.push(h)}),0===s.length)return s;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const t of i)this.push(t);return s}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},i=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,i){this._min=1/0,this._max=-1/0;for(const s of t){const t=i?i(s):s;Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};export{t as RingBuffer,i as IncrementalExtent};
@@ -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,useChartSetup as i,useCustomChartSetup as r,useFrameImperativeHandle as n}from"./chunk-chunk-BHYTYMY2.module.min.js";import{DataSourceAdapter as s,IncrementalExtent as a,accessorsEquivalent as l,barCanvasRenderer as c,buildEnrichAnnotationData as h,buildRectNode as u,resolveAccessor as d,resolveAnnotationAccessor as g,resolveFrameGraphics as m,resolveStringAccessor as p,symbolCanvasRenderer as f,ticksForMode as y,toIdSet as v}from"./chunk-chunk-ZLKRTF5N.module.min.js";import{RingBuffer as b,compactTimestampBufferForRemoval as x,computePulseIntensity as w,createTimestampBufferForData as A,ensureRingBufferCapacity as k,hasActivePulses as S,pointCanvasRenderer as _,pushWithTimestamp as C,refreshIdlePulse as P,setPulseState as R,useLegendCategoryEmission as M,useOrdinalKeyboardNavigation as L,useSemanticFrameInteractions as I}from"./chunk-chunk-5WEFWNUW.module.min.js";import{StalenessBadge as T,attachUpdateResultStore as H,buildBaseMetadataProps as B,buildCustomBehaviorProps as O,buildDatumIndexMap as F,buildOrdinalTooltip as E,buildTooltipProps as N,composeOverlays as D,computeDecayOpacity as W,createCustomLayoutFailureDiagnostic as j,findHitPointInQuadtree as z,getHitRadius as G,glyphCanvasRenderer as V,hitTestRect as $,normalizeAngle as q,paintSceneWithBackend as X,renderPathPulse as Y,renderSceneWithBackend as Q,useConfigSync as K,useLayoutSelectionSync as Z,useStableShallow as U,useStalenessCheck as J,warnCustomLayoutDiagnostics as ee}from"./chunk-chunk-FAKO3RGQ.module.min.js";import{wrapWithCustomLayoutSelection as te}from"./chunk-chunk-5UKL5W76.module.min.js";import{makeRuleValueResolver as oe,resolveStyleRules as ie}from"./chunk-chunk-EMO5NUGE.module.min.js";import{buildResolveColor as re,resolveCustomLayoutPalette as ne}from"./chunk-chunk-STZFFTAN.module.min.js";import{AccessibleDataTable as se,AriaLiveTooltip as ae,CanvasFrameBackground as le,FlippingTooltip as ce,FocusRing as he,STREAMING_PALETTE as ue,SYMBOL_SEQUENCE as de,SceneRevisionDiagnosticsObserver as ge,ScreenReaderSummary as me,SkipToTableLink as pe,TITLE_BASELINE as fe,UpdateResultTracker as ye,annotationLayout as ve,annularSectorPath as be,buildGaugeGradientGeometry as xe,buildHoverData as we,coerceCanvasFill as Ae,computeCanvasAriaLabel as ke,computeEasing as Se,computeRawProgress as _e,createColorScale as Ce,createDefaultAnnotationRules as Pe,createHatchPattern as Re,createLegend as Me,defaultTooltipStyle as Le,filterSparseArray as Ie,getColor as Te,getDevicePixelRatio as He,getSize as Be,interpolateBrBG as Oe,interpolatePRGn as Fe,interpolatePiYG as Ee,interpolateRdBu as Ne,interpolateRdYlBu as De,interpolateRdYlGn as We,interpolateSpectral as je,isAnnotationActivationTarget as ze,isServerEnvironment as Ge,lerp as Ve,normalizeLinkedBrush as $e,normalizeTooltip as qe,now as Xe,observationInputType as Ye,ordinalSceneNodeToSVG as Qe,parseCanvasColor as Ke,renderAnnotationPass as Ze,renderLegendFromConfig as Ue,resolveCSSColor as Je,resolveCanvasFill as et,resolveDefaultFill as tt,smartTooltipEntries as ot,symbolRadius as it,useAnnotationActivationOptions as rt,useBrushSelection as nt,useCategoryColors as st,useChartMode as at,useFrame as lt,useFrameCanvasHost as ct,useLinkedChartCategories as ht,useSceneRevisionDiagnostics as ut,useSortedData as dt,useThemeCategorical as gt,useThemeDiverging as mt,wrapStyleWithSelection as pt}from"./chunk-chunk-ODUZEEBH.module.min.js";import{getMax as ft,getMinMax as yt}from"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveThemeSemanticColors as vt}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphHitGeometry as bt}from"./chunk-chunk-KTWEBFMX.module.min.js";import{ChartError as xt,SafeRender as wt,useHydration as At,useWasHydratingFromSSR as kt,warnMissingField as St}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{useRef as _t,useState as Ct,useEffect as Pt,useMemo as Rt,useCallback as Mt,useImperativeHandle as Lt,forwardRef as It,memo as Tt}from"react";import{scaleBand as Ht,scaleLinear as Bt}from"d3-scale";var Ot=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,o){if(t&&"function"==typeof e.pieceStyle){const i=e.pieceStyle(t,o);return i&&!i.fill&&o?{...i,fill:this.getColorFromScheme(e,o)}:i}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&o?{fill:e.barColors[o]||"#007bff"}:{fill:o?this.getColorFromScheme(e,o):"#007bff"}}resolveSummaryStyle(e,t,o){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,o):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const o=this.colorSchemeMap.get(t);if(o)return o;const i=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||ue,r=i[this.colorSchemeIndex%i.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function Ft(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,i=new Map;let r=0;return e=>{const n=t(e)+"",s=o?.[n];if(s)return s;let a=i.get(n);return a||(a=de[r%de.length],r++,i.set(n,a)),a}}function Et(e,t,o,i,r,n,s){e.push(t?{type:"symbol",x:i,y:r,size:Math.PI*n*n,symbolType:t(o),style:s,datum:o}:{type:"point",x:i,y:r,r:n,style:s,datum:o})}function Nt(e,t){const{columns:o,config:i,resolvePieceStyle:r}=e,n=[],s=Math.min(t.width,t.height)/2-4,a="donut"===i.chartType?i.innerRadius||60:0,l=-Math.PI/2+(i.startAngle||0)*Math.PI/180,c=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,h=null!=i.sweepAngle&&360>i.sweepAngle,u=Object.values(o),d=u.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),g=h&&!d&&u.length>1&&(i.cornerRadius??0)>0;for(let e=0;u.length>e;e++){const t=u[e],o=t.pieceData[0],h="number"==typeof o?._pctStart?o._pctStart:t.pctStart,d=l+h*c,m=l+(h+("number"==typeof o?._pct?o._pct:t.pct))*c,p=r(t.pieceData[0],t.name),f=0===e,y=e===u.length-1,v={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:d,endAngle:m,...i.cornerRadius&&{cornerRadius:i.cornerRadius},style:p,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?v.roundedEnds=o._roundedEnds:g&&(v.roundedEnds={start:f,end:y}),o?._gradientBand&&(v._gradientBand=o._gradientBand),n.push(v)}return n}import{quantile as Dt}from"d3-array";function Wt(e){const t=e.length,o=e[0],i=e[t-1];return{n:t,min:o,q1:Dt(e,.25)??o,median:Dt(e,.5)??(o+i)/2,q3:Dt(e,.75)??i,max:i,mean:e.reduce((e,t)=>e+t,0)/t}}import{scaleLinear as jt}from"d3-scale";var zt={bar:function(e,t){const{scales:o,columns:i,config:r,getR:n,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,h=[],d="vertical"===c,g="horizontal"===c,m=r.normalize,p=[];if(s){const e=new Set;for(const t of Object.values(i))for(const o of t.pieceData){const t=s(o);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(i)){const t=new Map;for(const o of e.pieceData){const e=s?s(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e);i.total+=n(o),i.pieces.push(o)}let o=0;if(m)for(const e of t.values())o+=Math.abs(e.total);let i=0,r=0;for(const n of p){const c=t.get(n);if(!c)continue;let p=c.total;m&&o>0&&(p/=o);const f=a(c.pieces[0],s?n:e.name),y={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>p?r:i+p),o=0>p?l(r+p)-l(r):l(i)-l(i+p);h.push(u(e.x,t,e.width,Math.abs(o),f,y,n)),0>p?r+=p:i+=p}else if(g){const t=l(0>p?r+p:i),o=0>p?l(r)-l(r+p):l(i+p)-l(i);h.push(u(t,e.x,Math.abs(o),e.width,f,y,n)),0>p?r+=p:i+=p}}}const f="vertical"===c,y=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of h){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=f?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(y>0){const e=new Map;for(const t of h){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(f?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=y),o.length>0&&(o.reduce(f?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=y)}}return h},clusterbar:function(e,t){const{scales:o,columns:i,config:r,getR:n,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,h=[],d="vertical"===c,g=[],m=new Set;for(const e of Object.values(i))for(const t of e.pieceData){const e=s?s(t):"_default";m.has(e)||(m.add(e),g.push(e))}const p=g.length||1;for(const e of Object.values(i)){const t=e.width/p,o=.2*t,i=t-o,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;g.length>s;s++){const c=r.get(g[s])||[];for(const r of c){const c=n(r),m=a(r,g[s]);if(d){const n=e.x+s*t+o/2,a=l(0),d=l(c);h.push(u(n,Math.min(a,d),i,Math.abs(a-d),m,r,g[s]))}else{const n=e.x+s*t+o/2,a=l(0),d=l(c);h.push(u(Math.min(a,d),n,Math.abs(d-a),i,m,r,g[s]))}}}}const f=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of h){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=n(e.datum);f>0&&(e.roundedTop=f),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return h},point:function(e,t){const{scales:o,columns:i,getR:r,multiScales:n,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],h="vertical"===l,u="radial"===l,d=n.length>0,g=Ft(e),m=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const o=t.__rIndex??0,i=t.__rValue??r(t),l=d&&n[o]||a,f=s(t,e.name),y=f.r||5;let v,b;if(u){const t=p+(e.pctStart+e.pct/2)*m,o=l(i);v=Math.cos(t)*o,b=Math.sin(t)*o}else h?(v=e.middle,b=l(i)):(v=l(i),b=e.middle);Et(c,g,t,v,b,y,f)}return c},swarm:function(e,t){const{scales:o,columns:i,getR:r,resolvePieceStyle:n}=e,{r:s,projection:a}=o,l=[],c="vertical"===a,h=Ft(e);for(const e of Object.values(i)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const i=e.pieceData[o],a=r(i),u=n(i,e.name),d=u.r||4,g=(7919*o%100/100-.5)*t*.8;Et(l,h,i,c?e.middle+g:s(a),c?s(a):e.middle+g,d,u)}}return l},pie:Nt,donut:Nt,boxplot:function(e,t){const{scales:o,columns:i,config:r,getR:n,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],h="vertical"===l,u=!1!==r.showOutliers;for(const t of Object.values(i)){const o=t.pieceData.map(e=>n(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const i=o[0],r=o[o.length-1],l=Dt(o,.25)??i,d=Dt(o,.5)??(i+r)/2,g=Dt(o,.75)??r,m=g-l,p=l-1.5*m,f=g+1.5*m,y=o.find(e=>e>=p)??i,v=[...o].reverse().find(e=>f>=e)??r,b=s(t.pieceData[0],t.name),x=[];if(u)for(const e of t.pieceData){const o=n(e);if(p>o||o>f){const i=h?t.middle:a(o),r=h?a(o):t.middle;x.push({px:i,py:r,value:o,datum:e})}}if(c.push({type:"boxplot",x:h?t.middle:0,y:h?0:t.middle,projection:h?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(y),q1Pos:a(l),medianPos:a(d),q3Pos:a(g),maxPos:a(v),stats:{n:o.length,min:y,q1:l,median:d,q3:g,max:v,mean:o.reduce((e,t)=>e+t,0)/o.length},style:b,datum:t.pieceData,category:t.name,outliers:x}),u)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:b.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:i,config:r,getR:n,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],h="vertical"===l,u=r.bins||20,d=!1!==r.showIQR;for(const e of Object.values(i)){const t=e.pieceData.map(e=>n(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/u||1,l=Array(u).fill(0);for(const e of t)l[Math.min(Math.floor((e-o)/r),u-1)]++;const g=ft(l,1),m=e.width/2*.9;let p;if(h){p=`M ${e.middle} ${a(o)}`;for(let t=0;u>t;t++){const i=a(o+(t+.5)*r);p+=` L ${e.middle+l[t]/g*m} ${i}`}p+=` L ${e.middle} ${a(i)}`;for(let t=u-1;t>=0;t--){const i=a(o+(t+.5)*r);p+=` L ${e.middle-l[t]/g*m} ${i}`}p+=" Z"}else{p=`M ${a(o)} ${e.middle}`;for(let t=0;u>t;t++)p+=` L ${a(o+(t+.5)*r)} ${e.middle-l[t]/g*m}`;p+=` L ${a(i)} ${e.middle}`;for(let t=u-1;t>=0;t--)p+=` L ${a(o+(t+.5)*r)} ${e.middle+l[t]/g*m}`;p+=" Z"}const f=s(e.pieceData[0],e.name);let y;if(d&&t.length>=4){const r=Dt(t,.25)??o,n=Dt(t,.5)??(o+i)/2,s=Dt(t,.75)??i;y={q1Pos:a(r),medianPos:a(n),q3Pos:a(s),centerPos:e.middle,isVertical:h}}const v=h?{x:e.x,y:Math.min(a(i),a(o)),width:e.width,height:Math.abs(a(i)-a(o))}:{x:Math.min(a(o),a(i)),y:e.x,width:Math.abs(a(i)-a(o)),height:e.width};c.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:v,iqrLine:y,stats:Wt(t),style:f,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:i,config:r,getR:n,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=r.bins||25,h=r.normalize,d=a.domain?.(),g=d?+d[0]:void 0,m=d?+d[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>n(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[o,i]=yt(t),r=null!=g&&isFinite(g)?g:o,d=null!=m&&isFinite(m)?m:i,p=(d-r)/c||1,f=Array(c).fill(0);for(const e of t)r>e||e>d||f[Math.min(Math.floor((e-r)/p),c-1)]++;const y=t.length,v=ft(f,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===f[t])continue;const o=(h?f[t]/y:f[t]/v)*e.width*.9,i=a(r+t*p),n=a(r+(t+1)*p);l.push(u(Math.min(i,n),e.x+e.width-o,Math.abs(n-i),o,b,{bin:t,count:f[t],range:[r+t*p,r+(t+1)*p],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:i,config:r,getR:n,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],h=r.bins||20,u="horizontal"===l,d=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>n(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/h||1,l=Array(h).fill(0);for(const e of t)o>e||e>i||l[Math.min(Math.floor((e-o)/r),h-1)]++;const g=ft(l,1),m=s(e.pieceData[0],e.name),p=e.width*d;let f;if(u){const t=e.x+e.width;f=`M ${a(o)} ${t}`;for(let e=0;h>e;e++)f+=` L ${a(o+(e+.5)*r)} ${t-l[e]/g*p}`;f+=` L ${a(i)} ${t} Z`}else{const t=e.x;f=`M ${t} ${a(o)}`;for(let e=0;h>e;e++){const i=a(o+(e+.5)*r);f+=` L ${t+l[e]/g*p} ${i}`}f+=` L ${t} ${a(i)} Z`}const y=u?{x:Math.min(a(o),a(i)),y:e.x,width:Math.abs(a(i)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(i),a(o)),width:e.width,height:Math.abs(a(i)-a(o))};c.push({type:"violin",pathString:f,translateX:0,translateY:0,bounds:y,stats:Wt(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:i,getRawRange:r,resolvePieceStyle:n}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(i))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[i,a]=o,h=n(t,e.name);if(c){const o=s(Math.min(i,a)),r=s(Math.max(i,a));l.push(u(o,e.x,r-o,e.width,h,t,e.name))}else{const o=s(Math.max(i,a)),r=s(Math.min(i,a));l.push(u(e.x,o,e.width,r-o,h,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:i,getStack:r,resolvePieceStyle:n}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return s;const h=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),h.push(e))}const g=h.length>1&&"_default"!==h[0],m=[];let p=0;for(const e of c){const t=new Map;let o=0;for(const n of e.pieceData){const e=r?r(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=i(n);s.total+=a,s.pieces.push(n),o+=a}m.push({col:e,groups:t,stepTotal:o}),g||o>p&&(p=o)}if(g)for(const e of m){let t=0,o=0;for(let i=0;h.length>i;i++){const r=e.groups.get(h[i]);r&&(i%2==0?t+=r.total:o+=r.total)}const i=Math.max(t,o);i>p&&(p=i)}if(0===p)return s;const f=new Map;for(const e of h){const t=m[0].groups.get(e);f.set(e,t?.total??0)}const y=m[0].stepTotal,v=g?.95*a:.9*t.width,b=jt().domain([0,p]).range([0,v]),x=e.config.connectorOpacity??.3;let w=new Map;for(let t=0;m.length>t;t++){const o=m[t],i=o.col,r=0===t,c=i.width,d=.55*c,p=i.x+(c-d)/2,v=new Map;if(g){let e=0;for(const t of h){const i=o.groups.get(t);i&&(e+=b(i.total))}let t=a,c=a;for(let g=0;h.length>g;g++){const m=h[g],y=o.groups.get(m);if(!y)continue;const x=b(y.total),w=g%2==0,A=w?t:c-x;w?t+=x:c-=x;const k=n(y.pieces[0],m),S=f.get(m)??y.total,_={...y.pieces[0],__funnelValue:y.total,__funnelPercent:S>0?y.total/S*100:0,__funnelStep:i.name,__funnelIsFirstStep:r,__aggregateValue:y.total,__pieceCount:y.pieces.length,category:m};l&&(0===g&&(_.__funnelStepLabel=i.name,_.__funnelStepLabelX=a,_.__funnelStepLabelY=p,_.__funnelRowWidth=e),_.__funnelValueLabelX=A+x/2,_.__funnelValueLabelY=p,_.__funnelBarW=x),s.push(u(A,p,x,d,k,_,m)),v.set(m,{x:A,y:p,w:x,h:d})}}else{const e=o.stepTotal,t=b(e),c=a-t/2,g=h[0],m="_default"!==g,f=o.groups.get(g)?.pieces[0]??i.pieceData[0],x=m?g:i.name,w=n(f,x),A=y>0?e/y*100:0,k={...f,__funnelValue:e,__funnelPercent:A,__funnelStep:i.name,__funnelIsFirstStep:r,category:m?g:i.name};l&&(k.__funnelStepLabel=i.name,k.__funnelStepLabelX=a,k.__funnelStepLabelY=p,k.__funnelRowWidth=t,k.__funnelValueLabelX=a,k.__funnelValueLabelY=p,k.__funnelBarW=t),s.push(u(c,p,t,d,w,k,x)),v.set(g,{x:c,y:p,w:t,h:d})}if(t>0&&w.size>0){const t=g?h:[h[0]];for(const r of t){const t=w.get(r),a=v.get(r);if(!t||!a)continue;const l=(()=>{const e=o.groups.get(r);return n(e?e.pieces[0]:i.pieceData[0],"_default"===r?i.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:x},datum:o.groups.get(r)?.pieces[0]??i.pieceData[0],category:"_default"===r?i.name:r};s.push(c)}}w=v}return s},"bar-funnel":function(e,t){const{columns:o,getR:i,getStack:r,resolvePieceStyle:n,scales:s}=e,a=[],l=s.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return a;const c=[],h=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";h.has(e)||(h.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],g=[];for(const e of l){const t=new Map;let o=0;for(const n of e.pieceData){const e=r?r(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=i(n);s.total+=a,s.pieces.push(n),o+=a}g.push({col:e,groups:t,stepTotal:o})}const m=new Map;for(const e of c){const t=g[0]?.groups.get(e);m.set(e,t?.total??0)}const p=s.r,f=d?c.length:1,y=d?.15:0;for(let e=0;g.length>e;e++){const t=g[e],o=t.col,i=0===e,r=e>0?g[e-1]:null,s=o.width/f,l=s*y,h=s-l;for(let e=0;c.length>e;e++){const g=c[e],f=t.groups.get(g);if(!f)continue;const y=f.total,v=m.get(g)??y,b=v>0?y/v*100:0,x=r?.groups.get(g),w=i?0:Math.max(0,(x?.total??y)-y),A=o.x+e*s+l/2,k=p(y),S=p(0)-k,_=n(f.pieces[0],d?g:o.name),C={...f.pieces[0],__barFunnelValue:y,__barFunnelPercent:b,__barFunnelIsFirstStep:i,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:w,__barFunnelCategory:"_default"===g?void 0:g,category:d?g:o.name,__barFunnelLabelX:A+h/2,__barFunnelLabelY:p(y+w)};if(a.push(u(A,k,h,S,_,C,d?g:o.name)),w>0){const e=p(y+w),t=k-e,i={..._},r={...f.pieces[0],__barFunnelValue:w,__barFunnelPercent:v>0?w/v*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===g?void 0:g,category:d?g:o.name};a.push(u(A,e,h,t,i,r,d?g:o.name))}}}return a},swimlane:function(e,t){const{scales:o,columns:i,getR:r,getStack:n,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],h="horizontal"===l,d=e.config.gradientFill,g=h?"left":"bottom",m=e.config.trackFill;if(m){const e="string"==typeof m?m:m.color,t="string"==typeof m?1:m.opacity??1,[o,r]=a.range(),n=Math.min(o,r),s=Math.abs(r-o);for(const o of Object.values(i)){const i={fill:e,opacity:t},r=h?u(n,o.x,s,o.width,i,null,"__track__"):u(o.x,n,o.width,s,i,null,"__track__");c.push(r)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const o=c.length;for(const o of e.pieceData){const i=Math.abs(r(o));if(0===i)continue;const l=n?n(o):e.name,m=s(o,l);let p;if(h){const r=a(t),n=a(t+i);p=u(r,e.x,n-r,e.width,m,o,l)}else{const r=a(t+i),n=a(t);p=u(e.x,r,e.width,n-r,m,o,l)}d&&(p.fillGradient=d,p.roundedEdge=g),c.push(p),t+=i}if(p>0&&c.length>o){const e=c.slice(o),t=e[0],i=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:h?(t.cornerRadii={tl:p,bl:p},i.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},i.cornerRadii={tl:p,tr:p})}}return c}},Gt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Vt=["scene-style","data-paint","accessibility","evidence"],$t=(e,t)=>({retainedData:e,invalidations:t}),qt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Xt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Yt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Qt=["scene-geometry","data-paint","accessibility","evidence"],Kt=["scene-style","data-paint","accessibility","evidence"],Zt=[],Ut={chartType:$t("rebuild",qt),runtimeMode:$t("rebuild",qt),categoryAccessor:$t("rebuild",qt),valueAccessor:$t("rebuild",qt),oAccessor:$t("rebuild",qt),rAccessor:$t("rebuild",qt),stackBy:$t("rebuild",qt),groupBy:$t("rebuild",qt),timeAccessor:$t("rebuild",qt),accessorRevision:$t("rebuild",qt),colorAccessor:$t("rebuild",Kt),symbolAccessor:$t("rebuild",Qt),connectorAccessor:$t("rebuild",Qt),dataIdAccessor:$t("rebuild",Qt),projection:$t("preserve",Xt),extentPadding:$t("preserve",Xt),axisExtent:$t("preserve",Xt),rExtent:$t("preserve",Xt),oExtent:$t("preserve",Xt),multiAxis:$t("preserve",Xt),normalize:$t("preserve",Xt),bins:$t("preserve",Xt),oSort:$t("preserve",Yt),barPadding:$t("preserve",Yt),roundedTop:$t("preserve",Yt),baselinePadding:$t("preserve",Yt),innerRadius:$t("preserve",Yt),cornerRadius:$t("preserve",Yt),startAngle:$t("preserve",Yt),sweepAngle:$t("preserve",Yt),trackFill:$t("preserve",Yt),showOutliers:$t("preserve",Yt),showIQR:$t("preserve",Yt),amplitude:$t("preserve",Yt),connectorOpacity:$t("preserve",Yt),showLabels:$t("preserve",Yt),dynamicColumnWidth:$t("rebuild",Yt),customLayout:$t("preserve",Yt),layoutConfig:$t("preserve",Yt),layoutMargin:$t("preserve",Yt),symbolMap:$t("preserve",Qt),pieceStyle:$t("preserve",Kt),summaryStyle:$t("preserve",Kt),connectorStyle:$t("preserve",Kt),gradientFill:$t("preserve",Kt),colorScheme:$t("preserve",Kt),themeCategorical:$t("preserve",Kt),themeSemantic:$t("preserve",Kt),themeSequential:$t("preserve",Kt),themeDiverging:$t("preserve",Kt),barColors:$t("preserve",Kt),decay:$t("preserve",Kt),pulse:$t("preserve",Kt),staleness:$t("preserve",Kt),layoutSelection:$t("preserve",Kt),windowSize:$t("preserve",Zt),windowMode:$t("preserve",Zt),clock:$t("preserve",Zt),transition:$t("preserve",Zt),introAnimation:$t("preserve",Zt),onLayoutError:$t("preserve",Zt)},Jt=$t("preserve",Yt),eo=class{constructor(){this.tracker=new ye}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Gt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Vt):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const i of e){const e=Ut[i]??Jt;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};import{quadtree as to}from"d3-quadtree";var oo=class{constructor(e){this.rExtent=new a,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new eo,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new Ot,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new b(e.windowSize),this.getO=p(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>d(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new a)):(this.getR=d(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=p(e.stackBy),this.getGroup=p(e.groupBy),this.getColor=p(e.colorAccessor),this.getSymbol=p(e.symbolAccessor),this.getConnector=p(e.connectorAccessor),this.getDataId=p(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new b(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,i;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,i=this.currentTime(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:A(t,i):null)}currentTime(){return this.config.clock?.()??Xe()}ingest(e){const t=this.currentTime();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),k(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)C(this.buffer,o,this.timestampBuffer,t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=C(this.buffer,o,this.timestampBuffer,t);this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this,i=this.scales,r=this.multiScales,n=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),h="horizontal"===a,u="radial"===a,d=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let g,m;if(u){g=Ht().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=t.innerRadius||0;m=Bt().domain(c).range([i,o])}else h?(g=Ht().domain(l).range([0,e.height]).padding(d),m=Bt().domain(c).range([0,e.width])):(g=Ht().domain(l).range([0,e.width]).padding(d),m=Bt().domain(c).range([e.height,0]));this.scales={o:g,r:m,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((i,r)=>{const n=this.rExtents[r];n.dirty&&n.recalculate(o,i);let[s,a]=n.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),h?Bt().domain([s,a]).range([0,e.width]):Bt().domain([s,a]).range([e.height,0])}):[];let p=s;this.rAccessors.length>1&&(p=s.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(p,l,g,a,e),this._customLayoutFailedThisBuild=!1;const f=this.buildSceneNodes(p,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=i,this.multiScales=r,this.columns=n):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=f,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,i="auto"===t?void 0:t;let r=null;if(o){r=new Set;for(const t of e)r.add(this.getO(t))}const n=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(o&&void 0===i){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return n}if(!1===i)return n;if("function"==typeof i)return n.sort(i);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return n.sort("asc"===i?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:i,normalize:r,rExtent:n,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:h,getStack:u,rawRExtent:d}=e,g=s;if("radial"===i&&("pie"===o||"donut"===o))return[0,1];let m=0,p=0;if("bar"===o&&u&&r)m=0,p=1;else if("bar"===o&&u){const e=new Map,o=new Map;for(const i of t){const t=c(i),r=h(i);0>r?o.set(t,(o.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>p&&(p=t);for(const e of o.values())m>e&&(m=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),i=h(o);e.set(t,(e.get(t)||0)+i)}for(const t of e.values())t>p&&(p=t),m>t&&(m=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),i=Math.abs(h(o));e.set(t,(e.get(t)||0)+i)}for(const t of e.values())t>p&&(p=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=h(e);t>p&&(p=t),m>t&&(m=t)}else{const e=d[0],t=d[1];e!==1/0&&(m=e),t!==-1/0&&(p=t)}n&&(null!=n[0]&&(m=n[0]),null!=n[1]&&(p=n[1]));const f="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(f&&null==n?.[0]&&null==n?.[1]&&(m>0&&(m=0),0>p&&(p=0)),"bar-funnel"!==o&&"exact"!==l){const e=p-m,t=e>0?e*g:1,i=f&&!a&&0===m,r=f&&!a&&0===p||"swimlane"===o;null!=n?.[0]||i||(m-=t),null!=n?.[1]||r||(p+=t)}return[m,p]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,i,r){return function(e){const{data:t,oExtent:o,oScale:i,projection:r,layout:n,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},h=new Map;for(const e of t){const t=a(e);h.has(t)||h.set(t,[]),h.get(t).push(e)}let u=0;if("radial"===r)for(const e of t)u+=Math.abs(l(e));let d=null;if(s&&"radial"!==r){d=new Map;let e=0;for(const t of o){const o=h.get(t)||[];let i;i="string"==typeof s?o.reduce((e,t)=>e+(Number(t[s])||0),0):s(o),d.set(t,i),e+=i}const t=("horizontal"===r?n.height:n.width)-i.padding()*i.step()*o.length;if(e>0)for(const[o,i]of d)d.set(o,i/e*t)}let g=0,m=0;for(const e of o){const t=h.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=u>0?o/u:0;let n,s;d?(n=m,s=d.get(e)||i.bandwidth(),m+=s+i.padding()*i.step()):(n=i(e)??0,s=i.bandwidth()),c[e]={name:e,x:n,y:0,width:s,middle:n+s/2,padding:i.padding()*i.step(),pieceData:t,pct:r,pctStart:g},g+=r}return c}({data:e,oExtent:t,oScale:o,projection:i,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const o=this.buildLayoutContext(e,t);let i;try{i=this.config.customLayout(o)}catch(e){const t=null!==this.lastCustomLayoutResult,o=j("ordinal",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const r=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return ee({label:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),i=zt[this.config.chartType];let r=i?i(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:i,getConnector:r,getO:n}=e;if(!r||!o)return[];const s=[],{projection:a}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let i,s;"point"===e.type?(i=e.x,s=e.y):(i=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:i,y:s,datum:t,category:n(t)})}const c=o.o.domain(),h=i.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let i=0;o.length-1>i;i++){const r=o[i],n=o[i+1],a="function"==typeof h?h(r.datum):h||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:n.x,y2:n.y,style:a,datum:r.datum,group:t})}}return s}(o,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const o=this.config,i=o.layoutMargin??{top:0,right:0,bottom:0,left:0},r=ne(o.colorScheme,o.themeCategorical,ue),n=this.scales;return{data:e,scales:{o:n.o,r:n.r,projection:n.projection},dimensions:{width:t.width,height:t.height,margin:i,plot:"radial"===n.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:o.themeSemantic??{},categorical:[...r]},resolveColor:re(r,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?W(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=F(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,i=o?null:t||"category",r=new Map;for(let n=0;e.length>n;n++){const s=e[n],a=o?t(s):s[i],l=r.get(a);l?l.push(n):r.set(a,[n])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const i of e)"point"===i.type&&(t++,i.r>o&&(o=i.r));if(500>=t)return{quadtree:null,maxRadius:o};const i=Array(t);let r=0;for(const t of e)"point"===t.type&&(i[r++]=t);return{maxRadius:o,quadtree:to().x(e=>e.x).y(e=>e.y).addAll(i)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const i=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=i.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,o=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,i,r,n){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let i=0;for(const s of r(t)??[]){const t=o.get(s);null!=t&&(i=Math.max(i,w(e,t,n)))}l=R(c,i,s)||l;continue}if(null==c.datum)continue;const t=i.get(c.datum);if(null==t)continue;const h=o.get(t),u=null==h?0:w(e,h,n);l=R(c,u,s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&S(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let i;for(let r=0;this.scene.length>r;r++){const n=this.scene[r],s=this.getNodeKey(n,e);s&&("rect"===n.type?this.prevPositionMap.set(s,o?{x:n.x,y:t,w:n.w,h:0,opacity:n.style.opacity??1}:{x:t,y:n.y,w:0,h:n.h,opacity:n.style.opacity??1}):"point"===n.type?this.prevPositionMap.set(s,{x:n.x,y:n.y,r:0,opacity:0}):"wedge"===n.type&&(void 0===i&&(i=n.startAngle),this.prevPositionMap.set(s,{x:n.cx,y:n.cy,startAngle:i,endAngle:i,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,i=t.get(o)||0;return t.set(o,i+1),`${o}:${i}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],i=this.getNodeKey(o,e);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,i=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],n=this.getNodeKey(r,i);if(!n)continue;r._transitionKey=n;const s=this.prevPositionMap.get(n);if("point"===r.type)s?(o.add(n),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(o.add(n),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)o.add(n),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(n,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,i]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:i.x,y:i.y,r:i.r??3,style:{opacity:i.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:i.x,y:i.y,w:i.w??0,h:i.h??0,style:{opacity:i.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((i.startAngle??0)+(i.endAngle??0))/2,o={type:"wedge",cx:i.x,cy:i.y,innerRadius:i.innerRadius??0,outerRadius:i.outerRadius??100,startAngle:i.startAngle??0,endAngle:i.endAngle??0,style:{opacity:i.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=_e(e,this.activeTransition),o=Se(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const i=this.prevPositionMap.get(t);e.style.opacity=Ve(i?i.opacity??1:0,e._targetOpacity,o)}const i=this.prevPositionMap.get(t);void 0!==e._targetX&&i&&(e.x=Ve(i.x,e._targetX,o),e.y=Ve(i.y,e._targetY,o)),void 0!==e._targetR&&void 0!==i?.r&&(e.r=Ve(i.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const i=this.prevPositionMap.get(t);e.style.opacity=Ve(i?i.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const i=this.prevPositionMap.get(t);if(!i)continue;e.x=Ve(i.x,e._targetX,o),e.y=Ve(i.y,e._targetY,o),void 0!==i.w&&(e.w=Ve(i.w,e._targetW,o),e.h=Ve(i.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const i=this.prevPositionMap.get(t);e.style={...e.style,opacity:Ve(i?i.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const i=this.prevPositionMap.get(t);i&&void 0!==i.startAngle&&(e.startAngle=Ve(i.startAngle,e._targetStartAngle,o),e.endAngle=Ve(i.endAngle,e._targetEndAngle,o))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=v(e),o=this.getDataId,i=e=>t.has(o(e));x(this.buffer,this.timestampBuffer,i);const r=this.buffer.remove(i);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=v(e),i=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{o.has(i(e))&&r.add(t)});const n=this.buffer.update(e=>o.has(i(e)),t);if(0===n.length)return this.updateResults.recordNoop("update"),n;for(const e of n)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",n.length),n}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const i of e){const e=this._baseStyles.get(i)??i.style??{},r=o(i,t);i.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.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 e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!l(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!l(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!l(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let i=!1;("categoryAccessor"in e||"oAccessor"in e)&&(l(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=p(this.config.categoryAccessor||this.config.oAccessor,"category"),i=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(e)?e:[e],n=Array.isArray(o)?o:[o];if(r=i.length!==n.length||i.some((e,t)=>!l(e,n[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>d(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new a)):(this.getR=d(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!l(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?p(this.config.stackBy):void 0),"groupBy"in e&&!l(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?p(this.config.groupBy):void 0),"colorAccessor"in e&&!l(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?p(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!l(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?p(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!l(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?p(this.config.connectorAccessor):void 0),(i||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};function io(e,t,o,i=30,r,n=0){let s=null;if(r){const e=z(r,t,o,i,n);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const n of e){let e=null;switch(n.type){case"rect":if(null==n.datum)break;e=ro(n,t,o);break;case"point":if(r)break;e=no(n,t,o,i);break;case"symbol":e=so(n,t,o,i);break;case"glyph":e=ao(n,t,o,i);break;case"wedge":if(null===n.datum)break;e=lo(n,t,o);break;case"boxplot":e=co(n,t,o);break;case"violin":e=ho(n,t,o)}e&&i>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ro(e,t,o){const i=$(t,o,e);return i.hit?{datum:e.datum,x:i.cx,y:e.y,distance:0,category:e.group}:null}function no(e,t,o,i=30){const r=t-e.x,n=o-e.y,s=Math.sqrt(r*r+n*n);return s>G(e.r,i)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function so(e,t,o,i=30){const r=t-e.x,n=o-e.y,s=Math.sqrt(r*r+n*n);return s>G(it(e.size),i)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function ao(e,t,o,i=30){if(null==e.datum)return null;const r=bt(e.glyph,e.size),n=e.x+r.centerDx,s=e.y+r.centerDy,a=t-n,l=o-s,c=Math.sqrt(a*a+l*l);return c>G(r.radius,i)?null:{datum:e.datum,x:n,y:s,distance:c}}function lo(e,t,o){const i=t-e.cx,r=o-e.cy,n=Math.sqrt(i*i+r*r);if(e.innerRadius>n||n>e.outerRadius)return null;const s=q(Math.atan2(r,i)),a=q(e.startAngle),l=q(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,h=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*h,y:e.cy+Math.sin(c)*h,distance:0,category:e.category}}function co(e,t,o){const i=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-i>t||t>e.x+i||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-i,n=e.y+i;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>o||o>n))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ho(e,t,o){if(!e.bounds)return null;const{x:i,y:r,width:n,height:s}=e.bounds;return i>t||t>i+n||r>o||o>r+s?null:{datum:e.datum,x:i+n/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}H(oo);import{useMemo as uo,useRef as go}from"react";import{Fragment as mo,jsx as po,jsxs as fo}from"react/jsx-runtime";function yo(e){const{width:t,height:o,totalWidth:i,totalHeight:r,margin:n,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:h,axisExtent:u}=e,d="radial"===s?.projection,g="horizontal"===s?.projection,m=uo(()=>!s||d?[]:(h||y(s.r,5,u)).map(e=>({value:e,pixel:s.r(e),label:(c||vo)(e)})),[s,c,d,h,u]),p=l&&s&&!d,f=a&&s&&!d;return p||f?po("svg",{width:i,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:fo("g",{transform:`translate(${n.left},${n.top})`,children:[p&&po("g",{className:"ordinal-grid",children:m.map((e,i)=>po("line",{x1:g?e.pixel:0,y1:g?0:e.pixel,x2:g?e.pixel:t,y2:g?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+i))}),f&&po(mo,{children:fo(mo,g?{children:[po("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),po("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[po("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),po("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function vo(e){return Math.round(100*e)/100+""}function bo(e){const{width:t,height:o,totalWidth:i,totalHeight:r,margin:n,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:h,oFormat:u,rFormat:d,showGrid:g,title:m,legend:p,legendHoverBehavior:f,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:x,legendPosition:w="right",legendLayout:A,foregroundGraphics:k,annotations:S,onAnnotationActivate:_,onObservation:C,chartId:P,chartType:R,autoPlaceAnnotations:M,svgAnnotationRules:L,xAccessor:I,yAccessor:T,annotationData:H,underlayRendered:B,canvasObscuresUnderlay:O=!0,children:F}=e,E=rt({onAnnotationActivate:_,onObservation:C,chartId:P,chartType:R}),N="radial"===s?.projection,D="horizontal"===s?.projection,W=!1!==l,j=!B||O,z=uo(()=>{if(!a||!W||!s||N)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,o)=>({value:t,pixel:(s.o(t)??0)+e/2,label:u?u(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e,i=t.map(e=>{return t=e.label,D?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=D?0:6;if(i.every((e,t)=>0===t||o>=(i[t-1]+e)/2+r))return t;const n=Math.max(...i)+r,l=Math.max(1,Math.ceil(n/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,W,s,u,N,D]),G=e.rTickValues,V=e.tickLabelEdgeAlign,$=e.axisExtent,q=uo(()=>a&&s&&!N?(G||y(s.r,5,$)).map(e=>({value:e,pixel:s.r(e),label:(d||vo)(e)})):[],[a,s,d,N,G,$]),X=go(new Map),Y=go(S?.length??0),Q=S?.length??0;Y.current!==Q&&(Y.current=Q,X.current=new Map);const K=uo(()=>{if(!S||0===S.length)return null;const e=Pe("ordinal",E),i="horizontal"===s?.projection,r=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,n={scales:s?{x:i?s.r:r||s.r,y:i&&r||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:I,yAccessor:T,width:t,height:o,data:H,frameType:"ordinal",projection:i?"horizontal":"vertical",stickyPositionCache:X.current},a=M?ve({annotations:S,context:n,..."object"==typeof M?M:{}}):S;return Ze(a,e,L,n)},[S,M,L,t,o,s,I,T,H,E]);return a||m||p||k||K&&K.length>0||g||F?fo("svg",{role:"img",width:i,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[po("title",{children:"string"==typeof m?m:"Ordinal Chart"}),po("desc",{children:"string"==typeof m?m+" (ordinal data visualization)":"Ordinal data visualization"}),fo("g",{transform:`translate(${n.left},${n.top})`,children:[g&&s&&!N&&j&&po("g",{className:"ordinal-grid",children:q.map((e,i)=>po("line",{x1:D?e.pixel:0,y1:D?0:e.pixel,x2:D?e.pixel:t,y2:D?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+i))}),a&&s&&!N&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return po("g",{className:"ordinal-axes",children:fo(mo,D?{children:[fo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[j&&po("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,o)=>fo("g",{transform:`translate(0,${t.pixel})`,children:[po("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?po("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):po("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:po("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&po("text",{x:15-n.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-n.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...i},children:c})]}),fo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[j&&po("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),j&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?po("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),q.map((t,i)=>{const r=V?0===i?"start":i===q.length-1?"end":"middle":"middle";return fo("g",{transform:`translate(${t.pixel},${o})`,children:[po("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),po("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+i)}),h&&po("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...i},children:h})]})]}:{children:[fo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[j&&(()=>{const e=s?.r?s.r(0):o,i=0>e||e>o?o:e;return po("line",{x1:0,y1:i,x2:t,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),z.map((t,i)=>fo("g",{transform:`translate(${t.pixel},${o})`,children:[po("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?po("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):po("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:po("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+i)),c&&po("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...i},children:c})]}),fo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[j&&po("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),q.map((t,o)=>fo("g",{transform:`translate(0,${t.pixel})`,children:[po("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),po("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),h&&po("text",{x:15-n.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-n.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...i},children:h})]})]})})})(),K,k,F]}),m&&"string"==typeof m?po("text",{x:i/2,y:fe,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?po("foreignObject",{x:0,y:0,width:i,height:n.top,children:m}):null,Ue({legend:p,totalWidth:i,totalHeight:r,margin:n,legendPosition:w,title:m,legendLayout:A,legendHoverBehavior:f,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:x})]}):null}import*as xo from"react";import{jsx as wo}from"react/jsx-runtime";var Ao=null,ko=null;function So(e){const[t,o]=xo.useState(()=>Ao);return xo.useEffect(()=>{if(t)return;let e=!1;return(Ao?Promise.resolve(Ao):(ko||(ko=import("./chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js").then(e=>Ao=e.OrdinalBrushOverlay)),ko)).then(t=>{e||o(()=>t)}),()=>{e=!0}},[t]),t?wo(t,{...e}):null}import{arc as _o}from"d3-shape";function Co(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:i,slices:r}=xe({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:o}),n=new Path2D(i);e.save(),e.translate(t.cx,t.cy),e.clip(n);for(const t of r)e.fillStyle=Je(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n),e.restore())}function Po(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Ro(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},i=_o().cornerRadius(t.cornerRadius)(o);if(!i)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(i);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Mo=(e,t,o,i)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Co(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Po(e,t),Y(e,t)),e.globalAlpha=1;else{if(e.fillStyle=et(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=be({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Ro(e,t)):(Po(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Po(e,t),Y(e,t)),e.globalAlpha=1}},Lo=(e,t,o,i)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const o=t.columnWidth/2,i="vertical"===t.projection,r=Je(e,"var(--semiotic-primary, #007bff)"),n=Je(e,"var(--semiotic-text, #333)"),s=et(e,t.style.fill,r),a=t.style.stroke,l="string"==typeof a?Je(e,a)||a:n,c=t.style.strokeWidth||1,h=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,e.beginPath(),i?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),i?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=h,e.fillStyle=s,i){const i=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,i,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-o,i,t.columnWidth,r)}else{const i=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(i,t.y-o,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(i,t.y-o,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),i?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Io=(e,t,o,i)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=et(e,t.style.fill,"#007bff"),e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,i=!1!==t.iqrLine.isVertical;e.beginPath(),i?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),i?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},To=(e,t,o,i)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const n=new Map;for(const e of r){const t=e.group||"_default";n.has(t)||n.set(t,[]),n.get(t).push(e)}for(const[,t]of n){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=o.fillOpacity??o.opacity??.3,e.fillStyle=Ae(e,o.fill)??"#999",e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=Je(e,o.style.stroke)||et(e,o.style.fill,"")||Je(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Ho=(e,t,o,i)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const o=t.points;if(o.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=Ae(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=Je(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Bo(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Oo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Fo=new Map;function Eo(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,i=Fo.get(o);if(void 0!==i)return i;const r=Re({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Fo.set(o,r),r}function No(e,t,o,i,r,n){e.moveTo(t+n,o),e.lineTo(t+i-n,o),e.quadraticCurveTo(t+i,o,t+i,o+n),e.lineTo(t+i,o+r-n),e.quadraticCurveTo(t+i,o+r,t+i-n,o+r),e.lineTo(t+n,o+r),e.quadraticCurveTo(t,o+r,t,o+r-n),e.lineTo(t,o+n),e.quadraticCurveTo(t,o,t+n,o),e.closePath()}function Do(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Wo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function jo(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function zo(e){return(t,o,i,r)=>{e(t,o.filter(jo),{x:i.r,y:i.r},r)}}var Go=zo(c),Vo=zo(_),$o=zo(f),qo=zo(V),Xo=e=>[To,...e],Yo={bar:Xo([Go]),clusterbar:Xo([Go]),point:Xo([Vo,$o]),swarm:Xo([Vo,$o]),pie:[Mo],donut:[Mo],boxplot:Xo([Lo,Vo]),violin:Xo([Io]),histogram:Xo([Go]),ridgeline:Xo([Io]),timeline:Xo([Go]),funnel:[Go,Ho,(e,t,o,i)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const i=o.__funnelStepLabel;if(e.measureText(i).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const r=o.__funnelStepLabelX,n=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(i,r,n),e.fillStyle="#fff",e.fillText(i,r,n)}e.font="bold 13px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const i=o.__funnelBarW??0;if(60>i)continue;const r=o.__funnelValue;if(null==r||0===r)continue;const n=o.__funnelPercent,s=!0===o.__funnelIsFirstStep;let a;if(a=s?Bo(r):null!=n?`${Bo(r)} (${Oo(n)})`:Bo(r),e.measureText(a).width+16>i){if(s||null==n)continue;if(a=Bo(r),e.measureText(a).width+16>i)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Go,(e,t,o,i)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const o=("string"==typeof t.style.fill?t.style.fill:null)||Je(e,"var(--semiotic-border, #999)"),i=Eo(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),i?e.fillStyle=i:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,i)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const n=function(e,t){const[o,i,r]=Ke(e,t);return(.2126*o+.7152*i+.0722*r)/255>.6}(e,Je(e,"var(--semiotic-text, #333)")),s=n?"#1f2937":"#ffffff",a=n?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=n?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const o=t.datum;if(!o)continue;const i=o.__barFunnelValue;if(null==i)continue;if(25>t.w)continue;const r=o.__barFunnelPercent,n=!(!0===o.__barFunnelIsFirstStep)&&null!=r,h=n?Wo(r):"",u=Do(i);e.font="bold 13px sans-serif";const d=n?e.measureText(h).width:0;e.font="11px sans-serif";const g=e.measureText(u).width,m=Math.max(d,g)+12,p=n?32:17,f=o.__barFunnelLabelX,y=f-m/2,v=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),No(e,y,v,m,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),No(e,y,v,m,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",n?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(h,f,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,f,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,f,v+3))}e.lineWidth=1}],swimlane:Xo([Go]),custom:Xo([Go,Vo,$o,qo,Mo,Lo,Io,Ho])};import{jsx as Qo,jsxs as Ko}from"react/jsx-runtime";function Zo(e){const t=ot(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:Ko("div",{className:"semiotic-tooltip",style:Le,children:[null!=t.title&&Qo("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>Ko("div",{children:[Ko("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Uo({hover:e}){const t=e.data||{},o=e.stats,i=e.category;if(Array.isArray(t)){const e=i||t[0]?.category||"";if(o)return Ko("div",{className:"semiotic-tooltip",style:Le,children:[e&&Qo("div",{style:{fontWeight:"bold"},children:e+""}),Ko("div",{children:["n = ",o.n]}),Ko("div",{children:["Min: ",o.min.toLocaleString()]}),Ko("div",{children:["Q1: ",o.q1.toLocaleString()]}),Ko("div",{children:["Median: ",o.median.toLocaleString()]}),Ko("div",{children:["Q3: ",o.q3.toLocaleString()]}),Ko("div",{children:["Max: ",o.max.toLocaleString()]}),Ko("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return Ko("div",{className:"semiotic-tooltip",style:Le,children:[e&&Qo("div",{style:{fontWeight:"bold"},children:e+""}),Ko("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return Ko("div",{className:"semiotic-tooltip",style:Le,children:[t.category&&Qo("div",{style:{fontWeight:"bold"},children:t.category+""}),Ko("div",{children:["Count: ",t.count]}),2===e.length&&Ko("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,n=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return Zo(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(n&&null!=t[n]?t[n]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?Ko("div",{className:"semiotic-tooltip",style:Le,children:[a&&Qo("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&Qo("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):Zo(t)}Uo.ownsChrome=!0;import{jsx as Jo,jsxs as ei}from"react/jsx-runtime";var ti={top:50,right:40,bottom:60,left:70},oi=Tt(It(function(e,t){const{chartType:o,runtimeMode:i,data:r,oAccessor:n="category",rAccessor:a="value",colorAccessor:l,symbolAccessor:c,symbolMap:u,stackBy:d,groupBy:p,multiAxis:f,timeAccessor:y,valueAccessor:v,categoryAccessor:b,accessorRevision:x,projection:w="vertical",size:A=[600,400],responsiveWidth:k,responsiveHeight:S,margin:_,barPadding:C,roundedTop:R,gradientFill:H,trackFill:B,baselinePadding:O,innerRadius:F,cornerRadius:E,normalize:N,startAngle:W,sweepAngle:j,dynamicColumnWidth:z,bins:G,showOutliers:V,showIQR:$,amplitude:q,connectorOpacity:Y,showLabels:ee,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,rExtent:ne,oExtent:ue,extentPadding:de=.05,oSort:fe,windowMode:ye="sliding",windowSize:ve=200,pieceStyle:be,summaryStyle:xe,renderMode:Ae,colorScheme:Se,barColors:_e,showAxes:Ce=!0,showCategoryTicks:Pe,categoryLabel:Re,valueLabel:Me,categoryFormat:Le,valueFormat:Te,oLabel:Be,rLabel:Oe,oFormat:Fe,rFormat:Ee,rTickValues:Ne,tickLabelEdgeAlign:De,axisExtent:We,enableHover:je=!0,hoverAnnotation:Ve,tooltipContent:$e,customHoverBehavior:qe,customClickBehavior:Xe,onObservation:Ke,annotationObservationCallback:Ze,chartId:Ue,annotations:Je,onAnnotationActivate:et,autoPlaceAnnotations:tt,svgAnnotationRules:ot,showGrid:it=!1,legend:rt,legendHoverBehavior:nt,legendClickBehavior:st,legendHighlightedCategory:at,legendIsolatedCategories:ht,legendPosition:dt,legendLayout:gt,legendCategoryAccessor:mt,onCategoriesChange:pt,backgroundGraphics:ft,foregroundGraphics:yt,title:bt,className:xt,background:wt,centerContent:St,decay:It,pulse:Tt,transition:Ht,animate:Bt,staleness:Ot,frameScheduler:Ft,clock:Et,random:Nt,seed:Dt,paused:Wt=!1,suspendWhenHidden:jt=!0,brush:zt,onBrush:Gt,accessibleTable:Vt=!0,description:$t,summary:qt,customLayout:Xt,onLayoutError:Yt,layoutConfig:Qt,layoutSelection:Kt}=e,{customHoverBehavior:Zt,customClickBehavior:Ut,hasClickBehavior:Jt}=I({customHoverBehavior:qe,customClickBehavior:Xe,onObservation:Ke,chartId:Ue,chartType:"StreamOrdinalFrame"}),eo=b??n,to=v??a,ro=_t(!0),no=lt({sizeProp:A,responsiveWidth:k,responsiveHeight:S,userMargin:_,marginDefault:ti,title:bt,legend:rt,legendPosition:dt,animate:Bt,transitionProp:Ht,frameScheduler:Ft,clock:Et,random:Nt,seed:Dt,paused:Wt,suspendWhenHidden:jt,themeDirtyRef:ro}),{reducedMotionRef:so,responsiveRef:ao,size:lo,margin:co,adjustedWidth:ho,adjustedHeight:uo,currentTheme:go,transition:mo,introEnabled:po,tableId:fo,rafRef:vo,renderFnRef:xo,scheduleRender:wo,frameRuntime:Ao}=no,ko=At(),_o=kt(),Co=Rt(()=>Ie(r),[r]),Po=Re??Be,Ro=Me??Oe,Mo=Le??Fe,Lo=Te??Ee,Io=_t(null),[To,Ho]=Ct(null),[Bo,Oo]=Ct(null),Fo=m(yt,lo,co,Bo),Eo=m(ft,lo,co,Bo),No=ft||"transparent"===wt?null:Jo("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-co.left,y:-co.top,width:lo[0],height:lo[1],fill:wt||"var(--semiotic-bg, transparent)"}),[Do,Wo]=Ct(0),jo=_t(0),[zo,Go]=Ct(!1),Vo=_t({w:-1,h:-1}),$o=_t(!1),qo=ut("StreamOrdinalFrame"),Xo=je||Ve,Qo="streaming"===i,Ko=Rt(()=>({chartType:o,runtimeMode:Qo?"streaming":"bounded",windowSize:ve,windowMode:ye,extentPadding:de,projection:w,oAccessor:Qo?void 0:eo,rAccessor:Qo?void 0:to,accessorRevision:x,colorAccessor:l,symbolAccessor:c,symbolMap:u,stackBy:d,groupBy:p,multiAxis:f,timeAccessor:Qo?y:void 0,valueAccessor:Qo?v||("string"==typeof to||"function"==typeof to?to:void 0):void 0,categoryAccessor:Qo?eo:void 0,rExtent:ne,oExtent:ue,axisExtent:We,barPadding:C,roundedTop:R,gradientFill:H,trackFill:B,baselinePadding:O,innerRadius:F,cornerRadius:E,normalize:N,startAngle:W,sweepAngle:j,dynamicColumnWidth:z,bins:G,showOutliers:V,showIQR:$,amplitude:q,connectorOpacity:Y,showLabels:ee,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,oSort:fe,pieceStyle:be,summaryStyle:xe,colorScheme:Se,themeCategorical:go?.colors?.categorical,themeSemantic:vt(go),themeSequential:go?.colors?.sequential,themeDiverging:go?.colors?.diverging,barColors:_e,decay:It,pulse:Tt,transition:mo,introAnimation:po,staleness:Ot,clock:Ao.now,customLayout:Xt,onLayoutError:Yt,layoutConfig:Qt,layoutMargin:co}),[o,Qo,ve,ye,de,w,eo,to,x,l,c,u,d,p,f,y,v,ne,ue,We,C,R,H,B,O,F,E,N,W,j,z,G,V,$,q,Y,ee,oe,ie,re,fe,be,xe,Se,go,_e,It,Tt,mo,po,Ot,Ao.now,Xt,Yt,Qt,co]),Zo=U(Ko),oi=_t(null);oi.current||(oi.current=new oo(Zo));const ii=M(oi,mt,pt,e=>e.getData());K(oi,Zo,ro,wo),Z(oi,Kt,ro,wo);const ri=_t(null);ri.current||(ri.current=new s(e=>{const t=oi.current;t&&t.ingest(e)&&(ro.current=!0,wo())}));const ni=Mt(e=>{ri.current?.push(e)},[]),si=Mt(e=>{ri.current?.pushMany(e)},[]),ai=Mt(()=>{ri.current?.clear(),oi.current?.clear(),ro.current=!0,wo()},[wo]),li=Mt(e=>{ri.current?.clearLastData(),ri.current?.setReplacementData(e)},[]);Lt(t,()=>({push:ni,pushMany:si,replace:li,remove:e=>{ri.current?.flush();const t=oi.current?.remove(e)??[];if(t.length>0){const e=Io.current?.data;!!Io.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Io.current=null,Ho(null)),ro.current=!0,wo()}return t},update:(e,t)=>{ri.current?.flush();const o=oi.current?.update(e,t)??[];return o.length>0&&(ro.current=!0,wo()),o},clear:ai,getData:()=>(ri.current?.flush(),oi.current?.getData()??[]),getScales:()=>oi.current?.scales??null,getCustomLayout:()=>oi.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>oi.current?.lastCustomLayoutFailure??null}),[ni,si,li,ai,wo]),Pt(()=>{r&&ri.current?.setBoundedData(Co)},[r,Co]);const{canvasRef:ci}=ct(no,{storeRef:oi,dirtyRef:ro,hydrated:ko,wasHydratingFromSSR:_o,cleanup:()=>ri.current?.clear(),canvasPaintDependencies:[o,ho,uo,Ce,wt,ft,Ae,wo]}),{hoverHandlerRef:hi,hoverLeaveRef:ui,onPointerMove:di,onPointerLeave:gi}=no;hi.current=e=>{if(!Xo)return;const t=ci.current;if(!t)return;const i=t.getBoundingClientRect(),r=e.clientX-i.left-co.left,n=e.clientY-i.top-co.top;if(0>r||r>ho||0>n||n>uo)return void(Io.current&&(Io.current=null,Ho(null),Zt&&Zt(null),wo()));const s=oi.current;if(!s||0===s.scene.length)return;const a="radial"===w,l=io(s.scene,a?r-ho/2:r,a?n-uo/2:n,30,s.pointQuadtree,s.maxPointRadius);if(!l)return void(Io.current&&(Io.current=null,Ho(null),Zt&&Zt(null),wo()));const c=we(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof eo?eo:void 0,__rAccessor:"string"==typeof to?to:void 0,__chartType:o});Io.current=c,Ho(c),Zt&&(Zt(c),ro.current=!0),wo()},ui.current=()=>{Io.current&&(Io.current=null,Ho(null),Zt&&(Zt(null),ro.current=!0),wo())};const mi=Mt(e=>{if(ze(e.target))return;if(!Ut)return;const t=ci.current;if(!t)return Ut(null),ro.current=!0,void wo();const i=t.getBoundingClientRect(),r=e.clientX-i.left-co.left,n=e.clientY-i.top-co.top;if(0>r||r>ho||0>n||n>uo)return Ut(null),ro.current=!0,void wo();const s=oi.current;if(!s||0===s.scene.length)return Ut(null),ro.current=!0,void wo();const a="radial"===w,l=io(s.scene,a?r-ho/2:r,a?n-uo/2:n,30,s.pointQuadtree,s.maxPointRadius);if(!l)return Ut(null),ro.current=!0,void wo();Ut(we(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof eo?eo:void 0,__rAccessor:"string"==typeof to?to:void 0,__chartType:o}),{type:"activate",inputType:Ye(e.nativeEvent.pointerType)}),ro.current=!0,wo()},[Ut,ci,co.left,co.top,ho,uo,w,eo,to,o,wo]),{kbFocusIndexRef:pi,focusedNavPointRef:fi,onKeyDown:yi}=L({storeRef:oi,hoverRef:Io,setHoverPoint:Ho,customHoverBehavior:Zt,customClickBehavior:Ut,scheduleRender:wo,chartType:o,oAccessor:eo,rAccessor:to}),vi=Mt(e=>{pi.current=-1,fi.current=null,di(e)},[fi,pi,di]);xo.current=()=>{if(vo.current=null,!Ao.isActive)return;const e=ci.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const i=oi.current;if(!i)return;const r=Ao.now(),n=i.advanceTransition(so.current?r+1e6:r),s=!so.current&&n,a=Vo.current.w!==ho||Vo.current.h!==uo,l=ro.current;let c=!1;const h=qo.current.beforeCompute(i.getLastUpdateResult(),s);!l&&!a||s&&!a||(i.computeScene({width:ho,height:uo}),Vo.current={w:ho,h:uo},c=!0,ii()),qo.current.afterCompute(h,c,a),ro.current=l&&s&&!c;const u=P(i,r,c,$o);(c||s)&&e.setAttribute("aria-label",ke(i.scene,o+" chart"));const d=He(),g=lo[0]*d,m=lo[1]*d;e.width===g&&e.height===m||(e.width=g,e.height=m,e.style.width=lo[0]+"px",e.style.height=lo[1]+"px"),t.setTransform(d,0,0,d,0,0),t.clearRect(0,0,lo[0],lo[1]);const p=Ot&&i.lastIngestTime>0&&r-i.lastIngestTime>(Ot?.threshold??5e3);p&&(t.globalAlpha=Ot?.dimOpacity??.5);const f="radial"===w;t.save(),t.beginPath(),t.rect(co.left,co.top,ho,uo),t.clip(),f?(t.save(),t.translate(co.left+ho/2,co.top+uo/2)):t.translate(co.left,co.top);const y=Xt?Yo.custom:Yo[o]||[],v={width:ho,height:uo},b=i.scales;b&&X({context:t,nodes:i.scene,renderMode:Ae,pixelRatio:d,paintBuiltIn:e=>{for(const o of y)o(t,e,b,v)}}),f&&t.restore(),t.restore(),p&&(t.globalAlpha=1),c&&i.scales?(Oo(i.scales),Wo(e=>e+1),jo.current=r):s&&i.scales&&r-jo.current>=33&&(Wo(e=>e+1),jo.current=r),Ot?.showBadge&&Go(!!p),(s||null!=i.activeTransition||u.pending)&&wo()},J(Ot,oi,ro,wo,zo,Go);const bi=Xo&&To?$e?$e(To):Jo(Uo,{hover:To}):null,xi="radial"===w,wi=bi?Jo(ce,{x:To?xi?To.x+ho/2:To.x:0,y:To?xi?To.y+uo/2:To.y:0,containerWidth:ho,containerHeight:uo,margin:co,className:"stream-ordinal-tooltip",children:bi}):null,Ai="horizontal"===w?eo:to,ki=g("horizontal"===w?to:eo,void 0,"__semiotic_resolvedO",""),Si=g(Ai,void 0,"__semiotic_resolvedR",""),_i=ki.key,Ci=Si.key,Pi=h(ki,Si,Je&&Je.length>0||!1);if(Ge||!ko&&_o){const e=oi.current;e&&r&&(e.ingest({inserts:Co,bounded:!0}),e.computeScene({width:ho,height:uo}));const t=e?.scene??[],o=e?.scales??null,i=m(yt,lo,co,o),n=m(ft,lo,co,o),s="radial"===w,a=s?co.left+ho/2:co.left,l=s?co.top+uo/2:co.top;return ei("div",{ref:ao,className:"stream-ordinal-frame"+(xt?" "+xt:""),role:"img","aria-label":$t||("string"==typeof bt?bt:"Ordinal chart"),style:{position:"relative",width:k?"100%":lo[0],height:S?"100%":lo[1]},children:[Jo(me,{summary:qt}),ei("svg",{xmlns:"http://www.w3.org/2000/svg",width:lo[0],height:lo[1],style:{position:"absolute",left:0,top:0},children:[n&&Jo("g",{transform:`translate(${co.left},${co.top})`,children:n}),ei("g",{transform:`translate(${a},${l})`,children:[wt&&Jo("rect",{x:0,y:0,width:ho,height:uo,fill:wt}),t.map((e,t)=>Q({node:e,index:t,renderMode:Ae,fallback:()=>Qe(e,t,fo)})).filter(Boolean)]})]}),Jo(bo,{width:ho,height:uo,totalWidth:lo[0],totalHeight:lo[1],margin:co,scales:o,showAxes:Ce,showCategoryTicks:Pe,oLabel:Po,rLabel:Ro,oFormat:Mo,rFormat:Lo,rTickValues:Ne,tickLabelEdgeAlign:De,axisExtent:We,showGrid:it,title:bt,legend:rt,legendHoverBehavior:nt,legendClickBehavior:st,legendHighlightedCategory:at,legendIsolatedCategories:ht,legendPosition:dt,legendLayout:gt,foregroundGraphics:D(i,te(oi.current?.customLayoutOverlays,Kt??null)),annotations:Je,onAnnotationActivate:et,onObservation:Ze??Ke,chartId:Ue,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:tt,svgAnnotationRules:ot,annotationFrame:0,xAccessor:_i,yAccessor:Ci,annotationData:Pi(e?.getData())}),St&&"radial"===w&&Jo("div",{style:{position:"absolute",left:co.left+ho/2,top:co.top+uo/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:St})]})}return ei("div",{ref:ao,className:"stream-ordinal-frame"+(xt?" "+xt:""),role:"group","aria-label":$t||("string"==typeof bt?bt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:k?"100%":lo[0],height:S?"100%":lo[1],overflow:"visible"},onKeyDown:yi,children:["production"!==process.env.NODE_ENV&&oi.current&&Jo(ge,{store:oi.current,diagnostics:qo.current}),Vt&&Jo(pe,{tableId:fo}),Vt&&Jo(se,{scene:oi.current?.scene??[],chartType:o+" chart",tableId:fo,chartTitle:"string"==typeof bt?bt:void 0}),Jo(me,{summary:qt}),Jo(ae,{hoverPoint:To}),ei("div",{role:"img","aria-label":$t||("string"==typeof bt?bt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Xo?vi:void 0,onMouseLeave:Xo?gi:void 0,onClick:Jt?mi:void 0,children:[ei(le,{size:lo,margin:co,children:[No,Eo]}),Jo(yo,{width:ho,height:uo,totalWidth:lo[0],totalHeight:lo[1],margin:co,scales:Bo,showAxes:Ce,showGrid:it,rFormat:Lo,rTickValues:Ne,axisExtent:We}),Jo("canvas",{ref:ci,"aria-label":ke(oi.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:lo[0],height:lo[1]}}),Jo(bo,{width:ho,height:uo,totalWidth:lo[0],totalHeight:lo[1],margin:co,scales:Bo,showAxes:Ce,showCategoryTicks:Pe,oLabel:Po,rLabel:Ro,oFormat:Mo,rFormat:Lo,rTickValues:Ne,axisExtent:We,showGrid:it,title:bt,legend:rt,legendHoverBehavior:nt,legendClickBehavior:st,legendHighlightedCategory:at,legendIsolatedCategories:ht,legendPosition:dt,legendLayout:gt,foregroundGraphics:D(Fo,te(oi.current?.customLayoutOverlays,Kt??null)),annotations:Je,onAnnotationActivate:et,onObservation:Ze??Ke,chartId:Ue,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:tt,svgAnnotationRules:ot,annotationFrame:Do,xAccessor:_i,yAccessor:Ci,annotationData:Pi(oi.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(zt||Gt)&&"radial"!==w&&Jo(So,{width:ho,height:uo,totalWidth:lo[0],totalHeight:lo[1],margin:co,scales:Bo,onBrush:Gt||(()=>{})}),St&&"radial"===w&&Jo("div",{style:{position:"absolute",left:co.left+ho/2,top:co.top+uo/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:St}),Ot?.showBadge&&Jo(T,{isStale:zo,position:Ot.badgePosition}),Jo(he,{active:pi.current>=0,hoverPoint:To,margin:co,size:lo,shape:fi.current?.shape,width:fi.current?.w,height:fi.current?.h}),wi]})]})}));oi.displayName="StreamOrdinalFrame";var ii=oi;import{forwardRef as ri,useMemo as ni}from"react";import{jsx as si}from"react/jsx-runtime";var ai=ri(function(e,t){const{data:o,layout:i,layoutConfig:n,onLayoutError:s,categoryAccessor:a="category",valueAccessor:l="value",oExtent:c,rExtent:h,projection:u="vertical",margin:d,className:g,colorBy:m,colorScheme:p,showAxes:f=!1,annotations:y,onObservation:v,onClick:b,selection:x,linkedHover:w,chartId:A,loading:k,loadingContent:S,emptyContent:_,frameProps:C={}}=e,{frameRef:P,resolved:R,safeData:M,setup:L,earlyReturn:I}=r({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:m,colorScheme:p,selection:x,linkedHover:w,onObservation:v,onClick:b,chartId:A,loading:k,loadingContent:S,emptyContent:_,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),T=L.effectiveSelectionHook,H=ni(()=>T?.isActive?{isActive:!0,predicate:T.predicate}:null,[T?.isActive,T?.predicate]);if(I)return I;const{width:F,height:E,enableHover:N,showGrid:D,title:W,description:j,summary:z,accessibleTable:G}=R,V={chartType:"custom",...null!=o&&{data:M},customLayout:i,layoutConfig:n,onLayoutError:s,...H&&{layoutSelection:H},oAccessor:a,rAccessor:l,oExtent:c,rExtent:h,projection:u,colorAccessor:m,colorScheme:p,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:L.margin,enableHover:N,showAxes:f,showGrid:D,annotations:y,...B({title:W,description:j,summary:z,accessibleTable:G,className:g,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...O({linkedHover:w,selection:x,onObservation:v,onClick:b,hoverHighlight:!1,mobileInteraction:L.mobileInteraction,customHoverBehavior:L.customHoverBehavior,customClickBehavior:L.customClickBehavior}),...C};return si(wt,{componentName:"OrdinalCustomChart",width:F,height:E,children:si(ii,{ref:P,...V})})});ai.displayName="OrdinalCustomChart";import{useMemo as li,forwardRef as ci,useRef as hi}from"react";import{useImperativeHandle as ui}from"react";function di({ref:e,frameRef:t,setup:o}){return ui(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}import{useMemo as gi}from"react";function mi(e){const{colorBy:t,colorScale:i,color:r,themeCategorical:n,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:h,opacity:u,effectiveSelectionHook:d,resolvedSelection:g,cycleByCategory:m=!1,baseStyleExtras:p,linkStrokeToFill:f=!1,styleRules:y,resolveRuleValue:v}=e,b=gi(()=>(e,o)=>{const l="function"==typeof p?p(e,o):p,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!i)return c;c.fill=Te(e,t,i)}else c.fill=tt(r,n,s,m?o:void 0,a);if(y&&y.length>0){const t=ie(e,y,{value:v?v(e):void 0,category:o});Object.assign(c,t)}return f&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,i,r,n,s,a,m,p,f,y,v]),x=gi(()=>o(l?"function"==typeof l?(e,t)=>({...b(e,t),...l(e,t)||{}}):(e,t)=>({...b(e,t),...l}):b,{stroke:c,strokeWidth:h,opacity:u}),[b,l,c,h,u]);return gi(()=>pt(x,d??null,g),[x,d,g])}import{jsx as pi}from"react/jsx-runtime";var fi=ci(function(o,r){const n=at(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),s=hi(null),{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,sort:f=!1,barPadding:y=40,roundedTop:v,gradientFill:b=!1,styleRules:x,baselinePadding:w=!1,tooltip:A,annotations:k,regression:S,valueExtent:_,frameProps:C={},selection:P,linkedHover:R,onObservation:M,onClick:L,hoverHighlight:I,chartId:T,loading:H,loadingContent:F,emptyContent:D,legendInteraction:W,legendPosition:j,color:z,stroke:G,strokeWidth:V,opacity:$,showCategoryTicks:q,categoryFormat:X,dataIdAccessor:Y}=o,{width:Q,height:K,enableHover:Z,showGrid:U,showLegend:J,title:ee,description:te,summary:ie,accessibleTable:re,categoryLabel:ne,valueLabel:se}=n,ae=li(()=>Ie(a),[a]),le=i({data:ae,rawData:a,colorBy:m,colorScheme:p,legendInteraction:W,legendPosition:j,selection:P,linkedHover:R,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!0,onObservation:M,onClick:L,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BarChart",chartId:T,showLegend:J,userMargin:l,marginDefaults:n.marginDefaults,loading:H,loadingContent:F,emptyContent:D,width:Q,height:K}),{effectiveLegendProps:ce,effectiveMargin:he}=di({ref:r,frameRef:s,setup:le});St("BarChart",ae,"categoryAccessor",h),St("BarChart",ae,"valueAccessor",u);const ue=dt(ae,f,u),de=gt(),ge=li(()=>new Map,[]),me=li(()=>oe(u),[u]),pe=mi({colorBy:m,colorScale:le.colorScale,color:z,themeCategorical:de,colorScheme:p,categoryIndexMap:ge,userPieceStyle:C?.pieceStyle,stroke:G,strokeWidth:V,opacity:$,styleRules:x,resolveRuleValue:me,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection}),fe=li(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:m&&m!==h?m:void 0,groupLabel:"string"==typeof m?m:"group",valueFormat:g}),[h,u,m,g]);if(le.earlyReturn)return le.earlyReturn;const ye=t({componentName:"BarChart",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(ye)return pi(xt,{componentName:"BarChart",message:ye,width:Q,height:K});const ve=e(S),be=ve?[ve,...k||[]]:k,xe={chartType:"bar",...null!=a&&{data:ue},oAccessor:h,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:pe,size:[Q,K],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:he,barPadding:y,...null!=v&&{roundedTop:v},...b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b},...Y&&{dataIdAccessor:Y},baselinePadding:w,enableHover:Z,showAxes:n.showAxes,oLabel:ne,rLabel:se,rFormat:g,...X&&{oFormat:X},showGrid:U,showCategoryTicks:q,oSort:f,...ce,...B({title:ee,description:te,summary:ie,accessibleTable:re,className:c,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...N({tooltip:A,defaultTooltipContent:fe}),...O({linkedHover:R,selection:P,onObservation:M,onClick:L,hoverHighlight:I,mobileInteraction:le.mobileInteraction,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior}),...be&&be.length>0&&{annotations:be},..._&&{rExtent:_},...Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e))};return pi(wt,{componentName:"BarChart",width:Q,height:K,children:pi(ii,{ref:s,...xe})})});fi.displayName="BarChart";import{useMemo as yi,forwardRef as vi,useRef as bi}from"react";import{jsx as xi}from"react/jsx-runtime";var wi=vi(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=bi(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:h,valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,normalize:f=!1,sort:y=!1,barPadding:v=40,roundedTop:b,styleRules:x,baselinePadding:w=!1,tooltip:A,annotations:k,valueExtent:S,frameProps:_={},selection:C,linkedHover:P,onObservation:R,onClick:M,hoverHighlight:L,chartId:I,loading:T,loadingContent:H,emptyContent:F,legendInteraction:D,legendPosition:W,color:j,stroke:z,strokeWidth:G,opacity:V,categoryFormat:$}=e,{width:q,height:X,enableHover:Y,showGrid:Q,showLegend:K,title:Z,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ie}=r,re=yi(()=>Ie(s),[s]),ne=m||h,se=i({data:re,rawData:s,colorBy:ne,colorScheme:p,legendInteraction:D,legendPosition:W,selection:C,linkedHover:P,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:R,onClick:M,hoverHighlight:L,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedBarChart",chartId:I,showLegend:K,userMargin:a,marginDefaults:r.marginDefaults,loading:T,loadingContent:H,emptyContent:F,width:q,height:X}),ae=gt(),le=yi(()=>new Map,[]),ce=yi(()=>oe(u),[u]),he=mi({colorBy:ne,colorScale:se.colorScale,color:j,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:_?.pieceStyle,stroke:z,strokeWidth:G,opacity:V,styleRules:x,resolveRuleValue:ce,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),ue=yi(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:c,valueFormat:g}),[h,c,u,g]),de=t({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u},requiredProps:{stackBy:h}}),{effectiveLegendProps:ge,effectiveMargin:me}=di({ref:o,frameRef:n,setup:se});if(se.earlyReturn)return se.earlyReturn;const pe={chartType:"bar",...null!=s&&{data:re},oAccessor:c,rAccessor:u,stackBy:h,normalize:f,oSort:y,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:he,size:[q,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:me,barPadding:v,...null!=b&&{roundedTop:b},baselinePadding:w,enableHover:Y,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:te,rLabel:ie,rFormat:g,...$&&{oFormat:$},showGrid:Q,...ge,...B({title:Z,description:U,summary:J,accessibleTable:ee,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:A,defaultTooltipContent:ue}),...O({linkedHover:P,selection:C,onObservation:R,onClick:M,hoverHighlight:L,mobileInteraction:se.mobileInteraction,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e))};return de?xi(xt,{componentName:"StackedBarChart",message:de,width:q,height:X}):xi(wt,{componentName:"StackedBarChart",width:q,height:X,children:xi(ii,{ref:n,...pe})})});wi.displayName="StackedBarChart";import*as Ai from"react";import{useMemo as ki,useCallback as Si,forwardRef as _i,useRef as Ci,useImperativeHandle as Pi}from"react";import{useRef as Ri,useState as Mi,useCallback as Li,useMemo as Ii}from"react";import{useMemo as Ti,useCallback as Hi,useRef as Bi}from"react";var Oi={RdBu:Ne,PiYG:Ee,PRGn:Fe,BrBG:Oe,RdYlBu:De,RdYlGn:We,Spectral:je},Fi="__likert_neutral_neg",Ei="__likert_neutral_pos";function Ni(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Di(e,t,o,i,r,n){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(i){const e=i(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const r=t[o];c.set(r,(c.get(r)||0)+1)}else if(r&&n){const e=r(l),t=n(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let i=0;for(const e of t)i+=o.get(e)||0;if(0!==i)for(let r=0;t.length>r;r++){const n=t[r],s=o.get(n)||0;l.push({__likertCategory:e,__likertLevel:n,__likertLevelLabel:n,__likertCount:s,__likertPct:s/i*100,__likertLevelIndex:r})}}return l}function Wi(e,t){const o=t.length,i=o%2!=0,r=Math.floor(o/2),n=[];for(const t of e){const e=t.__likertLevelIndex;if(i&&e===r){const e=t.__likertPct/2;n.push({...t,__likertLevel:Fi,__likertPct:-e}),n.push({...t,__likertLevel:Ei,__likertPct:e})}else n.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return n}function ji(e,t){const o=t.length,i=o%2!=0,r=Math.floor(o/2),n=new Map;for(const t of e){const e=n.get(t.__likertCategory)||[];e.push(t),n.set(t.__likertCategory,e)}const s=[];for(const[,e]of n){const t=new Map;let n,a;for(const o of e)o.__likertLevel===Fi?n=o:o.__likertLevel===Ei?a=o:t.set(o.__likertLevelIndex,o);i&&n&&s.push(n);for(let e=r-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}i&&a&&s.push(a);for(let e=i?r+1:r;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}var zi=["Very Low","Low","Neutral","High","Very High"];import{jsx as Gi}from"react/jsx-runtime";var Vi=new Map,$i=_i(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Ci(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:h,levelAccessor:u,countAccessor:d="count",levels:g=zi,orientation:m="horizontal",colorScheme:p,barPadding:f=20,tooltip:y,annotations:v,valueExtent:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:S,hoverHighlight:_,chartId:C,valueFormat:P,loading:R,loadingContent:M,emptyContent:L,legendInteraction:I,legendPosition:T,categoryFormat:H,stroke:B,strokeWidth:F,opacity:E}=e,{width:N,height:D,enableHover:W,showGrid:j,showLegend:z,title:G,description:V,summary:$,accessibleTable:q,categoryLabel:X,valueLabel:Y}=r,Q="horizontal"===m,K=void 0===s,Z=!u,U=mt(),J=ki(()=>p&&Array.isArray(p)&&p.length>=g.length?p:function(e,t){if(0>=e)return[];if(t){const o=Oi[t];if(o){if(1===e)return[o(.5)];const t=[];for(let i=0;e>i;i++)t.push(o(i/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],i=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const n=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);n&&a.push(r);for(let e=0;s>e;e++)a.push(i[Math.min(Math.floor(e*i.length/s),i.length-1)]);return a}(g.length,U),[p,g.length,U]),ee=ki(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],J[t]||"#888");return e},[g,J]),{processedData:te,reAggregate:oe,accumulatorRef:ie}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:i,levelAccessor:r,countAccessor:n,isDiverging:s,frameRef:a}){const l=!r,c=Ti(()=>Ni(o,"question"),[o]),h=Ti(()=>l?Ni(i,"score"):null,[l,i]),u=Ti(()=>l?null:Ni(r,"level"),[l,r]),d=Ti(()=>l?null:Ni(n,"count"),[l,n]),g=Bi([]);return{processedData:Ti(()=>{const o=e||[];if(0===o.length)return[];let i=Di(o,t,c,h,u,d);return s&&(i=Wi(i,t),i=ji(i,t)),i},[e,t,c,h,u,d,s]),reAggregate:Hi(e=>{let o=Di(e,t,c,h,u,d);s&&(o=Wi(o,t),o=ji(o,t)),a.current?.replace(o)},[t,c,h,u,d,s,a]),accumulatorRef:g}}({data:s,levels:g,categoryAccessor:c,valueAccessor:h,levelAccessor:u,countAccessor:d,isDiverging:Q,frameRef:n}),re="__likertLevelLabel",ne=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:i,legendPosition:r="right"}){const n=Ri(new Set),s=Ri([]),[a,l]=Mi(0),c=st(),h=gt(),u=Li(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),d=Li(o=>{if(!e||!t)return;let i=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=u(e);null==t||n.current.has(t)||(n.current.add(t),s.current.push(t),i=!0)}i&&l(e=>e+1)},[e,t,u]),g=Li(o=>{if(!e||!t)return;const i=Array.from(new Set(o.map(String))),r=s.current;r.length===i.length&&r.every((e,t)=>e===i[t])||(n.current=new Set(i),s.current=i,l(e=>e+1))},[e,t]),m=Li(e=>t=>{d([t]),e(t)},[d]),p=Li(e=>t=>{d(t),e(t)},[d]),f=Li(()=>{n.current=new Set,s.current=[],l(e=>e+1)},[]);ht(e&&t?s.current:[]);const y=Ii(()=>{if(!e||!t||!1===i)return;const r=s.current;if(0===r.length)return;const n=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:h&&h.length>0?h:ue,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),u=Ce(l,a,n);return Me({data:l,colorBy:a,colorScale:e=>c?.[e]||u(e)||"#999",getColor:Te})},[e,t,i,o,c,h,a]),v=Ii(()=>{if(y)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[y,r]);return{wrapPush:m,wrapPushMany:p,resetCategories:f,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:g}:{},streamingLegend:y,streamingMarginAdjust:v}}({isPushMode:K,colorBy:re,colorScheme:J,showLegend:z,legendPosition:T}),{wrapPush:se,wrapPushMany:ae}=ne,le=Si(e=>se(e=>{ie.current.push(e),oe(ie.current)})(e),[se,oe,ie]),ce=Si(e=>ae(e=>{ie.current.push(...e),oe(ie.current)})(e),[ae,oe,ie]);Pi(o,()=>({push:le,pushMany:ce,remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>{ie.current=[],ne.resetCategories(),n.current?.clear()},getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}),[le,ce,ie,ne]);const he=i({data:te,rawData:s,colorBy:re,colorScheme:J,legendInteraction:I,legendPosition:T,selection:w,linkedHover:A,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:_,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LikertChart",chartId:C,showLegend:z,userMargin:a,marginDefaults:r.marginDefaults,loading:R,loadingContent:M,emptyContent:L,width:N,height:D}),de=ki(()=>{const e=g.length;return e%2!=0&&ee.get(g[Math.floor(e/2)])||"#888"},[g,ee]),ge=mi({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Vi,userPieceStyle:x?.pieceStyle,stroke:B,strokeWidth:F,opacity:E,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===Fi||o===Ei)return{fill:de};const i=t||o;return i&&ee.has(i)?{fill:ee.get(i)}:{fill:"#888"}}}),me=ki(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),pe=ki(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",i=o===Fi||o===Ei?me:o,r=t.__likertCategory||"",n=Math.abs(t.__likertPct||0),s=o===Fi||o===Ei?2*n:n,a=t.__likertCount||0;return Ai.createElement("div",{className:"semiotic-tooltip",style:Le},Ai.createElement("div",{style:{fontWeight:"bold"}},r),Ai.createElement("div",{style:{marginTop:4}},`${i}: ${s.toFixed(1)}% (n=${a})`))},[me]),fe=ki(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(h&&u)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(u&&!d)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return Z?h&&(e.valueAccessor=h):(u&&(e.levelAccessor=u),d&&(e.countAccessor=d)),t({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:g}})},[s,c,h,u,d,g,Z]),ye=ki(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,ee]),ve=ki(()=>!1!==z?{...he.legendBehaviorProps,legend:{legendGroups:ye},legendPosition:T||he.legendPosition||"bottom"}:he.legendBehaviorProps,[he.legendBehaviorProps,he.legendPosition,T,z,ye]),be=ki(()=>{const e={...he.margin};if(K&&!1!==z){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ne.streamingMarginAdjust)for(const[t,o]of Object.entries(ne.streamingMarginAdjust))o>e[t]&&(e[t]=o);return Q&&100>e.left&&(e.left=100),e},[he.margin,ne.streamingMarginAdjust,Q,K,z,T]),xe=ki(()=>P||(Q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[Q,P]);if(he.earlyReturn)return he.earlyReturn;const we={chartType:"bar",...null!=s&&{data:te},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:Q?"horizontal":"vertical",pieceStyle:ge,size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be,barPadding:f,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:X,rLabel:Y||(Q?void 0:"Percentage"),rFormat:xe,...H&&{oFormat:H},showGrid:j,...ve,...G&&{title:G},...V&&{description:V},...$&&{summary:$},...void 0!==q&&{accessibleTable:q},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===y?()=>null:!0===y?pe:qe(y)||pe,...O({linkedHover:A,selection:w,onObservation:k,onClick:S,hoverHighlight:_,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...v&&v.length>0&&{annotations:v},...b&&{rExtent:b},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return fe?Gi(xt,{componentName:"LikertChart",message:fe,width:N,height:D}):Gi(wt,{componentName:"LikertChart",width:N,height:D,children:Gi(ii,{ref:n,...we})})});$i.displayName="LikertChart";import{useMemo as qi,forwardRef as Xi,useRef as Yi}from"react";import{useCallback as Qi,useRef as Ki}from"react";function Zi({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:i}){const r=$e("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),n="string"==typeof i?i:"value",s=nt({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||n}),a=Ki(s.brushInteraction);a.current=s.brushInteraction;const l=Qi(e=>{if(r){a.current.end(e?e.r:null)}t?.(e)},[t,r]),c=!!(e||o||t);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}import{jsx as Ui}from"react/jsx-runtime";var Ji=Xi(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=Yi(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,sizeBy:f,sizeRange:y=[3,8],symbolBy:v,symbolMap:b,pointRadius:x=4,pointOpacity:w=.7,categoryPadding:A=20,tooltip:k,annotations:S,valueExtent:_,brush:C,onBrush:P,linkedBrush:R,frameProps:M={},selection:L,linkedHover:I,onObservation:T,onClick:H,hoverHighlight:F,chartId:D,loading:W,loadingContent:j,emptyContent:z,legendInteraction:G,legendPosition:V,color:$,stroke:q,strokeWidth:X,opacity:Y,showCategoryTicks:Q,categoryFormat:K}=e,{width:Z,height:U,enableHover:J,showGrid:ee,showLegend:te,title:oe,description:ie,summary:re,accessibleTable:ne,categoryLabel:se,valueLabel:ae}=r,le=qi(()=>Ie(a),[a]),ce=i({data:le,rawData:a,colorBy:m,colorScheme:p,legendInteraction:G,legendPosition:V,selection:L,linkedHover:I,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:T,onClick:H,hoverHighlight:F,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"SwarmPlot",chartId:D,showLegend:te,userMargin:l,marginDefaults:r.marginDefaults,loading:W,loadingContent:j,emptyContent:z,width:Z,height:U}),he=Zi({brushProp:C,onBrushProp:P,linkedBrush:R,valueAccessor:u}),ue=qi(()=>{if(!f)return;const e=le.map(e=>"function"==typeof f?f(e):e[f]);return yt(e)},[le,f]),de=gt(),ge=qi(()=>new Map,[]),me=mi({colorBy:m,colorScale:ce.colorScale,color:$,themeCategorical:de,colorScheme:p,categoryIndexMap:ge,userPieceStyle:M?.pieceStyle,stroke:q,strokeWidth:X,opacity:Y,effectiveSelectionHook:ce.effectiveSelectionHook,resolvedSelection:ce.resolvedSelection,baseStyleExtras:e=>({fillOpacity:w,r:f?Be(e,f,y,ue):x})}),pe=qi(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:m||void 0,valueFormat:g}),[h,u,m,g]);if(ce.earlyReturn)return ce.earlyReturn;const fe=t({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(fe)return Ui(xt,{componentName:"SwarmPlot",message:fe,width:Z,height:U});const ye={chartType:"swarm",...null!=a&&{data:le},oAccessor:h,rAccessor:u,...v&&{symbolAccessor:v},...b&&{symbolMap:b},projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:me,size:[Z,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce.margin,barPadding:A,enableHover:J,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:se,rLabel:ae,rFormat:g,...K&&{oFormat:K},showGrid:ee,showCategoryTicks:Q,...ce.legendBehaviorProps,...B({title:oe,description:ie,summary:re,accessibleTable:ne,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:k,defaultTooltipContent:pe}),...O({linkedHover:I,selection:L,onObservation:T,onClick:H,hoverHighlight:F,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior}),...S&&S.length>0&&{annotations:S},..._&&{rExtent:_},...he.brushStreamProps,...Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e))};return Ui(wt,{componentName:"SwarmPlot",width:Z,height:U,children:Ui(ii,{ref:s,...ye})})});Ji.displayName="SwarmPlot";import{useMemo as er,forwardRef as tr,useRef as or}from"react";import{jsx as ir,jsxs as rr}from"react/jsx-runtime";function nr(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",i=t.stats||(t.data||t).stats;if(i&&null!=i.median)return rr("div",{className:"semiotic-tooltip",style:Le,children:[o&&ir("div",{style:{fontWeight:"bold"},children:o+""}),null!=i.n&&rr("div",{children:["n = ",i.n]}),null!=i.min&&rr("div",{children:["Min: ",i.min.toLocaleString()]}),null!=i.q1&&rr("div",{children:["Q1: ",i.q1.toLocaleString()]}),rr("div",{children:["Median: ",i.median.toLocaleString()]}),null!=i.q3&&rr("div",{children:["Q3: ",i.q3.toLocaleString()]}),null!=i.max&&rr("div",{children:["Max: ",i.max.toLocaleString()]}),null!=i.mean&&rr("div",{style:{opacity:.8},children:["Mean: ",i.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const i=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),n=r.length,s=n>0?n%2!=0?r[Math.floor(n/2)]:(r[n/2-1]+r[n/2])/2:null;return rr("div",{className:"semiotic-tooltip",style:Le,children:[o&&ir("div",{style:{fontWeight:"bold"},children:o+""}),n>0&&rr("div",{children:["n = ",n]}),null!=s&&rr("div",{children:["Median: ",s.toLocaleString()]})]})}return ir("div",{className:"semiotic-tooltip",style:Le,children:ir("div",{style:{fontWeight:"bold"},children:o+""})})}}import{jsx as sr}from"react/jsx-runtime";var ar=tr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=or(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,showOutliers:f=!0,outlierRadius:y=3,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,frameProps:A={},selection:k,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:P,chartId:R,loading:M,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:H,color:F,stroke:E,strokeWidth:D,opacity:W,showCategoryTicks:j,categoryFormat:z}=e,{width:G,height:V,enableHover:$,showGrid:q,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=r,ee=er(()=>Ie(a),[a]),te=i({data:ee,rawData:a,colorBy:m,colorScheme:p,legendInteraction:T,legendPosition:H,selection:k,linkedHover:S,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"BoxPlot",chartId:R,showLegend:X,userMargin:l,marginDefaults:r.marginDefaults,loading:M,loadingContent:L,emptyContent:I,width:G,height:V}),oe=gt(),ie=er(()=>new Map,[]),re=mi({colorBy:m,colorScale:te.colorScale,color:F,themeCategorical:oe,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:D,opacity:W,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=er(()=>nr(),[]);if(te.earlyReturn)return te.earlyReturn;const se=t({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(se)return sr(xt,{componentName:"BoxPlot",message:se,width:G,height:V});const ae={chartType:"boxplot",...null!=a&&{data:ee},oAccessor:h,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,showOutliers:f,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:v,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:U,rLabel:J,rFormat:g,...z&&{oFormat:z},showGrid:q,showCategoryTicks:j,...te.legendBehaviorProps,...B({title:Y,description:Q,summary:K,accessibleTable:Z,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:b,defaultTooltipContent:ne}),...O({linkedHover:S,selection:k,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...x&&x.length>0&&{annotations:x},...w&&{rExtent:w},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return sr(wt,{componentName:"BoxPlot",width:G,height:V,children:sr(ii,{ref:s,...ae})})});ar.displayName="BoxPlot";import{useMemo as lr,forwardRef as cr,useRef as hr}from"react";import{jsx as ur,jsxs as dr}from"react/jsx-runtime";var gr=e=>{const t=e?.category;return null==t?"All":t+""},mr=cr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=hr(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h=gr,valueAccessor:u="value",bins:d=25,relative:g=!1,valueFormat:m,colorBy:p,colorScheme:f,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:A,linkedBrush:k,frameProps:S={},selection:_,linkedHover:C,onObservation:P,onClick:R,hoverHighlight:M,chartId:L,loading:I,loadingContent:T,emptyContent:H,legendInteraction:F,legendPosition:E,color:D,stroke:W,strokeWidth:j,opacity:z,showCategoryTicks:G,categoryFormat:V}=e,{width:$,height:q,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=r,oe=lr(()=>Ie(a),[a]),ie=i({data:oe,rawData:a,colorBy:p,colorScheme:f,legendInteraction:F,legendPosition:E,selection:_,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"Histogram",chartId:L,showLegend:Q,userMargin:l,marginDefaults:r.marginDefaults,loading:I,loadingContent:T,emptyContent:H,width:$,height:q}),re=Zi({brushProp:w,onBrushProp:A,linkedBrush:k,valueAccessor:u}),ne=lr(()=>{if(0===oe.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,o=-1/0;for(const i of oe){const r=e(i);null!=r&&isFinite(r)&&(t>r&&(t=r),r>o&&(o=r))}return t>o?void 0:[t,o]},[oe,u]),se=gt(),ae=lr(()=>new Map,[]),le=mi({colorBy:p,colorScale:ie.colorScale,color:D,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:void 0,stroke:W,strokeWidth:j,opacity:z,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ce=lr(()=>e=>{const t=e.data||e,o=t.category||e.category||"",i=t.count,r=t.range;return dr("div",{className:"semiotic-tooltip",style:Le,children:[o&&ur("div",{style:{fontWeight:"bold"},children:o+""}),null!=i&&dr("div",{children:["Count: ",i]}),r&&2===r.length&&dr("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(ie.earlyReturn)return ie.earlyReturn;const he=t({componentName:"Histogram",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(he)return ur(xt,{componentName:"Histogram",message:he,width:$,height:q});const ue={chartType:"histogram",...null!=a&&{data:oe},oAccessor:h,rAccessor:u,projection:"horizontal",summaryStyle:le,bins:d,normalize:g,...x?{rExtent:x}:ne&&{rExtent:ne},size:[$,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,barPadding:y,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:ee,rLabel:te,rFormat:m,...V&&{oFormat:V},showGrid:Y,showCategoryTicks:G,...ie.legendBehaviorProps,...B({title:K,description:Z,summary:U,accessibleTable:J,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:v,defaultTooltipContent:ce}),...O({linkedHover:C,selection:_,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...b&&b.length>0&&{annotations:b},...re.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return ur(wt,{componentName:"Histogram",width:$,height:q,children:ur(ii,{ref:s,...ue})})});mr.displayName="Histogram";import{useMemo as pr,forwardRef as fr,useRef as yr}from"react";import{jsx as vr}from"react/jsx-runtime";var br=fr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=yr(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="vertical",bins:g=25,curve:m="catmullRom",showIQR:p=!0,valueFormat:f,colorBy:y,colorScheme:v,categoryPadding:b=20,tooltip:x,annotations:w,valueExtent:A,brush:k,onBrush:S,linkedBrush:_,frameProps:C={},selection:P,linkedHover:R,onObservation:M,onClick:L,hoverHighlight:I,chartId:T,loading:H,loadingContent:F,emptyContent:E,legendInteraction:D,legendPosition:W,color:j,stroke:z,strokeWidth:G,opacity:V,showCategoryTicks:$,categoryFormat:q}=e,{width:X,height:Y,enableHover:Q,showGrid:K,showLegend:Z,title:U,description:J,summary:ee,accessibleTable:te,categoryLabel:oe,valueLabel:ie}=r,re=pr(()=>Ie(a),[a]),ne=i({data:re,rawData:a,colorBy:y,colorScheme:v,legendInteraction:D,legendPosition:W,selection:P,linkedHover:R,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:M,onClick:L,hoverHighlight:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ViolinPlot",chartId:T,showLegend:Z,userMargin:l,marginDefaults:r.marginDefaults,loading:H,loadingContent:F,emptyContent:E,width:X,height:Y}),se=Zi({brushProp:k,onBrushProp:S,linkedBrush:_,valueAccessor:u}),ae=gt(),le=pr(()=>new Map,[]),ce=mi({colorBy:y,colorScale:ne.colorScale,color:j,themeCategorical:ae,colorScheme:v,categoryIndexMap:le,userPieceStyle:void 0,stroke:z,strokeWidth:G,opacity:V,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),he=pr(()=>nr({valueAccessor:u}),[u]);if(ne.earlyReturn)return ne.earlyReturn;const ue=t({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(ue)return vr(xt,{componentName:"ViolinPlot",message:ue,width:X,height:Y});const de={chartType:"violin",...null!=a&&{data:re},oAccessor:h,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ce,bins:g,showIQR:p,size:[X,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:b,enableHover:Q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:oe,rLabel:ie,rFormat:f,...q&&{oFormat:q},showGrid:K,showCategoryTicks:$,...ne.legendBehaviorProps,...B({title:U,description:J,summary:ee,accessibleTable:te,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:x,defaultTooltipContent:he}),...O({linkedHover:R,selection:P,onObservation:M,onClick:L,hoverHighlight:I,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...w&&w.length>0&&{annotations:w},...A&&{rExtent:A},...se.brushStreamProps,...Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e))};return vr(wt,{componentName:"ViolinPlot",width:X,height:Y,children:vr(ii,{ref:s,...de})})});br.displayName="ViolinPlot";import{useMemo as xr,forwardRef as wr,useRef as Ar}from"react";import{jsx as kr}from"react/jsx-runtime";var Sr=wr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=Ar(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:h="category",valueAccessor:u="value",orientation:d="horizontal",bins:g=20,amplitude:m=1.5,valueFormat:p,colorBy:f,colorScheme:y,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:A={},selection:k,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:P,chartId:R,loading:M,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:H,color:F,stroke:E,strokeWidth:D,opacity:W,showCategoryTicks:j,categoryFormat:z}=e,{width:G,height:V,enableHover:$,showGrid:q,showLegend:X,title:Y,description:Q,summary:K,accessibleTable:Z,categoryLabel:U,valueLabel:J}=r,ee=xr(()=>Ie(a),[a]),te=i({data:ee,rawData:a,colorBy:f,colorScheme:y,legendInteraction:T,legendPosition:H,selection:k,linkedHover:S,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof h?h:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"RidgelinePlot",chartId:R,showLegend:X,userMargin:l,marginDefaults:r.marginDefaults,loading:M,loadingContent:L,emptyContent:I,width:G,height:V}),oe=gt(),ie=xr(()=>new Map,[]),re=mi({colorBy:f,colorScale:te.colorScale,color:F,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:D,opacity:W,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=xr(()=>nr(),[]);if(te.earlyReturn)return te.earlyReturn;const se=t({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:h,valueAccessor:u}});if(se)return kr(xt,{componentName:"RidgelinePlot",message:se,width:G,height:V});const ae={chartType:"ridgeline",...null!=a&&{data:ee},oAccessor:h,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:g,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,barPadding:v,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:U,rLabel:J,rFormat:p,...z&&{oFormat:z},showGrid:q,showCategoryTicks:j,oSort:!1,amplitude:m,...te.legendBehaviorProps,...B({title:Y,description:Q,summary:K,accessibleTable:Z,className:c,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:b,defaultTooltipContent:ne}),...O({linkedHover:S,selection:k,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...x&&x.length>0&&{annotations:x},...w&&{rExtent:w},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return kr(wt,{componentName:"RidgelinePlot",width:G,height:V,children:kr(ii,{ref:s,...ae})})});Sr.displayName="RidgelinePlot";import{useMemo as _r,forwardRef as Cr,useRef as Pr}from"react";import{jsx as Rr,jsxs as Mr}from"react/jsx-runtime";var Lr=Cr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),s=Pr(null);n(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,stepAccessor:h="step",valueAccessor:u="value",categoryAccessor:d,colorBy:g,colorScheme:m,orientation:p="horizontal",connectorOpacity:f=.3,showLabels:y=!0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:A,onObservation:k,onClick:S,hoverHighlight:_,chartId:C,loading:P,loadingContent:R,emptyContent:M,legendInteraction:L,legendPosition:I,color:T,stroke:H,strokeWidth:B,opacity:F,categoryFormat:E}=e,N="vertical"===p,{width:D,height:W,enableHover:j,showLegend:z,title:G,description:V,summary:$,accessibleTable:q}=r,X=N?{top:G?60:40,right:20,bottom:60,left:60}:{top:G?40:10,right:10,bottom:10,left:10},Y=_r(()=>Ie(a),[a]),Q=g||d,K=!Q,Z=i({data:Y,rawData:a,colorBy:Q,colorScheme:m,legendInteraction:L,legendPosition:I,selection:w,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:_,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"FunnelChart",chartId:C,showLegend:z,userMargin:l,marginDefaults:X,loading:P,loadingContent:R,emptyContent:M,width:D,height:W});St("FunnelChart",Y,"stepAccessor",h),St("FunnelChart",Y,"valueAccessor",u);const U=gt(),J=_r(()=>new Map,[]),ee=_r(()=>{if(K)return T||(U?.[0]?U[0]:Array.isArray(m)&&m[0]?m[0]:"#4e79a7")},[K,T,U,m]),te=mi({colorBy:ee?void 0:Q,colorScale:Z.colorScale,color:ee??T,themeCategorical:U,colorScheme:m,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:H,strokeWidth:B,opacity:F,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),oe=_r(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",i=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,n=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||n?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return Mr("div",{className:"semiotic-tooltip",style:Le,children:[o&&Rr("div",{style:{fontWeight:"bold"},children:o+""}),a&&a!==o&&Rr("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&Rr("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),Mr("div",{style:{marginTop:4},children:[i+"",l]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=t({componentName:"FunnelChart",data:a,accessors:{stepAccessor:h,valueAccessor:u}});if(ie)return Rr(xt,{componentName:"FunnelChart",message:ie,width:D,height:W});const re={chartType:N?"bar-funnel":"funnel",...null!=a&&{data:Y},oAccessor:h,rAccessor:u,...d&&{stackBy:d},projection:N?"vertical":"horizontal",barPadding:N?40:0,pieceStyle:te,size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,enableHover:j,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:N,showCategoryTicks:N,...E&&{oFormat:E},showGrid:N,...!N&&{connectorOpacity:f},showLabels:y,...Z.legendBehaviorProps,...G&&{title:G},...V&&{description:V},...$&&{summary:$},...void 0!==q&&{accessibleTable:q},...c&&{className:c},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===v?()=>null:!0===v||null==v?oe:qe(v)||oe,...O({linkedHover:A,selection:w,onObservation:k,onClick:S,hoverHighlight:_,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...b&&b.length>0&&{annotations:b},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return Rr(wt,{componentName:"FunnelChart",width:D,height:W,children:Rr(ii,{ref:s,...re})})});Lr.displayName="FunnelChart";import{useMemo as Ir,forwardRef as Tr,useRef as Hr}from"react";import{jsx as Br}from"react/jsx-runtime";var Or=Tr(function(o,r){const s=at(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid??!0,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),a=Hr(null);n(r,{variant:"xy",frameRef:a});const{data:l,margin:c,className:h,categoryAccessor:u="category",valueAccessor:d="value",orientation:g="horizontal",valueFormat:m,colorBy:p,colorScheme:f,sort:y="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:A,valueExtent:k,frameProps:S={},selection:_,linkedHover:C,onObservation:P,onClick:R,hoverHighlight:M,chartId:L,loading:I,loadingContent:T,emptyContent:H,legendInteraction:F,legendPosition:D,color:W,stroke:j,strokeWidth:z,opacity:G,categoryFormat:V}=o,{width:$,height:q,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=s,oe=Ir(()=>Ie(l),[l]),ie=i({data:oe,rawData:l,colorBy:p,colorScheme:f,legendInteraction:F,legendPosition:D,selection:_,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"DotPlot",chartId:L,showLegend:Q,userMargin:c,marginDefaults:s.marginDefaults,loading:I,loadingContent:T,emptyContent:H,width:$,height:q}),re=dt(oe,y,d),ne=gt(),se=Ir(()=>new Map,[]),ae=mi({colorBy:p,colorScale:ie.colorScale,color:W,themeCategorical:ne,colorScheme:f,categoryIndexMap:se,userPieceStyle:S?.pieceStyle,stroke:j,strokeWidth:z,opacity:G,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),le=Ir(()=>E({categoryAccessor:u,valueAccessor:d,valueFormat:m}),[u,d,m]);if(ie.earlyReturn)return ie.earlyReturn;const ce=t({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:d}});if(ce)return Br(xt,{componentName:"DotPlot",message:ce,width:$,height:q});const he=e(A),ue=he?[he,...w||[]]:w,de={chartType:"point",...null!=l&&{data:re},oAccessor:u,rAccessor:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ae,size:[$,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie.margin,barPadding:b,enableHover:X,...o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor},showAxes:s.showAxes,oLabel:ee,rLabel:te,rFormat:m,...V&&{oFormat:V},showGrid:Y,oSort:y,...ie.legendBehaviorProps,...B({title:K,description:Z,summary:U,accessibleTable:J,className:h,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...N({tooltip:x,defaultTooltipContent:le}),...O({linkedHover:C,selection:_,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...ue&&ue.length>0&&{annotations:ue},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return Br(wt,{componentName:"DotPlot",width:$,height:q,children:Br(ii,{ref:a,...de})})});Or.displayName="DotPlot";import{useMemo as Fr,forwardRef as Er,useRef as Nr}from"react";import{jsx as Dr}from"react/jsx-runtime";var Wr=Er(function(e,o){const r=at(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Nr(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:h="value",colorBy:u,colorScheme:d,startAngle:g=0,cornerRadius:m,tooltip:p,annotations:f,frameProps:y={},selection:v,linkedHover:b,onObservation:x,onClick:w,hoverHighlight:A,chartId:k,loading:S,loadingContent:_,emptyContent:C,legendInteraction:P,legendPosition:R,color:M,stroke:L,strokeWidth:I,opacity:T}=e,{width:H,height:F,enableHover:D,showLegend:W,title:j,description:z,summary:G,accessibleTable:V}=r,$=Fr(()=>Ie(s),[s]),q=u||c,X=i({data:$,rawData:s,colorBy:q,colorScheme:d,legendInteraction:P,legendPosition:R,selection:v,linkedHover:b,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:A,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:W,userMargin:a,marginDefaults:r.marginDefaults,loading:S,loadingContent:_,emptyContent:C,width:H,height:F}),Y=gt(),Q=Fr(()=>new Map,[]),K=mi({colorBy:q,colorScale:X.colorScale,color:M,themeCategorical:Y,colorScheme:d,categoryIndexMap:Q,userPieceStyle:y?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection,cycleByCategory:!0}),Z=Fr(()=>E({categoryAccessor:c,valueAccessor:h,groupAccessor:u&&u!==c?u:void 0,groupLabel:"string"==typeof u?u:"group",pieData:!0}),[c,h,u]),U=t({componentName:"PieChart",data:s,accessors:{categoryAccessor:c,valueAccessor:h}}),{effectiveLegendProps:J,effectiveMargin:ee}=di({ref:o,frameRef:n,setup:X});if(X.earlyReturn)return X.earlyReturn;const te={chartType:"pie",...null!=s&&{data:$},oAccessor:c,rAccessor:h,projection:"radial",pieceStyle:K,startAngle:g,...null!=m&&{cornerRadius:m},size:[H,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...J,...B({title:j,description:z,summary:G,accessibleTable:V,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:p,defaultTooltipContent:Z}),...O({linkedHover:b,selection:v,onObservation:x,onClick:w,hoverHighlight:A,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior}),...f&&f.length>0&&{annotations:f},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return U?Dr(xt,{componentName:"PieChart",message:U,width:H,height:F}):Dr(wt,{componentName:"PieChart",width:H,height:F,children:Dr(ii,{ref:n,...te})})});Wr.displayName="PieChart";import{useMemo as jr,forwardRef as zr,useRef as Gr}from"react";import{jsx as Vr}from"react/jsx-runtime";var $r=zr(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),n=Gr(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:h="value",innerRadius:u,centerContent:d,colorBy:g,colorScheme:m,startAngle:p=0,cornerRadius:f,tooltip:y,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:A,onClick:k,hoverHighlight:S,chartId:_,loading:C,loadingContent:P,emptyContent:R,legendInteraction:M,legendPosition:L,color:I,stroke:T,strokeWidth:H,opacity:F}=e,{width:D,height:W,enableHover:j,showLegend:z,title:G,description:V,summary:$,accessibleTable:q}=r,X=jr(()=>Ie(s),[s]),Y=g||c,Q=i({data:X,rawData:s,colorBy:Y,colorScheme:m,legendInteraction:M,legendPosition:L,selection:x,linkedHover:w,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:A,onClick:k,hoverHighlight:S,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"DonutChart",chartId:_,showLegend:z,userMargin:a,marginDefaults:r.marginDefaults,loading:C,loadingContent:P,emptyContent:R,width:D,height:W}),K=u??Math.max(2,.15*Math.min(D,W)),Z=gt(),U=jr(()=>new Map,[]),J=mi({colorBy:Y,colorScale:Q.colorScale,color:I,themeCategorical:Z,colorScheme:m,categoryIndexMap:U,userPieceStyle:b?.pieceStyle,stroke:T,strokeWidth:H,opacity:F,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,cycleByCategory:!0}),ee=jr(()=>E({categoryAccessor:c,valueAccessor:h,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,h,g]),te=t({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:h}}),{effectiveLegendProps:oe,effectiveMargin:ie}=di({ref:o,frameRef:n,setup:Q});if(Q.earlyReturn)return Q.earlyReturn;const re={chartType:"donut",...null!=s&&{data:X},oAccessor:c,rAccessor:h,projection:"radial",pieceStyle:J,innerRadius:K,startAngle:p,...null!=f&&{cornerRadius:f},centerContent:d,size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,enableHover:j,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...oe,...B({title:G,description:V,summary:$,accessibleTable:q,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:y,defaultTooltipContent:ee}),...O({linkedHover:w,selection:x,onObservation:A,onClick:k,hoverHighlight:S,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior}),...v&&v.length>0&&{annotations:v},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return te?Vr(xt,{componentName:"DonutChart",message:te,width:D,height:W}):Vr(wt,{componentName:"DonutChart",width:D,height:W,children:Vr(ii,{ref:n,...re})})});$r.displayName="DonutChart";import{useMemo as qr,forwardRef as Xr,useRef as Yr}from"react";function Qr(e=240){const t=360-e,o=180+t/2,i=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:i,offsetRad:-Math.PI/2+i}}function Kr(e){return Math.max(0,Math.min(1,e))}function Zr(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function Ur(e,t,o){const i=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${i(e)}${i(t)}${i(o)}`}function Jr(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Kr(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const i=Kr(t);if(o[0].offset>=i)return o[0].color;if(i>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],r=o[e+1];if(t.offset>i||i>r.offset)continue;const n=r.offset-t.offset,s=n>0?(i-t.offset)/n:0,a=Zr(t.color),l=Zr(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,h,u]=a,[d,g,m]=l;return Ur(c+(d-c)*s,h+(g-h)*s,u+(m-u)*s)}return o[o.length-1].color}function en(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}import{jsx as tn,jsxs as on}from"react/jsx-runtime";var rn=Xr(function(e,t){const i=at(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),r=Yr(null),n="context"===e.mode,{compactMode:s}=i,{value:a,min:l=0,max:c=100,thresholds:h,gradientFill:u,color:d,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:p,showNeedle:f=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:v,valueFormat:b,showScaleLabels:x=!s,sweep:w=240,fillZones:A=!0,tooltip:k,annotations:S,frameProps:_={},className:C,stroke:P,strokeWidth:R,opacity:M}=e,{width:L,height:I,title:T,description:H,summary:B,accessibleTable:O}=i,F=u&&"object"==typeof u?u:void 0,E=Math.max(l,Math.min(c,a)),N=c-l||1,D=(E-l)/N,{gaugeData:W,pieceStyle:j,gaugeAnnotations:z}=qr(()=>function(e){const{min:t,max:o,value:i,thresholds:r,fillColor:n,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:h=240}=e,u=o-t||1,d=(Math.max(t,Math.min(o,i))-t)/u;let g=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:o,color:n||"#007bff"}];g=g.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>g[g.length-1].value&&g.push({value:o,color:g[g.length-1].color});const m=!!c&&c.colorStops.length>=2,p=[],f=new Map,y=[];if(m){const e=a?d:1,t=en("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),f.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(h)),o=Math.max(1,Math.min(t,Math.round(e*t))),i=[];for(let t=0;o>t;t++)i.push(Jr(c.colorStops,e*(t+.5)/o));const r=en("fill",0);p.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:i}}),f.set(r,{fill:i[0]||s})}}else{let e=t;for(let o=0;g.length>o;o++){const i=g[o],r=(i.value-e)/u,n=(e-t)/u,l=(i.value-t)/u,c=Math.max(0,(a?Math.min(d,l):l)-n),h=a?Math.max(0,r-c):0;if(c>0){const e=en("fill",o);p.push({category:e,value:c,_zone:i.label||"Zone "+(o+1),_isFill:!0}),f.set(e,{fill:i.color})}if(h>0){const e=en("bg",o);p.push({category:e,value:h,_zone:i.label||"Zone "+(o+1),_isFill:!1}),f.set(e,{fill:s,opacity:.4})}e=i.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&o>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>f.get(t||e.category)||{fill:s},gaugeAnnotations:y}}({min:l,max:c,value:a,thresholds:h,fillColor:d,backgroundColor:g,fillZones:A,showScaleLabels:x,gradientFill:F}),[a,l,c,h,d,g,x,A,F]),G=qr(()=>o(j,{stroke:P,strokeWidth:R,opacity:M}),[j,P,R,M]),{sweepRad:V,startAngleDeg:$}=Qr(w),q=function(e=240){const{sweepRad:t,offsetRad:o}=Qr(e),i=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||i.push([Math.cos(e),Math.sin(e)]);const r=i.map(e=>e[0]),n=i.map(e=>e[1]),[s,a]=yt(r),[l,c]=yt(n);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(w),X=Math.min(10,Math.max(1,Math.min(L,I)/12)),Y=q.cx,Q=q.cy,K=Math.max(4,Math.min((L-2*X)/q.width,(I-2*X)/q.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-m))),U=L/2-Y*K,J=I/2-Q*K,ee=2*(K+4),te=qr(()=>{if(s&&null==v)return null;if(null!=v)return"function"==typeof v?v(E,l,c):v;const e=b?b(E):Math.round(E)+"";return on("div",{style:{textAlign:"center",lineHeight:1.2},children:[tn("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),x&&on("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[l," – ",c]})]})},[v,E,l,c,b,x,K,s]),oe=qr(()=>n&&null==v?{type:"gauge-value",text:b?b(E):Math.round(E)+""}:null,[n,v,E,b]),ie=qr(()=>{if(!f)return null;const e=-Math.PI/2+$*Math.PI/180+D*V,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[f,$,D,V,Z,K,y]),re=qr(()=>(e,t,o)=>{if("gauge-needle"===e.type){const i=(o.width||L)/2,r=(o.height||I)/2,n=Math.max(1,K-Z),s=Math.max(1,Math.min(2.5,.4*n)),a=Math.max(1,Math.min(5,.6*n));return on("g",{transform:`translate(${i},${r})`,children:[tn("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),tn("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const i=-Math.PI/2+$*Math.PI/180+(e.value-l)/N*V,r=(o.width||L)/2,n=(o.height||I)/2,s=Z-1,a=K+1,c=Math.cos(i)*s,h=Math.sin(i)*s,u=Math.cos(i)*a,d=Math.sin(i)*a,g=K+10,m=Math.cos(i)*g,p=Math.sin(i)*g,f=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,v;return f>=11||1>f?(y="middle",v="auto"):f>=1&&5>f?(y="start",v="middle"):f>=5&&7>f?(y="middle",v="hanging"):(y="end",v="middle"),on("g",{transform:`translate(${r},${n})`,children:[tn("line",{x1:c,y1:h,x2:u,y2:d,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),tn("text",{x:m,y:p,textAnchor:y,dominantBaseline:v,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?tn("text",{x:(o.width||L)/2,y:(o.height||I)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[L,I,l,N,$,V,Z,K]),ne=qr(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),oe&&e.push(oe),e},[z,S,ie,oe]),se=qr(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",i=t?._isFill;return on("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[tn("div",{style:{fontWeight:600},children:o}),tn("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===W.length)return tn(xt,{componentName:"GaugeChart",message:"No data to display",width:L,height:I});const ae={chartType:"donut",data:W,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:G,innerRadius:Z,startAngle:$,sweepAngle:w,...null!=p&&{cornerRadius:p},centerContent:te,size:[L,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:J-ee/2,bottom:I-J-ee/2,left:U-ee/2,right:L-U-ee/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:qe(k)||se,svgAnnotationRules:re,...ne.length>0&&{annotations:ne},...T&&{title:T},...H&&{description:H},...B&&{summary:B},...void 0!==O&&{accessibleTable:O},...C&&{className:C},...null!=e.animate&&{animate:e.animate},..._};return tn(wt,{componentName:"GaugeChart",width:L,height:I,children:tn(ii,{ref:r,...ae})})});rn.displayName="GaugeChart";import{useMemo as nn,forwardRef as sn,useRef as an}from"react";import{jsx as ln}from"react/jsx-runtime";var cn=sn(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=an(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:h,valueAccessor:u="value",orientation:d="vertical",valueFormat:g,colorBy:m,colorScheme:p,sort:f=!1,barPadding:y=60,roundedTop:v,styleRules:b,baselinePadding:x=!1,tooltip:w,annotations:A,valueExtent:k,frameProps:S={},selection:_,linkedHover:C,onObservation:P,onClick:R,hoverHighlight:M,chartId:L,loading:I,loadingContent:T,emptyContent:H,legendInteraction:F,legendPosition:D,color:W,stroke:j,strokeWidth:z,opacity:G,categoryFormat:V}=e,{width:$,height:q,enableHover:X,showGrid:Y,showLegend:Q,title:K,description:Z,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=r,ie=nn(()=>Ie(s),[s]),re=m||h,ne=i({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:F,legendPosition:D,selection:_,linkedHover:C,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"GroupedBarChart",chartId:L,showLegend:Q,userMargin:a,marginDefaults:r.marginDefaults,loading:I,loadingContent:T,emptyContent:H,width:$,height:q}),se=gt(),ae=nn(()=>new Map,[]),le=nn(()=>oe(u),[u]),ce=mi({colorBy:re,colorScale:ne.colorScale,color:W,themeCategorical:se,colorScheme:p,categoryIndexMap:ae,userPieceStyle:S.pieceStyle,stroke:j,strokeWidth:z,opacity:G,styleRules:b,resolveRuleValue:le,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),he=nn(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:c,valueFormat:g}),[h,c,u,g]),ue=t({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u},requiredProps:{groupBy:h}}),{effectiveLegendProps:de,effectiveMargin:ge}=di({ref:o,frameRef:n,setup:ne});if(ne.earlyReturn)return ne.earlyReturn;const me={chartType:"clusterbar",...null!=s&&{data:ie},oAccessor:c,rAccessor:u,groupBy:h,oSort:f,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ce,size:[$,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ge,barPadding:y,...null!=v&&{roundedTop:v},baselinePadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:ee,rLabel:te,rFormat:g,...V&&{oFormat:V},showGrid:Y,...de,...B({title:K,description:Z,summary:U,accessibleTable:J,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:w,defaultTooltipContent:he}),...O({linkedHover:C,selection:_,onObservation:P,onClick:R,hoverHighlight:M,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...A&&A.length>0&&{annotations:A},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return ue?ln(xt,{componentName:"GroupedBarChart",message:ue,width:$,height:q}):ln(wt,{componentName:"GroupedBarChart",width:$,height:q,children:ln(ii,{ref:n,...me})})});cn.displayName="GroupedBarChart";import{useMemo as hn,forwardRef as un,useRef as dn}from"react";import{jsx as gn}from"react/jsx-runtime";var mn=un(function(e,o){const r=at(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=dn(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:h,valueAccessor:u="value",orientation:d="horizontal",valueFormat:g,colorBy:m,colorScheme:p,barPadding:f,tooltip:y,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:A={},selection:k,linkedHover:S,onObservation:_,onClick:C,hoverHighlight:P,chartId:R,loading:M,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:H,color:F,stroke:D,strokeWidth:W,opacity:j,categoryFormat:z,rTickValues:G,tickLabelEdgeAlign:V,showCategoryTicks:$,gradientFill:q,trackFill:X,roundedTop:Y,valueExtent:Q}=e,{width:K,height:Z,enableHover:U,showGrid:J,showLegend:ee,title:te,description:oe,summary:ie,accessibleTable:re,categoryLabel:ne,valueLabel:se}=r,ae=hn(()=>Ie(s),[s]),le=m||h,ce=hn(()=>{if(null!=f)return f;if("sparkline"!==e.mode)return 40;const t=new Set(ae.map(e=>"function"==typeof c?c(e):e[c])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===d?Z:K)-2*o)/(o-1))):1},[f,e.mode,ae,c,d,K,Z]),he=i({data:ae,rawData:s,colorBy:le,colorScheme:p,legendInteraction:T,legendPosition:H,selection:k,linkedHover:S,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"SwimlaneChart",chartId:R,showLegend:ee,userMargin:a,marginDefaults:r.marginDefaults,loading:M,loadingContent:L,emptyContent:I,width:K,height:Z}),ue=Zi({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:u}),de=gt(),ge=hn(()=>new Map,[]),me=mi({colorBy:le,colorScale:he.colorScale,color:F,themeCategorical:de,colorScheme:p,categoryIndexMap:ge,userPieceStyle:A?.pieceStyle,stroke:D,strokeWidth:W,opacity:j,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,cycleByCategory:!0}),pe=hn(()=>E({categoryAccessor:h,valueAccessor:u,groupAccessor:c,valueFormat:g}),[h,c,u,g]),fe=t({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u,subcategoryAccessor:h},requiredProps:{subcategoryAccessor:h}}),{effectiveLegendProps:ye,effectiveMargin:ve}=di({ref:o,frameRef:n,setup:he});if(he.earlyReturn)return he.earlyReturn;const be={chartType:"swimlane",...null!=s&&{data:ae},oAccessor:c,rAccessor:u,stackBy:h,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:me,size:[K,Z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,barPadding:ce,enableHover:U,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:r.showAxes,oLabel:!1===$?void 0:ne,rLabel:se,rFormat:g,...G&&{rTickValues:G},...null!=V&&{tickLabelEdgeAlign:V},...z&&{oFormat:z},...void 0!==$&&{showCategoryTicks:$},showGrid:J,...ye,...B({title:te,description:oe,summary:ie,accessibleTable:re,className:l,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...N({tooltip:y,defaultTooltipContent:pe}),...O({linkedHover:S,selection:k,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...v&&v.length>0&&{annotations:v},...q&&{gradientFill:!0===q?{topOpacity:.8,bottomOpacity:.05}:q},...null!=X&&{trackFill:X},...null!=Y&&{roundedTop:Y},...Q&&{rExtent:Q},...ue.brushStreamProps,...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return fe?gn(xt,{componentName:"SwimlaneChart",message:fe,width:K,height:Z}):gn(wt,{componentName:"SwimlaneChart",width:K,height:Z,children:gn(ii,{ref:n,...be})})});mn.displayName="SwimlaneChart";export{ii as StreamOrdinalFrame_default,ai as OrdinalCustomChart,fi as BarChart,wi as StackedBarChart,$i as LikertChart,Ji as SwarmPlot,ar as BoxPlot,mr as Histogram,br as ViolinPlot,Sr as RidgelinePlot,Lr as FunnelChart,Or as DotPlot,Wr as PieChart,$r as DonutChart,rn as GaugeChart,cn as GroupedBarChart,mn as SwimlaneChart};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{addMqlListener as e}from"./chunk-chunk-YHNZCPOZ.module.min.js";import{createContext as o,useCallback as r,useContext as t,useMemo as a,useRef as i,useSyncExternalStore as c}from"react";import{jsx as s}from"react/jsx-runtime";function n(e){let n=null;const d=()=>(n||(n=o(null)),n),f=l(e);return[function({children:o,initialState:r}){const t=i(r),c=a(()=>l(e,t.current),[]),n=d();return s(n.Provider,{value:c,children:o})},(e,o)=>{const a=d(),s=t(a)??f,n=i(e);n.current=e;const l=i({hasValue:!1,value:void 0}),u=r(()=>{const e=n.current(s.getState()),r=l.current;return r.hasValue&&o&&o(r.value,e)?r.value:(l.current={hasValue:!0,value:e},e)},[s,o]),p=r(()=>n.current(s.getState()),[s]);return c(s.subscribe,u,p)}]}function l(e,o){const r=new Set;let t={...e(function(e){const o=e(t);if(function(e){for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o))return!0;return!1}(o)){t={...t,...o};for(const e of r)e()}}),...o??{}};return{getState:()=>t,subscribe:function(e){return r.add(e),()=>{r.delete(e)}}}}function d(e){if(!e?.colors)return;const o=e.colors;return{primary:o.primary,secondary:o.secondary||o.primary,surface:o.surface||o.background,success:o.success,danger:o.danger,warning:o.warning,error:o.error,info:o.info,text:o.text,textSecondary:o.textSecondary,border:o.border,grid:o.grid}}function f(e){if(!e.accessibility)return e;let o=e;if(e.accessibility.colorBlindSafe&&(o={...o,colors:{...o.colors,categorical:u}}),e.accessibility.highContrast){const e="dark"===o.mode;o={...o,colors:{...o.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return o}var u=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],p={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},g={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},y={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:u,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function b(e,o){if("light"===o)return p;if("dark"===o)return g;if("high-contrast"===o)return y;if("string"==typeof o)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${o}". Keeping current theme.`),e;if(o.mode&&"auto"!==o.mode){const e="dark"===o.mode?g:p;return f({...e,...o,colors:{...e.colors,...o.colors||{}},typography:{...e.typography,...o.typography||{}}})}return f({...e,...o,colors:{...e.colors,...o.colors||{}},typography:{...e.typography,...o.typography||{}}})}var[m,h]=n(e=>({theme:p,setTheme(o){e(e=>({theme:b(e.theme,o)}))}}));function x(e,o=":root"){const r=[];return r.push(` --semiotic-bg: ${e.colors.background};`),r.push(` --semiotic-text: ${e.colors.text};`),r.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),r.push(` --semiotic-grid: ${e.colors.grid};`),r.push(` --semiotic-border: ${e.colors.border};`),r.push(` --semiotic-primary: ${e.colors.primary};`),r.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&r.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&r.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&r.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&r.push(` --semiotic-diverging: ${e.colors.diverging};`),e.tooltip?.background&&r.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),e.tooltip?.text&&r.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),e.tooltip?.borderRadius&&r.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),e.tooltip?.fontSize&&r.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),e.tooltip?.shadow&&r.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&r.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&r.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&r.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&r.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&r.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&r.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&r.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),r.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),r.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&r.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&r.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&r.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&r.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&r.push(` --semiotic-info: ${e.colors.info};`),`${o} {\n${r.join("\n")}\n}`}function S(e){return{semiotic:{bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:e.tooltip?.background||e.colors.background,$type:"color"},text:{$value:e.tooltip?.text||e.colors.text,$type:"color"},radius:{$value:e.tooltip?.borderRadius||"6px",$type:"dimension"},"font-size":{$value:e.tooltip?.fontSize||"14px",$type:"dimension"},shadow:{$value:e.tooltip?.shadow||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:e.colors.selectionOpacity??.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"},...e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{},...e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{},...null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{},...null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{},...null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{},...null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{},secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"},...e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{},...e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{},...e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{},...e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{},...e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{}}}}var k=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],$={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},z={light:p,dark:g,"high-contrast":y,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function v(e){return z[e]}import*as w from"react";import{jsx as F,jsxs as R}from"react/jsx-runtime";var q=w.createContext(void 0),B="undefined"==typeof window?w.useEffect:w.useLayoutEffect;function C(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return v(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function M({theme:o}){const r=h(e=>e.setTheme),t=h(e=>e.theme),a=w.useRef(t);a.current=t;const i=w.useRef(null);w.useEffect(()=>{if(void 0!==o)return;if("undefined"==typeof window||!window.matchMedia)return;const t=window.matchMedia("(forced-colors: active)");return t.matches&&(i.current=a.current===y?p:a.current,r("high-contrast")),e(t,e=>{e.matches?(i.current=a.current===y?i.current??p:a.current,r("high-contrast")):(function(e,o){e(o===p?"light":o===g?"dark":o===y?"high-contrast":o)}(r,i.current??p),i.current=null)})},[o,r]);const c=w.useRef(!1);return B(()=>{c.current?void 0!==o&&r(C(o)):c.current=!0},[o,r]),null}function N({children:e}){const o=h(e=>e.theme),r={position:"relative","--semiotic-bg":o.colors.background,"--semiotic-text":o.colors.text,"--semiotic-text-secondary":o.colors.textSecondary,"--semiotic-grid":o.colors.grid,"--semiotic-border":o.colors.border,"--semiotic-cell-border":o.colors.cellBorder||o.colors.border,"--semiotic-primary":o.colors.primary,"--semiotic-font-family":o.typography.fontFamily,...o.colors.focus?{"--semiotic-focus":o.colors.focus}:{},...o.tooltip?.background?{"--semiotic-tooltip-bg":o.tooltip.background}:{},...o.tooltip?.text?{"--semiotic-tooltip-text":o.tooltip.text}:{},...o.tooltip?.borderRadius?{"--semiotic-tooltip-radius":o.tooltip.borderRadius}:{},...o.tooltip?.fontSize?{"--semiotic-tooltip-font-size":o.tooltip.fontSize}:{},...o.tooltip?.shadow?{"--semiotic-tooltip-shadow":o.tooltip.shadow}:{},...o.borderRadius?{"--semiotic-border-radius":o.borderRadius}:{},...o.colors.selection?{"--semiotic-selection-color":o.colors.selection}:{},...null!=o.colors.selectionOpacity?{"--semiotic-selection-opacity":o.colors.selectionOpacity+""}:{},...o.colors.diverging?{"--semiotic-diverging":o.colors.diverging}:{},...o.colors.annotation?{"--semiotic-annotation-color":o.colors.annotation}:{},...null!=o.typography.legendSize?{"--semiotic-legend-font-size":o.typography.legendSize+"px"}:{},...null!=o.typography.titleFontSize?{"--semiotic-title-font-size":o.typography.titleFontSize+"px"}:{},...null!=o.typography.tickFontFamily?{"--semiotic-tick-font-family":o.typography.tickFontFamily}:{},...null!=o.typography.tickSize?{"--semiotic-tick-font-size":o.typography.tickSize+"px"}:{},...null!=o.typography.labelSize?{"--semiotic-axis-label-font-size":o.typography.labelSize+"px"}:{},"--semiotic-secondary":o.colors.secondary||o.colors.primary,"--semiotic-surface":o.colors.surface||o.colors.background,...o.colors.success?{"--semiotic-success":o.colors.success}:{},...o.colors.danger?{"--semiotic-danger":o.colors.danger}:{},...o.colors.warning?{"--semiotic-warning":o.colors.warning}:{},...o.colors.error?{"--semiotic-error":o.colors.error}:{},...o.colors.info?{"--semiotic-info":o.colors.info}:{}},t=w.useContext(q),a={};return t&&(a["data-semiotic-theme"]=t),F("div",{style:r,...a,children:e})}function O({theme:e,children:o}){const r="string"==typeof e&&v(e)?e:void 0,t=w.useMemo(()=>function(e){return void 0!==e?b(p,C(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?y:p}(e),[e]);return F(m,{initialState:{theme:t},children:R(q.Provider,{value:r,children:[F(M,{theme:e}),F(N,{children:o})]})})}function P(){return h(e=>e.theme)}export{n as createStore,d as resolveThemeSemanticColors,u as COLOR_BLIND_SAFE_CATEGORICAL,p as LIGHT_THEME,g as DARK_THEME,y as HIGH_CONTRAST_THEME,h as useThemeSelector,x as themeToCSS,S as themeToTokens,k as CARBON_CATEGORICAL_14,$ as CARBON_ALERT,z as THEME_PRESETS,v as resolveThemePreset,O as ThemeProviderWrapper,P as useTheme};