semiotic 3.8.3 → 3.8.4

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 (163) hide show
  1. package/CLAUDE.md +9 -9
  2. package/README.md +40 -39
  3. package/ai/examples.md +1 -1
  4. package/ai/schema.json +2726 -300
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/system-prompt.md +1 -1
  7. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
  8. package/dist/chunk-chunk-3ILKBVVQ.module.min.js +1 -0
  9. package/dist/{chunk-chunk-XQYVEKEJ.module.min.js → chunk-chunk-6TPGFL7M.module.min.js} +1 -1
  10. package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
  11. package/dist/chunk-chunk-7KZJUTKP.module.min.js +2 -0
  12. package/dist/chunk-chunk-7RYBCTK5.module.min.js +1 -0
  13. package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
  14. package/dist/{chunk-chunk-AZJUDQRM.module.min.js → chunk-chunk-AQPQN2HH.module.min.js} +1 -1
  15. package/dist/chunk-chunk-ASKSE5F5.module.min.js +1 -0
  16. package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
  17. package/dist/chunk-chunk-B3DRZPBK.module.min.js +2 -0
  18. package/dist/chunk-chunk-BFHUYEOS.module.min.js +2 -0
  19. package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
  20. package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
  21. package/dist/chunk-chunk-F5V4UIE6.module.min.js +2 -0
  22. package/dist/chunk-chunk-F7WFPD4O.module.min.js +2 -0
  23. package/dist/{chunk-chunk-SANERMIZ.module.min.js → chunk-chunk-FBGHXL72.module.min.js} +1 -1
  24. package/dist/chunk-chunk-FP44FHFO.module.min.js +2 -0
  25. package/dist/chunk-chunk-HKXUAEPJ.module.min.js +2 -0
  26. package/dist/chunk-chunk-ICEXPNDC.module.min.js +2 -0
  27. package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
  28. package/dist/{chunk-chunk-7FW6EGLP.module.min.js → chunk-chunk-JDXT6ORT.module.min.js} +1 -1
  29. package/dist/chunk-chunk-JMVEIZXP.module.min.js +1 -0
  30. package/dist/chunk-chunk-KHCOJMGK.module.min.js +1 -0
  31. package/dist/{chunk-chunk-OQTLSTGI.module.min.js → chunk-chunk-KQ546MKE.module.min.js} +1 -1
  32. package/dist/chunk-chunk-LQBSXO7K.module.min.js +2 -0
  33. package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
  34. package/dist/chunk-chunk-MFHF4J2Z.module.min.js +1 -0
  35. package/dist/{chunk-chunk-JNCHKRIR.module.min.js → chunk-chunk-N6VKKF3A.module.min.js} +1 -1
  36. package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
  37. package/dist/chunk-chunk-NKZ75IM5.module.min.js +2 -0
  38. package/dist/chunk-chunk-PLIDPQNG.module.min.js +2 -0
  39. package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
  40. package/dist/chunk-chunk-QGZGZI4X.module.min.js +1 -0
  41. package/dist/chunk-chunk-RP7WTID5.module.min.js +1 -0
  42. package/dist/chunk-chunk-S7KLNUO6.module.min.js +1 -0
  43. package/dist/chunk-chunk-SR4ZXOWR.module.min.js +2 -0
  44. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
  45. package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
  46. package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
  47. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
  48. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
  49. package/dist/components/ChartContainer.d.ts +2 -2
  50. package/dist/components/ai/chartCapabilityTypes.d.ts +5 -0
  51. package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
  52. package/dist/components/charts/geo/DistanceCartogram.d.ts +7 -3
  53. package/dist/components/charts/geo/FlowMap.d.ts +4 -0
  54. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
  55. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
  56. package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
  57. package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
  58. package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
  59. package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
  60. package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
  61. package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
  62. package/dist/components/charts/shared/chartMode.d.ts +8 -0
  63. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
  64. package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
  65. package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
  66. package/dist/components/charts/shared/types.d.ts +2 -2
  67. package/dist/components/charts/shared/validateProps.d.ts +1 -1
  68. package/dist/components/charts/xy/AreaChart.d.ts +10 -0
  69. package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
  70. package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
  71. package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
  72. package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
  73. package/dist/components/realtime/types.d.ts +5 -0
  74. package/dist/components/recipes/gridObservatory.d.ts +176 -0
  75. package/dist/components/recipes/recipeChrome.d.ts +24 -0
  76. package/dist/components/recipes/sequenceLayout.d.ts +139 -0
  77. package/dist/components/semiotic-recipes-core.d.ts +6 -2
  78. package/dist/components/server/staticAnnotations.d.ts +3 -1
  79. package/dist/components/stream/SceneToSVG.d.ts +6 -6
  80. package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
  81. package/dist/components/stream/networkFramePaint.d.ts +2 -0
  82. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
  83. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
  84. package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
  85. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
  86. package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
  87. package/dist/components/stream/sceneToSVGShared.d.ts +30 -1
  88. package/dist/components/stream/types.d.ts +4 -0
  89. package/dist/components/stream/useHydration.d.ts +7 -1
  90. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
  91. package/dist/forceLayoutWorker.js +1 -1
  92. package/dist/geo.min.js +1 -1
  93. package/dist/geo.module.min.js +1 -1
  94. package/dist/network.min.js +1 -1
  95. package/dist/network.module.min.js +1 -1
  96. package/dist/ordinal.min.js +1 -1
  97. package/dist/ordinal.module.min.js +1 -1
  98. package/dist/physics.min.js +1 -1
  99. package/dist/physics.module.min.js +1 -1
  100. package/dist/physicsWorker.js +1 -1
  101. package/dist/realtime.min.js +1 -1
  102. package/dist/realtime.module.min.js +1 -1
  103. package/dist/rough.min.js +1 -1
  104. package/dist/rough.module.min.js +1 -1
  105. package/dist/semiotic-ai-core.min.js +1 -1
  106. package/dist/semiotic-ai-core.module.min.js +1 -1
  107. package/dist/semiotic-ai.min.js +1 -1
  108. package/dist/semiotic-ai.module.min.js +1 -1
  109. package/dist/semiotic-experimental.min.js +1 -1
  110. package/dist/semiotic-experimental.module.min.js +1 -1
  111. package/dist/semiotic-realtime-core.min.js +1 -1
  112. package/dist/semiotic-realtime-core.module.min.js +1 -1
  113. package/dist/semiotic-recipes-core.d.ts +6 -2
  114. package/dist/semiotic-recipes-core.min.js +1 -1
  115. package/dist/semiotic-recipes-core.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-utils-core.min.js +1 -1
  123. package/dist/semiotic-utils-core.module.min.js +1 -1
  124. package/dist/semiotic-utils.min.js +1 -1
  125. package/dist/semiotic-utils.module.min.js +1 -1
  126. package/dist/semiotic-value.module.min.js +1 -1
  127. package/dist/semiotic.min.js +1 -1
  128. package/dist/semiotic.module.min.js +1 -1
  129. package/dist/server.min.js +1 -1
  130. package/dist/server.module.min.js +1 -1
  131. package/dist/xy.min.js +1 -1
  132. package/dist/xy.module.min.js +1 -1
  133. package/package.json +3 -2
  134. package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
  135. package/dist/chunk-chunk-2CCFBTQC.module.min.js +0 -2
  136. package/dist/chunk-chunk-2RXP3FS3.module.min.js +0 -1
  137. package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
  138. package/dist/chunk-chunk-4TMZXLCR.module.min.js +0 -1
  139. package/dist/chunk-chunk-5APBQXZA.module.min.js +0 -1
  140. package/dist/chunk-chunk-6HSGDMTA.module.min.js +0 -2
  141. package/dist/chunk-chunk-7OEOSCBP.module.min.js +0 -1
  142. package/dist/chunk-chunk-A63CTACR.module.min.js +0 -2
  143. package/dist/chunk-chunk-B6V35LMY.module.min.js +0 -2
  144. package/dist/chunk-chunk-BOSVL645.module.min.js +0 -2
  145. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
  146. package/dist/chunk-chunk-F25UA5HT.module.min.js +0 -1
  147. package/dist/chunk-chunk-FRIO6MCV.module.min.js +0 -1
  148. package/dist/chunk-chunk-GWSWSPXN.module.min.js +0 -1
  149. package/dist/chunk-chunk-I6C3KR5H.module.min.js +0 -2
  150. package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
  151. package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
  152. package/dist/chunk-chunk-J5RL6GXU.module.min.js +0 -2
  153. package/dist/chunk-chunk-L3H6DQCR.module.min.js +0 -2
  154. package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
  155. package/dist/chunk-chunk-M7VYYHCE.module.min.js +0 -2
  156. package/dist/chunk-chunk-MC35ILYP.module.min.js +0 -2
  157. package/dist/chunk-chunk-N72SWNBV.module.min.js +0 -1
  158. package/dist/chunk-chunk-OBQRFTIL.module.min.js +0 -2
  159. package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
  160. package/dist/chunk-chunk-SA3D43RA.module.min.js +0 -2
  161. package/dist/chunk-chunk-UHSZEB74.module.min.js +0 -1
  162. package/dist/chunk-chunk-Y6AXCRVO.module.min.js +0 -1
  163. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{buildRegressionAnnotation as e}from"./chunk-chunk-YCQYG6J5.module.min.js";import{validateArrayData as t}from"./chunk-chunk-JCG72SGW.module.min.js";import{mergeShapeStyle as o,normalizePartialMargin as n,useChartSetup as i,useCustomChartSetup as r,useFrameImperativeHandle as a,useResolvedSelection as s}from"./chunk-chunk-PLIDPQNG.module.min.js";import{StreamXYFrame_default as l}from"./chunk-chunk-B3DRZPBK.module.min.js";import{accessorName as c,bandTooltipFields as h,buildBaseMetadataProps as d,buildCustomBehaviorProps as m,buildDefaultTooltip as u,buildTooltipProps as p}from"./chunk-chunk-F7WFPD4O.module.min.js";import{makeXYRuleContext as f,resolveStyleRules as y}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as g,DEFAULT_COLOR as b,DEFAULT_COLORS as v,DEFAULT_SELECTION_OPACITY as x,LinkedCharts as A,MultiPointTooltip as w,composeLegendConfigs as k,defaultTooltipStyle as S,filterSparseArray as C,getColor as L,getCrosshairProps as H,getSequentialInterpolator as B,getSize as I,interpolateViridis as F,normalizeLinkedBrush as R,normalizeTooltip as _,resolveMobileInteraction as N,useBrushSelection as P,useChartLegendAndMargin as W,useChartMode as D,useChartSelection as M,useColorScale as E,useLegendInteraction as O,useSelection as T,useSelectionSelector as G,useThemeCategorical as z,useThemeSequential as j,wrapStyleWithSelection as $}from"./chunk-chunk-BFHUYEOS.module.min.js";import{getMax as Q,getMinMax as V}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartError as X,SafeRender as Y,renderEmptyState as q,renderLoadingState as J,warnMissingField as K}from"./chunk-chunk-ACLDBMRH.module.min.js";import*as U from"react";import{useMemo as Z,useCallback as ee,forwardRef as te,useRef as oe}from"react";import{useMemo as ne}from"react";function ie(e){const{colorBy:t,colorScale:n,color:i,pointRadius:r=5,radiusFn:a,fillOpacity:s=1,fallbackFill:l,baseStyleExtras:c,stroke:h,strokeWidth:d,opacity:m,effectiveSelectionHook:u,resolvedSelection:p,colorDatumAccessor:f,styleRules:g,ruleContext:v}=e,x=ne(()=>e=>{const o="function"==typeof c?c(e):c,h=o?{...o}:{};if(void 0===h.fillOpacity&&(h.fillOpacity=s),void 0===h.fill)if(t){if(n){const o=f?f(e):e;h.fill=L(o,t,n)}}else h.fill=l?l(e):i||b;return void 0===h.r&&(h.r=a?a(e):r),g&&g.length>0&&Object.assign(h,y(e,g,v?v(e):{value:void 0})),h},[t,n,i,r,a,s,l,c,f,g,v]),A=ne(()=>o(x,{stroke:h,strokeWidth:d,opacity:m}),[x,h,d,m]);return ne(()=>$(A,u??null,p),[A,u,p])}import{useCallback as re,useMemo as ae,useRef as se,useState as le}from"react";function ce(e){const{accessor:t,data:o,isPushMode:n}=e,i=se(null),[r,a]=le(0),s=re(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[t];if(null==e)continue;const r="number"==typeof e?e:Number(e);Number.isFinite(r)&&(i.current?(i.current[0]>r&&(i.current[0]=r,o=!0),r>i.current[1]&&(i.current[1]=r,o=!0)):(i.current=[r,r],o=!0))}o&&a(e=>e+1)},[n,t]),l=re(()=>{n&&(i.current=null,a(e=>e+1))},[n]);return{domain:ae(()=>{if(n)return i.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let r=1/0,a=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(r>n&&(r=n),n>a&&(a=n))}return Number.isFinite(r)&&Number.isFinite(a)?[r,a]:void 0},[o,t,n,r]),trackPushed:s,reset:l}}import{useEffect as he,useMemo as de,useRef as me,useState as ue}from"react";var pe="__forecastSegment",fe=null;async function ye(){return fe||(fe=await import("./chunk-statisticalOverlays-6MVAK5RW.module.min.js")),fe}var ge="__semiotic_resolvedX",be="__semiotic_resolvedY";function ve(e){const{data:t,xAccessor:o,yAccessor:n,forecast:i,anomaly:r,groupBy:a}=e,s="string"==typeof o?o:ge,l="string"==typeof n?n:be,c=de(()=>{if(!i&&!r)return t;const e="function"==typeof o,a="function"==typeof n;return e||a?t.map(t=>{const i={...t};return e&&(i[ge]=o(t)),a&&(i[be]=n(t)),i}):t},[t,i,r,o,n]),[h,d]=ue(null),[m,u]=ue([]),p=me(i),f=me(r);return he(()=>{if(!i&&!r)return void((p.current||f.current)&&(d(null),u([]),p.current=i,f.current=r));let e=!1;const t=i!==p.current||r!==f.current;if(p.current=i,f.current=r,t&&(d(null),u([])),i){const t=a&&"string"==typeof a&&"object"==typeof i?{...i,_groupBy:a}:i;(async function(...e){return(await ye()).buildForecast(...e)})(c,s,l,t,r).then(t=>{e||(d(t),u(t.annotations))}).catch(()=>{e||(d(null),u([]))})}else r&&async function(...e){return(await ye()).buildAnomalyAnnotations(...e)}(r).then(t=>{e||(d(null),u(t))}).catch(()=>{e||u([])});return()=>{e=!0}},[c,i,r,s,l,a]),{effectiveData:h?h.processedData:t,statisticalAnnotations:m,hasForecast:!!h,xAccessorKey:s,yAccessorKey:l}}import{jsx as xe}from"react/jsx-runtime";var Ae=te(function(o,n){const r=oe(null),s=D(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:x="x",yAccessor:A="y",xScaleType:w,yScaleType:k,colorBy:S,colorScheme:L,styleRules:H,sizeBy:B,sizeRange:F=[3,15],symbolBy:_,symbolMap:N,pointRadius:W=5,pointOpacity:M=.8,tooltip:E,marginalGraphics:O,pointIdAccessor:T,annotations:G,regression:z,forecast:j,anomaly:$,xExtent:Q,yExtent:V,frameProps:q={},selection:J,linkedHover:te,linkedBrush:ne,onObservation:re,onClick:ae,hoverHighlight:se,chartId:le,loading:he,loadingContent:de,emptyContent:me,legendInteraction:ue,legendPosition:pe,color:fe,stroke:ye,strokeWidth:ge,opacity:be}=o,{width:Ae,height:we,enableHover:ke,showGrid:Se,showLegend:Ce,title:Le,description:He,summary:Be,accessibleTable:Ie,xLabel:Fe,yLabel:Re}=s,_e=Z(()=>C(h),[h]),Ne=void 0===h,{domain:Pe,trackPushed:We,reset:De}=ce({accessor:B,data:_e,isPushMode:Ne}),Me=ee(e=>{We([e]),r.current?.push(e)},[We]),Ee=ee(e=>{We(e),r.current?.pushMany(e)},[We]);a(n,{variant:"xy",frameRef:r,overrides:{push:Me,pushMany:Ee,clear:()=>{De(),r.current?.clear()}}});const Oe=i({data:_e,rawData:h,colorBy:S,colorScheme:L,legendInteraction:ue,legendPosition:pe,selection:J,linkedHover:te,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:re,onClick:ae,hoverHighlight:se,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"Scatterplot",chartId:le,showLegend:Ce,userMargin:y,marginDefaults:s.marginDefaults,loading:he,loadingContent:de,emptyContent:me,width:Ae,height:we}),Te=R(ne),Ge=P({name:Te?.name||"__unused_brush__",xField:Te?.xField||("string"==typeof x?x:void 0),yField:Te?.yField||("string"==typeof A?A:void 0)}),ze=Te?"xyBrush"===Ge.brushInteraction.brush?"xy":"xBrush"===Ge.brushInteraction.brush?"x":"y":void 0,je=U.useRef(Ge.brushInteraction);je.current=Ge.brushInteraction;const $e=ee(e=>{const t=je.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);K("Scatterplot",_e,"xAccessor",x),K("Scatterplot",_e,"yAccessor",A);const Qe=Z(()=>B?Pe??[0,1]:void 0,[B,Pe]),Ve=Z(()=>B?e=>I(e,B,F,Qe):void 0,[B,F,Qe]),Xe=Z(()=>f(x,A),[x,A]),Ye=ie({colorBy:S,colorScale:Oe.colorScale,color:fe,pointRadius:W,fillOpacity:M,radiusFn:Ve,stroke:ye,strokeWidth:ge,opacity:be,styleRules:H,ruleContext:Xe,effectiveSelectionHook:Oe.effectiveSelectionHook,resolvedSelection:Oe.resolvedSelection}),qe=Z(()=>u([{label:Fe||c(x),accessor:x,role:"x",format:b},{label:Re||c(A),accessor:A,role:"y",format:v},...S?[{label:c(S),accessor:S,role:"color"}]:[],...B?[{label:c(B),accessor:B,role:"size"}]:[]]),[x,A,Fe,Re,S,B,b,v]),{effectiveData:Je,statisticalAnnotations:Ke}=ve({data:_e,xAccessor:x,yAccessor:A,forecast:j,anomaly:$}),Ue=Z(()=>{const t=e(z);return t||0!==Ke.length?[...t?[t]:[],...G||[],...Ke]:G},[z,G,Ke]);if(Oe.earlyReturn)return Oe.earlyReturn;const Ze=t({componentName:"Scatterplot",data:h,accessors:{xAccessor:x,yAccessor:A}});if(Ze)return xe(X,{componentName:"Scatterplot",message:Ze,width:Ae,height:we});const et={chartType:"scatter",...null!=h&&{data:Je},xAccessor:x,yAccessor:A,xScaleType:w,yScaleType:k,colorAccessor:S||void 0,sizeAccessor:B||void 0,..._&&{symbolAccessor:_},...N&&{symbolMap:N},sizeRange:F,pointStyle:Ye,colorScheme:L,size:[Ae,we],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Oe.margin,showAxes:s.showAxes,xLabel:Fe,yLabel:Re,xFormat:b,yFormat:v,enableHover:ke,showGrid:Se,...Oe.legendBehaviorProps,...d({title:Le,description:He,summary:Be,accessibleTable:Ie,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:E,defaultTooltipContent:qe}),...m({linkedHover:te,selection:J,onObservation:re,onClick:ae,hoverHighlight:se,mobileInteraction:Oe.mobileInteraction,customHoverBehavior:Oe.customHoverBehavior,customClickBehavior:Oe.customClickBehavior}),...O&&{marginalGraphics:O},...T&&{pointIdAccessor:T},...Ue&&Ue.length>0&&{annotations:Ue},...Q&&{xExtent:Q},...V&&{yExtent:V},...Te&&{brush:{dimension:ze},onBrush:$e},...Oe.crosshairProps,...q};return xe(Y,{componentName:"Scatterplot",width:Ae,height:we,children:xe(l,{ref:r,...et})})});Ae.displayName="Scatterplot";import{useMemo as we,forwardRef as ke,useRef as Se}from"react";import{Fragment as Ce,jsx as Le}from"react/jsx-runtime";function He(e,t){return F(1===t?.5:e/(t-1))}var Be=ke(function(o,n){const r=Se(null);a(n,{variant:"xy",frameRef:r});const s=D(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:A="x",yAccessor:w="y",orderAccessor:k,orderLabel:S,styleRules:C,pointRadius:L=4,tooltip:H,pointIdAccessor:B,annotations:I,regression:F,forecast:R,anomaly:_,xExtent:N,yExtent:P,frameProps:W={},selection:M,linkedHover:E,onObservation:O,onClick:T,hoverHighlight:G,chartId:z,loading:j,loadingContent:$,emptyContent:Q,legendInteraction:V,stroke:q,strokeWidth:J,opacity:U}=o,{width:Z,height:ee,enableHover:te,showGrid:oe,title:ne,description:re,summary:ae,accessibleTable:se,xLabel:le,yLabel:ce}=s,{safeData:he,orderMap:de}=we(()=>{const e=h||[],t="function"==typeof A?A:e=>e[A],o="function"==typeof w?w:e=>e[w];let n=e;if(k&&e.length>0){const t="function"==typeof k?k:e=>e[k];n=[...e].sort((e,o)=>{const n=t(e),i=t(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const i=new WeakMap;let r=0;for(const e of n){const n=t(e),i=o(e);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let a=0;for(const e of n){const n=t(e),s=o(e);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&i.set(e,{idx:a++,total:r})}return{safeData:n,orderMap:i}},[h,k,A,w]);K("ConnectedScatterplot",he,"xAccessor",A),K("ConnectedScatterplot",he,"yAccessor",w);const me=i({data:he,rawData:h,colorBy:void 0,colorScheme:void 0,legendInteraction:V,selection:M,linkedHover:E,fallbackFields:[],unwrapData:!1,onObservation:O,onClick:T,hoverHighlight:G,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"ConnectedScatterplot",chartId:z,showLegend:void 0,userMargin:y,marginDefaults:s.marginDefaults,loading:j,loadingContent:$,emptyContent:Q,width:Z,height:ee}),ue=me.resolvedSelection?.unselectedOpacity??x,pe=we(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const n=me.effectiveSelectionHook?.isActive,i=me.effectiveSelectionHook?.predicate,r=100>o.length,a=o.length;e.lineCap="round";for(let t=0;a-1>t;t++){const s=o[t],l=o[t+1],c=He(t,a),h=!n||!i||i(s.datum??s)||i(l.datum??l),d=n?h?1:ue:1;r&&(e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=L+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=L,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[L,me.effectiveSelectionHook,ue]),fe=we(()=>[pe],[pe]),ye=we(()=>(e,t,o)=>{const n=e.filter(e=>"point"===e.type);if(2>n.length)return null;const i=n.length,r=100>i,a=[];for(let e=0;i-1>e;e++){const t=n[e],o=n[e+1],s=He(e,i),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);r&&a.push(Le("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:L+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),a.push(Le("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:s,strokeWidth:L,strokeLinecap:"round",opacity:l},"seg-"+e))}return Le(Ce,{children:a})},[L]),ge=we(()=>[ye],[ye]),be=ie({colorScale:void 0,baseStyleExtras:we(()=>e=>{const t=de.get(e),o=t?.idx??0,n=t?.total??1;return{fill:n>0?He(o,n):"#6366f1",stroke:"white",strokeWidth:1,r:L,fillOpacity:1}},[L,de]),stroke:q,strokeWidth:J,opacity:U,styleRules:C,ruleContext:we(()=>f(A,w),[A,w]),effectiveSelectionHook:me.effectiveSelectionHook,resolvedSelection:me.resolvedSelection}),xe=S||("string"==typeof k?k:"Order"),Ae=we(()=>u([{label:le||c(A),accessor:A,role:"x",format:b},{label:ce||c(w),accessor:w,role:"y",format:v},...k?[{label:xe,accessor:k,role:"group"}]:[]]),[A,w,le,ce,k,xe,b,v]),ke=t({componentName:"ConnectedScatterplot",data:h,accessors:{xAccessor:A,yAccessor:w}}),{effectiveData:Be,statisticalAnnotations:Ie}=ve({data:he,xAccessor:A,yAccessor:w,forecast:R,anomaly:_});if(me.earlyReturn)return me.earlyReturn;const Fe=e(F),Re=Fe||Ie.length>0?[...Fe?[Fe]:[],...I||[],...Ie]:I,_e={chartType:"scatter",...null!=h&&{data:Be},xAccessor:A,yAccessor:w,pointStyle:be,size:[Z,ee],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:me.margin,showAxes:s.showAxes,xLabel:le,yLabel:ce,xFormat:b,yFormat:v,enableHover:te,showGrid:oe,...d({title:ne,description:re,summary:ae,accessibleTable:se,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:H,defaultTooltipContent:Ae}),...m({linkedHover:E,selection:M,onObservation:O,onClick:T,hoverHighlight:G,mobileInteraction:me.mobileInteraction,customHoverBehavior:me.customHoverBehavior,customClickBehavior:me.customClickBehavior}),...B&&{pointIdAccessor:B},canvasPreRenderers:fe,svgPreRenderers:ge,...Re&&Re.length>0&&{annotations:Re},...N&&{xExtent:N},...P&&{yExtent:P},...me.crosshairProps,...W};return ke?Le(X,{componentName:"ConnectedScatterplot",message:ke,width:Z,height:ee}):Le(Y,{componentName:"ConnectedScatterplot",width:Z,height:ee,children:Le(l,{ref:r,..._e})})});Be.displayName="ConnectedScatterplot";import{useMemo as Ie,useCallback as Fe,useState as Re,useEffect as _e,forwardRef as Ne,useRef as Pe}from"react";import{useMemo as We}from"react";function De(e){const{lineWidth:t=2,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:h,opacity:d,effectiveSelectionHook:m,resolvedSelection:u,styleRules:p,ruleContext:f}=e,g=We(()=>function(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:i,resolveStroke:r,fillArea:a,areaOpacity:s=.3,styleRules:l,ruleContext:c}=e;return(e,h)=>{const d={strokeWidth:t},m=!0===a||Array.isArray(a)&&null!=h&&a.includes(h);let u;return r?u=r(e,h):o?n&&(u=L(e,o,n)):u=i||b,void 0!==u&&(d.stroke=u,m&&(d.fill=u,d.fillOpacity=s)),l?.length&&Object.assign(d,y(e,l,c?c(e,h):{value:void 0,category:h})),d}}({lineWidth:t,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l,styleRules:p,ruleContext:f}),[t,n,i,r,a,s,l,p,f]),v=We(()=>o(g,{stroke:c,strokeWidth:h,opacity:d}),[g,c,h,d]);return We(()=>$(v,m??null,u),[v,m,u])}import{jsx as Me}from"react/jsx-runtime";var Ee="__lineObjectSeries",Oe=Ne(function(e,o){const n=Pe(null);a(o,{variant:"xy",frameRef:n});const r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:d,className:p,xFormat:y,yFormat:g,axisExtent:v,xAccessor:x="x",yAccessor:A="y",lineBy:S,lineDataAccessor:H="coordinates",colorBy:B,colorScheme:I,styleRules:F,curve:R="linear",showPoints:N=!1,pointRadius:P=3,fillArea:W=!1,areaOpacity:M=.3,lineWidth:E=2,lineGradient:O,tooltip:T,pointIdAccessor:G,annotations:z,directLabel:j,gapStrategy:$="break",anomaly:Q,forecast:V,band:q,xExtent:J,yExtent:U,frameProps:Z={},selection:ee,linkedHover:te,onObservation:oe,onClick:ne,hoverHighlight:ie,hoverRadius:re,chartId:ae,loading:se,loadingContent:le,emptyContent:ce,legendInteraction:he,legendPosition:de,legend:me,xScaleType:ue,yScaleType:fe,color:ge,stroke:be,strokeWidth:xe,opacity:Ae}=e,{legend:we,...ke}=Z,Se=Ie(()=>k(we,me),[we,me]),{width:Ce,height:Le,enableHover:He,showGrid:Be,showLegend:Ne,title:We,description:Oe,summary:Te,accessibleTable:Ge,xLabel:ze,yLabel:je}=r,$e=Ie(()=>C(s),[s]),Qe=Array.isArray($e[0]?.[H])?$e[0][H]:$e;K("LineChart",Qe,"xAccessor",x),K("LineChart",Qe,"yAccessor",A);const{effectiveData:Ve,statisticalAnnotations:Xe}=ve({data:$e,xAccessor:x,yAccessor:A,forecast:V,anomaly:Q,groupBy:S}),Ye="__compoundGroup",qe=!(!V||!S),Je=qe?Ye:V?pe:S,Ke=Ie(()=>{if(!qe)return Ve;const e="function"==typeof S?S:e=>e[S];return Ve.map(t=>{const o={...t};return o[Ye]=`${e(t)}__${t[pe]||"observed"}`,o})},[Ve,qe,S]),Ue=qe?Ke:Ve,Ze=B||S,et=Ie(()=>{if(!V)return;const e=V.upperBounds,t=V.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const a=Ve;for(const e of a){const t="function"==typeof A?A(e):+e[A];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[V,Ve,A]),tt=Fe(e=>{const t="function"==typeof x?x(e):e[x],o="function"==typeof A?A(e):e[A];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[x,A]),ot=void 0!==Ue[0]?.[H],nt=ot?Ee:Je,it=Ie(()=>{if(ot)return Ue.map((e,t)=>{const o="function"==typeof S?S(e):"string"==typeof S?e[S]:void 0,n=null==o?"line-"+t:o+"",i=Array.isArray(e[H])?e[H]:[];return{...e,[Ee]:n,[H]:i.map(t=>({...t,[Ee]:n,parentLine:e,..."string"==typeof S&&void 0!==e[S]?{[S]:e[S]}:{}}))}});if(Je){const e=Ue.reduce((e,t)=>{const o="function"==typeof Je?Je(t):t[Je];if(!e[o]){const n={[H]:[]};"string"==typeof Je&&(n[Je]=o),qe&&(n[pe]=t[pe],"string"==typeof S&&(n[S]=t[S])),e[o]=n}return e[o][H].push(t),e},{});return Object.values(e)}return[{[H]:Ue}]},[ot,Je,H,Ue,S,qe]),{gapProcessedLineData:rt,hasGaps:at}=Ie(()=>{if("interpolate"===$){let e=!1;const t=[];for(const o of it){const n=(o[H]||[]).filter(t=>!tt(t)||(e=!0,!1));n.length>0&&t.push({...o,[H]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===$){let e=!1;const t=[];for(const o of it){const n=o[H]||[];let i=[],r=0;const a=nt&&"string"==typeof nt?o[nt]:void 0;for(const s of n)if(tt(s))e=!0,i.length>0&&(t.push({...o,[H]:i}),i=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;i.push({...s,_gapSegment:e})}i.length>0&&t.push({...o,[H]:i})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===$){let e=!1;const t="string"==typeof A?A:"y",o=[];for(const n of it){const i=n[H]||[],r=[];for(const o of i)tt(o)?(e=!0,r.push({...o,[t]:0})):r.push(o);o.push({...n,[H]:r})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:it,hasGaps:!1}},[it,$,H,tt,nt,A]),st="object"==typeof j?j:{},lt=st.position||"end",ct=st.fontSize||11,ht=Ie(()=>{if(!j||!Ze)return[];const e="function"==typeof Ze?Ze:e=>e[Ze],t=new Set;for(const o of rt){const n=o[H]||[];if(0===n.length)continue;const i=e("end"===lt?n[n.length-1]:n[0])??e(o);if(null==i)continue;const r=i+"";""!==r&&t.add(r)}return Array.from(t)},[j,Ze,rt,H,lt]),dt=Ie(()=>{if(!j)return r.marginDefaults;const e=ht.reduce((e,t)=>Math.max(e,t.length*(.6*ct)),0)+10,t="end"===lt?"right":"left";return{...r.marginDefaults,[t]:Math.max(r.marginDefaults[t]||0,e)}},[j,ht,ct,lt,r.marginDefaults]),mt=i({data:Ve,rawData:s,colorBy:Ze,colorScheme:I,legendInteraction:he,legendPosition:de,selection:ee,linkedHover:te,fallbackFields:Ze?["string"==typeof Ze?Ze:""]:[],unwrapData:!1,onObservation:oe,onClick:ne,hoverHighlight:ie,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LineChart",chartId:ae,showLegend:(!j||void 0!==Ne)&&Ne,legend:Se,userMargin:d,marginDefaults:dt,loading:se,loadingContent:le,emptyContent:ce,width:Ce,height:Le}),ut=mt.colorScale,pt=mt.effectiveSelectionHook,ft=mt.resolvedSelection,yt=mt.customHoverBehavior,gt=mt.customClickBehavior,bt=mt.crosshairProps,vt=Ie(()=>{if(Ze)return ot?e=>{const t=e.parentLine||e;return"function"==typeof Ze?Ze(t):t[Ze]}:Ze},[Ze,ot]),xt=Ie(()=>f(x,A),[x,A]),At=De({lineWidth:E,colorBy:vt,colorScale:ut,color:ge,fillArea:W,areaOpacity:M,stroke:be,strokeWidth:xe,opacity:Ae,effectiveSelectionHook:pt,resolvedSelection:ft,styleRules:F,ruleContext:xt}),[wt,kt]=Re(null);_e(()=>{if(!V)return void kt(null);let e=!1;return async function(...e){return(await ye()).createSegmentLineStyle(...e)}(At,V).then(t=>{e||kt(()=>t)}).catch(()=>{e||kt(null)}),()=>{e=!0}},[At,V]);const St=wt||At,Ct=Ie(()=>{if(N)return e=>{const t={r:P,fillOpacity:1};return Ze?ut&&(t.fill=L(e.parentLine||e,Ze,ut)):t.fill=ge||b,t}},[N,P,Ze,ut,ge]),Lt=Array.isArray(W)?"mixed":W?"area":"line",Ht=Ie(()=>{if(!j||!Ze)return[];const e="function"==typeof x?x:e=>e[x],t="function"==typeof A?A:e=>e[A],o="function"==typeof Ze?Ze:e=>e[Ze],n=new Map;for(const e of rt){const t=e[H]||[];if(0===t.length)continue;const i="end"===lt?t[t.length-1]:t[0],r=o(i)??o(e);if(null==r)continue;const a=r+"";""===a||n.has(a)||n.set(a,i)}const i=Array.from(n.entries()).map(([o,n])=>({type:"text",label:o,["string"==typeof x?x:"x"]:e(n),["string"==typeof A?A:"y"]:t(n),dx:"end"===lt?6:-6,dy:0,color:ut?ut(o):b,fontSize:ct}));i.sort((e,t)=>{const o="string"==typeof A?A:"y";return e[o]-t[o]});for(let e=1;i.length>e;e++){const t="string"==typeof A?A:"y",o=i[e-1],n=i[e];ct+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=ct+2)}return i},[j,Ze,ut,rt,H,x,A,lt,ct]),Bt=mt.margin,It=S||B,Ft=Ie(()=>u([{label:ze||c(x),accessor:x,role:"x",format:y},{label:je||c(A),accessor:A,role:"y",format:g},...It?[{label:c(It),accessor:It,role:"group"}]:[],...h(q,g)]),[x,A,ze,je,It,y,g,q]),Rt=t({componentName:"LineChart",data:ot?Ve[0]?.[H]||[]:s,accessors:{xAccessor:x,yAccessor:A}}),_t=Ie(()=>ot||nt||at?rt.flatMap(e=>{const t=e[H]||[];return nt&&"string"==typeof nt?t.map(t=>({...t,[nt]:t[nt]??e[nt]})):t}):Ue,[rt,H,ot,nt,Ue,at]),Nt={chartType:Lt,...Array.isArray(W)&&{areaGroups:W},...O&&{lineGradient:O},...null!=s&&{data:_t},xAccessor:x,yAccessor:A,xScaleType:ue,yScaleType:fe,...J&&{xExtent:J},...!U||null==U[0]&&null==U[1]?et?{yExtent:et}:{}:{yExtent:U},groupAccessor:"break"===$&&at?"_gapSegment":nt||void 0,...q&&{band:q},curve:R,lineStyle:St,...N&&{pointStyle:Ct},size:[Ce,Le],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Bt,showAxes:r.showAxes,xLabel:ze,yLabel:je,xFormat:y,yFormat:g,...void 0!==v&&{axisExtent:v},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:He,showGrid:Be,...mt.legendBehaviorProps,...We&&{title:We},...Oe&&{description:Oe},...Te&&{summary:Te},...void 0!==Ge&&{accessibleTable:Ge},...p&&{className:p},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===T?()=>null:"multi"===T?w():_(T)||Ft,..."multi"===T&&{tooltipMode:"multi"},...m({linkedHover:te,selection:ee,onObservation:oe,onClick:ne,hoverRadius:re,hoverHighlight:ie,mobileInteraction:mt.mobileInteraction,customHoverBehavior:yt,customClickBehavior:gt}),...G&&{pointIdAccessor:G},...(z?.length||Xe.length||Ht.length)&&{annotations:[...z||[],...Xe,...Ht]},...bt,...ke};return mt.earlyReturn?mt.earlyReturn:Rt?Me(X,{componentName:"LineChart",message:Rt,width:Ce,height:Le}):Me(Y,{componentName:"LineChart",width:Ce,height:Le,children:Me(l,{ref:n,...Nt})})});Oe.displayName="LineChart";import{useMemo as Te,forwardRef as Ge,useRef as ze}from"react";import{useMemo as je}from"react";function $e(e){const{safeData:t,data:n,areaBy:i,lineDataAccessor:r,colorBy:a,colorScale:s,color:l,stroke:d,strokeWidth:m,opacity:p,effectiveSelectionHook:f,resolvedSelection:g,areaOpacity:v,showLine:x,lineWidth:A,showPoints:w,pointRadius:k,xAccessor:S,yAccessor:C,xLabel:H,yLabel:B,xFormat:I,yFormat:F,groupField:R,styleRules:_,ruleContext:N}=e,P=je(()=>function({data:e,safeData:t,areaBy:o,lineDataAccessor:n}){if(null==e)return[];const i=void 0!==t[0]?.[n];if(!i&&!o)return t;let r;if(i)r=t;else{const e=t.reduce((e,t)=>{const i="function"==typeof o?o(t):t[o],r=i+"";if(!e[r]){const t={[n]:[]};"string"==typeof o&&(t[o]=i),e[r]=t}return e[r][n].push(t),e},{});r=Object.values(e)}return r.flatMap(e=>{const t=Array.isArray(e[n])?e[n]:[];return"string"==typeof o?t.map(t=>({...t,[o]:t[o]??e[o]})):t})}({data:n,safeData:t,areaBy:i,lineDataAccessor:r}),[n,t,i,r]),W=je(()=>e=>{const t={};if(a){if(s){const o=L(e,a,s);t.fill=o,x?(t.stroke=o,t.strokeWidth=A):t.stroke="none"}}else{const e=l||b;t.fill=e,x?(t.stroke=e,t.strokeWidth=A):t.stroke="none"}return t.fillOpacity=v,_&&_.length>0&&Object.assign(t,y(e,_,N?N(e):{value:void 0})),t},[a,s,l,v,x,A,_,N]),D=je(()=>o(W,{stroke:d,strokeWidth:m,opacity:p}),[W,d,m,p]);return{flattenedData:P,lineStyle:je(()=>$(D,f??null,g),[D,f,g]),pointStyle:je(()=>{if(w)return e=>{const t={r:k,fillOpacity:1};return a?s&&(t.fill=L(e.parentLine||e,a,s)):t.fill=l||b,t}},[w,k,a,s,l]),defaultTooltipContent:je(()=>u([{label:H||c(S),accessor:S,role:"x",format:I},{label:B||c(C),accessor:C,role:"y",format:F},...R?[{label:c(R),accessor:R,role:"group"}]:[],...h(e.band,F)]),[S,C,H,B,R,I,F,e.band])}}import{jsx as Qe}from"react/jsx-runtime";function Ve(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var Xe=Ge(function(e,o){const n=ze(null);a(o,{variant:"xy",frameRef:n});const r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:u,yFormat:y,xAccessor:g="x",yAccessor:b="y",areaBy:v,y0Accessor:x,gradientFill:A=!1,semanticGradient:k,lineDataAccessor:S="coordinates",colorBy:L,colorScheme:H,styleRules:B,curve:I="monotoneX",areaOpacity:F=.7,lineGradient:R,showLine:_=!0,lineWidth:N=2,showPoints:P=!1,pointRadius:W=3,tooltip:M,annotations:E,forecast:O,anomaly:T,band:G,xExtent:z,yExtent:j,frameProps:$={},selection:Q,linkedHover:V,onObservation:q,onClick:J,hoverHighlight:U,chartId:Z,loading:ee,loadingContent:te,emptyContent:oe,legendInteraction:ne,legendPosition:ie,color:re,stroke:ae,strokeWidth:se,opacity:le}=e,{width:ce,height:he,enableHover:de,showGrid:me,showLegend:ue,title:pe,description:fe,summary:ye,accessibleTable:ge,xLabel:be,yLabel:xe}=r,Ae=Te(()=>C(s),[s]),we=L||v,ke=Te(()=>{return k&&k.length>0?{colorStops:(e=k,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Ve(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:A;var e},[k,A]);K("AreaChart",Ae,"xAccessor",g),K("AreaChart",Ae,"yAccessor",b);const Se=i({data:Ae,rawData:s,colorBy:we,colorScheme:H,legendInteraction:ne,legendPosition:ie,selection:Q,linkedHover:V,fallbackFields:we?["string"==typeof we?we:""]:[],unwrapData:!1,onObservation:q,onClick:J,hoverHighlight:U,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"AreaChart",chartId:Z,showLegend:ue,userMargin:c,marginDefaults:r.marginDefaults,loading:ee,loadingContent:te,emptyContent:oe,width:ce,height:he}),{effectiveData:Ce,statisticalAnnotations:Le}=ve({data:Ae,xAccessor:g,yAccessor:b,forecast:O,anomaly:T,groupBy:v}),He=Te(()=>f(g,b),[g,b]),{flattenedData:Be,lineStyle:Ie,pointStyle:Fe,defaultTooltipContent:Re}=$e({safeData:Ce,data:s,areaBy:v,lineDataAccessor:S,colorBy:we,colorScale:Se.colorScale,color:re,stroke:ae,strokeWidth:se,opacity:le,effectiveSelectionHook:Se.effectiveSelectionHook,resolvedSelection:Se.resolvedSelection,areaOpacity:F,showLine:_,lineWidth:N,showPoints:P,pointRadius:W,xAccessor:g,yAccessor:b,xLabel:be,yLabel:xe,xFormat:u,yFormat:y,groupField:v||L,band:G,styleRules:B,ruleContext:He}),_e=t({componentName:"AreaChart",data:s,accessors:{xAccessor:g,yAccessor:b}}),Ne={chartType:"area",...null!=s&&{data:Be},xAccessor:g,yAccessor:b,groupAccessor:v||void 0,...x&&{y0Accessor:x},...G&&{band:G},...ke&&{gradientFill:ke},...R&&{lineGradient:R},curve:I,lineStyle:Ie,...P&&Fe&&{pointStyle:Fe},size:[ce,he],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Se.margin,showAxes:r.showAxes,xLabel:be,yLabel:xe,xFormat:u,yFormat:y,enableHover:de,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:me,...Se.legendBehaviorProps,...d({title:pe,description:fe,summary:ye,accessibleTable:ge,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:w(),tooltipMode:"multi"}:p({tooltip:M,defaultTooltipContent:Re}),...m({linkedHover:V,selection:Q,onObservation:q,onClick:J,hoverHighlight:U,mobileInteraction:Se.mobileInteraction,customHoverBehavior:Se.customHoverBehavior,customClickBehavior:Se.customClickBehavior}),...(E&&E.length>0||Le.length>0)&&{annotations:[...E||[],...Le]},...z&&{xExtent:z},...j&&{yExtent:j},...Se.crosshairProps,...$};return Se.earlyReturn?Se.earlyReturn:_e?Qe(X,{componentName:"AreaChart",message:_e,width:ce,height:he}):Qe(Y,{componentName:"AreaChart",width:ce,height:he,children:Qe(l,{ref:n,...Ne})})});Xe.displayName="AreaChart";import{useMemo as Ye,forwardRef as qe,useRef as Je,useState as Ke,useImperativeHandle as Ue,useCallback as Ze}from"react";import{jsx as et,jsxs as tt}from"react/jsx-runtime";function ot(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var nt=qe(function(e,t){const o=Je(null),n=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:a,className:s,xFormat:c,yFormat:h,xAccessor:u="x",seriesAAccessor:p="a",seriesBAccessor:f="b",seriesALabel:y="A",seriesBLabel:g="B",seriesAColor:b="var(--semiotic-danger, #dc2626)",seriesBColor:v="var(--semiotic-info, #2563eb)",showLines:x=!0,lineWidth:A=1.5,showPoints:w=!1,pointRadius:k=3,curve:L="linear",areaOpacity:H=.6,gradientFill:B,tooltip:I,annotations:F,xExtent:R,yExtent:N,frameProps:P={},selection:W,linkedHover:M,onObservation:E,onClick:O,hoverHighlight:T,chartId:G,loading:z,loadingContent:j,emptyContent:$,legendInteraction:Q,legendPosition:V,pointIdAccessor:X,windowSize:q}=e,{width:J,height:K,enableHover:U,showGrid:Z,showLegend:ee,title:te,description:oe,summary:ne,accessibleTable:ie,xLabel:re,yLabel:ae}=n,se=Ye(()=>"function"==typeof u?e=>ot(u(e)):e=>ot(e[u]),[u]),le=Ye(()=>"function"==typeof p?e=>ot(p(e)):e=>ot(e[p]),[p]),ce=Ye(()=>"function"==typeof f?e=>ot(f(e)):e=>ot(e[f]),[f]),[he,de]=Ke([]),me=Je([]),ue=null==r,pe=Ye(()=>C(ue?he:r),[ue,he,r]),fe=Ye(()=>function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let a=0,s=null,l=null,c=[];const h=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,m=e=>r.push(e),u=(e,t)=>{m({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],p=t(r),f=o(r),y=n(r);if(!Number.isFinite(p)||!Number.isFinite(f)||!Number.isFinite(y))continue;const g=h(f,y);if(null!==g)if(null!=s){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=f-l.a-(y-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(p-l.x),t=l.a+n*(f-l.a)}else e=l.x,t=l.a}m({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=g,m({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)u(c[e],s)}else for(const e of c)u(e,s);c=[],m({__x:p,__y:y>f?y:f,__y0:y>f?f:y,__diffSegment:d(s),__diffWinner:s,__valA:f,__valB:y,__sourceDatum:r}),l={x:p,a:f,b:y,w:g}}else{s=g;for(const e of c)u(e,s);c=[],m({__x:p,__y:y>f?y:f,__y0:y>f?f:y,__diffSegment:d(s),__diffWinner:s,__valA:f,__valB:y,__sourceDatum:r}),l={x:p,a:f,b:y,w:g}}else c.push({x:p,y:f,datum:r})}for(const e of c)u(e,s??"A");return r}(pe,se,le,ce),[pe,se,le,ce]),ye=Ye(()=>x?function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];for(const e of i){const i=t(e),a=o(e),s=n(e);Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-B"})}return r}(pe,se,le,ce):[],[x,pe,se,le,ce]),ge=Ye(()=>[...fe,...ye],[fe,ye]),be=Ye(()=>{const e=new Set;for(const t of fe)e.add(t.__diffSegment);return Array.from(e)},[fe]);Ue(t,()=>{const e=e=>{const t=q&&e.length>q?e.slice(e.length-q):e;me.current=t,de(t)},t=X?"function"==typeof X?X:e=>e[X]:null;return{push:t=>e([...me.current,t]),pushMany:t=>e([...me.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of me.current)n.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(o,n)=>{if(!t)return[];const i=Array.isArray(o)?o:[o],r=[],a=me.current.map(e=>{if(i.includes(t(e))){const t=n(e);return r.push(t),t}return e});return e(a),r},clear:()=>e([]),getData:()=>ue?me.current:pe,getScales:()=>o.current?.getScales()??null}},[ue,pe,X,q]);const ve=i({data:pe,rawData:r,colorBy:"__diffWinner",colorScheme:[b,v],legendInteraction:Q,legendPosition:V,selection:W,linkedHover:M,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:E,onClick:O,hoverHighlight:T,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DifferenceChart",chartId:G,showLegend:ee,userMargin:a,marginDefaults:n.marginDefaults,loading:z,loadingContent:j,emptyContent:$,width:J,height:K}),xe=Ye(()=>{if(!1!==ee)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:y,color:b},{label:g,color:v}]}]}},[ee,y,g,b,v]),Ae=Ze(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?b:v,stroke:"none",fillOpacity:H}},[b,v,H]),we=Ze(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?b:v,strokeWidth:A,fill:"none"}),[b,v,A]),ke=Ze(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?b:v,r:k}),[b,v,k]),Se=Ze(e=>{const t=e.data,o=e.allSeries,n=e.xValue??t?.__x;let i=t?.__valA,r=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(i=e.value),null!=t?.value&&Number.isFinite(t.value)&&(r=t.value)}if(null!=n&&(null==i||null==r)){const e=pe.find(e=>se(e)===n);e&&(null==i&&(i=le(e)),null==r&&(r=ce(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",s=c&&null!=n?c(n):null!=n?n+"":"";return tt("div",{className:"semiotic-tooltip",style:S,children:[s&&et("div",{style:{fontWeight:600,marginBottom:4},children:s}),tt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[et("span",{style:{width:10,height:10,background:b,display:"inline-block",borderRadius:2}}),tt("span",{children:[y,": ",a(i)]})]}),tt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[et("span",{style:{width:10,height:10,background:v,display:"inline-block",borderRadius:2}}),tt("span",{children:[g,": ",a(r)]})]}),null!=i&&null!=r&&Number.isFinite(i)&&Number.isFinite(r)&&tt("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(i-r)]})]})},[pe,se,le,ce,c,b,v,y,g]),Ce="multi"===I,Le=Ye(()=>!1===I?()=>null:Ce?Se:_(I)||Se,[I,Ce,Se]);if(ve.earlyReturn)return ve.earlyReturn;const He={chartType:"mixed",data:ge,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:be,curve:L,areaStyle:Ae,lineStyle:we,...w&&{pointStyle:ke},size:[J,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve.margin,showAxes:n.showAxes,xLabel:re,yLabel:ae,xFormat:c,yFormat:h,enableHover:U,showGrid:Z,...B&&{gradientFill:!0===B?{topOpacity:.85,bottomOpacity:.15}:B},...xe&&{legend:xe,legendPosition:ve.legendPosition},...d({title:te,description:oe,summary:ne,accessibleTable:ie,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:Le,...Ce&&{tooltipMode:"multi"},...m({linkedHover:M,selection:W,onObservation:E,onClick:O,hoverHighlight:T,mobileInteraction:ve.mobileInteraction,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior}),...F&&F.length>0&&{annotations:F},...R&&{xExtent:R},...N&&{yExtent:N},...ve.crosshairProps,...P};return et(Y,{componentName:"DifferenceChart",width:J,height:K,children:et(l,{ref:o,...He})})});"function"==typeof nt&&(nt.displayName="DifferenceChart");import{useMemo as it,forwardRef as rt,useRef as at}from"react";import{jsx as st}from"react/jsx-runtime";var lt=rt(function(e,o){const n=at(null),r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:u,yFormat:y,xAccessor:g="x",yAccessor:b="y",areaBy:v,lineDataAccessor:x="coordinates",colorBy:A,colorScheme:k,styleRules:S,curve:L="monotoneX",areaOpacity:H=.7,showLine:B=!0,lineWidth:I=2,showPoints:F=!1,pointRadius:R=3,normalize:_=!1,baseline:N="zero",stackOrder:P,tooltip:W,annotations:M,xExtent:E,yExtent:O,frameProps:T={},selection:G,linkedHover:z,onObservation:j,onClick:$,hoverHighlight:Q,chartId:V,loading:q,loadingContent:J,emptyContent:K,legendInteraction:U,legendPosition:Z,color:ee,stroke:te,strokeWidth:oe,opacity:ne}=e,{width:ie,height:re,enableHover:ae,showGrid:se,showLegend:le,title:ce,description:he,summary:de,accessibleTable:me,xLabel:ue,yLabel:pe}=r,fe=it(()=>C(s),[s]),ye=A||v;a(o,{variant:"xy",frameRef:n});const ge=i({data:fe,rawData:s,colorBy:ye,colorScheme:k,legendInteraction:U,legendPosition:Z,selection:G,linkedHover:z,fallbackFields:ye?["string"==typeof ye?ye:""]:[],unwrapData:!1,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedAreaChart",chartId:V,showLegend:le,userMargin:c,marginDefaults:r.marginDefaults,loading:q,loadingContent:J,emptyContent:K,width:ie,height:re}),be=it(()=>f(g,b),[g,b]),{flattenedData:ve,lineStyle:xe,pointStyle:Ae,defaultTooltipContent:we}=$e({safeData:fe,data:s,areaBy:v,lineDataAccessor:x,colorBy:ye,colorScale:ge.colorScale,color:ee,stroke:te,strokeWidth:oe,opacity:ne,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection,areaOpacity:H,showLine:B,lineWidth:I,showPoints:F,pointRadius:R,xAccessor:g,yAccessor:b,xLabel:ue,yLabel:pe,xFormat:u,yFormat:y,groupField:v||A,styleRules:S,ruleContext:be}),ke=t({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:g,yAccessor:b}}),Se={chartType:"stackedarea",...null!=s&&{data:ve},xAccessor:g,yAccessor:b,groupAccessor:v||void 0,curve:L,normalize:_,baseline:_?"zero":N,stackOrder:P,lineStyle:xe,...F&&Ae&&{pointStyle:Ae},size:[ie,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:ue,yLabel:pe,xFormat:u,yFormat:y,enableHover:ae,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:se,...ge.legendBehaviorProps,...d({title:ce,description:he,summary:de,accessibleTable:me,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===W?{tooltipContent:w(),tooltipMode:"multi"}:p({tooltip:W,defaultTooltipContent:we}),...m({linkedHover:z,selection:G,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:ge.mobileInteraction,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior}),...M&&M.length>0&&{annotations:M},...E&&{xExtent:E},...O&&{yExtent:O},...ge.crosshairProps,...T};return ge.earlyReturn?ge.earlyReturn:ke?st(X,{componentName:"StackedAreaChart",message:ke,width:ie,height:re}):st(Y,{componentName:"StackedAreaChart",width:ie,height:re,children:st(l,{ref:n,...Se})})});lt.displayName="StackedAreaChart";import{useMemo as ct,forwardRef as ht,useRef as dt}from"react";import{scaleSequential as mt}from"d3-scale";import{jsx as ut}from"react/jsx-runtime";var pt=ht(function(e,o){const n=dt(null);a(o,{variant:"xy",frameRef:n});const i=D(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:h,className:f,xAccessor:y="x",yAccessor:g="y",valueAccessor:b="value",xFormat:v,yFormat:x,colorScheme:A,customColorScale:w,showValues:k=!1,valueFormat:S,cellBorderColor:L="#fff",cellBorderWidth:I=1,tooltip:F,annotations:R,xExtent:_,yExtent:N,frameProps:P={},selection:E,linkedHover:T,onObservation:G,onClick:z,hoverHighlight:$,chartId:Q,loading:K,loadingContent:U,emptyContent:Z,showLegend:ee,legendPosition:te,legendInteraction:oe}=e,{width:ne,height:ie,enableHover:re,title:ae,description:se,summary:le,accessibleTable:ce,xLabel:he,yLabel:de}=i,me=J(K,ne,ie,U),ue=me?null:q(r,ne,ie,Z),pe=ct(()=>C(r),[r]),fe=j(),ye=A??fe??"blues",ge=ee??!1,be=te??"right",{margin:ve}=W({data:pe,colorBy:ge?"value":void 0,colorScale:void 0,showLegend:ge,legendPosition:be,userMargin:h,defaults:i.marginDefaults}),{customHoverBehavior:xe,customClickBehavior:Ae,crosshairSourceId:we}=M({selection:E,linkedHover:T,fallbackFields:[],onObservation:G,onClick:z,chartType:"Heatmap",chartId:Q,hoverHighlight:$,colorByField:void 0,mobileInteraction:i.mobileInteraction});s(E);const ke=H(T,we);O(oe,void 0,[]);const Se=ct(()=>"function"==typeof b?e=>b(e):e=>e[b],[b]),Ce=ct(()=>{const e=pe.map(Se);return V(e)},[pe,Se]),Le=ct(()=>{if("custom"===ye&&w)return w;const e=B(ye);return mt(e).domain(Ce)},[ye,w,Ce]),He=ct(()=>{const e=Number.isFinite(I)?Math.max(0,I):1;return()=>({stroke:L,strokeWidth:e})},[L,I]),Be=ct(()=>u([{label:he||c(y),accessor:y,role:"x",format:v},{label:de||c(g),accessor:g,role:"y",format:x},{label:c(b),accessor:b,role:"value",format:S}]),[y,g,he,de,b,v,x,S]),Ie=t({componentName:"Heatmap",data:r,accessors:{xAccessor:y,yAccessor:g,valueAccessor:b}}),Fe=ct(()=>{if(ge)return{gradient:{colorFn:e=>Le(e),domain:Ce,label:"string"==typeof b?b:"value",format:S}}},[ge,Le,Ce,b,S]),Re={chartType:"heatmap",...null!=r&&{data:pe},xAccessor:y,yAccessor:g,valueAccessor:b,colorScheme:"custom"!==ye?ye:void 0,areaStyle:He,showValues:k,heatmapValueFormat:S,size:[ne,ie],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,showAxes:i.showAxes,xLabel:he,yLabel:de,xFormat:v,yFormat:x,enableHover:re,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Fe&&{legend:Fe,legendPosition:be},...d({title:ae,description:se,summary:le,accessibleTable:ce,className:f,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...p({tooltip:F,defaultTooltipContent:Be}),...m({linkedHover:T,selection:E,onObservation:G,onClick:z,hoverHighlight:$,mobileInteraction:i.mobileInteraction,customHoverBehavior:xe,customClickBehavior:Ae}),...R&&R.length>0&&{annotations:R},..._&&{xExtent:_},...N&&{yExtent:N},...ke,...P};return me||ue||(Ie?ut(X,{componentName:"Heatmap",message:Ie,width:ne,height:ie}):ut(Y,{componentName:"Heatmap",width:ne,height:ie,children:ut(l,{ref:n,...Re})}))});pt.displayName="Heatmap";import{useMemo as ft,useCallback as yt,forwardRef as gt,useRef as bt}from"react";import{jsx as vt}from"react/jsx-runtime";var xt=gt(function(o,n){const r=bt(null),s=D(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:x="x",yAccessor:A="y",sizeBy:w,sizeRange:k=[5,40],colorBy:S,colorScheme:L,styleRules:H,bubbleOpacity:B=.6,bubbleStrokeWidth:F=1,bubbleStrokeColor:_="white",tooltip:N,marginalGraphics:W,pointIdAccessor:M,annotations:E,regression:O,xExtent:T,yExtent:G,frameProps:z={},selection:j,linkedHover:$,linkedBrush:Q,onObservation:V,onClick:q,hoverHighlight:J,chartId:K,loading:U,loadingContent:Z,emptyContent:ee,legendInteraction:te,legendPosition:oe,color:ne,stroke:re,strokeWidth:ae,opacity:se}=o,{width:le,height:he,enableHover:de,showGrid:me,showLegend:ue,title:pe,description:fe,summary:ye,accessibleTable:ge,xLabel:be,yLabel:ve}=s,xe=ft(()=>C(h),[h]),Ae=void 0===h,we=i({data:xe,rawData:h,colorBy:S,colorScheme:L,legendInteraction:te,legendPosition:oe,selection:j,linkedHover:$,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:V,onClick:q,hoverHighlight:J,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"BubbleChart",chartId:K,showLegend:ue,userMargin:y,marginDefaults:s.marginDefaults,loading:U,loadingContent:Z,emptyContent:ee,width:le,height:he}),{domain:ke,trackPushed:Se,reset:Ce}=ce({accessor:w,data:xe,isPushMode:Ae}),Le=yt(e=>{Se([e]),r.current?.push(e)},[Se]),He=yt(e=>{Se(e),r.current?.pushMany(e)},[Se]);a(n,{variant:"xy",frameRef:r,overrides:{push:Le,pushMany:He,clear:()=>{Ce(),r.current?.clear()}}});const Be=R(Q),Ie=(P({name:Be?.name||"__unused_brush__",xField:Be?.xField||("string"==typeof x?x:void 0),yField:Be?.yField||("string"==typeof A?A:void 0)}),ft(()=>({stroke:_,strokeWidth:F}),[_,F])),Fe=ft(()=>ke??[0,1],[ke]),Re=yt(e=>I(e,w,k,Fe),[w,k,Fe]),_e=ft(()=>f(x,A),[x,A]),Ne=ie({colorBy:S,colorScale:we.colorScale,color:ne,fillOpacity:B,radiusFn:Re,baseStyleExtras:Ie,stroke:re,strokeWidth:ae,opacity:se,styleRules:H,ruleContext:_e,effectiveSelectionHook:we.effectiveSelectionHook,resolvedSelection:we.resolvedSelection}),Pe=ft(()=>u([{label:be||c(x),accessor:x,role:"x",format:b},{label:ve||c(A),accessor:A,role:"y",format:v},{label:c(w),accessor:w,role:"size"},...S?[{label:c(S),accessor:S,role:"color"}]:[]]),[x,A,be,ve,w,S,b,v]);if(we.earlyReturn)return we.earlyReturn;const We=t({componentName:"BubbleChart",data:h,accessors:{xAccessor:x,yAccessor:A},requiredProps:{sizeBy:w}});if(We)return vt(X,{componentName:"BubbleChart",message:We,width:le,height:he});const De=e(O),Me=De?[De,...E||[]]:E,Ee={chartType:"bubble",...null!=h&&{data:xe},xAccessor:x,yAccessor:A,colorAccessor:S||void 0,sizeAccessor:w,sizeRange:k,pointStyle:Ne,colorScheme:L,size:[le,he],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:we.margin,showAxes:s.showAxes,xLabel:be,yLabel:ve,xFormat:b,yFormat:v,enableHover:de,showGrid:me,...we.legendBehaviorProps,...d({title:pe,description:fe,summary:ye,accessibleTable:ge,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:N,defaultTooltipContent:Pe}),...m({linkedHover:$,selection:j,onObservation:V,onClick:q,hoverHighlight:J,mobileInteraction:we.mobileInteraction,customHoverBehavior:we.customHoverBehavior,customClickBehavior:we.customClickBehavior}),...W&&{marginalGraphics:W},...M&&{pointIdAccessor:M},...Me&&Me.length>0&&{annotations:Me},...T&&{xExtent:T},...G&&{yExtent:G},...we.crosshairProps,...z};return vt(Y,{componentName:"BubbleChart",width:le,height:he,children:vt(l,{ref:r,...Ee})})});xt.displayName="BubbleChart";import*as At from"react";import{useMemo as wt,useCallback as kt,useState as St,useRef as Ct}from"react";import*as Lt from"react";import{jsx as Ht}from"react/jsx-runtime";var Bt=null,It=null;function Ft(e){const[t,o]=Lt.useState(()=>Bt);return Lt.useEffect(()=>{if(t)return;let e=!1;return(Bt?Promise.resolve(Bt):(It||(It=import("./chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js").then(e=>Bt=e.ScatterplotMatrixBrushOverlay).catch(e=>{throw It=null,e})),It)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?Ht(t,{...e}):null}import{jsx as Rt,jsxs as _t}from"react/jsx-runtime";var Nt="__splomIdx",Pt={top:4,bottom:4,left:4,right:4};function Wt({data:e,xField:t,yField:o,cellSize:n,pointRadius:i,pointOpacity:r,colorBy:a,colorScale:s,brushSelectionName:c,hoverSelectionName:h,unselectedOpacity:d,mobileInteraction:u,mode:p,onPointHover:f,onPointClick:y}){const g=Ct(null),v=T({name:c,clientId:`splom-${t}-${o}`,fields:[t,o]}),x=P({name:c,xField:t,yField:o}),A=T({name:h,clientId:"splom-hover-source",fields:[Nt]}),w=A.selectPoints,k=kt(e=>{e?x.brushInteraction.during(e):x.brushInteraction.end(null)},[x.brushInteraction]),S=kt(e=>{if(!e)return void f?.(null);const t=e.data,o=t?.[Nt];void 0!==o&&(w({[Nt]:[o]}),f?.(t,e.x+Pt.left,e.y+Pt.top))},[w,f]),C=kt(e=>{if(!e)return void y?.(null);const t=e.data;t&&y?.(t,e.x+Pt.left,e.y+Pt.top)},[y]),H=kt(e=>{const t={opacity:r,r:i};return t.fill=a?L(e,a,s):b,"hover"===p?A.isActive&&A.predicate(e)?(t.opacity=1,t.r=2.5*i,t.stroke="#333",t.strokeWidth=1.5):A.isActive&&(t.opacity=.6*r):v.isActive&&!v.predicate(e)&&(t.opacity=d),t},[r,i,a,p,s,A,v,d]);return _t("div",{style:{position:"relative",width:n,height:n},children:[Rt(l,{ref:g,chartType:"scatter",data:e,size:[n,n],xAccessor:t,yAccessor:o,pointStyle:H,margin:Pt,showAxes:!1,enableHover:"hover"===p,...m({forceHoverBehavior:"hover"===p,forceClickBehavior:!!y,mobileInteraction:u,customHoverBehavior:S,customClickBehavior:C}),tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&Rt(Ft,{frameRef:g,cellSize:n,onBrush:k})]})}function Dt({data:e,field:t,label:o,cellSize:n,bins:i,colorBy:r,colorScale:a,brushSelectionName:s,hoverSelectionName:l,mode:c}){const h=T({name:s,clientId:"splom-diag-"+t,fields:[t]}),d=T({name:l,clientId:`splom-diag-${t}-hover`,fields:[Nt]}),m="hover"===c?d:h,u=m.isActive,p=m.predicate,f=wt(()=>{const o="string"==typeof r?r:null,a=[],s=new Set;for(const n of e){const e=n[t];if(null==e||isNaN(e)||a.push(Number(e)),o){const e=n[o];null!=e&&s.add(e+"")}}if(0===a.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=V(a),h=(c-l)/i||1,d=Array.from(s),m=new Map(d.map((e,t)=>[e,t])),f=Array(i).fill(0),y=Array(i).fill(0),g=Array.from({length:i},()=>Array(d.length).fill(0)),b=Array.from({length:i},()=>Array(d.length).fill(0));for(const n of e){const e=n[t];if(null==e||isNaN(e))continue;const r=Math.min(Math.floor((e-l)/h),i-1);if(f[r]++,u&&!p(n)||y[r]++,o){const e=m.get(n[o]+"");void 0!==e&&(g[r][e]++,u&&!p(n)||b[r][e]++)}}const v=Q(f,1),x=g.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/v*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})}),A=b.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/v*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})});return{bars:f.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/v*(n-24),count:e})),selectedBars:y.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/v*(n-24),count:e})),categoryBars:x,selectedCategoryBars:A,max:v,categories:d}},[e,t,i,n,u,p,r]);return _t("svg",{width:n,height:n,style:{overflow:"hidden"},children:[Rt("text",{x:n/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),f.categories.length>0?f.categoryBars.map((e,t)=>e.map((e,o)=>Rt("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):b,opacity:u?.3:.6},`bg-${t}-${o}`))):f.bars.map((e,t)=>Rt("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:b,opacity:u?.3:.6},"bg-"+t)),u&&(f.categories.length>0?f.selectedCategoryBars.map((e,t)=>e.map((e,o)=>Rt("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):b,opacity:.7},`sel-${t}-${o}`))):f.selectedBars.map((e,t)=>Rt("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:b,opacity:.7},"sel-"+t)))]})}function Mt({label:e,cellSize:t}){return Rt("svg",{width:t,height:t,children:Rt("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Et(e){const{data:t,fields:o,fieldLabels:n={},colorBy:i,colorScheme:r,cellSize:a=150,cellGap:s=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:h="histogram",histogramBins:d=20,brushMode:m="crossfilter",hoverMode:u=!0,unselectedOpacity:p=.1,showGrid:f=!1,tooltip:y,showLegend:g,idAccessor:v,width:x,className:A,onObservation:w,onClick:k,chartId:S}=e,C="splom",L="splom-hover",H=N(e.mobileInteraction,{mode:e.mode,width:x??o.length*a,mobileSemantics:e.mobileSemantics}),B=u?"hover":m?"brush":"hover",I=G(e=>e.clearSelection),[F,R]=St(null),_=kt(()=>{I(L),R(null)},[I,L]),P=wt(()=>(t||[]).map((e,t)=>void 0!==e[Nt]?e:{...e,[Nt]:t}),[t]),W=E(P,i,r),D=kt((e,t,o,n)=>[40+e*(a+s)+(o??0),t*(a+s)+(n??0)],[40,a,s]),M=void 0!==g?g:!!i,O=wt(()=>{if(!M||!i)return null;const e="string"==typeof i?i:null;return e?Array.from(new Set(P.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:W?W(e+""):b})):null},[M,i,P,W]),T=wt(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>a+"px").join(" "),gridTemplateRows:o.map(()=>a+"px").join(" ")+" 40px",gap:s+"px",width:"fit-content"}),[o,a,s,40]);return _t("div",{className:A,style:{position:"relative"},children:[O&&Rt("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:O.map(e=>_t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[Rt("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),Rt("span",{style:{fontSize:11},children:e.label})]},e.label))}),_t("div",{style:T,onMouseLeave:"hover"===B?_:void 0,children:[o.map((e,t)=>_t(At.Fragment,{children:[Rt("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e}),o.map((o,r)=>t===r?"label"===h?Rt(Mt,{label:n[e]||e,cellSize:a},"diag-"+e):Rt(Dt,{data:P,field:e,label:n[e]||e,cellSize:a,bins:d,colorBy:i,colorScale:W,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,mode:B},"diag-"+e):Rt(Wt,{data:P,xField:o,yField:e,fieldLabels:n,cellSize:a,pointRadius:l,pointOpacity:c,colorBy:i,colorScale:W,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,showGrid:f,tooltip:y,mobileInteraction:H,mode:B,onPointHover:"hover"===B?(n,i,a)=>{if(n){if(R({datum:n,xField:o,yField:e,colIndex:r,rowIndex:t,px:i??0,py:a??0}),w){const[e,o]=D(r,t,i,a);w({type:"hover",datum:n,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else R(null),w&&w({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:k||w?(e,o,n)=>{if(!e)return;const[i,a]=D(r,t,o,n);k&&k(e,{x:i,y:a}),w&&w({type:"click",datum:e,x:i,y:a,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),Rt("div",{})," ",o.map(e=>Rt("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e},"col-label-"+e))]}),F&&"hover"===B&&(()=>{const e=F.datum,t=n[F.xField]||F.xField,o=n[F.yField]||F.yField,r=i?"function"==typeof i?i(e):e[i]:null,l=v?"function"==typeof v?v(e):e[v]:"Row "+e[Nt];return _t("div",{style:{position:"absolute",left:40+F.colIndex*(a+s)+F.px,top:F.rowIndex*(a+s)+F.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[Rt("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),_t("div",{children:[t,": ",null!=e[F.xField]?Number(e[F.xField]).toFixed(1):"–"]}),_t("div",{children:[o,": ",null!=e[F.yField]?Number(e[F.yField]).toFixed(1):"–"]}),null!=r&&_t("div",{style:{opacity:.8},children:["string"==typeof i?i:"group",": ",r+""]})]})})()]})}function Ot(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),Rt(A,{selections:n,children:Rt(Et,{...e})})}Ot.displayName="ScatterplotMatrix";import{useState as Tt,useRef as Gt,useEffect as zt,useMemo as jt,useCallback as $t}from"react";import*as Qt from"react";import{jsx as Vt}from"react/jsx-runtime";var Xt=null,Yt=null;function qt(e){const[t,o]=Qt.useState(()=>Xt);return Qt.useEffect(()=>{if(t)return;let e=!1;return(Xt?Promise.resolve(Xt):(Yt||(Yt=import("./chunk-minimapBrushOverlay-JU57U7NM.module.min.js").then(e=>Xt=e.MinimapBrushOverlay).catch(e=>{throw Yt=null,e})),Yt)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?Vt(t,{...e}):null}import{jsx as Jt,jsxs as Kt}from"react/jsx-runtime";function Ut(e){const{data:o,width:n=600,height:i=400,margin:r,className:a,title:s,description:h,summary:d,xLabel:m,yLabel:p,xFormat:f,yFormat:y,xAccessor:g="x",yAccessor:v="y",lineBy:x,lineDataAccessor:A="coordinates",colorBy:w,colorScheme:k,curve:S="linear",lineWidth:H=2,fillArea:B=!1,areaOpacity:I=.3,showPoints:F=!1,pointRadius:R=3,enableHover:N=!0,showGrid:P=!1,showLegend:D,legendPosition:M,tooltip:O,minimap:T={},renderBefore:G=!1,onBrush:z,brushExtent:j,yExtent:$,frameProps:Q={},loading:V,loadingContent:K,emptyContent:U}=e,Z=J(V,n,i,K),ee=Z?null:q(o,n,i,U),te=jt(()=>C(o),[o]),[oe,ne]=Tt(null),ie=j??oe,re=$t(e=>{j||ne(e),z?.(e)},[j,z]),ae=Gt(null),[se,le]=Tt(null);zt(()=>{let e=0,t=!1;const o=()=>{if(t)return;const n=ae.current?.getScales?.();n?le(n):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[o]);const ce=void 0!==te[0]?.[A],he=jt(()=>{if(ce)return te;if(x){const e=te.reduce((e,t)=>{const o="function"==typeof x?x(t):t[x];if(!e[o]){const t={[A]:[]};"string"==typeof x&&(t[x]=o),e[o]=t}return e[o][A].push(t),e},{});return Object.values(e)}return[{[A]:te}]},[te,x,A,ce]),de=jt(()=>ce||x?he.flatMap(e=>{const t=e[A]||[];return x&&"string"==typeof x?t.map(t=>({...t,[x]:e[x]})):t}):te,[he,A,ce,x,te]),me=E(te,w,k),ue=De({lineWidth:H,colorBy:w,colorScale:me,fillArea:B,areaOpacity:I}),pe=jt(()=>{if(T.lineStyle)return T.lineStyle},[T.lineStyle]),fe=De({lineWidth:1,colorBy:w,colorScale:me}),ye=pe??fe,ge=jt(()=>{if(F)return e=>{const t={r:R,fillOpacity:1};return t.fill=w?L(e.parentLine||e,w,me):b,t}},[F,R,w,me]),{legend:be,margin:ve,legendPosition:xe}=W({data:he,colorBy:w,colorScale:me,showLegend:D,legendPosition:M,userMargin:r}),Ae=T.height||60,we=jt(()=>({top:T.margin?.top??0,bottom:T.margin?.bottom??20,left:T.margin?.left??ve.left,right:T.margin?.right??ve.right}),[T.margin,ve]),ke=T.brushDirection||"x",Se=jt(()=>u([{label:m||c(g),accessor:g,role:"x",format:f},{label:p||c(v),accessor:v,role:"y",format:y}]),[g,v,m,p,f,y]),Ce=t({componentName:"MinimapChart",data:o,accessors:{xAccessor:g,yAccessor:v}});if(Ce)return Jt(X,{componentName:"MinimapChart",message:Ce,width:n,height:i});const Le=B?"area":"line",He={chartType:Le,data:de,xAccessor:g,yAccessor:v,groupAccessor:x||void 0,curve:S,lineStyle:ue,...F&&{pointStyle:ge},size:[n,i],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,showAxes:!0,xLabel:m,yLabel:p,xFormat:f,yFormat:y,enableHover:N,showGrid:P,...be&&{legend:be,legendPosition:xe},...s&&{title:s},...h&&{description:h},...d&&{summary:d},tooltipContent:!1===O?()=>null:_(O)||Se,...ie&&{xExtent:ie},...$&&{yExtent:$},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...Q},Be={chartType:Le,data:de,xAccessor:g,yAccessor:v,groupAccessor:x||void 0,curve:S,lineStyle:ye,size:[n,Ae+we.top+we.bottom],margin:we,showAxes:T.showAxes??!1,background:T.background,enableHover:!1,...$&&{yExtent:$}},Ie=Kt("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[Jt(l,{ref:ae,...Be}),Jt(qt,{width:n-we.left-we.right,height:Ae,margin:we,scales:se,brushDirection:ke,extent:ie,onBrush:re})]},"minimap"),Fe=Jt("div",{style:{overflow:"hidden"},children:Jt(l,{...He})},"main");return Z||ee||Jt(Y,{componentName:"MinimapChart",width:n,height:i,children:Kt("div",{className:"minimap-chart"+(a?" "+a:""),children:[G?Ie:Fe,G?Fe:Ie]})})}Ut.displayName="MinimapChart";import{useMemo as Zt,forwardRef as eo,useRef as to}from"react";var oo={topLeft:{label:"Low / High",color:"#E9C46A",opacity:.08},topRight:{label:"High / High",color:"#2A9D8F",opacity:.08},bottomLeft:{label:"Low / Low",color:"#E76F51",opacity:.08},bottomRight:{label:"High / Low",color:"#86BBD8",opacity:.08}};import{Fragment as no,jsx as io,jsxs as ro}from"react/jsx-runtime";function ao(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var so=eo(function(e,o){const n=to(null);a(o,{variant:"xy",frameRef:n});const r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:h,className:d,xFormat:p,yFormat:y,xAccessor:g="x",yAccessor:v="y",xCenter:x,yCenter:A,quadrants:w,centerlineStyle:k={},showQuadrantLabels:S=!0,quadrantLabelSize:L=12,colorBy:H,colorScheme:B,styleRules:F,sizeBy:R,sizeRange:N=[3,15],pointRadius:P=5,pointOpacity:W=.8,tooltip:M,pointIdAccessor:E,annotations:O,frameProps:T={},selection:G,linkedHover:z,onObservation:j,onClick:$,hoverHighlight:Q,chartId:q,loading:J,loadingContent:U,emptyContent:Z,legendInteraction:ee,legendPosition:te,color:oe,stroke:ne,strokeWidth:re,opacity:ae}=e,{width:se,height:le,enableHover:ce,showGrid:he,showLegend:de,title:me,description:ue,summary:pe,accessibleTable:fe,xLabel:ye,yLabel:ge}=r,be=Zt(()=>({topLeft:ao(oo.topLeft,w?.topLeft),topRight:ao(oo.topRight,w?.topRight),bottomLeft:ao(oo.bottomLeft,w?.bottomLeft),bottomRight:ao(oo.bottomRight,w?.bottomRight)}),[w]),ve=Zt(()=>C(s),[s]),xe=i({data:ve,rawData:s,colorBy:H,colorScheme:B,legendInteraction:ee,legendPosition:te,selection:G,linkedHover:z,fallbackFields:"string"==typeof H?[H]:[],unwrapData:!1,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"QuadrantChart",chartId:q,showLegend:de,userMargin:h,marginDefaults:r.marginDefaults,loading:J,loadingContent:U,emptyContent:Z,width:se,height:le});K("QuadrantChart",ve,"xAccessor",g),K("QuadrantChart",ve,"yAccessor",v);const Ae=Zt(()=>{if(!ve.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof v?v:e=>+e[v];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const a of ve){const s=e(a),l=t(a);isFinite(s)&&(o>s&&(o=s),s>n&&(n=s)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=x&&isFinite(x)&&(o>x&&(o=x),x>n&&(n=x)),null!=A&&isFinite(A)&&(i>A&&(i=A),A>r&&(r=A)),o===1/0)return;const a=.1*(n-o)||1,s=.1*(r-i)||1;return{xExtent:[o-a,n+a],yExtent:[i-s,r+s]}},[ve,g,v,x,A]),we=Zt(()=>{if(!R||0===ve.length)return;const e=ve.map(e=>"function"==typeof R?R(e):e[R]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?V(e):void 0},[ve,R]),ke=Zt(()=>"function"==typeof g?g:e=>+e[g],[g]),Se=Zt(()=>"function"==typeof v?v:e=>+e[v],[v]),Ce=Zt(()=>e=>{const t=ke(e),o=Se(e),n=null!=x?t>=x:void 0,i=null!=A?o>=A:void 0;return void 0===i||void 0===n?oe||b:i&&n?be.topRight.color:i&&!n?be.topLeft.color:!i&&n?be.bottomRight.color:be.bottomLeft.color},[ke,Se,x,A,be,oe]),Le=Zt(()=>R?e=>I(e,R,N,we):void 0,[R,N,we]),He=Zt(()=>f(g,v),[g,v]),Be=ie({colorBy:H,colorScale:xe.colorScale,color:oe,pointRadius:P,fillOpacity:W,radiusFn:Le,fallbackFill:Ce,stroke:ne,strokeWidth:re,opacity:ae,styleRules:F,ruleContext:He,effectiveSelectionHook:xe.effectiveSelectionHook,resolvedSelection:xe.resolvedSelection}),Ie=Zt(()=>{if(!ve.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof v&&e.add(v),"string"==typeof H&&e.add(H),"string"==typeof R&&e.add(R);const t=ve[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ve,g,v,H,R]),Fe=Zt(()=>u([...Ie?[{label:Ie,accessor:Ie,role:"title"}]:[],{label:ye||c(g),accessor:g,role:"x",format:p},{label:ge||c(v),accessor:v,role:"y",format:y},...H?[{label:c(H),accessor:H,role:"color"}]:[],...R?[{label:c(R),accessor:R,role:"size"}]:[]]),[Ie,g,v,ye,ge,H,R,p,y]),Re=t({componentName:"QuadrantChart",data:s,accessors:{xAccessor:g,yAccessor:v}}),_e=Zt(()=>{const e={stroke:k.stroke||"#999",strokeWidth:k.strokeWidth??1,dashArray:k.strokeDasharray||[]};return[(t,o,n,i)=>{if(!n?.x||!n?.y)return;const r=i.width,a=i.height,s=null!=x?n.x(x):r/2,l=null!=A?n.y(A):a/2;if(null!=x&&!isFinite(s))return;if(null!=A&&!isFinite(l))return;const c=Math.max(0,Math.min(r,s)),h=Math.max(0,Math.min(a,l)),d=[{config:be.topLeft,x:0,y:0,w:c,h:h},{config:be.topRight,x:c,y:0,w:r-c,h:h},{config:be.bottomLeft,x:0,y:h,w:c,h:a-h},{config:be.bottomRight,x:c,y:h,w:r-c,h:a-h}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,a),t.stroke(),t.beginPath(),t.moveTo(0,h),t.lineTo(r,h),t.stroke(),t.setLineDash([])}]},[x,A,be,k]),Ne=Zt(()=>S?[..._e,(e,t,o,n)=>{if(!o?.x||!o?.y)return;const i=n.width,r=n.height,a=null!=x?o.x(x):i/2,s=null!=A?o.y(A):r/2;(null==x||isFinite(a))&&(null==A||isFinite(s))&&(e.font=`600 ${L}px sans-serif`,e.globalAlpha=.5,e.fillStyle=be.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(be.topLeft.label,8,8),e.fillStyle=be.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(be.topRight.label,i-8,8),e.fillStyle=be.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(be.bottomLeft.label,8,r-8),e.fillStyle=be.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(be.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:_e,[_e,S,L,be,x,A]),Pe=Zt(()=>{const e=T.canvasPreRenderers||[];return[...Ne,...e]},[Ne,T.canvasPreRenderers]),We=Zt(()=>{const e={stroke:k.stroke||"#999",strokeWidth:k.strokeWidth??1,dashArray:k.strokeDasharray?Array.isArray(k.strokeDasharray)?k.strokeDasharray.join(","):k.strokeDasharray:void 0};return[(t,o,n)=>{if(!o?.x||!o?.y)return null;const i=n.width,r=n.height,a=null!=x?o.x(x):i/2,s=null!=A?o.y(A):r/2;if(null!=x&&!isFinite(a))return null;if(null!=A&&!isFinite(s))return null;const l=Math.max(0,Math.min(i,a)),c=Math.max(0,Math.min(r,s));return ro(no,{children:[[{config:be.topLeft,x:0,y:0,w:l,h:c},{config:be.topRight,x:l,y:0,w:i-l,h:c},{config:be.bottomLeft,x:0,y:c,w:l,h:r-c},{config:be.bottomRight,x:l,y:c,w:i-l,h:r-c}].map((e,t)=>e.w>0&&e.h>0?io("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),io("line",{x1:l,y1:0,x2:l,y2:r,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),io("line",{x1:0,y1:c,x2:i,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),S&&ro(no,{children:[io("text",{x:8,y:8+L,fill:be.topLeft.color,fontWeight:600,fontSize:L,opacity:.5,children:be.topLeft.label}),io("text",{x:i-8,y:8+L,fill:be.topRight.color,fontWeight:600,fontSize:L,opacity:.5,textAnchor:"end",children:be.topRight.label}),io("text",{x:8,y:r-8,fill:be.bottomLeft.color,fontWeight:600,fontSize:L,opacity:.5,children:be.bottomLeft.label}),io("text",{x:i-8,y:r-8,fill:be.bottomRight.color,fontWeight:600,fontSize:L,opacity:.5,textAnchor:"end",children:be.bottomRight.label})]})]})}]},[x,A,be,k,S,L]);if(xe.earlyReturn)return xe.earlyReturn;const De={chartType:"scatter",...null!=s&&{data:ve},xAccessor:g,yAccessor:v,colorAccessor:H||void 0,sizeAccessor:R||void 0,sizeRange:N,pointStyle:Be,colorScheme:B,size:[se,le],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe.margin,showAxes:r.showAxes,xLabel:ye,yLabel:ge,xFormat:p,yFormat:y,enableHover:ce,showGrid:he,...Ae&&{xExtent:Ae.xExtent,yExtent:Ae.yExtent},...xe.legendBehaviorProps,...me&&{title:me},...ue&&{description:ue},...pe&&{summary:pe},...void 0!==fe&&{accessibleTable:fe},...d&&{className:d},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===M?()=>null:!0===M||void 0===M?Fe:_(M)||Fe,...m({linkedHover:z,selection:G,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior}),...E&&{pointIdAccessor:E},...O&&O.length>0&&{annotations:O},canvasPreRenderers:Pe,...xe.crosshairProps,...T,...Pe.length>0&&{canvasPreRenderers:Pe},svgPreRenderers:We};return Re?io(X,{componentName:"QuadrantChart",message:Re,width:se,height:le}):io(Y,{componentName:"QuadrantChart",width:se,height:le,children:io(l,{ref:n,...De})})});so.displayName="QuadrantChart";import*as lo from"react";import{useMemo as co,useCallback as ho,forwardRef as mo,useRef as uo,useImperativeHandle as po}from"react";import{jsx as fo}from"react/jsx-runtime";var yo="__ma_unitized",go="__ma_series";function bo(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function vo(e,t){return t[0]+e*(t[1]-t[0])}var xo=mo(function(e,o){const n=uo(null),r=uo([]),a=uo(e.series);a.current=e.series,po(o,()=>{const e=()=>(a.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const o=e(),i=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],a=t.extent||r.current[e];if(!a)continue;const s=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=s&&isFinite(s)&&n.current.push({...i,[yo]:bo(s,a),[go]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const o=e(),i=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const n=o[t],a=n.extent||r.current[t];if(!a)continue;const s=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=s&&isFinite(s)&&i.push({...e,[yo]:bo(s,a),[go]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const s=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:c,margin:h,className:d,xFormat:u,xAccessor:p="x",series:f,colorScheme:y,curve:b="monotoneX",lineWidth:x=2,tooltip:A,annotations:w,frameProps:k={},selection:S,linkedHover:L,onObservation:H,onClick:B,hoverHighlight:I,chartId:F,loading:R,loadingContent:N,emptyContent:P,legendInteraction:W,legendPosition:M,stroke:E,strokeWidth:O,opacity:T}=e,{width:G,height:j,enableHover:$,showGrid:Q,showLegend:V=!0,title:K,description:U,summary:Z,accessibleTable:ee,xLabel:te}=s,oe=co(()=>C(c),[c]),ne=co(()=>C(f),[f]),ie=ne,re=2===ne.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||re||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${ne.length}. Rendering as a standard multi-line chart.`);const ae=J(R,G,j,N),se=ae?null:q(c,G,j,P),le=z(),ce=co(()=>{let e;if(Array.isArray(y))e=y;else if(le&&le.length>0)e=le;else{const t=g[y];e=Array.isArray(t)?t:v}return ie.map((t,o)=>t.color||e[o%e.length])},[ie,y,le]),he=co(()=>ne.map((e,t)=>e.label||"Series "+(t+1)),[ne]),{unitizedData:de,extents:me}=co(()=>{if(0===oe.length){const e=ne.map(e=>e.extent||null).filter(Boolean);return e.length===ne.length&&(r.current=e),{unitizedData:[],extents:e.length===ne.length?e:[]}}const e=ne.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(oe,e.yAccessor));if(r.current=e,!re){const t=[];for(const e of oe)for(let o=0;ne.length>o;o++){const n=ne[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push({...e,[yo]:i,[go]:he[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of oe)for(let n=0;2>n;n++){const i=ne[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push({...o,[yo]:bo(r,e[n]),[go]:he[n]})}return{unitizedData:t,extents:e}},[oe,ne,re,he]),ue=co(()=>{if(re&&me.length>=2)return[{orient:"left",label:he[0],tickFormat:ne[0].format||(e=>{const t=vo(e,me[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:he[1],tickFormat:ne[1].format||(e=>{const t=vo(e,me[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[re,me,ne,he]),pe=co(()=>de.length>0?de:he.map(e=>({[go]:e})),[de,he]),fe=i({data:pe,rawData:c,colorBy:go,colorScheme:ce,legendInteraction:W,legendPosition:M,selection:S,linkedHover:L,fallbackFields:[go],unwrapData:!1,onObservation:H,onClick:B,hoverHighlight:I,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"MultiAxisLineChart",chartId:F,showLegend:V,userMargin:h,marginDefaults:re?{...s.marginDefaults,left:70,right:70}:s.marginDefaults,loading:R,loadingContent:N,emptyContent:P,width:G,height:j}),ye=co(()=>{const e=new Map;return he.forEach((t,o)=>e.set(t,ce[o])),e},[he,ce]),ge=De({lineWidth:x,resolveStroke:ho(e=>ye.get(e[go])||ce[0],[ye,ce]),stroke:E,strokeWidth:O,opacity:T,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),be=co(()=>{if(!1===A)return()=>null;return _(A)||(e=>{const t=e.data||e,o=t[go],n=he.indexOf(o),i=t[yo],r=re&&n>=0&&me[n]?vo(i,me[n]):i,a=n>=0&&ne[n]?.format?ne[n].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),s="function"==typeof p?p(t):t[p];return lo.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},lo.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ce[n]||"inherit"}},o),lo.createElement("div",null,`${"string"==typeof p?p:"x"}: ${s}`),lo.createElement("div",null,`${o}: ${a(r)}`))})},[A,he,ce,me,re,ne,p]);if(fe.earlyReturn)return fe.earlyReturn;const ve=t({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:p}}),xe=re?[0,1]:void 0,Ae={chartType:"line",...null!=c&&{data:de},xAccessor:p,yAccessor:yo,groupAccessor:go,lineStyle:ge,colorScheme:ce,size:[G,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:s.showAxes,...ue&&{axes:ue},xLabel:te,...re?{}:{yLabel:he[0]},xFormat:u,...re&&xe&&{yExtent:xe},enableHover:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Q,curve:b,...fe.legendBehaviorProps,...K&&{title:K},...U&&{description:U},...Z&&{summary:Z},...void 0!==ee&&{accessibleTable:ee},...d&&{className:d},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:be,...w&&{annotations:w},...m({linkedHover:L,selection:S,onObservation:H,onClick:B,hoverHighlight:I,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...fe.crosshairProps,...k};return ae||se||(ve?fo(X,{componentName:"MultiAxisLineChart",message:ve,width:G,height:j}):fo(Y,{componentName:"MultiAxisLineChart",width:G,height:j,children:fo(l,{ref:n,...Ae})}))});xo.displayName="MultiAxisLineChart";import{useMemo as Ao,forwardRef as wo,useRef as ko}from"react";import{jsx as So}from"react/jsx-runtime";var Co=wo(function(e,o){const i=ko(null);a(o,{variant:"xy",frameRef:i});const r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:h,className:f,xFormat:y,yFormat:g,xAccessor:b="x",highAccessor:v="high",lowAccessor:x="low",openAccessor:A,closeAccessor:w,candlestickStyle:k,tooltip:S,annotations:L,xExtent:B,yExtent:I,frameProps:F={},selection:R,linkedHover:_,onObservation:N,onClick:P,chartId:W,loading:E,loadingContent:O,emptyContent:T}=e,{width:G,height:z,enableHover:j,showGrid:$,title:Q,description:V,summary:U,accessibleTable:Z,xLabel:ee,yLabel:te}=r,oe=J(E,G,z,O),ne=oe?null:q(s,G,z,T),ie=Ao(()=>C(s),[s]),re=null==A||null==w;K("CandlestickChart",ie,"xAccessor",b),K("CandlestickChart",ie,"highAccessor",v),K("CandlestickChart",ie,"lowAccessor",x),re||(K("CandlestickChart",ie,"openAccessor",A),K("CandlestickChart",ie,"closeAccessor",w));const{customHoverBehavior:ae,customClickBehavior:se,crosshairSourceId:le}=M({selection:R,linkedHover:_,onObservation:N,onClick:P,chartType:"CandlestickChart",chartId:W,mobileInteraction:r.mobileInteraction}),ce=H(_,le),he=Ao(()=>{const e=r.marginDefaults,t="sparkline"===r.mode?{...e,top:0,bottom:0}:e;return null==h?t:{...t,...n(h)}},[h,r.marginDefaults,r.mode]),de=Ao(()=>{const e=[{label:ee||c(b),accessor:b,role:"x",format:y}];return re?(e.push({label:"High",accessor:v,role:"y",format:g}),e.push({label:"Low",accessor:x,format:g})):(e.push({label:"Open",accessor:A,format:g}),e.push({label:"High",accessor:v,format:g}),e.push({label:"Low",accessor:x,format:g}),e.push({label:"Close",accessor:w,format:g})),u(e)},[b,ee,y,g,v,x,A,w,re]),me=t({componentName:"CandlestickChart",data:s,accessors:{xAccessor:b,highAccessor:v,lowAccessor:x,...!re&&{openAccessor:A,closeAccessor:w}}}),ue={chartType:"candlestick",...null!=s&&{data:ie},xAccessor:b,yAccessor:v,highAccessor:v,lowAccessor:x,...!re&&{openAccessor:A,closeAccessor:w},...k&&{candlestickStyle:k},scalePadding:Math.max(2,Math.min(12,Math.round(G/40))),extentPadding:G>200?.1:.02,size:[G,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:y,yFormat:g,enableHover:j,showGrid:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...d({title:Q,description:V,summary:U,accessibleTable:Z,className:f,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...p({tooltip:S,defaultTooltipContent:de}),...m({linkedHover:_,selection:R,onObservation:N,onClick:P,mobileInteraction:r.mobileInteraction,customHoverBehavior:ae,customClickBehavior:se}),...L&&L.length>0&&{annotations:L},...B&&{xExtent:B},...I&&{yExtent:I},...ce,...F};return oe||ne||(me?So(X,{componentName:"CandlestickChart",message:me,width:G,height:z}):So(Y,{componentName:"CandlestickChart",width:G,height:z,children:So(l,{ref:i,...ue})}))});Co.displayName="CandlestickChart";import{forwardRef as Lo,useMemo as Ho}from"react";import{jsx as Bo}from"react/jsx-runtime";var Io=Lo(function(e,t){const{data:o,layout:n,layoutConfig:i,onLayoutError:a,xExtent:s,yExtent:c,showAxes:h=!1,margin:u,className:p,annotations:f,onObservation:y,onClick:g,selection:b,linkedHover:v,chartId:x,loading:A,loadingContent:w,emptyContent:S,colorBy:C,colorScheme:L,legend:H,frameProps:B={}}=e,{legend:I,...F}=B,R=Ho(()=>k(I,H),[I,H]),{frameRef:_,resolved:N,safeData:P,setup:W,earlyReturn:D}=r({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:C,colorScheme:L,legend:R,selection:b,linkedHover:v,onObservation:y,onClick:g,chartId:x,loading:A,loadingContent:w,emptyContent:S,margin:u,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),M=W.effectiveSelectionHook,E=Ho(()=>M?.isActive?{isActive:!0,predicate:M.predicate}:null,[M?.isActive,M?.predicate]);if(D)return D;const{width:O,height:T,enableHover:G,showGrid:z,title:j,description:$,summary:Q,accessibleTable:V,xLabel:X,yLabel:q}=N,J={chartType:"custom",...null!=o&&{data:P},customLayout:n,layoutConfig:i,onLayoutError:a,...E&&{layoutSelection:E},xExtent:s,yExtent:c,colorAccessor:C,colorScheme:L,size:[O,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:W.margin,showAxes:h,xLabel:X,yLabel:q,enableHover:G,showGrid:z,...W.legendBehaviorProps,...d({title:j,description:$,summary:Q,accessibleTable:V,className:p,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...m({linkedHover:v,selection:b,onObservation:y,onClick:g,hoverHighlight:!1,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior}),...f&&f.length>0&&{annotations:f},...W.crosshairProps,...F};return Bo(Y,{componentName:"XYCustomChart",width:O,height:T,children:Bo(l,{ref:_,...J})})});Io.displayName="XYCustomChart";export{Ae as Scatterplot,Be as ConnectedScatterplot,Oe as LineChart,Xe as AreaChart,nt as DifferenceChart,lt as StackedAreaChart,pt as Heatmap,xt as BubbleChart,Ot as ScatterplotMatrix,Ut as MinimapChart,oo as DEFAULT_QUADRANTS,so as QuadrantChart,xo as MultiAxisLineChart,Co as CandlestickChart,Io as XYCustomChart};
@@ -0,0 +1 @@
1
+ import{contrastRatio as e,fieldForRole as t,recipeConfig as i,recipeIntentId as a}from"./chunk-chunk-KHCOJMGK.module.min.js";import{extractAllRows as n,resolveResponsiveRules as r}from"./chunk-chunk-JMVEIZXP.module.min.js";import*as s from"react";function o(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),i=Math.abs(t);return 1e9>i?1e6>i?1e4>i?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}var l=864e5;function c(e){return 10>e?"0"+e:e+""}var u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function d(e){let t,i=e;return(a,n,r)=>{const s=a instanceof Date?a:new Date(a);e||!r||2>r.length||r===t||(t=r,i=function(e){if(2>e.length)return"days";const t=[];for(let i=1;e.length>i;i++)t.push(e[i]-e[i-1]);t.sort((e,t)=>e-t);const i=t[Math.floor(t.length/2)];return 12e4>i?"seconds":72e5>i?"minutes":2*l>i?"hours":60*l>i?"days":400*l>i?"months":"years"}(r));const o=i||"days";return null!=n&&0!==n&&r&&0!==r.length?function(e,t,i){const a=e.getUTCFullYear()!==t.getUTCFullYear(),n=a||e.getUTCMonth()!==t.getUTCMonth(),r=n||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),o=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=u[e.getUTCMonth()],d=e.getUTCDate(),m=e.getUTCFullYear(),h=c(e.getUTCHours()),p=c(e.getUTCMinutes()),g=c(e.getUTCSeconds());switch(i){case"seconds":return a?`${l} ${d}, ${m} ${h}:${p}:${g}`:r?`${l} ${d} ${h}:${p}:${g}`:s?`${h}:${p}:${g}`:o?`${p}:${g}`:":"+g;case"minutes":return a?`${l} ${d}, ${m} ${h}:${p}`:r?`${l} ${d} ${h}:${p}`:s?`${h}:${p}`:":"+p;case"hours":return a?`${l} ${d}, ${m} ${h}:00`:n?`${l} ${d} ${h}:${p}`:r?`${l} ${d} ${h}:00`:h+":00";case"days":return a?`${l} ${d}, ${m}`:n?`${l} ${d}`:""+d;case"months":return a?`${l} ${m}`:""+l;case"years":return""+m}}(s,new Date(r[n-1]),o):function(e,t){const i=u[e.getUTCMonth()],a=e.getUTCDate(),n=e.getUTCFullYear(),r=c(e.getUTCHours()),s=c(e.getUTCMinutes()),o=c(e.getUTCSeconds());switch(t){case"seconds":return`${i} ${a}, ${n} ${r}:${s}:${o}`;case"minutes":case"hours":return`${i} ${a}, ${n} ${r}:${s}`;case"days":return`${i} ${a}, ${n}`;case"months":return`${i} ${n}`;case"years":return""+n}}(s,o)}}var m=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),h=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),p={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function g(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function y(e){return"string"==typeof e&&e.trim().length>0}function b(e){const t=g(e.capability)?e.capability:null,i=g(e.recipe)?e.recipe:null,a=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,i?.mobile];for(const e of a)if(g(e))return e;return null}function f(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function v(e){return f(e.size)||f(g(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function x(e,t){e.push({...t,status:"pass"})}function w(e,t){e.push({...t,status:"warn"})}function k(e,t){e.push({...t,status:"manual"})}function $(e,t={},i={}){const a=i.viewportWidth??390,n=i.targetSize??44,s=v(t),o=r(t,{width:a,height:s?.[1]}),l=[],c=v(t=o.props),u=b(t),d=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),f=function(e){const t=b(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),$=!0===i.inChartContainer,C=y(t.title)||y(t.summary)||y(t.description)||!0===u?.summary||y(u?.summary);if(o.matches.length>0&&x(l,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${o.matches.length} responsive rule(s) applied for the ${a}px mobile audit.`}),c){const[t,i]=c;t>a&&!f?w(l,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${a}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):x(l,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof u?.minViewportWidth&&u.minViewportWidth>a&&w(l,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${u.minViewportWidth}px minimum, wider than the audited ${a}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const n=t/Math.max(1,i);430>=a&&n>2.4&&"BigNumber"!==e&&w(l,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${n.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>i&&"BigNumber"!==e&&w(l,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${i}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else k(l,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const A=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,g(e.frameProps)?e.frameProps.data:void 0];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i}(t);A>0&&(A>("number"==typeof u?.maxMarks?u.maxMarks:m.has(e)?1.25*a:h.has(e)?Math.max(8,Math.floor(a/34)):a)?w(l,{id:"density.mark-budget",category:"density",impact:m.has(e)?"medium":"high",message:`${A} data item(s) exceed the rough mobile density budget for ${e} at ${a}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):x(l,{id:"density.mark-budget",category:"density",impact:"medium",message:A+" data item(s) are within the rough mobile density budget for this component."}));const T=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i>0?i:null}(t),S=!1!==t.showAxes&&!1!==t.axis;if(S&&null!=T){const e=Math.max(3,Math.floor(a/58));T>e&&w(l,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${T} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${a}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else S&&(m.has(e)||h.has(e))&&k(l,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=g(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=b(e),i=g(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===i?.tapToSelect||!0===i?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||y(t?.interaction?.hoverFallback)}(e)}(t)?x(l,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):w(l,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const R=function(e,t){const i=p[e];if(!i)return null;let a=i.includes("hoverRadius")?30:null;for(const e of i){const i=t[e];"number"==typeof i&&Number.isFinite(i)&&i>0&&(a=null==a?i:Math.max(a,i))}return null==a?null:2*a}(e,t),M=g(t.mobileInteraction)?t.mobileInteraction:null,z=R??("number"==typeof M?.targetSize?M.targetSize:!0===t.mobileInteraction?44:"number"==typeof u?.minimumHitTarget?u.minimumHitTarget:"number"==typeof u?.interaction?.targetSize?u.interaction.targetSize:null);null!=z&&(24>z?w(l,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${z}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):n>z?w(l,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${z}px, above 24px but below the ${n}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):x(l,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${z}px, meeting the configured ${n}px target.`}));const U=[];null==t.brush&&null==t.onBrush||U.push("brush"),!0===t.zoomable&&U.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||U.push("legend filtering"),U.length>0&&!function(e,t){const i=b(e),a=g(e.mobileInteraction)?e.mobileInteraction:null,n=a?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(i?.interaction?.alternatives)&&i.interaction.alternatives.length>0)||!0===n||"all"===n||t.every(e=>"brush"===e?Array.isArray(n)?n.includes("brush"):"brush"===n:"pan/zoom"===e?Array.isArray(n)?n.includes("zoom"):"zoom"===n:"legend filtering"===e&&(Array.isArray(n)?n.includes("legend"):"legend"===n))}(t,U)&&w(l,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${U.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===u?.labels?.strategy||"inline"===u?.labels?.strategy||"external"===u?.labels?.strategy||a>430||w(l,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const P=Array.isArray(t.annotations)?t.annotations.filter(e=>g(e)):[];if(P.length>("number"==typeof u?.maxAnnotations?u.maxAnnotations:3)&&430>=a&&w(l,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:P.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),P.length>0){const e=P.filter(e=>!y(e.mobileText)&&!y(e.shortText)&&!y(e.label));e.length>0&&k(l,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}f||"BigNumber"===e||k(l,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),d&&(u?(x(l,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===u.custom?.dataBearingSceneNodes?w(l,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==u.custom?.dataBearingSceneNodes&&k(l,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):k(l,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),C||$||w(l,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const I=l.filter(e=>"warn"===e.status),N={highRisk:I.filter(e=>"high"===e.impact).length,warnings:I.length,manual:l.filter(e=>"manual"===e.status).length,passes:l.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:a,ok:0===N.highRisk,summary:N,findings:l,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}var C={pass:"PASS",warn:"WARN",manual:"MANUAL","not-applicable":"N/A"},A=["layout","density","interaction","annotation","semantics"];function T(e){const t=[],i=e.summary,a=e.ok?`no high-risk mobile blockers at ${e.viewportWidth}px`:`${i.highRisk} high-risk mobile issue(s) at ${e.viewportWidth}px`;t.push(`${e.ok?"PASS":"WARN"} ${e.component}: mobile visualization audit`),t.push(` ${a} - ${i.warnings} warning(s) - ${i.manual} manual check(s)`);for(const i of A){const a=e.findings.filter(e=>e.category===i&&"not-applicable"!==e.status);if(0!==a.length){t.push(""),t.push(" "+i.toUpperCase());for(const e of a)t.push(` ${C[e.status]} [${e.impact}] ${e.id}: ${e.message}`),!e.fix||"warn"!==e.status&&"manual"!==e.status||t.push(" -> "+e.fix)}}return t.push(""),t.push(" Ref: "+e.reference),t.join("\n")}function S(){return["Static audit only: rendered label collision, CSS-resolved type size, and actual touch behavior still require viewport testing.","Use multiple widths, usually 320, 360, 390, 430, and 768 CSS pixels.","A mobile pass means no high-risk static warnings, not that the chart is perceptually or ergonomically optimal."]}function R(e){const t={};for(const[i,a]of e){const e=[];for(const[,t]of a.clauses){const i={};for(const[e,a]of Object.entries(t.fields))i[e]="point"===a.type?{type:"point",values:Array.from(a.values)}:{type:"interval",range:a.range};e.push({clientId:t.clientId,type:t.type,fields:i})}t[i]={name:a.name,resolution:a.resolution,clauses:e}}return t}function M(e){const t=new Map;for(const[i,a]of Object.entries(e)){const e=new Map;for(const t of a.clauses){const i={};for(const[e,a]of Object.entries(t.fields))i[e]="point"===a.type?{type:"point",values:new Set(a.values)}:{type:"interval",range:a.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:i})}t.set(i,{name:a.name,resolution:a.resolution,clauses:e})}return t}async function z(e,t){const{format:i="png",filename:a="chart",scale:n=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const o=s.cloneNode(!0),l=s.getBoundingClientRect();if(o.getAttribute("width")||o.setAttribute("width",l.width+""),o.getAttribute("height")||o.setAttribute("height",l.height+""),o.getAttribute("xmlns")||o.setAttribute("xmlns","http://www.w3.org/2000/svg"),U(s,o),"svg"===i){const e=(new XMLSerializer).serializeToString(o);P(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),a+".svg")}else{const t=l.width*n,i=l.height*n,s=document.createElement("canvas");s.width=t,s.height=i;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,i),c.scale(n,n);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(o),m=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(m),p=new Image;p.width=l.width,p.height=l.height,await new Promise((e,t)=>{p.onload=()=>{c.drawImage(p,0,0),s.toBlob(i=>{i?(P(i,a+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(h)},p.onerror=()=>{URL.revokeObjectURL(h),t(Error("Failed to load SVG image"))},p.src=h})}}function U(e,t){const i=e.children,a=t.children,n=window.getComputedStyle(e),r=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of r){const i=n.getPropertyValue(e);i&&"none"!==i&&""!==i&&t.style?.setProperty(e,i)}for(let e=0;Math.min(i.length,a.length)>e;e++)U(i[e],a[e])}function P(e,t){const i=URL.createObjectURL(e),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function I(e){const t=e.pointId??e.id??e._transitionKey;return null==t||""===t?void 0:t+""}function N(e){return e.accessibility?.tableFields??e.accessibleDatum??e.datum??null}function F(e){return"number"==typeof e&&Number.isFinite(e)}function L(e){if(F(e.x)&&F(e.y)&&F(e.w)&&F(e.h))return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y+e.h};if(F(e.x)&&F(e.y)&&F(e.r))return{x0:e.x-e.r,y0:e.y-e.r,x1:e.x+e.r,y1:e.y+e.r};if(F(e.cx)&&F(e.cy)&&F(e.r))return{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r};if(F(e.cx)&&F(e.cy)&&F(e.outerR))return{x0:e.cx-e.outerR,y0:e.cy-e.outerR,x1:e.cx+e.outerR,y1:e.cy+e.outerR};const t=[e.path,e.topPath,e.bottomPath].filter(Array.isArray).flat().filter(e=>Array.isArray(e)&&F(e[0])&&F(e[1]));return t.length>0?{x0:Math.min(...t.map(e=>e[0])),y0:Math.min(...t.map(e=>e[1])),x1:Math.max(...t.map(e=>e[0])),y1:Math.max(...t.map(e=>e[1]))}:null}function B(e,t){const i=Math.max(0,Math.min(e.x1,t.x1)-Math.max(e.x0,t.x0))*Math.max(0,Math.min(e.y1,t.y1)-Math.max(e.y0,t.y0)),a=Math.min(Math.max(0,e.x1-e.x0)*Math.max(0,e.y1-e.y0),Math.max(0,t.x1-t.x0)*Math.max(0,t.y1-t.y0));return a>0?i/a:0}function D(e,i,a,n,r){if(e===i)return!0;const s=a.dataRoles.map(e=>t(e,n,r)).filter(e=>!!e).filter(t=>null!=e[t]&&null!=i[t]);return s.length>0&&s.every(t=>e[t]+""==i[t]+"")}function V(e,t,i,a,n,r="warn",s){return{id:e,category:t,status:i?"pass":r,message:i?a:n,...s?{evidence:s}:{}}}function j(r){const{recipe:s}=r,o=function(e){return Array.isArray(e)?e:e&&"object"==typeof e?[...e.nodes??e.sceneNodes??[],...e.sceneEdges??[]]:[]}(r.scene),l=r.layoutConfig??i({layoutConfig:r.layoutConfig}),c=r.dimensions.plot??{x:0,y:0,width:r.dimensions.width,height:r.dimensions.height},u=c.x??0,d=c.y??0,m=[],h=o.filter(e=>null!=N(e)),p=o.filter(e=>!("string"!=typeof e.pathD||!/NaN|Infinity|undefined/.test(e.pathD))||function(e){return[...[e.x,e.y,e.w,e.h,e.r,e.cx,e.cy,e.innerR,e.outerR,e.x1,e.x2,e.y1,e.y2,e.openY,e.closeY,e.highY,e.lowY,e.bodyWidth].filter(e=>void 0!==e),...[e.path,e.topPath,e.bottomPath].filter(Array.isArray).flat(2)]}(e).some(e=>"number"!=typeof e||!Number.isFinite(e)));m.push(V("geometry.finite","geometry",0===p.length,"All emitted geometry is finite.",p.length+" marks contain non-finite geometry.","fail",{count:p.length}));const g=o.map(L),y=g.filter(e=>e&&(e.x0>=e.x1||e.y0>=e.y1)).length;m.push(V("geometry.nonzero-area","geometry",0===y,"All bounded marks have positive area.",y+" marks have zero or negative area.","warn",{count:y}));const b=g.filter(e=>e&&(u>e.x0||d>e.y0||e.x1>u+c.width||e.y1>d+c.height)).length;m.push(V("geometry.bounds","geometry",0===b,"All bounded marks stay inside the plot.",b+" marks extend outside the plot bounds.","warn",{count:b}));const f=s.audit?.minimumHitTargetSize??s.accessibility.minimumHitTarget??24,v=g.filter(e=>!!e&&(f>e.x1-e.x0||f>e.y1-e.y0)).length;m.push(V("interaction.target-size","interaction",0===v,`All bounded targets meet the declared ${f}px minimum.`,`${v} targets are smaller than ${f}px in at least one dimension.`,"warn",{count:v,minimumTarget:f}));const x=h.map(I),w=x.filter(e=>!e).length,k=new Set,$=x.filter(e=>!(!e||!k.has(e)&&(k.add(e),1)));m.push(V("identity.stable-ids","identity",0===w,"Every data-bearing mark exposes a stable id.",w+" data-bearing marks have no pointId, id, or transition key.",s.audit?.requireStableIds?"fail":"warn",{missing:w})),m.push(V("identity.unique-ids","identity",0===$.length,"Stable mark ids are unique.",$.length+" duplicate stable ids were observed.","fail",{duplicates:[...new Set($)].slice(0,10)}));const C=x.filter(e=>e&&/^(datum|mark|node|point|rect)-?\d+$/.test(e)).length;C>0&&m.push({id:"identity.index-pattern",category:"identity",status:"warn",message:C+" ids look index-derived and may change when data is reordered.",remediation:"Derive ids from a declared identifier role or stable domain key."});const A=new Set;let T=0;const S=r.inputData;for(const e of h){const t=N(e),i=Array.isArray(t)?t:[t];let a=!1;for(const e of i)if(e&&"object"==typeof e)for(let t=0;S.length>t;t+=1)D(e,S[t],s,l,S)&&(A.add(t),a=!0);a||(T+=1)}const R=Math.max(0,S.length-A.size);m.push(V("coverage.input-data","coverage",0===R,"Every input datum is represented by the observed scene.",R+" input data items have no matching scene mark.",s.audit?.requireDatumCoverage?"fail":"warn",{represented:A.size,input:S.length})),m.push(V("coverage.scene-data","coverage",0===T,"Every data-bearing scene mark maps back to input data.",T+" scene marks do not map back to an input datum.","warn",{count:T}));const M=s.encodings?.some(e=>"count"===e.channel);!M&&h.length>A.size&&A.size>0&&m.push({id:"coverage.duplicate-references",category:"coverage",status:"warn",message:"Input data is referenced by multiple marks, but multiplicity is not declared as an encoding.",remediation:"Declare count/repetition semantics or preserve a one-to-one datum-to-mark mapping."});const z=h.filter(e=>!1===e.interactive).length;m.push(V("interaction.hit-targets","interaction",0===z&&h.length>0,"Every observed data-bearing scene node participates in hit testing.",0===h.length?"No data-bearing scene nodes were emitted for interaction.":z+" data-bearing marks explicitly disable interaction.","fail"));const U=(r.annotations??[]).map(e=>e.pointId).filter(e=>null!=e).map(String),P=U.filter(e=>!k.has(e));m.push(V("coverage.annotation-anchors","coverage",0===P.length,U.length?"All pointId annotation anchors resolve to observed scene nodes.":"No pointId annotations require scene resolution.",P.length+" annotations point to missing scene ids.","fail",{unresolved:P}));const F=(r.chart?.selectedIds??[]).filter(e=>!k.has(e));r.chart?.selectedIds&&m.push(V("interaction.selection-reachability","interaction",0===F.length,"Selected/highlighted states resolve to observed marks.",F.length+" selected ids are not reachable in the scene.","fail",{missing:F}));const j=n(o),q=(s.accessibility.tableFields??s.accessibility.tableRoles?.map(e=>({role:e,label:e}))??[]).map(e=>{if(e.field)return e.field;const i=e.role?s.dataRoles.find(t=>t.role===e.role):void 0;return i?t(i,l,S):void 0}).filter(e=>!!e),E=new Set(j.flatMap(e=>Object.keys(e.values))),W=q.filter(e=>!E.has(e));m.push(V("accessibility.table-fields","accessibility",0===W.length,q.length?"The accessible table preserves all recipe-declared fields.":"The recipe declares no explicit accessible table field projection.",`The accessible table loses declared fields: ${W.join(", ")}.`,"fail",{expectedFields:q,observedFields:[...E]})),new Set(S.flatMap(e=>Object.entries(e).filter(([,e])=>["string","number","boolean"].includes(typeof e)).map(([e])=>e))).size>2&&2>=E.size&&[...E].every(e=>"category"===e||"value"===e)&&m.push({id:"accessibility.generic-table-loss",category:"accessibility",status:"warn",message:"The table exposes only generic category/value fields although richer input data exists.",remediation:"Emit accessibleDatum or accessibility.tableFields on scene nodes."});const H=(s.encodings?.filter(e=>"color"===e.channel)??[]).filter(e=>!e.redundantWith||0===e.redundantWith.length);m.push(V("accessibility.color-only","accessibility",0===H.length,"Every declared color encoding names a redundant cue.",H.length+" color encodings have no declared redundant cue.","warn"));const O=r.chart;if(O){for(const[e,t]of[["title",s.accessibility.requiresTitle],["summary",s.accessibility.requiresSummary],["description","required"===s.accessibility.description]])t&&m.push(V("accessibility."+e,"accessibility","string"==typeof O[e]&&O[e].trim().length>0,`A chart ${e} is present.`,`The recipe requires a chart ${e}, but none was supplied.`,"fail"));(s.accessibility.requiresAccessibleTable||"required"===s.accessibility.accessibleTable||s.accessibility.fallbackTable)&&m.push(V("accessibility.fallback-table","accessibility",!1!==O.accessibleTable,"The accessible fallback table is enabled.","The recipe requires a fallback table, but accessibleTable is disabled.","fail")),O.navigationTree&&m.push(V("accessibility.navigation-depth","accessibility",(O.navigationTree.children?.length??0)>0,"The navigation tree exposes structure below the root.","The navigation tree is root-only.","fail"))}const G=r.theme?.background??"#ffffff",Y=o.filter(t=>{const i=t.style?.fill??t.fill;if("string"!=typeof i||!i.startsWith("#")||!G.startsWith("#"))return!1;const a=e(i,G);return null!=a&&3>a}).length;m.push(V("visual.contrast","visual",0===Y,"All statically checkable mark fills meet 3:1 contrast.",Y+" marks have fill contrast below 3:1.","warn",{background:G}));let J=0;const K=g.filter(e=>!!e).slice(0,500);for(let e=0;K.length>e;e+=1)for(let t=e+1;K.length>t;t+=1).8>B(K[e],K[t])||(J+=1);J>K.length&&m.push({id:"visual.overlap-density",category:"visual",status:"warn",message:J+" near-total mark overlaps suggest occlusion or excessive density.",remediation:"Aggregate, jitter, layer explicitly, or declare overlap as intentional."});const X=[["manual-at.screen-reader","Verify real screen-reader behavior with the target browser/AT combinations."],["manual-at.cognitive-load","Assess cognitive load and whether the custom metaphor is understood."],["manual-at.keyboard-order","Verify that keyboard order is meaningful, not merely mechanically available."],["manual-at.animation","Verify that animation is not distracting and reduced-motion behavior is sufficient."],["manual-at.reception","Test whether the memorable form is received as intended by the target audience."],["manual-at.overlay-occlusion","Inspect labels, overlays, annotations, and important marks for clipping or occlusion."],["manual-at.observation","Exercise hover, focus, selection, and observation emission in the rendered chart."]].map(([e,t])=>({id:e,category:"manual-at",status:"manual",message:t})),Q={dataRoles:s.dataRoles.map(e=>e.role),intents:s.intents.map(a).filter(e=>!!e),accessibilityExpectations:[...s.accessibility.requirements??[],...s.accessibility.tableFields?.map(e=>"table field: "+e.label)??[]],fallbackDeclared:!0===s.accessibility.fallbackTable||"required"===s.accessibility.accessibleTable||!0===s.accessibility.requiresAccessibleTable,designContractDeclared:!!s.designContract?.whyCustom},Z=[...m,...X],_=m.filter(e=>"fail"===e.status).length;return{recipeId:s.id,ok:0===_,summary:{marks:o.length,passes:Z.filter(e=>"pass"===e.status).length,warnings:Z.filter(e=>"warn"===e.status).length,failures:_,manual:Z.filter(e=>"manual"===e.status).length},declaredSemantics:Q,observedSceneEvidence:m,manualATChecks:X}}export{o as smartTickFormat,d as adaptiveTimeTicks,$ as auditMobileVisualization,T as formatMobileVisualizationAudit,S as mobileVisualizationCaveats,R as serializeSelections,M as deserializeSelections,z as exportChart,j as auditObservedScene};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import*as e from"react";import{jsx as r,jsxs as t}from"react/jsx-runtime";function n({componentName:e,message:n,diagnosticHint:i,width:o,height:a}){return r("div",{role:"alert",style:{width:o,height:Math.max(a,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[r("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),r("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),i&&r("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}import{jsx as i}from"react/jsx-runtime";var o=class extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,r){this.props.onError?.(e,r)}render(){if(this.state.error){const{fallback:e}=this.props,r=this.state.error;return"function"==typeof e?e(r):void 0!==e?e:i(n,{componentName:"ChartErrorBoundary",message:r.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{useEffect as a,useLayoutEffect as s,useRef as d,useState as c,useSyncExternalStore as l}from"react";var h="undefined"!=typeof window?s:a;function u(){const[e,r]=c(!1);return h(()=>{r(!0)},[]),e}var f=()=>()=>{},m=()=>!1,g=()=>!0;function p(){const e=l(f,m,g);return d(e).current}function b(e){const{hydrated:r,wasHydratingFromSSR:t,storeRef:n,dirtyRef:i,renderFnRef:o,cancelRender:s,cleanup:c}=e;h(()=>{const e=n.current;r&&t&&e?.cancelIntroAnimation?.(),!t&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():i.current=!0,s?.(),o.current()},[r,t]);const l=d(c);l.current=c,a(()=>()=>l.current?.(),[])}import{jsx as y}from"react/jsx-runtime";var x="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function v({componentName:e,width:r,height:t,children:i}){return y(o,{fallback:i=>y(n,{componentName:e,message:i.message,width:r,height:t}),children:i})}var w={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},S={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function j(e,r,t,n){return!1===n||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?y("div",{style:{...w,width:r,height:t},children:n||"No data available"}):null}function A(e,r,t,n){if(!e)return null;if(!1===n)return null;if(null!=n)return y("div",{style:{width:r,height:t,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:n});const i=Math.min(5,Math.floor(t/40)),o=Math.max(8,Math.floor(t/(3*i))),a=Math.max(6,Math.floor(t/(2.5*i))),s=Math.floor((t-(i*(o+a)-a))/2);return y("div",{style:{width:r,height:t,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,t)=>y("div",{className:"semiotic-loading-bar",style:{...S,position:"absolute",top:s+t*(o+a),left:Math.floor(.1*r),width:30+(37*t+13)%50+"%",height:o,opacity:.5+t%2*.2}},t))})}function N(e,r,t,n){if(!x)return;if(!r||0===r.length)return;if("string"!=typeof n)return;const i=r[0];if(!i||"object"!=typeof i)return;if(n in i)return;const o=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${t} "${n}" not found in data. Available keys: ${o}`)}export{u as useHydration,p as useWasHydratingFromSSR,b as useHydrationLifecycle,n as ChartError,o as ChartErrorBoundary,v as SafeRender,j as renderEmptyState,A as renderLoadingState,N as warnMissingField};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{renderRectPulse as t}from"./chunk-chunk-A63CTACR.module.min.js";import{buildLinearFillGradient as e,clampCornerRadii as n,filterSparseArray as s,hasAnyCornerRadius as i,resolveCSSColor as o,resolveCanvasFill as r,symbolPathString as l}from"./chunk-chunk-6HSGDMTA.module.min.js";var h=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,e){this._min=1/0,this._max=-1/0;for(const n of t){const t=e?e(n):n;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}},u=class{constructor(t,e){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=e?.chunkThreshold??5e3,this.chunkSize=e?.chunkSize??5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=s(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=s(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const s=t[n];null!=s&&"object"==typeof s&&(this.pushBuffer.push(s),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};function c(t,e){return t===e}function a(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function f(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function y(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}function d(t,e,n,s){return"function"==typeof t?t({size:e,margin:n,scales:s}):t}function m(t,e,n,s){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:s,fn:e}:{key:void 0,fn:null}}function p(t,e,n){return s=>{if(!s||!n||!t.fn&&!e.fn)return s;let i=!1;const o=s.map(n=>{const s=t.fn&&t.key&&!(t.key in n),o=e.fn&&e.key&&!(e.key in n);if(!s&&!o)return n;i=!0;const r={...n};return s&&(r[t.key]=t.fn(n)),o&&(r[e.key]=e.fn(n)),r});return i?o:s}}function k(t){return new Set(Array.isArray(t)?t:[t])}function g(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),s=n[0],i=n[n.length-1],o=s instanceof Date,r=s instanceof Date?s.getTime():s,l=i instanceof Date?i.getTime():i;if(2>e||r===l)return o?[new Date(r),new Date(l)]:[r,l];const h=(l-r)/(e-1),u=Array(e);for(let t=0;e>t;t++){const n=t===e-1?l:r+t*h;u[t]=o?new Date(n):n}return u}(t,e):t.ticks(e)}var T=new Map;function x(t){try{if(t.path)return new Path2D(t.path);const e=`${t.symbolType??"circle"}:${Math.round(t.size)}`;let n=T.get(e);return n||(n=new Path2D(l(t.symbolType,t.size)),T.size>256&&T.clear(),T.set(e,n)),n}catch{return null}}var b=(t,e)=>{const n=t.globalAlpha;for(const s of e){if("symbol"!==s.type)continue;const e=s;if(0>=e.size)continue;const i=x(e);if(!i)continue;t.save(),t.translate(e.x,e.y),e.rotation&&t.rotate(e.rotation);const o=(e.style.opacity??1)*(e._decayOpacity??1);e.style.fill&&(t.globalAlpha=n*o*(e.style.fillOpacity??1),t.fillStyle=r(t,e.style.fill,"#4e79a7"),t.fill(i)),e.style.stroke&&"none"!==e.style.stroke&&(t.globalAlpha=n*o,t.strokeStyle=r(t,e.style.stroke,e.style.stroke),t.lineWidth=e.style.strokeWidth??1,t.stroke(i)),t.restore()}t.globalAlpha=n};function w(t,e){const{x:s,y:i,w:o,h:r}=e,{tl:l,tr:h,br:u,bl:c}=n(e);t.beginPath(),t.moveTo(s+l,i),t.lineTo(s+o-h,i),h>0&&t.arcTo(s+o,i,s+o,i+h,h),t.lineTo(s+o,i+r-u),u>0&&t.arcTo(s+o,i+r,s+o-u,i+r,u),t.lineTo(s+c,i+r),c>0&&t.arcTo(s,i+r,s,i+r-c,c),t.lineTo(s,i+l),l>0&&t.arcTo(s,i,s+l,i,l),t.closePath()}function v(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}var S=(n,s,l,h)=>{const u=s.filter(t=>"rect"===t.type);for(const s of u){if(null!=s.style.opacity&&(n.globalAlpha=s.style.opacity),s.style.icon)F(n,s);else if(s.cornerRadii&&i(s.cornerRadii)){const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t,w(n,s),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else if(s.roundedTop&&s.roundedTop>0){const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t;const h=Math.min(s.roundedTop,s.w/2,s.h/2);n.beginPath();const{x:u,y:c,w:a,h:f}=s;switch(s.roundedEdge){case"right":n.moveTo(u,c),n.lineTo(u+a-h,c),n.arcTo(u+a,c,u+a,c+h,h),n.lineTo(u+a,c+f-h),n.arcTo(u+a,c+f,u+a-h,c+f,h),n.lineTo(u,c+f);break;case"left":n.moveTo(u+a,c),n.lineTo(u+h,c),n.arcTo(u,c,u,c+h,h),n.lineTo(u,c+f-h),n.arcTo(u,c+f,u+h,c+f,h),n.lineTo(u+a,c+f);break;case"bottom":n.moveTo(u,c),n.lineTo(u+a,c),n.lineTo(u+a,c+f-h),n.arcTo(u+a,c+f,u+a-h,c+f,h),n.lineTo(u+h,c+f),n.arcTo(u,c+f,u,c+f-h,h);break;default:n.moveTo(u,c+f),n.lineTo(u,c+h),n.arcTo(u,c,u+h,c,h),n.lineTo(u+a-h,c),n.arcTo(u+a,c,u+a,c+h,h),n.lineTo(u+a,c+f)}n.closePath(),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else{const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t,n.fillRect(s.x,s.y,s.w,s.h),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.strokeRect(s.x,s.y,s.w,s.h))}t(n,s),n.globalAlpha=1}};function F(t,e){const n=e.style.icon,s=e.style.iconPadding||2,i=Math.min(e.w,e.h)-s;if(0>=i)return;const o=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),o){const o=i+s,r=e.x+(e.w-i)/2;for(let s=e.y+e.h-i;s>=e.y-i;s-=o)t.drawImage(n,r,s,i,i)}else{const o=i+s,r=e.y+(e.h-i)/2;for(let s=e.x;e.x+e.w>s;s+=o)t.drawImage(n,s,r,i,i)}t.restore()}function A(t,e,n,s,i,o){const r=[];for(const i of t){const t=n(i),o=s(i);Number.isFinite(t)&&Number.isFinite(o)&&r.push({px:e.x(t),py:e.y(o),rawY:o,d:i})}r.sort((t,e)=>t.px-e.px);const l=Array(r.length),h=Array(r.length),u=Array(r.length);for(let t=0;r.length>t;t++){const e=r[t];l[t]=[e.px,e.py],h[t]=e.rawY,u[t]=e.d}return{type:"line",path:l,rawValues:h,style:i,datum:u,group:o}}function _(t,e,n,s,i,o,r,l){const h=[];for(const o of t){const t=n(o),r=s(o);if(!Number.isFinite(t)||!Number.isFinite(r))continue;const u=e.x(t),c=l?l(o):i;h.push({px:u,topY:e.y(r),botY:e.y(c)})}h.sort((t,e)=>t.px-e.px);const u=Array(h.length),c=Array(h.length);for(let t=0;h.length>t;t++){const e=h[t];u[t]=[e.px,e.topY],c[t]=[e.px,e.botY]}return{type:"area",topPath:u,bottomPath:c,style:o,datum:t,group:r}}function B(t,e,n,s){const i=new Map;if("silhouette"===s)for(const s of t){let t=0;for(const i of e)t+=n(i,s)||0;i.set(s,-t/2)}else if("wiggle"===s){t.length>0&&i.set(t[0],0);for(let s=1;t.length>s;s++){const o=t[s-1],r=t[s];let l=0,h=0,u=0;for(const t of e){const e=n(t,r)||0;l+=(2*u+e)*(e-(n(t,o)||0)),h+=e,u+=e}const c=i.get(o)??0;i.set(r,c-(h>0?l/(2*h):0))}if(t.length>0){let s=0;for(const o of t){let t=0;for(const s of e)t+=n(s,o)||0;s+=(i.get(o)??0)+t/2}const o=s/t.length;for(const e of t)i.set(e,(i.get(e)??0)-o)}}else for(const e of t)i.set(e,0);return i}function z(t,e,n){let s=0,i=0;for(const o of t){let t=0,r=0;for(const s of e){const e=n(s,o)||0;0>e?r+=e:t+=e}s>r&&(s=r),t>i&&(i=t)}return[s,i]}function D(t,e,n,s,i,o,r,l="zero"){const h=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&h.add(e)}const u=Array.from(h).sort((t,e)=>t-e),c=new Map;for(const e of t){const t=new Map;for(const i of e.data){const e=n(i),o=s(i);Number.isFinite(e)&&Number.isFinite(o)&&t.set(e,(t.get(e)||0)+o)}c.set(e.key,t)}let a;if(o){a=new Map;for(const e of u){let n=0;for(const s of t)n+=c.get(s.key)?.get(e)||0;a.set(e,n||1)}}const f=B(u,t.map(t=>t.key),(t,e)=>c.get(t)?.get(e)||0,l),y="diverging"===l&&!o,d=[],m=new Map,p=new Map,k=new Map,g=new Map;for(const t of u)p.set(t,f.get(t)??0),k.set(t,0),g.set(t,0);for(const n of t){const t=c.get(n.key),s=new Map;let l=[],h=[];const f=()=>{if(l.length>=2){const t={type:"area",topPath:l,bottomPath:h,style:i(n.key,n.data[0]),datum:n.data,group:n.key};r&&(t.curve=r),d.push(t)}l=[],h=[]};for(const n of u){const i=t.has(n);let r,u,c=i?t.get(n):0;if(o&&i&&(c/=a.get(n)),!i||!Number.isFinite(c)||0===c){f();continue}y?c>0?(r=k.get(n),u=r+c,k.set(n,u)):(r=g.get(n),u=r+c,g.set(n,u)):(r=p.get(n),u=r+c,p.set(n,u));const d=e.x(n);h.push([d,e.y(r)]),l.push([d,e.y(u)]),s.set(n,u)}f(),m.set(n.key,s)}return{nodes:d,stackedTops:m}}function M(t,e,n,s,i,o,r){const l=n(t),h=s(t);if(!Number.isFinite(l)||!Number.isFinite(h))return null;const u={type:"point",x:e.x(l),y:e.y(h),r:i,style:o,datum:t};return void 0!==r&&(u.pointId=r),u}function P(t,e,n,s,i,o,r,l){const h=n(t),u=s(t);if(!Number.isFinite(h)||!Number.isFinite(u))return null;const c={type:"symbol",x:e.x(h),y:e.y(u),size:i,symbolType:o,style:r,datum:t};return void 0!==l&&(c.pointId=l),c}function N(t,e,n,s,i,o,r){return{type:"rect",x:t,y:e,w:n,h:s,style:i,datum:o,group:r}}function W(t,e,n,s,i,o,r){const l={type:"heatcell",x:t,y:e,w:n,h:s,fill:i,datum:o};return r?.showValues&&(l.showValues=!0,l.value=r.value,r.valueFormat&&(l.valueFormat=r.valueFormat)),l}export{u as DataSourceAdapter,h as IncrementalExtent,c as accessorsEquivalent,a as resolveAccessor,f as resolveRawAccessor,y as resolveStringAccessor,k as toIdSet,A as buildLineNode,_ as buildAreaNode,B as computeStackOffsets,z as computeDivergingStackExtent,D as buildStackedAreaNodes,M as buildPointNode,P as buildSymbolNode,N as buildRectNode,W as buildHeatcellNode,g as ticksForMode,d as resolveFrameGraphics,m as resolveAnnotationAccessor,p as buildEnrichAnnotationData,b as symbolCanvasRenderer,S as barCanvasRenderer};
2
+ import{renderRectPulse as t}from"./chunk-chunk-F7WFPD4O.module.min.js";import{buildLinearFillGradient as e,clampCornerRadii as n,filterSparseArray as s,hasAnyCornerRadius as i,resolveCSSColor as o,resolveCanvasFill as r,symbolPathString as l}from"./chunk-chunk-BFHUYEOS.module.min.js";var h=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,e){this._min=1/0,this._max=-1/0;for(const n of t){const t=e?e(n):n;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}},u=class{constructor(t,e){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=e?.chunkThreshold??5e3,this.chunkSize=e?.chunkSize??5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=s(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=s(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const s=t[n];null!=s&&"object"==typeof s&&(this.pushBuffer.push(s),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};function c(t,e){return t===e}function a(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function f(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function y(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}function d(t,e,n,s){return"function"==typeof t?t({size:e,margin:n,scales:s}):t}function m(t,e,n,s){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:s,fn:e}:{key:void 0,fn:null}}function p(t,e,n){return s=>{if(!s||!n||!t.fn&&!e.fn)return s;let i=!1;const o=s.map(n=>{const s=t.fn&&t.key&&!(t.key in n),o=e.fn&&e.key&&!(e.key in n);if(!s&&!o)return n;i=!0;const r={...n};return s&&(r[t.key]=t.fn(n)),o&&(r[e.key]=e.fn(n)),r});return i?o:s}}function k(t){return new Set(Array.isArray(t)?t:[t])}function g(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),s=n[0],i=n[n.length-1],o=s instanceof Date,r=s instanceof Date?s.getTime():s,l=i instanceof Date?i.getTime():i;if(2>e||r===l)return o?[new Date(r),new Date(l)]:[r,l];const h=(l-r)/(e-1),u=Array(e);for(let t=0;e>t;t++){const n=t===e-1?l:r+t*h;u[t]=o?new Date(n):n}return u}(t,e):t.ticks(e)}var T=new Map;function x(t){try{if(t.path)return new Path2D(t.path);const e=`${t.symbolType??"circle"}:${Math.round(t.size)}`;let n=T.get(e);return n||(n=new Path2D(l(t.symbolType,t.size)),T.size>256&&T.clear(),T.set(e,n)),n}catch{return null}}var b=(t,e)=>{const n=t.globalAlpha;for(const s of e){if("symbol"!==s.type)continue;const e=s;if(0>=e.size)continue;const i=x(e);if(!i)continue;t.save(),t.translate(e.x,e.y),e.rotation&&t.rotate(e.rotation);const o=(e.style.opacity??1)*(e._decayOpacity??1);e.style.fill&&(t.globalAlpha=n*o*(e.style.fillOpacity??1),t.fillStyle=r(t,e.style.fill,"#4e79a7"),t.fill(i)),e.style.stroke&&"none"!==e.style.stroke&&(t.globalAlpha=n*o,t.strokeStyle=r(t,e.style.stroke,e.style.stroke),t.lineWidth=e.style.strokeWidth??1,t.stroke(i)),t.restore()}t.globalAlpha=n};function w(t,e){const{x:s,y:i,w:o,h:r}=e,{tl:l,tr:h,br:u,bl:c}=n(e);t.beginPath(),t.moveTo(s+l,i),t.lineTo(s+o-h,i),h>0&&t.arcTo(s+o,i,s+o,i+h,h),t.lineTo(s+o,i+r-u),u>0&&t.arcTo(s+o,i+r,s+o-u,i+r,u),t.lineTo(s+c,i+r),c>0&&t.arcTo(s,i+r,s,i+r-c,c),t.lineTo(s,i+l),l>0&&t.arcTo(s,i,s+l,i,l),t.closePath()}function v(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}var F=(n,s,l,h)=>{const u=s.filter(t=>"rect"===t.type);for(const s of u){if(null!=s.style.opacity&&(n.globalAlpha=s.style.opacity),s.style.icon)S(n,s);else if(s.cornerRadii&&i(s.cornerRadii)){const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t,w(n,s),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else if(s.roundedTop&&s.roundedTop>0){const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t;const h=Math.min(s.roundedTop,s.w/2,s.h/2);n.beginPath();const{x:u,y:c,w:a,h:f}=s;switch(s.roundedEdge){case"right":n.moveTo(u,c),n.lineTo(u+a-h,c),n.arcTo(u+a,c,u+a,c+h,h),n.lineTo(u+a,c+f-h),n.arcTo(u+a,c+f,u+a-h,c+f,h),n.lineTo(u,c+f);break;case"left":n.moveTo(u+a,c),n.lineTo(u+h,c),n.arcTo(u,c,u,c+h,h),n.lineTo(u,c+f-h),n.arcTo(u,c+f,u+h,c+f,h),n.lineTo(u+a,c+f);break;case"bottom":n.moveTo(u,c),n.lineTo(u+a,c),n.lineTo(u+a,c+f-h),n.arcTo(u+a,c+f,u+a-h,c+f,h),n.lineTo(u+h,c+f),n.arcTo(u,c+f,u,c+f-h,h);break;default:n.moveTo(u,c+f),n.lineTo(u,c+h),n.arcTo(u,c,u+h,c,h),n.lineTo(u+a-h,c),n.arcTo(u+a,c,u+a,c+h,h),n.lineTo(u+a,c+f)}n.closePath(),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else{const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t,n.fillRect(s.x,s.y,s.w,s.h),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.strokeRect(s.x,s.y,s.w,s.h))}t(n,s),n.globalAlpha=1}};function S(t,e){const n=e.style.icon,s=e.style.iconPadding||2,i=Math.min(e.w,e.h)-s;if(0>=i)return;const o=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),o){const o=i+s,r=e.x+(e.w-i)/2;for(let s=e.y+e.h-i;s>=e.y-i;s-=o)t.drawImage(n,r,s,i,i)}else{const o=i+s,r=e.y+(e.h-i)/2;for(let s=e.x;e.x+e.w>s;s+=o)t.drawImage(n,s,r,i,i)}t.restore()}function _(t,e,n,s,i,o){const r=[];for(const i of t){const t=n(i),o=s(i);Number.isFinite(t)&&Number.isFinite(o)&&r.push({px:e.x(t),py:e.y(o),rawY:o,d:i})}r.sort((t,e)=>t.px-e.px);const l=Array(r.length),h=Array(r.length),u=Array(r.length);for(let t=0;r.length>t;t++){const e=r[t];l[t]=[e.px,e.py],h[t]=e.rawY,u[t]=e.d}return{type:"line",path:l,rawValues:h,style:i,datum:u,group:o}}function A(t,e,n,s,i,o,r,l){const h=[];for(const o of t){const t=n(o),r=s(o);if(!Number.isFinite(t)||!Number.isFinite(r))continue;const u=e.x(t),c=l?l(o):i;h.push({px:u,topY:e.y(r),botY:e.y(c)})}h.sort((t,e)=>t.px-e.px);const u=Array(h.length),c=Array(h.length);for(let t=0;h.length>t;t++){const e=h[t];u[t]=[e.px,e.topY],c[t]=[e.px,e.botY]}return{type:"area",topPath:u,bottomPath:c,style:o,datum:t,group:r}}function B(t,e,n,s){const i=new Map;if("silhouette"===s)for(const s of t){let t=0;for(const i of e)t+=n(i,s)||0;i.set(s,-t/2)}else if("wiggle"===s){t.length>0&&i.set(t[0],0);for(let s=1;t.length>s;s++){const o=t[s-1],r=t[s];let l=0,h=0,u=0;for(const t of e){const e=n(t,r)||0;l+=(2*u+e)*(e-(n(t,o)||0)),h+=e,u+=e}const c=i.get(o)??0;i.set(r,c-(h>0?l/(2*h):0))}if(t.length>0){let s=0;for(const o of t){let t=0;for(const s of e)t+=n(s,o)||0;s+=(i.get(o)??0)+t/2}const o=s/t.length;for(const e of t)i.set(e,(i.get(e)??0)-o)}}else for(const e of t)i.set(e,0);return i}function z(t,e,n){let s=0,i=0;for(const o of t){let t=0,r=0;for(const s of e){const e=n(s,o)||0;0>e?r+=e:t+=e}s>r&&(s=r),t>i&&(i=t)}return[s,i]}function D(t,e,n,s,i,o,r,l="zero"){const h=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&h.add(e)}const u=Array.from(h).sort((t,e)=>t-e),c=new Map;for(const e of t){const t=new Map;for(const i of e.data){const e=n(i),o=s(i);Number.isFinite(e)&&Number.isFinite(o)&&t.set(e,(t.get(e)||0)+o)}c.set(e.key,t)}let a;if(o){a=new Map;for(const e of u){let n=0;for(const s of t)n+=c.get(s.key)?.get(e)||0;a.set(e,n||1)}}const f=B(u,t.map(t=>t.key),(t,e)=>c.get(t)?.get(e)||0,l),y="diverging"===l&&!o,d=[],m=new Map,p=new Map,k=new Map,g=new Map;for(const t of u)p.set(t,f.get(t)??0),k.set(t,0),g.set(t,0);for(const n of t){const t=c.get(n.key),s=new Map;let l=[],h=[];const f=()=>{if(l.length>=2){const t={type:"area",topPath:l,bottomPath:h,style:i(n.key,n.data[0]),datum:n.data,group:n.key};r&&(t.curve=r),d.push(t)}l=[],h=[]};for(const n of u){const i=t.has(n);let r,u,c=i?t.get(n):0;if(o&&i&&(c/=a.get(n)),!i||!Number.isFinite(c)||0===c){f();continue}y?c>0?(r=k.get(n),u=r+c,k.set(n,u)):(r=g.get(n),u=r+c,g.set(n,u)):(r=p.get(n),u=r+c,p.set(n,u));const d=e.x(n);h.push([d,e.y(r)]),l.push([d,e.y(u)]),s.set(n,u)}f(),m.set(n.key,s)}return{nodes:d,stackedTops:m}}function M(t,e,n,s,i,o,r){const l=n(t),h=s(t);if(!Number.isFinite(l)||!Number.isFinite(h))return null;const u={type:"point",x:e.x(l),y:e.y(h),r:i,style:o,datum:t};return void 0!==r&&(u.pointId=r),u}function P(t,e,n,s,i,o,r,l){const h=n(t),u=s(t);if(!Number.isFinite(h)||!Number.isFinite(u))return null;const c={type:"symbol",x:e.x(h),y:e.y(u),size:i,symbolType:o,style:r,datum:t};return void 0!==l&&(c.pointId=l),c}function N(t,e,n,s,i,o,r){return{type:"rect",x:t,y:e,w:n,h:s,style:i,datum:o,group:r}}function W(t,e,n,s,i,o,r){const l={type:"heatcell",x:t,y:e,w:n,h:s,fill:i,datum:o};return r?.showValues&&(l.showValues=!0,l.value=r.value,r.valueFormat&&(l.valueFormat=r.valueFormat)),l}export{u as DataSourceAdapter,h as IncrementalExtent,c as accessorsEquivalent,a as resolveAccessor,f as resolveRawAccessor,y as resolveStringAccessor,k as toIdSet,_ as buildLineNode,A as buildAreaNode,B as computeStackOffsets,z as computeDivergingStackExtent,D as buildStackedAreaNodes,M as buildPointNode,P as buildSymbolNode,N as buildRectNode,W as buildHeatcellNode,g as ticksForMode,d as resolveFrameGraphics,m as resolveAnnotationAccessor,p as buildEnrichAnnotationData,b as symbolCanvasRenderer,F as barCanvasRenderer};
@@ -0,0 +1 @@
1
+ import{makeRuleValueResolver as t,resolveStyleRules as e}from"./chunk-chunk-NEVE562N.module.min.js";import{PhysicsPipelineStore as o,absorbRegion as n,bodyGroupSpec as i,capacitatedRegion as a,collidersFromPlotBounds as r,collidersFromXScaleBins as s,forceFieldRegion as l,groupCompletionRows as c,portalRegion as u,pressureFieldRegion as p,processStageLayout as d,routeSurfaceRegion as h}from"./chunk-chunk-LRIFN2HK.module.min.js";import{buildResolveColor as g,resolveCustomLayoutPalette as m,xySceneNodeToSVG as f}from"./chunk-chunk-MFHF4J2Z.module.min.js";import{schemeCategory10 as y}from"./chunk-chunk-5RKXZQ2P.module.min.js";function x(t=[]){return t.map(t=>({id:t.id,label:t.label,count:t.count,...null!=t.secondary?{secondary:t.secondary}:{},...t.secondaryLabel?{secondaryLabel:t.secondaryLabel}:{},...null!=t.observed?{observed:t.observed}:{}}))}function w(t,e={}){const o=e.bodies??function(t){return t.world.bodies.map(t=>({id:t.id,x:t.x,y:t.y,prevX:t.prevX,prevY:t.prevY,vx:t.vx,vy:t.vy,angle:t.angle,mass:t.mass,shape:{...t.shape},sleeping:t.sleeping,datum:t.datum}))}(t),n=o.filter(t=>t.sleeping).length;return{bodyCount:o.length,sleepingCount:n,settled:"settled"===t.simulationState&&0===t.queue.length&&n===o.length,stepsRun:Math.max(0,Math.floor(e.stepsRun??0)),seed:t.world.options.seed,binCounts:x(e.projectionRows)}}var b={fill:"#4e79a7",stroke:"#172033",strokeWidth:1,opacity:.85};function M(t){const e=t.datum;if(e&&"object"==typeof e){const t=e.label??e.name??e.id;if(null!=t&&""!==t)return t+""}return t.id}function v(t,e){const o="function"==typeof e?e(t):e;return{...b,...o??{}}}function k(t,e={}){const o=function(t){return t.datum&&"object"==typeof t.datum?t.datum:null}(t),n={label:e.getBodyLabel?.(t)??M(t)},i={style:v(t,e.bodyStyle),datum:o,accessibleDatum:o,accessibility:n,_transitionKey:t.id};return"aabb"===t.shape.type?{type:"rect",x:t.x-t.shape.width/2,y:t.y-t.shape.height/2,w:t.shape.width,h:t.shape.height,...i}:{type:"point",x:t.x,y:t.y,r:t.shape.radius,pointId:t.id,...i}}function S(t,e={}){return t.map(t=>k(t,e))}function P(t,e={}){const o=t.settle(e.maxSteps),n=t.readBodies(),i=t.snapshot();return{snapshot:i,bodies:n,sceneNodes:S(n,e),evidence:w(i,{bodies:n,projectionRows:e.projectionRows,stepsRun:o}),stepsRun:o}}import*as A from"react-dom/server";import{jsx as I,jsxs as C}from"react/jsx-runtime";function z(t,e={}){const{width:o=640,height:n=360,title:i,description:a,background:r,className:s,idPrefix:l="physics",...c}=e,u=P(t,c),p=function(t){const e=t.replace(/[^A-Za-z0-9_-]/g,"_");return!e||/^\d/.test(e)?"physics-"+e:e}(l),d=i?p+"-title":void 0,h=a?p+"-desc":void 0,g=[d,h].filter(Boolean).join(" ")||void 0;return{svg:A.renderToStaticMarkup(C("svg",{xmlns:"http://www.w3.org/2000/svg",className:s??"stream-physics-frame",width:o,height:n,viewBox:`0 0 ${o} ${n}`,role:"img","aria-labelledby":g,children:[i&&I("title",{id:d,children:i}),a&&I("desc",{id:h,children:a}),r&&"transparent"!==r?I("rect",{x:0,y:0,width:o,height:n,fill:r}):null,I("g",{id:p+"-data-area",children:u.sceneNodes.map((t,e)=>f(t,e,p))})]})),scene:u,evidence:u.evidence}}import{scaleLinear as R}from"d3-scale";function T(t){const[e,o]=t,n=160>e||116>o,i=n?Math.min(12,Math.max(2,.08*e)):32,a=n?Math.min(8,Math.max(2,.12*o)):24,r=n?a:34;return{width:e,height:o,plot:{x:i,y:a,width:Math.max(1,e-2*i),height:Math.max(1,o-a-r)}}}function L(t){const e=(t??"")+"";if(!e)return"#4e79a7";const o=["#4e79a7","#59a14f","#e15759","#f28e2b","#76b7b2","#edc948","#b07aa1","#ff9da7"];let n=0;for(let t=0;e.length>t;t+=1)n=31*n+e.charCodeAt(t)>>>0;return o[n%o.length]}function E(o,n="#4e79a7",i){const a=i?.styleRules,r=!!a&&a.length>0,s=r?t(i?.valueAccessor):void 0;return t=>{const i=t.datum,l=i&&o?"function"==typeof o?o(i,0):i[o]:void 0,c={fill:null==l?n:L(l),stroke:"#111827",strokeWidth:1,opacity:.9};return r&&i&&Object.assign(c,e(i,a,{value:s?s(i):void 0,category:null==l?void 0:l+""})),c}}function j(t,e,o,n){return{fixedDt:1/120,maxSubsteps:8,colliders:e,observation:{chartType:o},kernel:{seed:t,gravity:{x:0,y:760},cellSize:36,collisionIterations:6,velocityDamping:.995,restitution:.08,friction:.4,sleepSpeed:8,sleepAfter:.6,...n}}}function Y(t,e,o){return"function"==typeof o?o(t,e):t[o]}function $(t){if(t instanceof Date){const e=t.getTime();return Number.isFinite(e)?e:null}const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function N(t,e,o){return Math.max(e,Math.min(o,t))}function F(t,e){const o=$(t);return null!=o&&o>0?o:e}function D(t){return((t??"unknown")+"").trim().replace(/[^A-Za-z0-9_-]+/g,"_")||"unknown"}function B(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}import{scaleLinear as X}from"d3-scale";function W(t){const e=Math.max(2,Math.round(t.bins)),o=Math.max(1,Math.round(t.pegRows??e-1)),n=Math.max(1,Math.round(t.count??Math.max(64,4*e))),i=N(Number.isFinite(t.branchProbability)?t.branchProbability??.5:.5,0,1),a=B(t.seed??1),r=t.idPrefix??"mechanical";return Array.from({length:n},(t,e)=>{let n=0;for(let t=0;o>t;t+=1)a()<i&&(n+=1);const s=o/2;return{id:`${r}-${e}`,value:n,mechanical:!0,pegRows:o,branchProbability:i,pathRights:n,side:s>n?"left":n>s?"right":"center"}})}function V(t){const{data:e,valueAccessor:o,bins:n,ballRadius:i,seed:a,size:l,valueExtent:c}=t,u=T(l),p=e.map((t,e)=>$(Y(t,e,o))).filter(t=>null!=t),d=function(t){if(!t)return;const e=$(t[0]),o=$(t[1]);return null!=e&&null!=o?e>o?[o,e]:[e,o]:void 0}(c),h=d?.[0]??(p.length?Math.min(...p):0),g=d?.[1]??(p.length?Math.max(...p):1),m=g===h?1:g-h,f=X().domain([0,n]).range([u.plot.x,u.plot.x+u.plot.width]),y=Array.from({length:n},()=>0),x=[];e.forEach((t,e)=>{const a=$(Y(t,e,o));if(null==a)return;const r=Math.max(0,Math.min(n-1,Math.floor((a-h)/m*n)));y[r]+=1,x.push({id:(t.id??"galton-"+e)+"",x:f(r+.5),y:u.plot.y+i+2,vx:8*(e%5-2),vy:0,mass:1,shape:{type:"circle",radius:i},datum:{...t,value:a,bin:r}})});const w=u.plot.y+u.plot.height;return{config:j(a,[...r({x:u.plot.x,y:u.plot.y,width:u.plot.width,height:u.plot.height},{idPrefix:"galton",wallThickness:20,floorThickness:20}),...s({idPrefix:"galton-bin",count:n,domainStart:0,domainStep:1,xScale:f,yTop:u.plot.y-400,yBottom:w,wallThickness:6})],"GaltonBoardChart"),initialSpawns:x,initialSpawnPacing:{pacing:{ratePerSec:55}},projectionRows:y.map((t,e)=>({label:e+1+"",value:t})),metadata:{kind:"galton-board",bins:n,plot:u.plot,valueExtent:[h,g]}}}import{scaleLinear as _}from"d3-scale";function O(t){const{count:e,idPrefix:o,wallThickness:n,xScale:i,yBottom:a,yTop:r,yTopForIndex:s}=t;return Array.from({length:e+1},(t,e)=>{const l=Math.min(a-1,s?.(e)??r),c=Math.max(1,a-l);return{id:`${o}-wall-${e}`,shape:{type:"aabb",x:i(e),y:l+c/2,width:n,height:c}}})}function Z(t){const{data:e,timeAccessor:o,arrivalAccessor:n,windows:i,watermark:a,ballRadius:s,seed:l,size:c,timeExtent:u,timeScale:p=1}=t,d=T(c),h=e.map((t,e)=>$(Y(t,e,o))).filter(t=>null!=t),g=$(u?.[0]),m=$(u?.[1]),f=h.length?Math.min(...h):0,y=h.length?Math.max(...h):f+i.size,x=Math.min(g??f,f),w=Math.max(m??y,y),b=Math.floor(x/i.size)*i.size,M=Math.max(1,Math.ceil((w-b+i.size)/i.size)),v=h.length?Math.max(...h):0,k="function"==typeof a?a(v):$(a?.value)??v-(a?.delay??i.size),S=Math.max(0,Math.min(M,Array.from({length:M},(t,e)=>e).reduce((t,e)=>b+(e+1)*i.size>k?t:t+1,0))),P=function(t,e){const o=Math.max(5*e,Math.min(92,.13*t.plot.width));return{gutter:{x:t.plot.x,y:t.plot.y,width:o,height:t.plot.height},windowPlot:{x:t.plot.x+o,y:t.plot.y,width:Math.max(40,t.plot.width-o),height:t.plot.height},wallTop:t.plot.y+.48*t.plot.height}}(d,s),A=b+M*i.size,I=_().domain([b,A]).range([P.windowPlot.x,P.windowPlot.x+P.windowPlot.width]),C=Array.from({length:M},()=>({value:0,secondary:0})),z=[];e.forEach((t,e)=>{const a=$(Y(t,e,o));if(null==a)return;const r=$(Y(t,e,n))??a,l=Math.max(0,Math.min(M-1,Math.floor((a-b)/i.size))),c=k>=b+(l+1)*i.size;C[l].value+=c?0:1,C[l].secondary+=c?1:0,z.push({id:(t.id??"event-"+e)+"",x:Math.max(P.windowPlot.x+s,Math.min(P.windowPlot.x+P.windowPlot.width-s,I(a))),y:d.plot.y+s+2,vx:8*(e%3-1),vy:0,mass:1,friction:.02,spawnAt:r,shape:{type:"circle",radius:s},datum:{...t,eventTime:a,arrivalTime:r,windowIndex:l,late:c}})});const R=d.plot.y+d.plot.height,L=function(t,e){const o=Math.max(0,Math.min(t.windowCount,t.closedWindowCount));if(!o)return[];const n=t.windowStart,i=t.windowStart+t.windowCount*t.windowSize,a=_().domain([n,i]).range([t.windowPlot.x,t.windowPlot.x+t.windowPlot.width]),r=a(t.windowStart+o*t.windowSize),s=t.windowPlot.x,l=e+Math.max(18,Math.min(.3*t.windowPlot.height,r-s)),c=t=>r===s?e:l+(t-s)/(r-s)*(e-l),u=[];for(let e=0;o>e;e+=1){const o=t.windowStart+e*t.windowSize,n=o+t.windowSize,i=a(o),r=a(n);u.push({id:"eventdrop-lid-"+e,windowIndex:e,x1:i,y1:c(i),x2:r,y2:c(r)})}return u}({closedWindowCount:S,gutter:P.gutter,plot:d.plot,windowCount:M,windowPlot:P.windowPlot,windowSize:i.size,windowStart:b},d.plot.y+.28*d.plot.height);return{config:j(l,[...r({x:d.plot.x,y:d.plot.y,width:d.plot.width,height:d.plot.height},{idPrefix:"eventdrop",wallThickness:20,floorThickness:20}),...O({idPrefix:"eventdrop-window",count:M,xScale:t=>I(b+t*i.size),yTop:P.wallTop,yTopForIndex:t=>{const e=(t=>{if(0>t||t>S)return null;const e=0===t?L[0]?.y1:L[t-1]?.y2??L[t]?.y1;return"number"==typeof e&&Number.isFinite(e)?e:null})(t);return null==e?P.wallTop:e+1.25*s},yBottom:R,wallThickness:6}),...L.map(t=>({id:t.id,shape:{type:"segment",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,thickness:Math.max(4,.42*s)},friction:.02,restitution:.01}))],"EventDropChart",{friction:.08}),initialSpawns:z,initialSpawnPacing:{pacing:"arrival",timeAccessor:t=>t.datum?.arrivalTime,timeScale:p},projectionRows:C.map((t,e)=>({label:`${b+e*i.size}-${b+(e+1)*i.size}`,value:t.value,secondary:t.secondary})),metadata:{kind:"event-drop",closedWindowCount:S,gutter:P.gutter,lidSegments:L,lateCount:C.reduce((t,e)=>t+e.secondary,0),plot:d.plot,windowPlot:P.windowPlot,watermarkValue:k,windowCount:M,windowSize:i.size,windowStart:b}}}function U(t={}){const e=(t.categories?.length?t.categories:["Intake","Review","Build","Ship"]).map(t=>(t+"").trim()).filter(Boolean),o=e.length?e:["Intake"],n=Math.max(o.length,Math.round(t.count??Math.max(48,12*o.length))),i=F(t.unitValue,1),a=B(t.seed??1),r=t.idPrefix??"mechanical-pile",s=o.map(()=>.65+.9*a()),l=s.reduce((t,e)=>t+e,0)||1,c=n-o.length,u=s.map(t=>t/l*c),p=u.map(t=>1+Math.floor(t));let d=n-p.reduce((t,e)=>t+e,0);const h=u.map((t,e)=>({index:e,fraction:t-Math.floor(t)})).sort((t,e)=>e.fraction-t.fraction);for(let t=0;d>0;t=(t+1)%h.length)p[h[t].index]+=1,d-=1;return o.map((t,e)=>({id:`${r}-${e}`,category:t,value:p[e]*i,mechanical:!0,unitCount:p[e],unitValue:i,share:p[e]/n}))}function H(t){const{data:e,categoryAccessor:o,valueAccessor:n,unitValue:i,ballRadius:a,seed:s,size:l}=t,c=F(i,1),u=T(l),p=[],d=new Map,h=new Map,g=[];function m(t){let e=d.get(t);return null==e&&(e=p.length,p.push(t),d.set(t,e)),e}e.forEach((t,e)=>{m((Y(t,e,o)??"unknown")+"")});const f=Math.max(1,p.length),y=function(t,e,o){const n=t.width/Math.max(1,e),i=Math.max(2,2*o),a=Math.min(.7*n,Math.max(3.2*i,i+8)),r=Math.max(1,Math.floor(a/i));return{laneWidth:n,tubeWidth:a,ballDiameter:i,perRow:r,centerX:e=>t.x+(e+.5)*n,pileHeight:t=>Math.ceil(Math.max(0,t)/r)*i}}(u.plot,f,a),x=Math.max(0,y.tubeWidth/2-a-1),w=p.map(()=>[]);e.forEach((t,e)=>{const i=(Y(t,e,o)??"unknown")+"",r=m(i),s=n?$(Y(t,e,n)):1,l=Math.max(0,Math.round((s??0)/c)),p=y.centerX(r);for(let o=0;l>o;o+=1){const n=h.get(i)??0,s=y.perRow>1?((y.perRow>1?n%y.perRow:0)/(y.perRow-1)*2-1)*x:0;h.set(i,n+1),w[r].push({id:`${(t.id??"pile-"+e)+""}-${o}`,x:p+s,y:u.plot.y+a+2,vx:(o%3-1)*a/2,vy:0,mass:1,shape:{type:"circle",radius:a},datum:{...t,category:i,unitIndex:o}})}});const b=w.reduce((t,e)=>Math.max(t,e.length),0);for(let t=0;b>t;t+=1)for(const e of w)e.length>t&&g.push(e[t]);const M=u.plot.y+u.plot.height,v=[...r({x:u.plot.x,y:u.plot.y,width:u.plot.width,height:u.plot.height},{idPrefix:"pile",wallThickness:20,floorThickness:20})],k=u.plot.y-400;for(let t=0;f>t;t+=1){const e=y.centerX(t);for(const o of[-1,1])v.push({id:`pile-tube-${t}-${0>o?"l":"r"}`,shape:{type:"aabb",x:e+o*y.tubeWidth/2,y:(k+M)/2,width:6,height:M-k}})}return{config:j(s,v,"PhysicsPileChart"),initialSpawns:g,initialSpawnPacing:{pacing:{ratePerSec:20}},projectionRows:p.map(t=>({label:t,value:h.get(t)??0}))}}import{scaleLinear as K}from"d3-scale";function q(t){const{data:e,xAccessor:o,groupAccessor:n,radiusAccessor:i,pointRadius:a,seed:s,size:l,xExtent:c,collisionIterations:u,settle:p}=t,d=T(l),h=B(s),g=[],m=[],f=new Map;e.forEach((t,e)=>{const r=$(Y(t,e,o));if(null==r)return;const s=n?(Y(t,e,n)??"All")+"":"All",l=i?$(Y(t,e,i)):null,c=N(null!=l&&l>0?l:a,2,18);!function(t){let e=f.get(t);null==e&&(e=m.length,m.push(t),f.set(t,e))}(s),g.push({datum:t,index:e,value:r,group:s,radius:c})});const y=g.map(t=>t.value),x=c?$(c[0]):null,w=c?$(c[1]):null,b=y.length?Math.min(...y):0,M=y.length?Math.max(...y):1;let v=x??b,k=w??M;if(v===k&&(v-=.5,k+=.5),v>k){const t=k;k=v,v=t}const S=Math.max(a,...g.map(t=>t.radius)),P=d.plot.x+S+8,A=d.plot.x+d.plot.width-S-8,I=K().domain([v,k]).range([P,A]),C=Math.max(1,m.length),z=Math.min(Math.max(28,3*S),d.plot.height/4),R=d.plot.y+z,L=Math.max(0,d.plot.y+d.plot.height-z-R),E=t=>{const e=f.get(t)??0;return 1===C?d.plot.y+.54*d.plot.height:R+e/(C-1)*L},F=new Map,D=g.map((t,e)=>{F.set(t.group,(F.get(t.group)??0)+1);const o=I(t.value),n=E(t.group),i=(h()-.5)*t.radius*1.6,a=(h()-.5)*t.radius*1.6;return{id:(t.datum.id??"collision-swarm-"+e)+"",x:p?o+i:N(o+(e%9-4)*t.radius*2.5,P,A),y:p?n+a:d.plot.y-18-e%12*t.radius,vx:p?0:22*(h()-.5),vy:p?0:24+18*h(),mass:1,shape:{type:"circle",radius:t.radius},datum:{...t.datum,xValue:t.value,group:t.group,radius:t.radius,targetX:o,targetY:n},springs:[{target:{type:"point",x:o,y:n},restLength:0,stiffness:34,damping:5.5}]}});return{config:j(s,r({x:d.plot.x,y:d.plot.y,width:d.plot.width,height:d.plot.height},{idPrefix:"collision-swarm",includeCeiling:!1,wallThickness:20,floorThickness:20}),"CollisionSwarmChart",{gravity:{x:0,y:0},cellSize:Math.max(24,4*S),collisionIterations:Math.max(1,Math.round(u??6)),velocityDamping:.992,restitution:.02,friction:.18,sleepSpeed:3,sleepAfter:.5}),initialSpawns:D,projectionRows:m.map(t=>({label:t,value:F.get(t)??0})),metadata:{kind:"collision-swarm",xExtent:[v,k],xRange:[P,A],groups:m.map(t=>({label:t,y:E(t),count:F.get(t)??0})),plot:d.plot}}}function G(t){if(Array.isArray(t)&&t.length>=2){const e=$(t[0]),o=$(t[1]);return null!=e&&null!=o?{x:e,y:o}:null}if(t&&"object"==typeof t){const e=t,o=$(e.x),n=$(e.y);return null!=o&&null!=n?{x:o,y:n}:null}return null}function J(t){return Array.isArray(t)?t.map(G).filter(t=>null!=t):[]}function Q(t,e,o){return"normalized"===o?{x:e.plot.x+t.x*e.plot.width,y:e.plot.y+t.y*e.plot.height}:{x:N(t.x,e.plot.x,e.plot.x+e.plot.width),y:N(t.y,e.plot.y,e.plot.y+e.plot.height)}}function tt(t){let e=0;for(let o=1;t.length>o;o+=1)e+=Math.hypot(t[o].x-t[o-1].x,t[o].y-t[o-1].y);return e}function et(t,e){if(0===t.length)return{x:0,y:0};if(1===t.length)return{...t[0]};const o=N(e,0,1)*tt(t);let n=0;for(let e=1;t.length>e;e+=1){const i=t[e-1],a=t[e],r=Math.hypot(a.x-i.x,a.y-i.y);if(r>0){if(n+r>=o){const t=(o-n)/r;return{x:i.x+(a.x-i.x)*t,y:i.y+(a.y-i.y)*t}}n+=r}}return{...t[t.length-1]}}function ot(t,e){const o=et(t,Math.max(0,e-.02)),n=et(t,Math.min(1,e+.02)),i=n.x-o.x,a=n.y-o.y,r=Math.hypot(i,a)||1;return{x:i/r,y:a/r}}function nt(t){const{coordinateMode:e,flowSpeed:o,links:n,maxParticles:i,nodeIdAccessor:a,nodeXAccessor:s,nodeYAccessor:l,nodes:c,particleRadius:u,particleRate:p,pathAccessor:d,pathConstraint:h="path",reducedMotion:g,seed:m,size:f,sourceAccessor:y,targetAccessor:x,throughputAccessor:w}=t,b=T(f),M=B(m),v=new Map,k=new Map,S=[];function P(t){if(t&&"object"==typeof t){const e=t;if("function"==typeof a){const t=a(e,0);if(null!=t)return t+""}if("string"==typeof a&&null!=e[a])return e[a]+"";if(null!=e.id)return e.id+""}return(t??"unknown")+""}c.forEach((t,e)=>{const o=(Y(t,e,a)??t.id??e)+"",n=$(Y(t,e,s)),i=$(Y(t,e,l));if(null!=n&&null!=i){const t={x:n,y:i};v.set(o,t),S.push(t)}k.set(o,(t.label??t.name??o)+"")});const A=[];n.forEach((t,e)=>{const o=P(Y(t,e,y)),n=P(Y(t,e,x)),i=Math.max(0,$(Y(t,e,w))??0),a=J(d?Y(t,e,d):void 0),r=a.length?a:J(t.path??t.points??t.route);r.forEach(t=>S.push(t)),A.push({id:(t.id??`physical-flow-${o}-${n}-${e}`)+"",link:t,index:e,source:o,target:n,throughput:i,rawPath:r})});const I=(z=S,"normalized"===(C=e)||"pixels"===C?C:z.length>0&&z.every(t=>!(0>t.x||t.x>1||0>t.y||t.y>1))?"normalized":"pixels");var C,z;const R=new Map;for(const[t,e]of v)R.set(t,Q(e,b,I));const L=[];for(const t of A){let e=t.rawPath.map(t=>Q(t,b,I));if(2>e.length){const o=R.get(t.source),n=R.get(t.target);o&&n&&(e=[o,n])}else R.has(t.source)||R.set(t.source,e[0]),R.has(t.target)||R.set(t.target,e[e.length-1]);e.length>=2&&t.throughput>0&&(k.has(t.source)||k.set(t.source,t.source),k.has(t.target)||k.set(t.target,t.target),L.push({...t,path:e,packetCount:0}))}const E=F(p,.12),X=Math.max(1,Math.round(i)),W=L.map(t=>Math.max(1,Math.round(t.throughput*E))),V=W.reduce((t,e)=>t+e,0),_=V>X?X/V:1;L.forEach((t,e)=>{t.packetCount=Math.max(1,Math.floor(W[e]*_))});let O=L.reduce((t,e)=>t+e.packetCount,0);for(;O>X;){const t=L.reduce((t,e,o)=>e.packetCount>1&&(-1===t||e.packetCount>L[t].packetCount)?o:t,-1);if(-1===t)break;L[t].packetCount-=1,O-=1}const Z=new Map,U=new Map,H=[],K=F(o,90),q=F(u,4);L.forEach((t,e)=>{Z.set(t.target,(Z.get(t.target)??0)+t.throughput),U.set(t.source,(U.get(t.source)??0)+t.throughput);const o=tt(t.path);for(let n=0;t.packetCount>n;n+=1){const i=(n+.5)/t.packetCount,a=g?i:N(.12+.84*i+.04*(M()-.5),.04,.98),r=g?a:Math.max(0,a-(.18+.12*M())),s=et(t.path,r),l=et(t.path,a),c=ot(t.path,r),u={x:-c.y,y:c.x},p=(M()-.5)*q*1.5;H.push({id:`${t.id}-packet-${n}`,x:s.x+u.x*p,y:s.y+u.y*p,vx:g?0:c.x*K+10*(M()-.5),vy:g?0:c.y*K+10*(M()-.5),mass:.8,spawnAt:g?0:.04*e+n/32,shape:{type:"circle",radius:q},datum:{...t.link,source:t.source,target:t.target,throughput:t.throughput,packetIndex:n,packetCount:t.packetCount,routeProgress:a,flowPath:t.path,flowPathLength:o,flowRouteId:t.id,flowSpeed:K,sourceLabel:k.get(t.source)??t.source,targetLabel:k.get(t.target)??t.target},springs:"none"!==h&&g?[{target:{type:"point",x:l.x,y:l.y},restLength:.7*q,stiffness:26,damping:4.25}]:void 0})}});const G=Math.max(18,5*q),nt=Array.from(R,([t,e])=>({nodeId:t,label:k.get(t)??t,sensorId:"physical-flow-node-"+D(t),point:e})),it=nt.map(t=>({id:t.sensorId,sensor:!0,shape:{type:"aabb",x:t.point.x,y:t.point.y,width:G,height:G}})),at=Object.fromEntries(nt.map(t=>[t.sensorId,{binId:t.label,enterType:"physics-proximity-enter",exitType:"physics-proximity-exit"}])),rt=j(m,[...r({x:b.plot.x,y:b.plot.y,width:b.plot.width,height:b.plot.height},{idPrefix:"physical-flow",wallThickness:18,floorThickness:18}),...it],"PhysicalFlowChart",{gravity:{x:0,y:0},cellSize:Math.max(24,7*q),collisionIterations:3,velocityDamping:.994,restitution:.01,friction:.16,sleepSpeed:2.5,sleepAfter:.7});rt.bodyLimit=X,rt.eviction="oldest",rt.observation={...rt.observation,sensors:at};const st=Array.from(R,([t,e])=>({id:t,label:k.get(t)??t,x:e.x,y:e.y,sensorId:"physical-flow-node-"+D(t),incoming:Z.get(t)??0,outgoing:U.get(t)??0})),lt=L.map(t=>({id:t.id,source:t.source,target:t.target,sourceLabel:k.get(t.source)??t.source,targetLabel:k.get(t.target)??t.target,throughput:t.throughput,packetCount:t.packetCount,path:t.path}));return{config:rt,initialSpawns:H,projectionRows:st.filter(t=>t.incoming>0||t.outgoing>0).map(t=>({label:t.label,value:t.incoming,secondary:t.outgoing})),metadata:{kind:"physical-flow",coordinateMode:I,particleCount:H.length,totalThroughput:L.reduce((t,e)=>t+e.throughput,0),plot:b.plot,nodes:st,links:lt}}}function it(t,e=12){return"number"==typeof t?{x:t,y:0}:t&&"object"==typeof t?{x:Number.isFinite(t.x)?Number(t.x):e,y:Number.isFinite(t.y)?Number(t.y):0}:{x:e,y:0}}function at(t){const e=t.stages;if(!e.length)throw Error("buildProcessFlowPhysics requires at least one stage");const o=t.size,r=T(o),s=N(t.ballRadius??6,2,18),g=t.seed??1,m=B(g),f=t.idAccessor,y=t.stageAccessor??"stage",x=t.groupBy,w=t.groupLabelAccessor,b=t.workAccessor,M=t.radiusAccessor,v=t.groupCompletion??(x?"allAbsorbed":"none"),k=t.springStiffness??.28,S=t.springDamping??.72,P=!0===t.settle,A=e.map(t=>({id:t.id,label:t.label??t.id,description:t.description,share:t.share})),I=d({width:o[0],height:o[1],shape:"lane",padX:Math.max(28,r.plot.x),padY:Math.max(36,r.plot.y+8),stages:A,idPrefix:"process-flow",includeMembraneRegions:!1,friction:.48,restitution:.14}),C=new Map(I.stages.map((t,e)=>[t.id,e])),z=new Map(I.stages.map(t=>[t.id,t])),R=I.stages[0].id,L=I.stages[0],E=new Set(e.filter(t=>t.absorb).map(t=>t.id)),j=e.map(t=>{const e=z.get(t.id)??L;return function(t,e){const o={id:"process-stage-"+t.id,label:t.label??t.id,description:t.description,x:e.x,y:e.y,width:Math.max(12,.92*e.width),height:Math.max(40,.88*e.height),semanticItem:!1,attributes:{stageId:t.id}};if(t.absorb)return n({...o,kind:t.kind??"sink",force:it(t.force,28),damping:t.damping??.04,charge:"absorbed",attributes:{...o.attributes,primitive:"absorb"}});if(t.portal){const e=t.portal.force??t.force??{x:-40,y:0};return u({...o,kind:t.kind??"force-field",force:it(e,-40),damping:t.damping??.1,targetStage:t.portal.targetStageId,attributes:{...o.attributes,primitive:"portal",targetStage:t.portal.targetStageId}})}if(t.capacity){const e=Math.max(.1,t.capacity.unitsPerSecond);return a({...o,kind:t.kind??"force-field",capacity:e,unitsPerSecond:e,force:it(t.force,10+.8*e),damping:t.damping??Math.max(.04,.32-.01*e),attributes:{...o.attributes,unitAccessor:t.capacity.unitAccessor,reviewerCapacity:e}})}if(t.pressure){const e="object"==typeof t.pressure&&t.pressure?t.pressure:{};return p({...o,kind:t.kind??"membrane",pressure:e.pressure,occupancy:e.occupancy,baseDamping:e.baseDamping??t.damping??.1,dampingPerUnit:e.dampingPerUnit??.1,energyPerUnit:e.energyPerUnit??0,force:it(t.force,8),attributes:{...o.attributes,primitive:"pressureField"}})}return null!=t.force||null!=t.damping?h({...o,kind:t.kind??"force-field",force:it(t.force,14),damping:t.damping??.02,attributes:{...o.attributes,primitive:"routeSurface"}}):l({...o,kind:t.kind??"force-field",force:{x:10,y:0},damping:.02,attributes:{...o.attributes,primitive:"forceField"}})}(t,{x:e.x,y:I.midY,width:e.width,height:I.bottomY-I.topY})});j.unshift(h({id:"process-flow-route",label:"process route",description:"Baseline conveyor along the process lane.",x:(I.left+I.right)/2,y:I.midY,width:I.right-I.left,height:I.bottomY-I.topY-12,force:8,damping:.012,semanticItem:!1}));const F=new Map;for(const t of I.stages)F.set(t.id,0);const D=[];t.data.forEach((t,e)=>{const o=(f?Y(t,e,f)??t.id??"process-flow-"+e:t.id??"process-flow-"+e)+"",n=(Y(t,e,y)??R)+"",i=C.has(n)?n:R;F.set(i,(F.get(i)??0)+1);const a=x?(Y(t,e,x)??"")+"":void 0,r=a&&w?(Y(t,e,w)??a)+"":a,l=b?$(Y(t,e,b))??1:1,c=M?$(Y(t,e,M)):null,u=N(null!=c&&c>0?c:s,2,18);D.push({datum:t,id:o,stageId:i,groupId:a||void 0,groupLabel:r||void 0,work:l,radius:u,index:e})});const X=new Map,W=new Map;for(const t of D){if(!t.groupId)continue;const e=X.get(t.groupId)??[];e.push(t.id),X.set(t.groupId,e),t.groupLabel&&W.set(t.groupId,t.groupLabel)}const V=N(t.groupAnchorAlong??.55,.15,.9),_=I.left+(I.right-I.left)*V,O=Array.from(X.keys()),Z=O.map((t,o)=>{const n=X.get(t)??[],a=O.length>1?I.topY+28+o/Math.max(1,O.length-1)*(I.bottomY-I.topY-56):I.midY;return i({id:t,label:W.get(t)??t,bodyIds:n,anchor:{x:_,y:a},x:_,y:a,completion:"allAbsorbed"===v?{mode:"allMembersAbsorbed",targetZone:e.find(t=>t.absorb)?.id??"merged"}:void 0,tether:{stiffness:.06,visible:!0,restLength:18}})}),U=D.filter(t=>E.has(t.stageId)).map(t=>t.id),H=c(Z,U),K=new Map(Z.map(t=>[t.id,t])),q=D.map((t,e)=>{const o=z.get(t.stageId)??L,n=o.x+(m()-.5)*Math.min(24,.2*o.width),i=I.boundaryY(n,"top")+t.radius+10,a=I.boundaryY(n,"bottom")-t.radius-10,r=a>i?i+m()*Math.max(1,a-i):I.midY,s=P?n:I.left+18+e%7*4,l=P?r:I.midY+(m()-.5)*(I.bottomY-I.topY)*.35,c=[{target:{type:"point",x:n,y:r},restLength:.45*t.radius,stiffness:k,damping:S}];if(t.groupId){const e=K.get(t.groupId);e?.anchor&&!E.has(t.stageId)&&c.push({target:{type:"point",x:e.anchor.x,y:e.anchor.y},restLength:e.tether?.restLength??22,stiffness:e.tether?.stiffness??.05,damping:.8})}return{id:t.id,x:s,y:l,vx:P?0:40+40*m(),vy:P?0:20*(m()-.5),mass:1,shape:{type:"circle",radius:t.radius},spawnAt:P?0:.03*e,springs:c,datum:{...t.datum,id:t.id,stage:t.stageId,groupId:t.groupId,groupLabel:t.groupLabel,work:t.work,__processFlow:!0}}}),G={kernel:{seed:g,gravity:{x:t.gravityX??22,y:t.gravityY??0},restitution:.14,friction:.48,velocityDamping:.988,maxVelocity:420,sleepSpeed:8,sleepAfter:.9,collisionIterations:4},colliders:I.colliders,fixedDt:1/60,maxSubsteps:8},J=I.stages.map(t=>({label:t.label??t.id,value:F.get(t.id)??0})),Q=e.map(t=>{const e=z.get(t.id)??L;return{id:t.id,label:t.label??t.id,x:e.x,width:e.width,count:F.get(t.id)??0,capacity:t.capacity?.unitsPerSecond,absorb:!0===t.absorb,portalTarget:t.portal?.targetStageId}});return{config:G,initialSpawns:q,initialSpawnPacing:P?void 0:{pacing:"arrival",timeAccessor:"spawnAt",timeScale:1},projectionRows:J,metadata:{kind:"process-flow",plot:r.plot,volume:I,stages:Q,groups:Z,groupCompletion:H,regionEffects:j}}}function rt(t,e){const o=e.config??{},n=(e.sensors??[]).map(t=>({...t,sensor:!0})),i=[...e.colliders??[],...n],a=[...t.colliders??[],...o.colliders??[],...i];return{...t,...o,observation:{...t.observation,...o.observation},...a.length>0&&{colliders:a}}}function st(t){const e=function(t,e,o){const n=t?.observation;return{...t,observation:{...n,chartId:e??n?.chartId??"physics-custom",chartType:n?.chartType??"PhysicsCustomChart",onObservation:o??n?.onObservation}}}(t.config,t.chartId,t.onObservation),n=m(t.colorScheme,t.themeCategorical,y),i=T(t.size),a={data:t.data,scales:{x:R().domain(t.xExtent??[0,1]).range([i.plot.x,i.plot.x+i.plot.width]),y:R().domain(t.yExtent??[0,1]).range([i.plot.y+i.plot.height,i.plot.y])},dimensions:i,theme:{semantic:t.semantic,categorical:[...n]},resolveColor:g(n,t.colorScheme),config:t.layoutConfig??{},world:new o(e)},r=t.skipLayout?{}:t.layout(a)??{},s=function(t,e){if(!e?.length)return t;const o=new Map;for(const t of e){const{bodyId:e,...n}=t,i=o.get(e)??[];i.push(n),o.set(e,i)}return t.map(t=>{const e=o.get(t.id);return e?.length?{...t,springs:[...t.springs??[],...e]}:t})}([...r.initialSpawns??r.bodies??[]],r.constraints);return{config:rt(e,r),context:a,initialSpawnPacing:r.initialSpawnPacing,initialSpawns:s,result:r}}export{E as styleFromColorAccessor,W as generateGaltonMechanicalSamples,V as buildGaltonBoardPhysics,Z as buildEventDropPhysics,U as generatePhysicsPileMechanicalSamples,H as buildPhysicsPile,q as buildCollisionSwarmPhysics,nt as buildPhysicalFlowPhysics,at as buildProcessFlowPhysics,st as resolveCustomLayout,w as buildPhysicsSettledEvidence,k as physicsBodyToXYSceneNode,S as physicsBodiesToXYSceneNodes,P as buildPhysicsSettledScene,z as renderPhysicsSettledSVG};
@@ -0,0 +1 @@
1
+ function t(t){let n=1/0,o=-1/0;for(const e of t)n>e&&(n=e),e>o&&(o=e);return[n,o]}function n(t,n=1/0){let o=n;for(const n of t)o>n&&(o=n);return o}function o(t,n=-1/0){let o=n;for(const n of t)n>o&&(o=n);return o}function e(t,n=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!o)return t;const e=Math.round(parseInt(o[1],16)*(1-n)),r=Math.round(parseInt(o[2],16)*(1-n)),a=Math.round(parseInt(o[3],16)*(1-n));return`#${e.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}function r(t,n=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!o)return t;const e=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*n),r=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*n),a=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*n);return`#${e.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}var a="__forecastSegment",s="__forecastOpacity";function i(n,o,e,r){const a=o.uncertaintyOpacity,i=o.confidenceAccessor;if(!a&&!i)return;const l="object"==typeof a?a:{},c=l.min??.15,f=l.max??1;if(i){const t="function"==typeof i?i:t=>t[i];for(const o of n){const n=t(o);null!=n&&Number.isFinite(n)&&(o[s]=c+Math.max(0,Math.min(1,n))*(f-c))}return}const u=n.map(t=>{const n=e(t),o=r(t);return null!=n&&null!=o&&Number.isFinite(n)&&Number.isFinite(o)?Math.abs(n-o):NaN}),p=u.filter(t=>Number.isFinite(t));if(0===p.length)return;const[h,y]=t(p),d=y-h;n.forEach((t,n)=>{const o=u[n];Number.isFinite(o)&&(t[s]=f-(d>0?(o-h)/d:0)*(f-c))})}function l(t,n){return"function"==typeof n?n(t):!!t[n]}function c(t){return[{type:"anomaly-band",threshold:t.threshold??2,showBand:!1!==t.showBand,fill:t.bandColor||"#6366f1",fillOpacity:t.bandOpacity??.1,anomalyColor:t.anomalyColor||"#ef4444",anomalyRadius:t.anomalyRadius??6,label:t.label}]}function f(t,n,e,r,s){return(c=r).isTraining||c.isForecast||c.isAnomaly||c.upperBounds||c.lowerBounds?function(t,n,o,e,r){const{isTraining:s,isForecast:c,isAnomaly:f,upperBounds:u,lowerBounds:p,color:h="#6366f1",bandOpacity:y=.15,anomalyColor:d="#ef4444",anomalyRadius:b=6,label:g}=e,m=t.map(t=>{let n="observed";return c&&l(t,c)?n="forecast":s&&l(t,s)&&(n="training"),{...t,[a]:n}}),_=e._groupBy,k=[];if(_){const t=new Map;for(const n of m){const o=n[_]??"__default";t.has(o)||t.set(o,[]),t.get(o).push(n)}const n=[];for(const[,o]of t)for(let t=0;o.length-1>t;t++)o[t][a]!==o[t+1][a]&&(n.push({...o[t+1],[a]:o[t][a]}),n.push({...o[t],[a]:o[t+1][a]}));k.push(...m,...n)}else for(let t=0;m.length>t;t++)k.push(m[t]),m.length-1>t&&m[t][a]!==m[t+1][a]&&(k.push({...m[t+1],[a]:m[t][a]}),k.push({...m[t],[a]:m[t+1][a]}));if(e.trainUnderline){const t=[];for(const n of k)"training"===n[a]&&t.push({...n,[a]:"training-base"});k.unshift(...t)}const O=[];if(u&&p){const t="string"==typeof u?u:"__envUpper",n="string"==typeof p?p:"__envLower";if("function"==typeof u||"function"==typeof p)for(const o of k)"function"==typeof u&&(o[t]=u(o)),"function"==typeof p&&(o[n]=p(o));O.push({type:"envelope",upperAccessor:t,lowerAccessor:n,fill:h,fillOpacity:y,label:g})}if(e.uncertaintyOpacity||e.confidenceAccessor){const t=u?"function"==typeof u?u:t=>t[u]:()=>{},n=p?"function"==typeof p?p:t=>t[p]:()=>{};i(k.filter(t=>"forecast"===t[a]),e,t,n)}if(f){const t=e.anomalyStyle,n={type:"highlight",filter:t=>l(t,f)};t?(n.style=t,n.r=b):"function"==typeof d?(n.style=t=>{const n=d(t);return{stroke:n,strokeWidth:1.5,fill:n,fillOpacity:.7}},n.r=b):(n.color=d,n.r=b,n.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),O.push(n)}return r&&O.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:k,annotations:O}}(t,0,0,r,s):function(t,n,e,r,s){const{trainEnd:l,steps:c=10,confidence:f=.95,color:u="#6366f1",bandOpacity:p=.15,label:h}=r;if(null==l)return{processedData:t,annotations:[]};const y=[],d=[];for(const o of t)o[n]>l?d.push({...o,[a]:"observed"}):y.push({...o,[a]:"training"});const b=y.map(t=>[t[n],t[e]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,n)=>t[0]-n[0]),g=[],m=[];if(b.length>=3){const s=b.length;let l=0,y=0,d=0,_=0;for(const[t,n]of b)l+=t,y+=n,d+=t*t,_+=t*n;const k=s*d-l*l;if(Math.abs(k)>1e-12){const d=(s*_-l*y)/k,O=(y-d*l)/s,w=t=>O+d*t,S=b.map(([t,n])=>n-w(t)).reduce((t,n)=>t+n*n,0),M=Math.sqrt(S/Math.max(s-2,1)),B=b.reduce((t,n)=>t+n[0],0)/s,F=b.reduce((t,n)=>t+(n[0]-B)**2,0),v=.99>f?.95>f?.9>f?1:1.645:1.96:2.576,C=o(t.map(t=>t[n]).filter(t=>null!=t&&isFinite(t))),D=b.length>1?(b[s-1][0]-b[0][0])/(s-1):1;for(let t=1;c>=t;t++){const o=C+t*D,r=w(o),i=M*Math.sqrt(1+1/s+(F>0?(o-B)**2/F:0))*v;m.push({[n]:o,[e]:r,[a]:"forecast",__forecastUpper:r+i,__forecastLower:r-i})}i(m,r,t=>t.__forecastUpper,t=>t.__forecastLower),g.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:u,fillOpacity:p,label:h})}}g.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),s&&g.push({type:"anomaly-band",threshold:s.threshold??2,showBand:!1!==s.showBand,fill:s.bandColor||"#6366f1",fillOpacity:s.bandOpacity??.1,anomalyColor:s.anomalyColor||"#ef4444",anomalyRadius:s.anomalyRadius??6,label:s.label});const _=[];if(_.push(...y),y.length>0&&d.length>0&&_.push({...y[y.length-1],[a]:"observed"}),_.push(...d),m.length>0){const t=d.length>0?d[d.length-1]:y[y.length-1];t&&_.push({...t,[a]:"forecast"}),_.push(...m)}return{processedData:_,annotations:g}}(t,n,e,r,s);var c}function u(t,n){const o=n.trainDasharray??"8,4",i=n.forecastDasharray??"4,4",l=n.color||"#6366f1",c=n.trainOpacity,f=n.forecastOpacity,u=n.trainStroke,p=n.trainLinecap,h=n.trainUnderline;return n=>{const y=t(n),d=n[a];if("training"===d){let t=y.stroke;return"darken"===u?t=e(y.stroke||"#666",.5):u&&(t=u),{...y,stroke:t,strokeDasharray:o,...p&&{strokeLinecap:p},...null!=c&&{strokeOpacity:c}}}if("training-base"===d){let t=y.stroke||"#666";return"lighten"===h&&(t=r(t,.4)),{...y,stroke:t,strokeDasharray:void 0}}if("forecast"===d){const t=n[s],o=null!=t?t:f;return{...y,stroke:l,strokeDasharray:i,...null!=o&&{strokeOpacity:o}}}return y}}export{t as getMinMax,n as getMin,o as getMax,e as darkenColor,r as lightenColor,a as SEGMENT_FIELD,s as FORECAST_OPACITY_FIELD,i as stampForecastOpacity,c as buildAnomalyAnnotations,f as buildForecast,u as createSegmentLineStyle};