semiotic 3.8.7 → 3.8.8

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 (206) hide show
  1. package/CLAUDE.md +2 -2
  2. package/README.md +56 -46
  3. package/ai/dist/mcp-server.js +28 -2
  4. package/ai/schema.json +124 -4
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/system-prompt.md +1 -1
  7. package/dist/{chunk-chartContainerDataAudit-JDSVSKGM.module.min.js → chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js} +1 -1
  8. package/dist/chunk-chunk-2B3AIKUZ.module.min.js +2 -0
  9. package/dist/chunk-chunk-2NVFEB7P.module.min.js +2 -0
  10. package/dist/chunk-chunk-3GCILWPB.module.min.js +2 -0
  11. package/dist/chunk-chunk-46KRGJQP.module.min.js +1 -0
  12. package/dist/{chunk-chunk-5SD6BHVW.module.min.js → chunk-chunk-4MLLQUGW.module.min.js} +1 -1
  13. package/dist/chunk-chunk-57RBPDBQ.module.min.js +2 -0
  14. package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
  15. package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
  16. package/dist/chunk-chunk-7LE56WAE.module.min.js +2 -0
  17. package/dist/chunk-chunk-7T25U75Z.module.min.js +2 -0
  18. package/dist/chunk-chunk-AF53TBSN.module.min.js +2 -0
  19. package/dist/chunk-chunk-BTZYH2IE.module.min.js +1 -0
  20. package/dist/chunk-chunk-BWV55BZK.module.min.js +2 -0
  21. package/dist/{chunk-chunk-FRO4TRXK.module.min.js → chunk-chunk-BZNOAHJV.module.min.js} +1 -1
  22. package/dist/chunk-chunk-CD6PVVS3.module.min.js +2 -0
  23. package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
  24. package/dist/{chunk-chunk-BNGBEY7N.module.min.js → chunk-chunk-FC3NZWYR.module.min.js} +1 -1
  25. package/dist/chunk-chunk-FEPXDKJP.module.min.js +1 -0
  26. package/dist/chunk-chunk-FJ76HWQZ.module.min.js +1 -0
  27. package/dist/chunk-chunk-FRGBMTZR.module.min.js +1 -0
  28. package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
  29. package/dist/{chunk-chunk-NH4MEAKP.module.min.js → chunk-chunk-H5IFO6CU.module.min.js} +1 -1
  30. package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
  31. package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
  32. package/dist/chunk-chunk-HCNDE26Q.module.min.js +2 -0
  33. package/dist/chunk-chunk-JJ4BSUYL.module.min.js +2 -0
  34. package/dist/chunk-chunk-JRHXQGEV.module.min.js +2 -0
  35. package/dist/chunk-chunk-L6FFYGYS.module.min.js +1 -0
  36. package/dist/{chunk-chunk-Z2AJERX5.module.min.js → chunk-chunk-LJDH3WV3.module.min.js} +1 -1
  37. package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
  38. package/dist/chunk-chunk-N3Q33XCB.module.min.js +2 -0
  39. package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
  40. package/dist/chunk-chunk-OG3TTJGJ.module.min.js +2 -0
  41. package/dist/{chunk-chunk-XEVJDUTH.module.min.js → chunk-chunk-OZK46A5U.module.min.js} +1 -1
  42. package/dist/chunk-chunk-PMR47KRY.module.min.js +2 -0
  43. package/dist/chunk-chunk-QQJNG23C.module.min.js +2 -0
  44. package/dist/{chunk-chunk-LG7YKJAK.module.min.js → chunk-chunk-RGJ6TKAH.module.min.js} +1 -1
  45. package/dist/{chunk-chunk-JWXLNZSM.module.min.js → chunk-chunk-SFLUSZ73.module.min.js} +1 -1
  46. package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
  47. package/dist/{chunk-chunk-LVHDZAT3.module.min.js → chunk-chunk-UEZ6SHW5.module.min.js} +1 -1
  48. package/dist/chunk-chunk-VUWYT7DY.module.min.js +2 -0
  49. package/dist/{chunk-chunk-OI7R7EJB.module.min.js → chunk-chunk-W5HWGQMD.module.min.js} +1 -1
  50. package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
  51. package/dist/chunk-chunk-WGROBM3I.module.min.js +2 -0
  52. package/dist/{chunk-chunk-GU2EJIDJ.module.min.js → chunk-chunk-WSDJFBKX.module.min.js} +1 -1
  53. package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
  54. package/dist/components/charts/index.d.ts +2 -2
  55. package/dist/components/charts/network/ProcessSankey.d.ts +105 -74
  56. package/dist/components/charts/network/processSankey/accessors.d.ts +7 -0
  57. package/dist/components/charts/network/processSankey/algorithm.d.ts +14 -193
  58. package/dist/components/charts/network/processSankey/axisChrome.d.ts +31 -0
  59. package/dist/components/charts/network/processSankey/bandPaths.d.ts +45 -0
  60. package/dist/components/charts/network/processSankey/buildScenes.d.ts +41 -3
  61. package/dist/components/charts/network/processSankey/fixtures.d.ts +17 -0
  62. package/dist/components/charts/network/processSankey/frameMargins.d.ts +11 -0
  63. package/dist/components/charts/network/processSankey/groupBonding.d.ts +13 -0
  64. package/dist/components/charts/network/processSankey/inventoryAtTime.d.ts +41 -0
  65. package/dist/components/charts/network/processSankey/labelPlacement.d.ts +34 -0
  66. package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +47 -0
  67. package/dist/components/charts/network/processSankey/layoutOrchestrator.d.ts +44 -0
  68. package/dist/components/charts/network/processSankey/layoutQualityProduct.d.ts +27 -0
  69. package/dist/components/charts/network/processSankey/massSimulation.d.ts +16 -0
  70. package/dist/components/charts/network/processSankey/ordering.d.ts +55 -0
  71. package/dist/components/charts/network/processSankey/orderingBond.d.ts +33 -0
  72. package/dist/components/charts/network/processSankey/orientation.d.ts +5 -0
  73. package/dist/components/charts/network/processSankey/packing.d.ts +8 -0
  74. package/dist/components/charts/network/processSankey/packingCache.d.ts +23 -0
  75. package/dist/components/charts/network/processSankey/processSankeyLayoutAsync.d.ts +27 -0
  76. package/dist/components/charts/network/processSankey/processSankeyLayoutWorkerClient.d.ts +72 -0
  77. package/dist/components/charts/network/processSankey/processSankeyTooltip.d.ts +26 -0
  78. package/dist/components/charts/network/processSankey/processSankeyTypes.d.ts +163 -0
  79. package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +26 -2
  80. package/dist/components/charts/network/processSankey/ribbonRunway.d.ts +45 -0
  81. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +23 -0
  82. package/dist/components/charts/network/processSankey/time.d.ts +11 -0
  83. package/dist/components/charts/network/processSankey/useProcessSankeyPush.d.ts +29 -0
  84. package/dist/components/charts/network/processSankey/useProcessSankeyScenes.d.ts +26 -0
  85. package/dist/components/charts/network/processSankey/validation.d.ts +33 -0
  86. package/dist/components/charts/shared/chartFamilySets.d.ts +1 -0
  87. package/dist/components/charts/shared/formatUtils.d.ts +12 -1
  88. package/dist/components/charts/shared/hatchFill.d.ts +2 -0
  89. package/dist/components/charts/shared/hooks.d.ts +1 -1
  90. package/dist/components/charts/shared/leastSquaresRegression.d.ts +31 -0
  91. package/dist/components/charts/shared/styleRules.d.ts +5 -1
  92. package/dist/components/charts/shared/useChartLegend.d.ts +6 -0
  93. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  94. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  95. package/dist/components/charts/shared/withChartWrapper.d.ts +0 -6
  96. package/dist/components/data/numericFieldProfiler.d.ts +2 -0
  97. package/dist/components/recipes/layout1d.d.ts +68 -0
  98. package/dist/components/semiotic-network.d.ts +2 -2
  99. package/dist/components/semiotic-recipes-core.d.ts +2 -0
  100. package/dist/components/semiotic.d.ts +2 -0
  101. package/dist/components/server/staticSVGChrome.d.ts +2 -1
  102. package/dist/components/store/createStore.d.ts +2 -0
  103. package/dist/components/stream/OrdinalPipelineStore.d.ts +3 -0
  104. package/dist/components/stream/PipelineStore.d.ts +5 -0
  105. package/dist/components/stream/accessorUtils.d.ts +21 -0
  106. package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -2
  107. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +3 -8
  108. package/dist/components/stream/layouts/index.d.ts +1 -1
  109. package/dist/components/stream/moduleWorkerSession.d.ts +67 -0
  110. package/dist/components/stream/networkTypes.d.ts +2 -0
  111. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
  112. package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
  113. package/dist/components/stream/pipelineIntroCancellation.d.ts +6 -0
  114. package/dist/components/stream/pipelineTransitions.d.ts +15 -1
  115. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +16 -4
  116. package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +4 -0
  117. package/dist/components/stream/symbolPath.d.ts +8 -0
  118. package/dist/components/stream/types.d.ts +2 -0
  119. package/dist/components/stream/useCanvasFrameHost.d.ts +6 -0
  120. package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
  121. package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -0
  122. package/dist/forceLayoutWorker.js +1 -1
  123. package/dist/geo.min.js +1 -1
  124. package/dist/geo.module.min.js +1 -1
  125. package/dist/network.min.js +1 -1
  126. package/dist/network.module.min.js +1 -1
  127. package/dist/ordinal.min.js +1 -1
  128. package/dist/ordinal.module.min.js +1 -1
  129. package/dist/physics.min.js +1 -1
  130. package/dist/physics.module.min.js +1 -1
  131. package/dist/physicsWorker.js +1 -1
  132. package/dist/processSankeyLayoutWorker.js +1 -0
  133. package/dist/realtime.min.js +1 -1
  134. package/dist/realtime.module.min.js +1 -1
  135. package/dist/semiotic-ai-core.min.js +1 -1
  136. package/dist/semiotic-ai-core.module.min.js +1 -1
  137. package/dist/semiotic-ai.min.js +1 -1
  138. package/dist/semiotic-ai.module.min.js +1 -1
  139. package/dist/semiotic-experimental-vacp.min.js +1 -1
  140. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  141. package/dist/semiotic-experimental.min.js +1 -1
  142. package/dist/semiotic-experimental.module.min.js +1 -1
  143. package/dist/semiotic-network.d.ts +2 -2
  144. package/dist/semiotic-realtime-core.min.js +1 -1
  145. package/dist/semiotic-realtime-core.module.min.js +1 -1
  146. package/dist/semiotic-recipes-core.d.ts +2 -0
  147. package/dist/semiotic-recipes-core.min.js +1 -1
  148. package/dist/semiotic-recipes-core.module.min.js +1 -1
  149. package/dist/semiotic-recipes.min.js +1 -1
  150. package/dist/semiotic-recipes.module.min.js +1 -1
  151. package/dist/semiotic-server-edge.min.js +1 -1
  152. package/dist/semiotic-server-edge.module.min.js +1 -1
  153. package/dist/semiotic-server-node.min.js +1 -1
  154. package/dist/semiotic-server-node.module.min.js +1 -1
  155. package/dist/semiotic-themes-core.module.min.js +1 -1
  156. package/dist/semiotic-themes-react.module.min.js +1 -1
  157. package/dist/semiotic-themes.module.min.js +1 -1
  158. package/dist/semiotic-utils-core.min.js +1 -1
  159. package/dist/semiotic-utils-core.module.min.js +1 -1
  160. package/dist/semiotic-utils-react.module.min.js +1 -1
  161. package/dist/semiotic-utils.min.js +1 -1
  162. package/dist/semiotic-utils.module.min.js +1 -1
  163. package/dist/semiotic-value.min.js +1 -1
  164. package/dist/semiotic-value.module.min.js +1 -1
  165. package/dist/semiotic.d.ts +2 -0
  166. package/dist/semiotic.min.js +1 -1
  167. package/dist/semiotic.module.min.js +1 -1
  168. package/dist/server.min.js +1 -1
  169. package/dist/server.module.min.js +1 -1
  170. package/dist/xy.min.js +1 -1
  171. package/dist/xy.module.min.js +1 -1
  172. package/package.json +4 -3
  173. package/dist/chunk-chunk-2YAZHXL4.module.min.js +0 -2
  174. package/dist/chunk-chunk-3NGIKFD6.module.min.js +0 -1
  175. package/dist/chunk-chunk-7TTBHSAG.module.min.js +0 -2
  176. package/dist/chunk-chunk-7ZDJSYKI.module.min.js +0 -2
  177. package/dist/chunk-chunk-BGHPD3RA.module.min.js +0 -1
  178. package/dist/chunk-chunk-BMRZ2SPU.module.min.js +0 -2
  179. package/dist/chunk-chunk-C7APLVQD.module.min.js +0 -2
  180. package/dist/chunk-chunk-DGWFBOGB.module.min.js +0 -1
  181. package/dist/chunk-chunk-DIVE2DRA.module.min.js +0 -2
  182. package/dist/chunk-chunk-DSNGDNJY.module.min.js +0 -1
  183. package/dist/chunk-chunk-FBUNUIPV.module.min.js +0 -2
  184. package/dist/chunk-chunk-G7QVPZUD.module.min.js +0 -2
  185. package/dist/chunk-chunk-GBPYV4FP.module.min.js +0 -2
  186. package/dist/chunk-chunk-KXAFCCDB.module.min.js +0 -2
  187. package/dist/chunk-chunk-LWITSR2O.module.min.js +0 -2
  188. package/dist/chunk-chunk-MX35T6RX.module.min.js +0 -2
  189. package/dist/chunk-chunk-NJETWX42.module.min.js +0 -2
  190. package/dist/chunk-chunk-NW25WGLS.module.min.js +0 -2
  191. package/dist/chunk-chunk-ONMLEXHR.module.min.js +0 -2
  192. package/dist/chunk-chunk-OY66GCE6.module.min.js +0 -1
  193. package/dist/chunk-chunk-PRDGLMJT.module.min.js +0 -2
  194. package/dist/chunk-chunk-PZFT457G.module.min.js +0 -1
  195. package/dist/chunk-chunk-Q3WW6JGR.module.min.js +0 -1
  196. package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +0 -1
  197. package/dist/chunk-chunk-RJRM2E6P.module.min.js +0 -1
  198. package/dist/chunk-chunk-RPL7WYXI.module.min.js +0 -1
  199. package/dist/chunk-chunk-V3OAKG32.module.min.js +0 -1
  200. package/dist/chunk-chunk-WCX6U47H.module.min.js +0 -2
  201. package/dist/chunk-chunk-WLOIUMWG.module.min.js +0 -2
  202. package/dist/chunk-chunk-XEGXX4F7.module.min.js +0 -1
  203. package/dist/chunk-chunk-XFRBLXYM.module.min.js +0 -1
  204. package/dist/chunk-chunk-ZXYDYAB7.module.min.js +0 -2
  205. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +0 -2
  206. package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +0 -2
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{buildRegressionAnnotation as e}from"./chunk-chunk-YCQYG6J5.module.min.js";import{mergeShapeStyle as t,normalizePartialMargin as o,useChartSetup as n,useCustomChartSetup as i,useFrameImperativeHandle as r,useResolvedSelection as a}from"./chunk-chunk-VUWYT7DY.module.min.js";import{validateArrayData as s}from"./chunk-chunk-J5QD4RAM.module.min.js";import{StreamXYFrame_default as l}from"./chunk-chunk-JRHXQGEV.module.min.js";import{normalizeColorGradient as c,normalizeGradient as h,normalizeSemanticGradient as d,reverseGradient as u}from"./chunk-chunk-57RBPDBQ.module.min.js";import{accessorName as m,bandTooltipFields as p,buildBaseMetadataProps as y,buildCustomBehaviorProps as f,buildDefaultTooltip as g,buildTooltipProps as b}from"./chunk-chunk-H5IFO6CU.module.min.js";import{useCustomLayoutSelection as x}from"./chunk-chunk-5UKL5W76.module.min.js";import{makeXYRuleContext as v,resolveStyleRules as A}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as w,DEFAULT_COLOR as k,DEFAULT_COLORS as S,DEFAULT_SELECTION_OPACITY as C,LinkedCharts as L,MultiPointTooltip as H,composeLegendConfigs as _,defaultTooltipStyle as R,filterSparseArray as I,getColor as B,getCrosshairProps as F,getSequentialInterpolator as P,getSize as N,interpolateViridis as M,normalizeLinkedBrush as O,normalizeTooltip as W,resolveDefaultFill as D,resolveMobileInteraction as E,resolveXYAxisChrome as T,useBrushSelection as G,useChartLegendAndMargin as j,useChartMode as z,useChartSelection as V,useColorScale as $,useLegendInteraction as Q,useSelection as Y,useSelectionSelector as X,useThemeCategorical as q,useThemeSequential as U,wrapStyleWithSelection as J}from"./chunk-chunk-HCNDE26Q.module.min.js";import{getMax as K,getMinMax as Z}from"./chunk-chunk-2NVFEB7P.module.min.js";import{useTheme as ee}from"./chunk-chunk-PMR47KRY.module.min.js";import{ChartError as te,SafeRender as oe,renderEmptyState as ne,renderLoadingState as ie,warnMissingField as re}from"./chunk-chunk-ACLDBMRH.module.min.js";import*as ae from"react";import{useMemo as se,useCallback as le,forwardRef as ce,useRef as he}from"react";import{useMemo as de}from"react";function ue(e){const{colorBy:o,colorScale:n,color:i,pointRadius:r=5,radiusFn:a,fillOpacity:s=1,fallbackFill:l,baseStyleExtras:c,stroke:h,strokeWidth:d,opacity:u,effectiveSelectionHook:m,resolvedSelection:p,colorDatumAccessor:y,styleRules:f,ruleContext:g}=e,b=de(()=>e=>{const t="function"==typeof c?c(e):c,h=t?{...t}:{};if(void 0===h.fillOpacity&&(h.fillOpacity=s),void 0===h.fill)if(o){if(n){const t=y?y(e):e;h.fill=B(t,o,n)}}else h.fill=l?l(e):i||k;return void 0===h.r&&(h.r=a?a(e):r),f&&f.length>0&&Object.assign(h,A(e,f,g?g(e):{value:void 0})),h},[o,n,i,r,a,s,l,c,y,f,g]),x=de(()=>t(b,{stroke:h,strokeWidth:d,opacity:u}),[b,h,d,u]);return de(()=>J(x,m??null,p),[x,m,p])}import{useCallback as me,useMemo as pe,useRef as ye,useState as fe}from"react";function ge(e){const{accessor:t,data:o,isPushMode:n}=e,i=ye(null),[r,a]=fe(0),s=me(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=me(()=>{n&&(i.current=null,a(e=>e+1))},[n]);return{domain:pe(()=>{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 be,useMemo as xe,useRef as ve,useState as Ae}from"react";var we="__forecastSegment",ke=null;async function Se(){return ke||(ke=await import("./chunk-statisticalOverlays-HMYYSGPE.module.min.js")),ke}var Ce="__semiotic_resolvedX",Le="__semiotic_resolvedY";function He(e){const{data:t,xAccessor:o,yAccessor:n,forecast:i,anomaly:r,groupBy:a}=e,s="string"==typeof o?o:Ce,l="string"==typeof n?n:Le,c=xe(()=>{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[Ce]=o(t)),a&&(i[Le]=n(t)),i}):t},[t,i,r,o,n]),[h,d]=Ae(null),[u,m]=Ae([]),p=ve(i),y=ve(r);return be(()=>{if(!i&&!r)return void((p.current||y.current)&&(d(null),m([]),p.current=i,y.current=r));let e=!1;const t=i!==p.current||r!==y.current;if(p.current=i,y.current=r,t&&(d(null),m([])),i){const t=a&&"string"==typeof a&&"object"==typeof i?{...i,_groupBy:a}:i;(async function(...e){return(await Se()).buildForecast(...e)})(c,s,l,t,r).then(t=>{e||(d(t),m(t.annotations))}).catch(()=>{e||(d(null),m([]))})}else r&&async function(...e){return(await Se()).buildAnomalyAnnotations(...e)}(r).then(t=>{e||(d(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[c,i,r,s,l,a]),{effectiveData:h?h.processedData:t,statisticalAnnotations:u,hasForecast:!!h,xAccessorKey:s,yAccessorKey:l}}import{jsx as _e}from"react/jsx-runtime";var Re=ce(function(t,o){const i=he(null),a=z(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules}),{data:c,margin:h,className:d,xFormat:u,yFormat:p,xAccessor:x="x",yAccessor:A="y",xScaleType:w,yScaleType:k,colorBy:S,colorScheme:C,styleRules:L,sizeBy:H,sizeRange:_=[3,15],symbolBy:R,symbolMap:B,pointRadius:F=5,pointOpacity:P=.8,tooltip:M,marginalGraphics:W,pointIdAccessor:D,annotations:E,regression:j,forecast:V,anomaly:$,xExtent:Q,yExtent:Y,frameProps:X={},selection:q,linkedHover:U,linkedBrush:J,onObservation:K,onClick:Z,hoverHighlight:ee,chartId:ne,loading:ie,loadingContent:ce,emptyContent:de,legendInteraction:me,legendPosition:pe,color:ye,stroke:fe,strokeWidth:be,opacity:xe}=t,{width:ve,height:Ae,enableHover:we,showGrid:ke,showLegend:Se,title:Ce,description:Le,summary:Re,accessibleTable:Ie,xLabel:Be,yLabel:Fe}=a,Pe=se(()=>I(c),[c]),Ne=void 0===c,{domain:Me,trackPushed:Oe,reset:We}=ge({accessor:H,data:Pe,isPushMode:Ne}),De=le(e=>{Oe([e]),i.current?.push(e)},[Oe]),Ee=le(e=>{Oe(e),i.current?.pushMany(e)},[Oe]);r(o,{variant:"xy",frameRef:i,overrides:{push:De,pushMany:Ee,clear:()=>{We(),i.current?.clear()}}});const Te=n({data:Pe,rawData:c,colorBy:S,colorScheme:C,legendInteraction:me,legendPosition:pe,selection:q,linkedHover:U,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:K,onClick:Z,hoverHighlight:ee,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"Scatterplot",chartId:ne,showLegend:Se,userMargin:h,marginDefaults:a.marginDefaults,loading:ie,loadingContent:ce,emptyContent:de,width:ve,height:Ae,hasTitle:!!Ce,axisChrome:T({showAxes:a.showAxes,xLabel:Be})}),Ge=O(J),je=G({name:Ge?.name||"__unused_brush__",xField:Ge?.xField||("string"==typeof x?x:void 0),yField:Ge?.yField||("string"==typeof A?A:void 0)}),ze=Ge?"xyBrush"===je.brushInteraction.brush?"xy":"xBrush"===je.brushInteraction.brush?"x":"y":void 0,Ve=ae.useRef(je.brushInteraction);Ve.current=je.brushInteraction;const $e=le(e=>{const t=Ve.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)},[]);re("Scatterplot",Pe,"xAccessor",x),re("Scatterplot",Pe,"yAccessor",A);const Qe=se(()=>H?Me??[0,1]:void 0,[H,Me]),Ye=se(()=>H?e=>N(e,H,_,Qe):void 0,[H,_,Qe]),Xe=se(()=>v(x,A),[x,A]),qe=ue({colorBy:S,colorScale:Te.colorScale,color:ye,pointRadius:F,fillOpacity:P,radiusFn:Ye,stroke:fe,strokeWidth:be,opacity:xe,styleRules:L,ruleContext:Xe,effectiveSelectionHook:Te.effectiveSelectionHook,resolvedSelection:Te.resolvedSelection}),Ue=se(()=>g([{label:Be||m(x),accessor:x,role:"x",format:u},{label:Fe||m(A),accessor:A,role:"y",format:p},...S?[{label:m(S),accessor:S,role:"color"}]:[],...H?[{label:m(H),accessor:H,role:"size"}]:[]]),[x,A,Be,Fe,S,H,u,p]),{effectiveData:Je,statisticalAnnotations:Ke}=He({data:Pe,xAccessor:x,yAccessor:A,forecast:V,anomaly:$}),Ze=se(()=>{const t=e(j);return t||0!==Ke.length?[...t?[t]:[],...E||[],...Ke]:E},[j,E,Ke]);if(Te.earlyReturn)return Te.earlyReturn;const et=s({componentName:"Scatterplot",data:c,accessors:{xAccessor:x,yAccessor:A}});if(et)return _e(te,{componentName:"Scatterplot",message:et,width:ve,height:Ae});const tt={chartType:"scatter",...null!=c&&{data:Je},xAccessor:x,yAccessor:A,xScaleType:w,yScaleType:k,colorAccessor:S||void 0,sizeAccessor:H||void 0,...R&&{symbolAccessor:R},...B&&{symbolMap:B},sizeRange:_,pointStyle:qe,colorScheme:C,size:[ve,Ae],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Te.margin,showAxes:a.showAxes,xLabel:Be,yLabel:Fe,xFormat:u,yFormat:p,enableHover:we,showGrid:ke,...Te.legendBehaviorProps,...y({title:Ce,description:Le,summary:Re,accessibleTable:Ie,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations}),...b({tooltip:M,defaultTooltipContent:Ue}),...f({linkedHover:U,selection:q,onObservation:K,onClick:Z,hoverHighlight:ee,mobileInteraction:Te.mobileInteraction,customHoverBehavior:Te.customHoverBehavior,customClickBehavior:Te.customClickBehavior}),...W&&{marginalGraphics:W},...D&&{pointIdAccessor:D},...Ze&&Ze.length>0&&{annotations:Ze},...Q&&{xExtent:Q},...Y&&{yExtent:Y},...Ge&&{brush:{dimension:ze},onBrush:$e},...Te.crosshairProps,...X};return _e(oe,{componentName:"Scatterplot",width:ve,height:Ae,children:_e(l,{ref:i,...tt})})});Re.displayName="Scatterplot";import{useMemo as Ie,forwardRef as Be,useRef as Fe}from"react";import{Fragment as Pe,jsx as Ne}from"react/jsx-runtime";function Me(e,t){return M(1===t?.5:e/(t-1))}var Oe=Be(function(t,o){const i=Fe(null);r(o,{variant:"xy",frameRef:i});const a=z(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules}),{data:c,margin:h,className:d,xFormat:u,yFormat:p,xAccessor:x="x",yAccessor:A="y",orderAccessor:w,orderLabel:k,styleRules:S,pointRadius:L=4,tooltip:H,pointIdAccessor:_,annotations:R,regression:I,forecast:B,anomaly:F,xExtent:P,yExtent:N,frameProps:M={},selection:O,linkedHover:W,onObservation:D,onClick:E,hoverHighlight:G,chartId:j,loading:V,loadingContent:$,emptyContent:Q,legendInteraction:Y,stroke:X,strokeWidth:q,opacity:U}=t,{width:J,height:K,enableHover:Z,showGrid:ee,title:ne,description:ie,summary:ae,accessibleTable:se,xLabel:le,yLabel:ce}=a,{safeData:he,orderMap:de}=Ie(()=>{const e=c||[],t="function"==typeof x?x:e=>e[x],o="function"==typeof A?A:e=>e[A];let n=e;if(w&&e.length>0){const t="function"==typeof w?w:e=>e[w];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}},[c,w,x,A]);re("ConnectedScatterplot",he,"xAccessor",x),re("ConnectedScatterplot",he,"yAccessor",A);const me=n({data:he,rawData:c,colorBy:void 0,colorScheme:void 0,legendInteraction:Y,selection:O,linkedHover:W,fallbackFields:[],unwrapData:!1,onObservation:D,onClick:E,hoverHighlight:G,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ConnectedScatterplot",chartId:j,showLegend:void 0,userMargin:h,marginDefaults:a.marginDefaults,loading:V,loadingContent:$,emptyContent:Q,width:J,height:K,hasTitle:!!ne,axisChrome:T({showAxes:a.showAxes,xLabel:le})}),pe=me.resolvedSelection?.unselectedOpacity??C,ye=Ie(()=>(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=Me(t,a),h=!n||!i||i(s.datum??s)||i(l.datum??l),d=n?h?1:pe: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,pe]),fe=Ie(()=>[ye],[ye]),ge=Ie(()=>(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=Me(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(Ne("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(Ne("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:s,strokeWidth:L,strokeLinecap:"round",opacity:l},"seg-"+e))}return Ne(Pe,{children:a})},[L]),be=Ie(()=>[ge],[ge]),xe=ue({colorScale:void 0,baseStyleExtras:Ie(()=>e=>{const t=de.get(e),o=t?.idx??0,n=t?.total??1;return{fill:n>0?Me(o,n):"#6366f1",stroke:"white",strokeWidth:1,r:L,fillOpacity:1}},[L,de]),stroke:X,strokeWidth:q,opacity:U,styleRules:S,ruleContext:Ie(()=>v(x,A),[x,A]),effectiveSelectionHook:me.effectiveSelectionHook,resolvedSelection:me.resolvedSelection}),ve=k||("string"==typeof w?w:"Order"),Ae=Ie(()=>g([{label:le||m(x),accessor:x,role:"x",format:u},{label:ce||m(A),accessor:A,role:"y",format:p},...w?[{label:ve,accessor:w,role:"group"}]:[]]),[x,A,le,ce,w,ve,u,p]),we=s({componentName:"ConnectedScatterplot",data:c,accessors:{xAccessor:x,yAccessor:A}}),{effectiveData:ke,statisticalAnnotations:Se}=He({data:he,xAccessor:x,yAccessor:A,forecast:B,anomaly:F});if(me.earlyReturn)return me.earlyReturn;const Ce=e(I),Le=Ce||Se.length>0?[...Ce?[Ce]:[],...R||[],...Se]:R,_e={chartType:"scatter",...null!=c&&{data:ke},xAccessor:x,yAccessor:A,pointStyle:xe,size:[J,K],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:me.margin,showAxes:a.showAxes,xLabel:le,yLabel:ce,xFormat:u,yFormat:p,enableHover:Z,showGrid:ee,...y({title:ne,description:ie,summary:ae,accessibleTable:se,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations}),...b({tooltip:H,defaultTooltipContent:Ae}),...f({linkedHover:W,selection:O,onObservation:D,onClick:E,hoverHighlight:G,mobileInteraction:me.mobileInteraction,customHoverBehavior:me.customHoverBehavior,customClickBehavior:me.customClickBehavior}),..._&&{pointIdAccessor:_},canvasPreRenderers:fe,svgPreRenderers:be,...Le&&Le.length>0&&{annotations:Le},...P&&{xExtent:P},...N&&{yExtent:N},...me.crosshairProps,...M};return we?Ne(te,{componentName:"ConnectedScatterplot",message:we,width:J,height:K}):Ne(oe,{componentName:"ConnectedScatterplot",width:J,height:K,children:Ne(l,{ref:i,..._e})})});Oe.displayName="ConnectedScatterplot";import{useMemo as We,useCallback as De,useState as Ee,useEffect as Te,forwardRef as Ge,useRef as je}from"react";import{useMemo as ze}from"react";function Ve(e){const{lineWidth:o=2,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:h,opacity:d,effectiveSelectionHook:u,resolvedSelection:m,styleRules:p,ruleContext:y}=e,f=ze(()=>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},u=!0===a||Array.isArray(a)&&null!=h&&a.includes(h);let m;return r?m=r(e,h):o?n&&(m=B(e,o,n)):m=i||k,void 0!==m&&(d.stroke=m,u&&(d.fill=m,d.fillOpacity=s)),l?.length&&Object.assign(d,A(e,l,c?c(e,h):{value:void 0,category:h})),d}}({lineWidth:o,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l,styleRules:p,ruleContext:y}),[o,n,i,r,a,s,l,p,y]),g=ze(()=>t(f,{stroke:c,strokeWidth:h,opacity:d}),[f,c,h,d]);return ze(()=>J(g,u??null,m),[g,u,m])}import{jsx as $e}from"react/jsx-runtime";var Qe="__lineObjectSeries",Ye=Ge(function(e,t){const o=je(null);r(t,{variant:"xy",frameRef:o});const i=z(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:a,margin:h,className:d,xFormat:u,yFormat:y,axisExtent:b,xAccessor:x="x",yAccessor:A="y",lineBy:w,lineDataAccessor:S="coordinates",colorBy:C,colorScheme:L,styleRules:R,curve:F="linear",showPoints:P=!1,pointRadius:N=3,fillArea:M=!1,areaOpacity:O=.3,lineWidth:D=2,lineGradient:E,tooltip:G,pointIdAccessor:j,annotations:V,directLabel:$,gapStrategy:Q="break",anomaly:Y,forecast:X,band:q,xExtent:U,yExtent:J,frameProps:K={},selection:Z,linkedHover:ee,onObservation:ne,onClick:ie,hoverHighlight:ae,hoverRadius:se,chartId:le,loading:ce,loadingContent:he,emptyContent:de,legendInteraction:ue,legendPosition:me,legend:pe,xScaleType:ye,yScaleType:fe,color:ge,stroke:be,strokeWidth:xe,opacity:ve}=e,{legend:Ae,...ke}=K,Ce=We(()=>_(Ae,pe),[Ae,pe]),{width:Le,height:_e,enableHover:Re,showGrid:Ie,showLegend:Be,title:Fe,description:Pe,summary:Ne,accessibleTable:Me,xLabel:Oe,yLabel:Ge}=i,ze=We(()=>I(a),[a]),Ye=Array.isArray(ze[0]?.[S])?ze[0][S]:ze;re("LineChart",Ye,"xAccessor",x),re("LineChart",Ye,"yAccessor",A);const{effectiveData:Xe,statisticalAnnotations:qe}=He({data:ze,xAccessor:x,yAccessor:A,forecast:X,anomaly:Y,groupBy:w}),Ue="__compoundGroup",Je=!(!X||!w),Ke=Je?Ue:X?we:w,Ze=We(()=>{if(!Je)return Xe;const e="function"==typeof w?w:e=>e[w];return Xe.map(t=>{const o={...t};return o[Ue]=`${e(t)}__${t[we]||"observed"}`,o})},[Xe,Je,w]),et=Je?Ze:Xe,tt=C||w,ot=We(()=>{if(!X)return;const e=X.upperBounds,t=X.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=Xe;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},[X,Xe,A]),nt=De(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]),it=void 0!==et[0]?.[S],rt=it?Qe:Ke,at=We(()=>{if(it)return et.map((e,t)=>{const o="function"==typeof w?w(e):"string"==typeof w?e[w]:void 0,n=null==o?"line-"+t:o+"",i=Array.isArray(e[S])?e[S]:[];return{...e,[Qe]:n,[S]:i.map(t=>({...t,[Qe]:n,parentLine:e,..."string"==typeof w&&void 0!==e[w]?{[w]:e[w]}:{}}))}});if(Ke){const e=et.reduce((e,t)=>{const o="function"==typeof Ke?Ke(t):t[Ke];if(!e[o]){const n={[S]:[]};"string"==typeof Ke&&(n[Ke]=o),Je&&(n[we]=t[we],"string"==typeof w&&(n[w]=t[w])),e[o]=n}return e[o][S].push(t),e},{});return Object.values(e)}return[{[S]:et}]},[it,Ke,S,et,w,Je]),{gapProcessedLineData:st,hasGaps:lt}=We(()=>{if("interpolate"===Q){let e=!1;const t=[];for(const o of at){const n=(o[S]||[]).filter(t=>!nt(t)||(e=!0,!1));n.length>0&&t.push({...o,[S]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===Q){let e=!1;const t=[];for(const o of at){const n=o[S]||[];let i=[],r=0;const a=rt&&"string"==typeof rt?o[rt]:void 0;for(const s of n)if(nt(s))e=!0,i.length>0&&(t.push({...o,[S]:i}),i=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;i.push({...s,_gapSegment:e})}i.length>0&&t.push({...o,[S]:i})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===Q){let e=!1;const t="string"==typeof A?A:"y",o=[];for(const n of at){const i=n[S]||[],r=[];for(const o of i)nt(o)?(e=!0,r.push({...o,[t]:0})):r.push(o);o.push({...n,[S]:r})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:at,hasGaps:!1}},[at,Q,S,nt,rt,A]),ct="object"==typeof $?$:{},ht=ct.position||"end",dt=ct.fontSize||11,ut=We(()=>{if(!$||!tt)return[];const e="function"==typeof tt?tt:e=>e[tt],t=new Set;for(const o of st){const n=o[S]||[];if(0===n.length)continue;const i=e("end"===ht?n[n.length-1]:n[0])??e(o);if(null==i)continue;const r=i+"";""!==r&&t.add(r)}return Array.from(t)},[$,tt,st,S,ht]),mt=We(()=>{if(!$)return i.marginDefaults;const e=ut.reduce((e,t)=>Math.max(e,t.length*(.6*dt)),0)+10,t="end"===ht?"right":"left";return{...i.marginDefaults,[t]:Math.max(i.marginDefaults[t]||0,e)}},[$,ut,dt,ht,i.marginDefaults]),pt=n({data:Xe,rawData:a,colorBy:tt,colorScheme:L,legendInteraction:ue,legendPosition:me,selection:Z,linkedHover:ee,fallbackFields:tt?["string"==typeof tt?tt:""]:[],unwrapData:!1,onObservation:ne,onClick:ie,hoverHighlight:ae,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"LineChart",chartId:le,showLegend:(!$||void 0!==Be)&&Be,legend:Ce,userMargin:h,marginDefaults:mt,loading:ce,loadingContent:he,emptyContent:de,width:Le,height:_e,hasTitle:!!Fe,axisChrome:T({showAxes:i.showAxes,xLabel:Oe})}),yt=pt.colorScale,ft=pt.effectiveSelectionHook,gt=pt.resolvedSelection,bt=pt.customHoverBehavior,xt=pt.customClickBehavior,vt=pt.crosshairProps,At=We(()=>{if(tt)return it?e=>{const t=e.parentLine||e;return"function"==typeof tt?tt(t):t[tt]}:tt},[tt,it]),wt=We(()=>v(x,A),[x,A]),kt=Ve({lineWidth:D,colorBy:At,colorScale:yt,color:ge,fillArea:M,areaOpacity:O,stroke:be,strokeWidth:xe,opacity:ve,effectiveSelectionHook:ft,resolvedSelection:gt,styleRules:R,ruleContext:wt}),[St,Ct]=Ee(null);Te(()=>{if(!X)return void Ct(null);let e=!1;return async function(...e){return(await Se()).createSegmentLineStyle(...e)}(kt,X).then(t=>{e||Ct(()=>t)}).catch(()=>{e||Ct(null)}),()=>{e=!0}},[kt,X]);const Lt=St||kt,Ht=We(()=>{if(P)return e=>{const t={r:N,fillOpacity:1};return tt?yt&&(t.fill=B(e.parentLine||e,tt,yt)):t.fill=ge||k,t}},[P,N,tt,yt,ge]),_t=Array.isArray(M)?"mixed":M?"area":"line",Rt=We(()=>{if(!$||!tt)return[];const e="function"==typeof x?x:e=>e[x],t="function"==typeof A?A:e=>e[A],o="function"==typeof tt?tt:e=>e[tt],n=new Map;for(const e of st){const t=e[S]||[];if(0===t.length)continue;const i="end"===ht?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"===ht?6:-6,dy:0,color:yt?yt(o):k,fontSize:dt}));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];dt+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=dt+2)}return i},[$,tt,yt,st,S,x,A,ht,dt]),It=pt.margin,Bt=w||C,Ft=We(()=>g([{label:Oe||m(x),accessor:x,role:"x",format:u},{label:Ge||m(A),accessor:A,role:"y",format:y},...Bt?[{label:m(Bt),accessor:Bt,role:"group"}]:[],...p(q,y)]),[x,A,Oe,Ge,Bt,u,y,q]),Pt=s({componentName:"LineChart",data:it?Xe[0]?.[S]||[]:a,accessors:{xAccessor:x,yAccessor:A}}),Nt=We(()=>it||rt||lt?st.flatMap(e=>{const t=e[S]||[];return rt&&"string"==typeof rt?t.map(t=>({...t,[rt]:t[rt]??e[rt]})):t}):et,[st,S,it,rt,et,lt]),Mt=c(E),Ot={chartType:_t,...Array.isArray(M)&&{areaGroups:M},...Mt&&{lineGradient:Mt},...null!=a&&{data:Nt},xAccessor:x,yAccessor:A,xScaleType:ye,yScaleType:fe,...U&&{xExtent:U},...!J||null==J[0]&&null==J[1]?ot?{yExtent:ot}:{}:{yExtent:J},groupAccessor:"break"===Q&&lt?"_gapSegment":rt||void 0,...q&&{band:q},curve:F,lineStyle:Lt,...P&&{pointStyle:Ht},size:[Le,_e],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:It,showAxes:i.showAxes,xLabel:Oe,yLabel:Ge,xFormat:u,yFormat:y,...void 0!==b&&{axisExtent:b},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:Re,showGrid:Ie,...pt.legendBehaviorProps,...Fe&&{title:Fe},...Pe&&{description:Pe},...Ne&&{summary:Ne},...void 0!==Me&&{accessibleTable:Me},...d&&{className:d},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===G?()=>null:"multi"===G?H():W(G)||Ft,..."multi"===G&&{tooltipMode:"multi"},...f({linkedHover:ee,selection:Z,onObservation:ne,onClick:ie,hoverRadius:se,hoverHighlight:ae,mobileInteraction:pt.mobileInteraction,customHoverBehavior:bt,customClickBehavior:xt}),...j&&{pointIdAccessor:j},...(V?.length||qe.length||Rt.length)&&{annotations:[...V||[],...qe,...Rt]},...vt,...ke};return pt.earlyReturn?pt.earlyReturn:Pt?$e(te,{componentName:"LineChart",message:Pt,width:Le,height:_e}):$e(oe,{componentName:"LineChart",width:Le,height:_e,children:$e(l,{ref:o,...Ot})})});Ye.displayName="LineChart";import{forwardRef as Xe,useMemo as qe}from"react";import{jsx as Ue}from"react/jsx-runtime";var Je=Xe(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:a,xExtent:s,yExtent:c,showAxes:h=!1,margin:d,className:u,annotations:m,onObservation:p,onClick:g,selection:b,linkedHover:x,hoverHighlight:v,chartId:A,loading:w,loadingContent:k,emptyContent:S,colorBy:C,colorScheme:L,legend:H,legendInteraction:R,legendPosition:I,frameProps:B={}}=e,{legend:F,...P}=B,N=qe(()=>_(F,H),[F,H]),{frameRef:M,resolved:O,safeData:W,setup:D,earlyReturn:E}=i({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:C,colorScheme:L,legend:N,legendInteraction:R,legendPosition:I,selection:b,linkedHover:x,hoverHighlight:v,onObservation:p,onClick:g,chartId:A,loading:w,loadingContent:k,emptyContent:S,margin:d,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}),T=D.effectiveSelectionHook,G=qe(()=>T?.isActive?{isActive:!0,predicate:T.predicate}:null,[T?.isActive,T?.predicate]);if(E)return E;const{width:j,height:z,enableHover:V,showGrid:$,title:Q,description:Y,summary:X,accessibleTable:q,xLabel:U,yLabel:J}=O,K={chartType:"custom",...null!=o&&{data:W},customLayout:n,layoutConfig:r,onLayoutError:a,...G&&{layoutSelection:G},xExtent:s,yExtent:c,colorAccessor:C,colorScheme:L,size:[j,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:D.margin,showAxes:h,xLabel:U,yLabel:J,enableHover:V,showGrid:$,...D.legendBehaviorProps,...y({title:Q,description:Y,summary:X,accessibleTable:q,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...f({linkedHover:x,selection:b,onObservation:p,onClick:g,hoverRadius:e.hoverRadius,hoverHighlight:v,mobileInteraction:D.mobileInteraction,customHoverBehavior:D.customHoverBehavior,customClickBehavior:D.customClickBehavior}),...m&&m.length>0&&{annotations:m},...D.crosshairProps,...P};return Ue(oe,{componentName:"XYCustomChart",width:j,height:z,children:Ue(l,{ref:M,...K})})});Je.displayName="XYCustomChart";import{forwardRef as Ke,useCallback as Ze,useMemo as et}from"react";function tt(e,t,o,n,i){const r=1-i;return r*r*r*e+3*r*r*i*t+3*r*i*i*o+i*i*i*n}function ot(e,t,o,n,i){const r=1-i;return 3*r*r*(t-e)+6*r*i*(o-t)+3*i*i*(n-o)}function nt(e,t,o,n,i){const r=[],a=(e.x+t.x)/2;for(let s=0;i>=s;s++){const l=s/i;let c,h,d,u;"linear"===n?(c=e.x+(t.x-e.x)*l,h=e.y+(t.y-e.y)*l,d=t.x-e.x,u=t.y-e.y):(c=tt(e.x,a,a,t.x,l),h=tt(e.y,e.y,t.y,t.y,l),d=ot(e.x,a,a,t.x,l),u=ot(e.y,e.y,t.y,t.y,l)),r.push({x:c,y:h,dx:d,dy:u,radius:e.radius+(t.radius-e.radius)*l,datumIndex:.5>l?o:o+1})}return r}function it(e,t={}){const o=[],n=[],i=[];if(2>e.length)return{topPath:o,bottomPath:n,datumIndices:i};const r=t.curve??"smooth",a=Math.max(2,Math.floor(t.samplesPerSegment??12));for(let t=0;e.length-1>t;t++){const s=nt(e[t],e[t+1],t,r,a);for(let e=0===t?0:1;s.length>e;e++){const t=s[e],r=Math.hypot(t.dx,t.dy)||1,a=-t.dy/r,l=t.dx/r,c=Math.max(0,t.radius);o.push([t.x+a*c,t.y+l*c]),n.push([t.x-a*c,t.y-l*c]),i.push(t.datumIndex)}}return{topPath:o,bottomPath:n,datumIndices:i}}import{jsx as rt,jsxs as at}from"react/jsx-runtime";function st(e,t,o){return"function"==typeof e?e(t,o):t[e]}function lt(e){return e instanceof Date?"date:"+e.getTime():`${typeof e}:${e+""}`}function ct(e,t={}){const o=t.xAccessor??"x",n=t.yAccessor??"y",i=t.lineBy??"series",r=t.rankDirection??"descending",a=[],s=new Map,l=new Map,c=[],h=new Map;let d=1/0,u=-1/0;e.forEach((e,t)=>{const r=st(o,e,t),m=lt(r);let p=s.get(m);null==p&&(p=a.length,s.set(m,p),a.push(r),l.set(p,[]));const y=st(i,e,t)+"";h.has(y)||(h.set(y,c.length),c.push(y));const f=Number(st(n,e,t));Number.isFinite(f)&&(d=Math.min(d,f),u=Math.max(u,f),l.get(p)?.push({datum:e,inputIndex:t,series:y,value:f}))});const m=[],p=new Map,y=new Map;for(let e=0;a.length>e;e++){const t=l.get(e)??[];t.sort((e,t)=>("descending"===r?t.value-e.value:e.value-t.value)||(h.get(e.series)??0)-(h.get(t.series)??0)),t.forEach((t,o)=>{const n=o+1;m.push({datum:t.datum,xIndex:e,xValue:a[e],series:t.series,value:t.value,rank:n}),p.set(t.series,(p.get(t.series)??0)+n),y.set(t.series,(y.get(t.series)??0)+1)})}const f=c.length+1,g=[...c].sort((e,t)=>{const o=y.get(e)??0,n=y.get(t)??0;return((p.get(e)??0)+(a.length-o)*f)/Math.max(1,a.length)-((p.get(t)??0)+(a.length-n)*f)/Math.max(1,a.length)||(h.get(e)??0)-(h.get(t)??0)}),b=new Set(g.slice(0,null==t.highlightTop?g.length:Math.max(0,Math.floor(t.highlightTop))));return{data:m.map(e=>{const t=b.has(e.series);return{...e.datum,x:e.xIndex,y:e.rank,__bumpRaw:e.datum,__bumpSeries:e.series,__bumpColorGroup:t?e.series:"Other",__bumpValue:e.value,__bumpRank:e.rank,__bumpXValue:e.xValue,__bumpHighlighted:t}}),xValues:a,seriesOrder:c,overallOrder:g,valueExtent:d===1/0?[0,0]:[d,u]}}function ht({datum:e,x:t,y:o,side:n,color:i,highlighted:r,labelStyle:a}){const s=x(),l=s.isActive&&!s.predicate(e),c="function"==typeof a?a(e.__bumpRaw):a;return rt("text",{className:"semiotic-bump-label",x:t+("end"===n?8:-8),y:o,dy:"0.35em",textAnchor:"end"===n?"start":"end",fill:i,fillOpacity:l?.16:1,fontWeight:r?650:450,fontSize:12,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-axis-label-font-size, 12px)",...c},children:e.__bumpSeries})}function dt(e,t,o){const[n,i]=t,[r,a]=o;return i===n?(r+a)/2:r+(a-r)*Math.max(0,Math.min(1,(e-n)/(i-n)))}function ut(e){const t=e instanceof Date?e.getTime():Number(e);return Number.isFinite(t)?t:void 0}function mt(e){return{value:e.__bumpValue,x:ut(e.__bumpXValue),y:e.__bumpValue,category:e.__bumpSeries}}function pt(e){const t=e.config,o=new Map;for(const t of e.data){const e=o.get(t.__bumpSeries)??[];e.push(t),o.set(t.__bumpSeries,e)}const n=t.seriesOrder.filter(e=>o.has(e)).sort((e,n)=>(o.get(e)?.[0]?.__bumpHighlighted?1:0)-(o.get(n)?.[0]?.__bumpHighlighted?1:0)||t.seriesOrder.indexOf(e)-t.seriesOrder.indexOf(n)),i=[],r=[];for(const a of n){const n=(o.get(a)??[]).sort((e,t)=>e.x-t.x);if(2>n.length)continue;const s=n[0].__bumpHighlighted,l=e.resolveColor(n[0].__bumpSeries,n[0]),c=t.color??(s?l:t.neutralColor??e.theme.semantic.textSecondary??e.theme.semantic.border??l),h=n.map(o=>({x:e.scales.x(o.x),y:e.scales.y(o.y),radius:t.ribbon?dt(o.__bumpValue,t.valueExtent,t.ribbonSizeRange)/2:Math.max(.5,t.lineWidth/2)})),d=it(h,{curve:t.curve,samplesPerSegment:t.samplesPerSegment}),u=d.datumIndices.map(e=>n[e]),m={fill:c,fillOpacity:1,opacity:s?t.ribbon?t.ribbonOpacity:t.lineOpacity:Math.min(t.ribbon?t.ribbonOpacity:t.lineOpacity,.58)};t.styleRules?.length&&Object.assign(m,A(n[0].__bumpRaw,t.styleRules,mt(n[0]))),t.areaStyle&&Object.assign(m,t.areaStyle(n[0].__bumpRaw)??{}),void 0!==t.stroke&&(m.stroke=t.stroke),void 0!==t.strokeWidth&&(m.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(m.opacity=t.opacity),i.push({type:"area",topPath:d.topPath,bottomPath:d.bottomPath,style:m,datum:u,accessibleDatum:n.map(e=>e.__bumpRaw),accessibility:{label:a+" ranking trajectory",tableFields:n.map(e=>e.__bumpRaw)},group:a,interactive:!0}),t.showPoints&&n.forEach((e,o)=>{const n={fill:c,stroke:"none",opacity:s?1:.75};t.styleRules?.length&&Object.assign(n,A(e.__bumpRaw,t.styleRules,mt(e))),t.pointStyle&&Object.assign(n,t.pointStyle(e.__bumpRaw)??{}),void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),i.push({type:"point",x:h[o].x,y:h[o].y,r:n.r??t.pointRadius,style:n,datum:e,accessibleDatum:e.__bumpRaw,accessibility:{label:`${a}, rank ${e.__bumpRank}, value ${e.__bumpValue}`},pointId:`${a}:${e.x}`})});const p=!0===t.showLabels?"end":t.showLabels,y=(e,o,n)=>{r.push(rt(ht,{datum:e,x:h[o].x,y:h[o].y,side:n,color:"string"==typeof m.fill?m.fill:c,highlighted:s,labelStyle:t.labelStyle},`${a}-${n}`))};"start"!==p&&"both"!==p||y(n[0],0,"start"),"end"!==p&&"both"!==p||y(n.at(-1),n.length-1,"end")}return{nodes:i,overlays:r.length?rt("g",{className:"semiotic-bump-labels",children:r}):void 0,restyle:(e,t)=>{const o=function(e){const t=Array.isArray(e.datum)?e.datum[0]:e.datum;return t&&"object"==typeof t&&"__bumpSeries"in t?t:void 0}(e);if(t?.isActive&&o&&!t.predicate(o))return{opacity:.14}}}}var yt=Ke(function(e,t){const o=q(),n=ee(),{data:i,xAccessor:r,yAccessor:a,lineBy:s,rankDirection:l="descending",ribbon:c=!1,curve:h="smooth",ribbonSizeRange:d=[4,28],samplesPerSegment:u=12,lineWidth:m=3,highlightTop:p,neutralColor:y,styleRules:f,labelStyle:g,colorScheme:b,ribbonOpacity:x=.82,lineOpacity:v=.9,showPoints:A=!1,pointRadius:w=3,showLabels:k=!0,showAxes:S=!0,showGrid:C=!0,showLegend:L=!1,enableHover:H=!0,hoverHighlight:_=!0,tooltip:I,frameProps:B={},xFormat:F,yFormat:P,onClick:N}=e,M=et(()=>ct(i,{xAccessor:r,yAccessor:a,lineBy:s,rankDirection:l,highlightTop:p}),[i,r,a,s,l,p]),{axes:O,areaStyle:E,pointStyle:T,...G}=B,j=et(()=>function(e){const{seriesOrder:t,overallOrder:o,highlightTop:n,color:i,colorScheme:r,neutralColor:a,themeCategorical:s,themeNeutral:l}=e;if(null==n&&null==i)return r;const c=new Set(o.slice(0,null==n?o.length:Math.max(0,Math.floor(n)))),h=new Map,d={};for(const e of t)d[e]=i??(c.has(e)?D(void 0,s,r,e,h):a??l??"#b8bec8");return d}({seriesOrder:M.seriesOrder,overallOrder:M.overallOrder,highlightTop:p,color:e.color,colorScheme:b,neutralColor:y,themeCategorical:o,themeNeutral:n.colors.textSecondary}),[M.seriesOrder,M.overallOrder,p,e.color,b,y,o,n.colors.textSecondary]),z=et(()=>({ribbon:c,curve:h,samplesPerSegment:u,ribbonSizeRange:d,valueExtent:M.valueExtent,seriesOrder:M.seriesOrder,lineWidth:m,ribbonOpacity:x,lineOpacity:v,neutralColor:y,color:e.color,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity,styleRules:f,areaStyle:E,pointStyle:T,labelStyle:g,showPoints:A,pointRadius:w,showLabels:k}),[c,h,u,d,M.valueExtent,M.seriesOrder,m,x,v,y,e.color,e.stroke,e.strokeWidth,e.opacity,f,E,T,g,A,w,k]),V=Ze((e,t)=>{if(0===M.xValues.length)return"";const o=M.xValues[Math.max(0,Math.min(M.xValues.length-1,Math.round(Number(e))))];return F?F(o,t):(o instanceof Date?o.toLocaleDateString():o)+""},[M.xValues,F]),$=Ze(e=>P?P(e):e.toLocaleString(),[P]),Q=et(()=>"multi"===I?void 0:W(I),[I]),Y=Ze(e=>{const t=e?.data??e;return t?!1===I?null:Q?Q({...e,data:t.__bumpRaw,__semioticHoverData:!0}):at("div",{className:"semiotic-tooltip",style:R,children:[rt("div",{style:{fontWeight:700},children:t.__bumpSeries}),at("div",{children:[V(t.x)," · Rank ",t.__bumpRank]}),at("div",{children:["Value: ",$(t.__bumpValue)]})]}):null},[$,V,Q,I]),X=et(()=>{if(N)return(e,t)=>{N(e.__bumpRaw??e,t)}},[N]),U=Math.max(1,M.seriesOrder.length),J=M.xValues.map((e,t)=>t),K=Array.from({length:U},(e,t)=>t+1),Z=O??[{orient:"left",tickValues:K,tickFormat:e=>e+"",label:e.yLabel??"Rank",baseline:!1},{orient:"bottom",tickValues:J,tickFormat:V,label:e.xLabel,tickAnchor:"edges"}],te=et(()=>function(e,t){if(!e?.length)return;const o=new Map(t.map((e,t)=>[lt(e),t]));return e.map(e=>{const t={...e},n=n=>{if(!(n in e))return;const i=o.get(lt(e[n]));void 0!==i&&(t[n]=i)};return n("x"),n("x0"),n("x1"),"string"!=typeof e.type||"x-threshold"!==e.type&&"x"!==e.type||n("value"),t})}(e.annotations,M.xValues),[e.annotations,M.xValues]);return rt(Je,{ref:t,data:M.data,layout:pt,layoutConfig:z,xExtent:[0,Math.max(1,M.xValues.length-1)],yExtent:[U+.5,.5],showAxes:S,showGrid:C,showLegend:L,enableHover:H,hoverHighlight:_,colorBy:"__bumpSeries",colorScheme:j,tooltip:Y,onClick:X,hoverRadius:e.hoverRadius,width:e.width,height:e.height,responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,responsiveRules:e.responsiveRules,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,mode:e.mode,margin:e.margin??{top:20,right:k?110:24,bottom:48,left:48},className:e.className,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,selection:e.selection,linkedHover:e.linkedHover,legend:e.legend,legendInteraction:e.legendInteraction,legendPosition:e.legendPosition,onObservation:e.onObservation,chartId:e.chartId,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations,annotations:te,xLabel:e.xLabel,yLabel:e.yLabel??"Rank",frameProps:{axes:Z,axisExtent:"exact",...G}})});yt.displayName="BumpChart";import{useMemo as ft,forwardRef as gt,useRef as bt}from"react";import{useMemo as xt}from"react";function vt(e){const{safeData:o,data:n,areaBy:i,lineDataAccessor:r,colorBy:a,colorScale:s,color:l,stroke:c,strokeWidth:h,opacity:d,effectiveSelectionHook:u,resolvedSelection:y,areaOpacity:f,showLine:b,lineWidth:x,showPoints:v,pointRadius:w,xAccessor:S,yAccessor:C,xLabel:L,yLabel:H,xFormat:_,yFormat:R,groupField:I,styleRules:F,ruleContext:P}=e,N=xt(()=>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:o,areaBy:i,lineDataAccessor:r}),[n,o,i,r]),M=xt(()=>e=>{const t={};if(a){if(s){const o=B(e,a,s);t.fill=o,b?(t.stroke=o,t.strokeWidth=x):t.stroke="none"}}else{const e=l||k;t.fill=e,b?(t.stroke=e,t.strokeWidth=x):t.stroke="none"}return t.fillOpacity=f,F&&F.length>0&&Object.assign(t,A(e,F,P?P(e):{value:void 0})),t},[a,s,l,f,b,x,F,P]),O=xt(()=>t(M,{stroke:c,strokeWidth:h,opacity:d}),[M,c,h,d]);return{flattenedData:N,lineStyle:xt(()=>J(O,u??null,y),[O,u,y]),pointStyle:xt(()=>{if(v)return e=>{const t={r:w,fillOpacity:1};return a?s&&(t.fill=B(e.parentLine||e,a,s)):t.fill=l||k,t}},[v,w,a,s,l]),defaultTooltipContent:xt(()=>g([{label:L||m(S),accessor:S,role:"x",format:_},{label:H||m(C),accessor:C,role:"y",format:R},...I?[{label:m(I),accessor:I,role:"group"}]:[],...p(e.band,R)]),[S,C,L,H,I,_,R,e.band])}}import{jsx as At}from"react/jsx-runtime";var wt=gt(function(e,t){const o=bt(null);r(t,{variant:"xy",frameRef:o});const i=z(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:a,margin:m,className:p,xFormat:g,yFormat:x,xAccessor:A="x",yAccessor:w="y",areaBy:k,y0Accessor:S,gradientFill:C=!1,semanticGradient:L,semanticLine:_=!0,lineDataAccessor:R="coordinates",colorBy:B,colorScheme:F,styleRules:P,curve:N="monotoneX",areaOpacity:M=.7,lineGradient:O,showLine:W=!0,lineWidth:D=2,showPoints:E=!1,pointRadius:G=3,tooltip:j,annotations:V,forecast:$,anomaly:Q,band:Y,xExtent:X,yExtent:q,frameProps:U={},selection:J,linkedHover:K,onObservation:Z,onClick:ee,hoverHighlight:ne,chartId:ie,loading:ae,loadingContent:se,emptyContent:le,legendInteraction:ce,legendPosition:he,color:de,stroke:ue,strokeWidth:me,opacity:pe}=e,{width:ye,height:fe,enableHover:ge,showGrid:be,showLegend:xe,title:ve,description:Ae,summary:we,accessibleTable:ke,xLabel:Se,yLabel:Ce}=i,Le=ft(()=>I(a),[a]),_e=B||k,Re=ft(()=>d(L),[L]),Ie=ft(()=>Re?.stops.length?u(Re):h(C),[Re,C]),Be=ft(()=>c(O),[O]),Fe=ft(()=>_&&Re?.stops.length?Re.stops.flatMap(({offset:e,color:t})=>t?[{offset:e,color:t}]:[]):void 0,[Re,_]);re("AreaChart",Le,"xAccessor",A),re("AreaChart",Le,"yAccessor",w);const Pe=n({data:Le,rawData:a,colorBy:_e,colorScheme:F,legendInteraction:ce,legendPosition:he,selection:J,linkedHover:K,fallbackFields:_e?["string"==typeof _e?_e:""]:[],unwrapData:!1,onObservation:Z,onClick:ee,hoverHighlight:ne,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"AreaChart",chartId:ie,showLegend:xe,userMargin:m,marginDefaults:i.marginDefaults,loading:ae,loadingContent:se,emptyContent:le,width:ye,height:fe,hasTitle:!!ve,axisChrome:T({showAxes:i.showAxes,xLabel:Se})}),{effectiveData:Ne,statisticalAnnotations:Me}=He({data:Le,xAccessor:A,yAccessor:w,forecast:$,anomaly:Q,groupBy:k}),Oe=ft(()=>v(A,w),[A,w]),{flattenedData:We,lineStyle:De,pointStyle:Ee,defaultTooltipContent:Te}=vt({safeData:Ne,data:a,areaBy:k,lineDataAccessor:R,colorBy:_e,colorScale:Pe.colorScale,color:de,stroke:ue,strokeWidth:me,opacity:pe,effectiveSelectionHook:Pe.effectiveSelectionHook,resolvedSelection:Pe.resolvedSelection,areaOpacity:M,showLine:W,lineWidth:D,showPoints:E,pointRadius:G,xAccessor:A,yAccessor:w,xLabel:Se,yLabel:Ce,xFormat:g,yFormat:x,groupField:k||B,band:Y,styleRules:P,ruleContext:Oe}),Ge=s({componentName:"AreaChart",data:a,accessors:{xAccessor:A,yAccessor:w}}),je={chartType:"area",...null!=a&&{data:We},xAccessor:A,yAccessor:w,groupAccessor:k||void 0,...S&&{y0Accessor:S},...Y&&{band:Y},...Ie&&{gradientFill:Ie},...Be&&{lineGradient:Be},...Fe&&{semanticLineStops:Fe},curve:N,lineStyle:De,...E&&Ee&&{pointStyle:Ee},size:[ye,fe],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Pe.margin,showAxes:i.showAxes,xLabel:Se,yLabel:Ce,xFormat:g,yFormat:x,enableHover:ge,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:be,...Pe.legendBehaviorProps,...y({title:ve,description:Ae,summary:we,accessibleTable:ke,className:p,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===j?{tooltipContent:H(),tooltipMode:"multi"}:b({tooltip:j,defaultTooltipContent:Te}),...f({linkedHover:K,selection:J,onObservation:Z,onClick:ee,hoverHighlight:ne,mobileInteraction:Pe.mobileInteraction,customHoverBehavior:Pe.customHoverBehavior,customClickBehavior:Pe.customClickBehavior}),...(V&&V.length>0||Me.length>0)&&{annotations:[...V||[],...Me]},...X&&{xExtent:X},...q&&{yExtent:q},...Pe.crosshairProps,...U};return Pe.earlyReturn?Pe.earlyReturn:Ge?At(te,{componentName:"AreaChart",message:Ge,width:ye,height:fe}):At(oe,{componentName:"AreaChart",width:ye,height:fe,children:At(l,{ref:o,...je})})});wt.displayName="AreaChart";import{useMemo as kt,forwardRef as St,useRef as Ct,useState as Lt,useImperativeHandle as Ht,useCallback as _t}from"react";import{jsx as Rt,jsxs as It}from"react/jsx-runtime";function Bt(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 Ft=St(function(e,t){const o=Ct(null),i=z(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:d,xAccessor:u="x",seriesAAccessor:m="a",seriesBAccessor:p="b",seriesALabel:g="A",seriesBLabel:b="B",seriesAColor:x="var(--semiotic-danger, #dc2626)",seriesBColor:v="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:w=1.5,showPoints:k=!1,pointRadius:S=3,curve:C="linear",areaOpacity:L=.6,gradientFill:H,tooltip:_,annotations:B,xExtent:F,yExtent:P,frameProps:N={},selection:M,linkedHover:O,onObservation:D,onClick:E,hoverHighlight:G,chartId:j,loading:V,loadingContent:$,emptyContent:Q,legendInteraction:Y,legendPosition:X,pointIdAccessor:q,windowSize:U}=e,{width:J,height:K,enableHover:Z,showGrid:ee,showLegend:te,title:ne,description:ie,summary:re,accessibleTable:ae,xLabel:se,yLabel:le}=i,ce=kt(()=>"function"==typeof u?e=>Bt(u(e)):e=>Bt(e[u]),[u]),he=kt(()=>"function"==typeof m?e=>Bt(m(e)):e=>Bt(e[m]),[m]),de=kt(()=>"function"==typeof p?e=>Bt(p(e)):e=>Bt(e[p]),[p]),[ue,me]=Lt([]),pe=Ct([]),ye=null==r,fe=kt(()=>I(ye?ue:r),[ye,ue,r]),ge=kt(()=>function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let a=0,s=null,l=null,c=[];const h=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,u=e=>r.push(e),m=(e,t)=>{u({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],p=t(r),y=o(r),f=n(r);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(f))continue;const g=h(y,f);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=y-l.a-(f-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*(y-l.a)}else e=l.x,t=l.a}u({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=g,u({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)m(c[e],s)}else for(const e of c)m(e,s);c=[],u({__x:p,__y:f>y?f:y,__y0:f>y?y:f,__diffSegment:d(s),__diffWinner:s,__valA:y,__valB:f,__sourceDatum:r}),l={x:p,a:y,b:f,w:g}}else{s=g;for(const e of c)m(e,s);c=[],u({__x:p,__y:f>y?f:y,__y0:f>y?y:f,__diffSegment:d(s),__diffWinner:s,__valA:y,__valB:f,__sourceDatum:r}),l={x:p,a:y,b:f,w:g}}else c.push({x:p,y:y,datum:r})}for(const e of c)m(e,s??"A");return r}(fe,ce,he,de),[fe,ce,he,de]),be=kt(()=>A?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}(fe,ce,he,de):[],[A,fe,ce,he,de]),xe=kt(()=>[...ge,...be],[ge,be]),ve=kt(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);Ht(t,()=>{const e=e=>{const t=U&&e.length>U?e.slice(e.length-U):e;pe.current=t,me(t)},t=q?"function"==typeof q?q:e=>e[q]:null;return{push:t=>e([...pe.current,t]),pushMany:t=>e([...pe.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of pe.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=pe.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:()=>ye?pe.current:fe,getScales:()=>o.current?.getScales()??null}},[ye,fe,q,U]);const Ae=n({data:fe,rawData:r,colorBy:"__diffWinner",colorScheme:[x,v],legendInteraction:Y,legendPosition:X,selection:M,linkedHover:O,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:D,onClick:E,hoverHighlight:G,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"DifferenceChart",chartId:j,showLegend:te,userMargin:a,marginDefaults:i.marginDefaults,loading:V,loadingContent:$,emptyContent:Q,width:J,height:K,hasTitle:!!ne,axisChrome:T({showAxes:i.showAxes,xLabel:se})}),we=kt(()=>{if(!1!==te)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:g,color:x},{label:b,color:v}]}]}},[te,g,b,x,v]),ke=_t(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?x:v,stroke:"none",fillOpacity:L}},[x,v,L]),Se=_t(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?x:v,strokeWidth:w,fill:"none"}),[x,v,w]),Ce=_t(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?x:v,r:S}),[x,v,S]),Le=_t(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=fe.find(e=>ce(e)===n);e&&(null==i&&(i=he(e)),null==r&&(r=de(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",s=c&&null!=n?c(n):null!=n?n+"":"";return It("div",{className:"semiotic-tooltip",style:R,children:[s&&Rt("div",{style:{fontWeight:600,marginBottom:4},children:s}),It("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Rt("span",{style:{width:10,height:10,background:x,display:"inline-block",borderRadius:2}}),It("span",{children:[g,": ",a(i)]})]}),It("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Rt("span",{style:{width:10,height:10,background:v,display:"inline-block",borderRadius:2}}),It("span",{children:[b,": ",a(r)]})]}),null!=i&&null!=r&&Number.isFinite(i)&&Number.isFinite(r)&&It("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(i-r)]})]})},[fe,ce,he,de,c,x,v,g,b]),He="multi"===_,_e=kt(()=>!1===_?()=>null:He?Le:W(_)||Le,[_,He,Le]),Re=kt(()=>h(H,{stops:[{offset:0,opacity:.85},{offset:1,opacity:.15}]}),[H]);if(Ae.earlyReturn)return Ae.earlyReturn;const Ie={chartType:"mixed",data:xe,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ve,curve:C,areaStyle:ke,lineStyle:Se,...k&&{pointStyle:Ce},size:[J,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ae.margin,showAxes:i.showAxes,xLabel:se,yLabel:le,xFormat:c,yFormat:d,enableHover:Z,showGrid:ee,...Re&&{gradientFill:Re},...we&&{legend:we,legendPosition:Ae.legendPosition},...y({title:ne,description:ie,summary:re,accessibleTable:ae,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:_e,...He&&{tooltipMode:"multi"},...f({linkedHover:O,selection:M,onObservation:D,onClick:E,hoverHighlight:G,mobileInteraction:Ae.mobileInteraction,customHoverBehavior:Ae.customHoverBehavior,customClickBehavior:Ae.customClickBehavior}),...B&&B.length>0&&{annotations:B},...F&&{xExtent:F},...P&&{yExtent:P},...Ae.crosshairProps,...N};return Rt(oe,{componentName:"DifferenceChart",width:J,height:K,children:Rt(l,{ref:o,...Ie})})});"function"==typeof Ft&&(Ft.displayName="DifferenceChart");import{useMemo as Pt,forwardRef as Nt,useRef as Mt}from"react";import{jsx as Ot}from"react/jsx-runtime";var Wt=Nt(function(e,t){const o=Mt(null),i=z(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:a,margin:c,className:h,xFormat:d,yFormat:u,xAccessor:m="x",yAccessor:p="y",areaBy:g,lineDataAccessor:x="coordinates",colorBy:A,colorScheme:w,styleRules:k,curve:S="monotoneX",areaOpacity:C=.7,showLine:L=!0,lineWidth:_=2,showPoints:R=!1,pointRadius:B=3,normalize:F=!1,baseline:P="zero",stackOrder:N,tooltip:M,annotations:O,xExtent:W,yExtent:D,frameProps:E={},selection:G,linkedHover:j,onObservation:V,onClick:$,hoverHighlight:Q,chartId:Y,loading:X,loadingContent:q,emptyContent:U,legendInteraction:J,legendPosition:K,color:Z,stroke:ee,strokeWidth:ne,opacity:ie}=e,{width:re,height:ae,enableHover:se,showGrid:le,showLegend:ce,title:he,description:de,summary:ue,accessibleTable:me,xLabel:pe,yLabel:ye}=i,fe=Pt(()=>I(a),[a]),ge=A||g;r(t,{variant:"xy",frameRef:o});const be=n({data:fe,rawData:a,colorBy:ge,colorScheme:w,legendInteraction:J,legendPosition:K,selection:G,linkedHover:j,fallbackFields:ge?["string"==typeof ge?ge:""]:[],unwrapData:!1,onObservation:V,onClick:$,hoverHighlight:Q,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"StackedAreaChart",chartId:Y,showLegend:ce,userMargin:c,marginDefaults:i.marginDefaults,loading:X,loadingContent:q,emptyContent:U,width:re,height:ae,hasTitle:!!he,axisChrome:T({showAxes:i.showAxes,xLabel:pe})}),xe=Pt(()=>v(m,p),[m,p]),{flattenedData:ve,lineStyle:Ae,pointStyle:we,defaultTooltipContent:ke}=vt({safeData:fe,data:a,areaBy:g,lineDataAccessor:x,colorBy:ge,colorScale:be.colorScale,color:Z,stroke:ee,strokeWidth:ne,opacity:ie,effectiveSelectionHook:be.effectiveSelectionHook,resolvedSelection:be.resolvedSelection,areaOpacity:C,showLine:L,lineWidth:_,showPoints:R,pointRadius:B,xAccessor:m,yAccessor:p,xLabel:pe,yLabel:ye,xFormat:d,yFormat:u,groupField:g||A,styleRules:k,ruleContext:xe}),Se=s({componentName:"StackedAreaChart",data:a,accessors:{xAccessor:m,yAccessor:p}}),Ce={chartType:"stackedarea",...null!=a&&{data:ve},xAccessor:m,yAccessor:p,groupAccessor:g||void 0,curve:S,normalize:F,baseline:F?"zero":P,stackOrder:N,lineStyle:Ae,...R&&we&&{pointStyle:we},size:[re,ae],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be.margin,showAxes:i.showAxes,xLabel:pe,yLabel:ye,xFormat:d,yFormat:u,enableHover:se,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:le,...be.legendBehaviorProps,...y({title:he,description:de,summary:ue,accessibleTable:me,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:H(),tooltipMode:"multi"}:b({tooltip:M,defaultTooltipContent:ke}),...f({linkedHover:j,selection:G,onObservation:V,onClick:$,hoverHighlight:Q,mobileInteraction:be.mobileInteraction,customHoverBehavior:be.customHoverBehavior,customClickBehavior:be.customClickBehavior}),...O&&O.length>0&&{annotations:O},...W&&{xExtent:W},...D&&{yExtent:D},...be.crosshairProps,...E};return be.earlyReturn?be.earlyReturn:Se?Ot(te,{componentName:"StackedAreaChart",message:Se,width:re,height:ae}):Ot(oe,{componentName:"StackedAreaChart",width:re,height:ae,children:Ot(l,{ref:o,...Ce})})});Wt.displayName="StackedAreaChart";import{useMemo as Dt,forwardRef as Et,useRef as Tt}from"react";import{scaleSequential as Gt}from"d3-scale";import{jsx as jt}from"react/jsx-runtime";var zt=Et(function(e,t){const o=Tt(null);r(t,{variant:"xy",frameRef:o});const n=z(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:i,margin:c,className:h,xAccessor:d="x",yAccessor:u="y",valueAccessor:p="value",xFormat:x,yFormat:v,colorScheme:A,customColorScale:w,showValues:k=!1,valueFormat:S,cellBorderColor:C="#fff",cellBorderWidth:L=1,tooltip:H,annotations:_,xExtent:R,yExtent:B,frameProps:N={},selection:M,linkedHover:O,onObservation:W,onClick:D,hoverHighlight:E,chartId:T,loading:G,loadingContent:$,emptyContent:Y,showLegend:X,legendPosition:q,legend:J,legendInteraction:K}=e,{width:ee,height:re,enableHover:ae,title:se,description:le,summary:ce,accessibleTable:he,xLabel:de,yLabel:ue}=n,me=ie(G,ee,re,$),pe=me?null:ne(i,ee,re,Y),ye=Dt(()=>I(i),[i]),fe=U(),ge=A??fe??"blues",be=X??!1,xe=q??"right",{customHoverBehavior:ve,customClickBehavior:Ae,crosshairSourceId:we}=V({selection:M,linkedHover:O,fallbackFields:[],onObservation:W,onClick:D,chartType:"Heatmap",chartId:T,hoverHighlight:E,colorByField:void 0,mobileInteraction:n.mobileInteraction});a(M);const ke=F(O,we);Q(K,void 0,[]);const Se=Dt(()=>"function"==typeof p?e=>p(e):e=>e[p],[p]),Ce=Dt(()=>{const e=ye.map(Se);return Z(e)},[ye,Se]),Le=Dt(()=>{if("custom"===ge&&w)return w;const e=P(ge);return Gt(e).domain(Ce)},[ge,w,Ce]),He=Dt(()=>{const e=Number.isFinite(L)?Math.max(0,L):1;return()=>({stroke:C,strokeWidth:e})},[C,L]),_e=Dt(()=>g([{label:de||m(d),accessor:d,role:"x",format:x},{label:ue||m(u),accessor:u,role:"y",format:v},{label:m(p),accessor:p,role:"value",format:S}]),[d,u,de,ue,p,x,v,S]),Re=s({componentName:"Heatmap",data:i,accessors:{xAccessor:d,yAccessor:u,valueAccessor:p}}),Ie=Dt(()=>{if(be)return{gradient:{colorFn:e=>Le(e),domain:Ce,label:"string"==typeof p?p:"value",format:S},legendDistance:J?.legendDistance}},[be,Le,Ce,p,S,J?.legendDistance]),{margin:Be}=j({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:xe,userMargin:c,defaults:n.marginDefaults,additionalLegend:Ie,chartWidth:ee,legendLayout:N.legendLayout,hasTitle:!!se,axisChrome:{hasAxis:!1!==n.showAxes,hasAxisLabel:!!de}}),Fe={chartType:"heatmap",...null!=i&&{data:ye},xAccessor:d,yAccessor:u,valueAccessor:p,colorScheme:"custom"!==ge?ge:void 0,areaStyle:He,showValues:k,heatmapValueFormat:S,size:[ee,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Be,showAxes:n.showAxes,xLabel:de,yLabel:ue,xFormat:x,yFormat:v,enableHover:ae,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Ie&&{legend:Ie,legendPosition:xe},...y({title:se,description:le,summary:ce,accessibleTable:he,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...b({tooltip:H,defaultTooltipContent:_e}),...f({linkedHover:O,selection:M,onObservation:W,onClick:D,hoverHighlight:E,mobileInteraction:n.mobileInteraction,customHoverBehavior:ve,customClickBehavior:Ae}),..._&&_.length>0&&{annotations:_},...R&&{xExtent:R},...B&&{yExtent:B},...ke,...N};return me||pe||(Re?jt(te,{componentName:"Heatmap",message:Re,width:ee,height:re}):jt(oe,{componentName:"Heatmap",width:ee,height:re,children:jt(l,{ref:o,...Fe})}))});zt.displayName="Heatmap";import{useMemo as Vt,useCallback as $t,forwardRef as Qt,useRef as Yt}from"react";import{jsx as Xt}from"react/jsx-runtime";var qt=Qt(function(t,o){const i=Yt(null),a=z(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules}),{data:c,margin:h,className:d,xFormat:u,yFormat:p,xAccessor:x="x",yAccessor:A="y",sizeBy:w,sizeRange:k=[5,40],colorBy:S,colorScheme:C,styleRules:L,bubbleOpacity:H=.6,bubbleStrokeWidth:_=1,bubbleStrokeColor:R="white",tooltip:B,marginalGraphics:F,pointIdAccessor:P,annotations:M,regression:W,xExtent:D,yExtent:E,frameProps:j={},selection:V,linkedHover:$,linkedBrush:Q,onObservation:Y,onClick:X,hoverHighlight:q,chartId:U,loading:J,loadingContent:K,emptyContent:Z,legendInteraction:ee,legendPosition:ne,color:ie,stroke:re,strokeWidth:ae,opacity:se}=t,{width:le,height:ce,enableHover:he,showGrid:de,showLegend:me,title:pe,description:ye,summary:fe,accessibleTable:be,xLabel:xe,yLabel:ve}=a,Ae=Vt(()=>I(c),[c]),we=void 0===c,ke=n({data:Ae,rawData:c,colorBy:S,colorScheme:C,legendInteraction:ee,legendPosition:ne,selection:V,linkedHover:$,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:Y,onClick:X,hoverHighlight:q,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"BubbleChart",chartId:U,showLegend:me,userMargin:h,marginDefaults:a.marginDefaults,loading:J,loadingContent:K,emptyContent:Z,width:le,height:ce,hasTitle:!!pe,axisChrome:T({showAxes:a.showAxes,xLabel:xe})}),{domain:Se,trackPushed:Ce,reset:Le}=ge({accessor:w,data:Ae,isPushMode:we}),He=$t(e=>{Ce([e]),i.current?.push(e)},[Ce]),_e=$t(e=>{Ce(e),i.current?.pushMany(e)},[Ce]);r(o,{variant:"xy",frameRef:i,overrides:{push:He,pushMany:_e,clear:()=>{Le(),i.current?.clear()}}});const Re=O(Q),Ie=(G({name:Re?.name||"__unused_brush__",xField:Re?.xField||("string"==typeof x?x:void 0),yField:Re?.yField||("string"==typeof A?A:void 0)}),Vt(()=>({stroke:R,strokeWidth:_}),[R,_])),Be=Vt(()=>Se??[0,1],[Se]),Fe=$t(e=>N(e,w,k,Be),[w,k,Be]),Pe=Vt(()=>v(x,A),[x,A]),Ne=ue({colorBy:S,colorScale:ke.colorScale,color:ie,fillOpacity:H,radiusFn:Fe,baseStyleExtras:Ie,stroke:re,strokeWidth:ae,opacity:se,styleRules:L,ruleContext:Pe,effectiveSelectionHook:ke.effectiveSelectionHook,resolvedSelection:ke.resolvedSelection}),Me=Vt(()=>g([{label:xe||m(x),accessor:x,role:"x",format:u},{label:ve||m(A),accessor:A,role:"y",format:p},{label:m(w),accessor:w,role:"size"},...S?[{label:m(S),accessor:S,role:"color"}]:[]]),[x,A,xe,ve,w,S,u,p]);if(ke.earlyReturn)return ke.earlyReturn;const Oe=s({componentName:"BubbleChart",data:c,accessors:{xAccessor:x,yAccessor:A},requiredProps:{sizeBy:w}});if(Oe)return Xt(te,{componentName:"BubbleChart",message:Oe,width:le,height:ce});const We=e(W),De=We?[We,...M||[]]:M,Ee={chartType:"bubble",...null!=c&&{data:Ae},xAccessor:x,yAccessor:A,colorAccessor:S||void 0,sizeAccessor:w,sizeRange:k,pointStyle:Ne,colorScheme:C,size:[le,ce],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ke.margin,showAxes:a.showAxes,xLabel:xe,yLabel:ve,xFormat:u,yFormat:p,enableHover:he,showGrid:de,...ke.legendBehaviorProps,...y({title:pe,description:ye,summary:fe,accessibleTable:be,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations}),...b({tooltip:B,defaultTooltipContent:Me}),...f({linkedHover:$,selection:V,onObservation:Y,onClick:X,hoverHighlight:q,mobileInteraction:ke.mobileInteraction,customHoverBehavior:ke.customHoverBehavior,customClickBehavior:ke.customClickBehavior}),...F&&{marginalGraphics:F},...P&&{pointIdAccessor:P},...De&&De.length>0&&{annotations:De},...D&&{xExtent:D},...E&&{yExtent:E},...ke.crosshairProps,...j};return Xt(oe,{componentName:"BubbleChart",width:le,height:ce,children:Xt(l,{ref:i,...Ee})})});qt.displayName="BubbleChart";import*as Ut from"react";import{useMemo as Jt,useCallback as Kt,useState as Zt,useRef as eo}from"react";import*as to from"react";import{jsx as oo}from"react/jsx-runtime";var no=null,io=null;function ro(e){const[t,o]=to.useState(()=>no);return to.useEffect(()=>{if(t)return;let e=!1;return(no?Promise.resolve(no):(io||(io=import("./chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js").then(e=>no=e.ScatterplotMatrixBrushOverlay).catch(e=>{throw io=null,e})),io)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?oo(t,{...e}):null}import{jsx as ao,jsxs as so}from"react/jsx-runtime";var lo="__splomIdx",co={top:4,bottom:4,left:4,right:4};function ho({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:m,onPointHover:p,onPointClick:y}){const g=eo(null),b=Y({name:c,clientId:`splom-${t}-${o}`,fields:[t,o]}),x=G({name:c,xField:t,yField:o}),v=Y({name:h,clientId:"splom-hover-source",fields:[lo]}),A=v.selectPoints,w=Kt(e=>{e?x.brushInteraction.during(e):x.brushInteraction.end(null)},[x.brushInteraction]),S=Kt(e=>{if(!e)return void p?.(null);const t=e.data,o=t?.[lo];void 0!==o&&(A({[lo]:[o]}),p?.(t,e.x+co.left,e.y+co.top))},[A,p]),C=Kt(e=>{if(!e)return void y?.(null);const t=e.data;t&&y?.(t,e.x+co.left,e.y+co.top)},[y]),L=Kt(e=>{const t={opacity:r,r:i};return t.fill=a?B(e,a,s):k,"hover"===m?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*i,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*r):b.isActive&&!b.predicate(e)&&(t.opacity=d),t},[r,i,a,m,s,v,b,d]);return so("div",{style:{position:"relative",width:n,height:n},children:[ao(l,{ref:g,chartType:"scatter",data:e,size:[n,n],xAccessor:t,yAccessor:o,pointStyle:L,margin:co,showAxes:!1,enableHover:"hover"===m,...f({forceHoverBehavior:"hover"===m,forceClickBehavior:!!y,mobileInteraction:u,customHoverBehavior:S,customClickBehavior:C}),tooltipContent:"hover"===m?()=>null:void 0}),"brush"===m&&ao(ro,{frameRef:g,cellSize:n,onBrush:w})]})}function uo({data:e,field:t,label:o,cellSize:n,bins:i,colorBy:r,colorScale:a,brushSelectionName:s,hoverSelectionName:l,mode:c}){const h=Y({name:s,clientId:"splom-diag-"+t,fields:[t]}),d=Y({name:l,clientId:`splom-diag-${t}-hover`,fields:[lo]}),u="hover"===c?d:h,m=u.isActive,p=u.predicate,y=Jt(()=>{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]=Z(a),h=(c-l)/i||1,d=Array.from(s),u=new Map(d.map((e,t)=>[e,t])),y=Array(i).fill(0),f=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(y[r]++,m&&!p(n)||f[r]++,o){const e=u.get(n[o]+"");void 0!==e&&(g[r][e]++,m&&!p(n)||b[r][e]++)}}const x=K(y,1),v=g.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/x*(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/x*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})});return{bars:y.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/x*(n-24),count:e})),selectedBars:f.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/x*(n-24),count:e})),categoryBars:v,selectedCategoryBars:A,max:x,categories:d}},[e,t,i,n,m,p,r]);return so("svg",{width:n,height:n,style:{overflow:"hidden"},children:[ao("text",{x:n/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,o)=>ao("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):k,opacity:m?.3:.6},`bg-${t}-${o}`))):y.bars.map((e,t)=>ao("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:k,opacity:m?.3:.6},"bg-"+t)),m&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,o)=>ao("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):k,opacity:.7},`sel-${t}-${o}`))):y.selectedBars.map((e,t)=>ao("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:k,opacity:.7},"sel-"+t)))]})}function mo({label:e,cellSize:t}){return ao("svg",{width:t,height:t,children:ao("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function po(e){const{data:t,fields:o,fieldLabels:n={},colorBy:i,colorScheme:r,cellSize:a=150,cellGap:s=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:h="histogram",histogramBins:d=20,brushMode:u="crossfilter",hoverMode:m=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:f,showLegend:g,idAccessor:b,width:x,className:v,onObservation:A,onClick:w,chartId:S}=e,C="splom",L="splom-hover",H=E(e.mobileInteraction,{mode:e.mode,width:x??o.length*a,mobileSemantics:e.mobileSemantics}),_=m?"hover":u?"brush":"hover",R=X(e=>e.clearSelection),[I,B]=Zt(null),F=Kt(()=>{R(L),B(null)},[R,L]),P=Jt(()=>(t||[]).map((e,t)=>void 0!==e[lo]?e:{...e,[lo]:t}),[t]),N=$(P,i,r),M=Kt((e,t,o,n)=>[40+e*(a+s)+(o??0),t*(a+s)+(n??0)],[40,a,s]),O=void 0!==g?g:!!i,W=Jt(()=>{if(!O||!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:N?N(e+""):k})):null},[O,i,P,N]),D=Jt(()=>({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 so("div",{className:v,style:{position:"relative"},children:[W&&ao("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:W.map(e=>so("div",{style:{display:"flex",alignItems:"center",gap:4},children:[ao("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),ao("span",{style:{fontSize:11},children:e.label})]},e.label))}),so("div",{style:D,onMouseLeave:"hover"===_?F:void 0,children:[o.map((e,t)=>so(Ut.Fragment,{children:[ao("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?ao(mo,{label:n[e]||e,cellSize:a},"diag-"+e):ao(uo,{data:P,field:e,label:n[e]||e,cellSize:a,bins:d,colorBy:i,colorScale:N,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,mode:_},"diag-"+e):ao(ho,{data:P,xField:o,yField:e,fieldLabels:n,cellSize:a,pointRadius:l,pointOpacity:c,colorBy:i,colorScale:N,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,showGrid:y,tooltip:f,mobileInteraction:H,mode:_,onPointHover:"hover"===_?(n,i,a)=>{if(n){if(B({datum:n,xField:o,yField:e,colIndex:r,rowIndex:t,px:i??0,py:a??0}),A){const[e,o]=M(r,t,i,a);A({type:"hover",datum:n,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else B(null),A&&A({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:w||A?(e,o,n)=>{if(!e)return;const[i,a]=M(r,t,o,n);w&&w(e,{x:i,y:a}),A&&A({type:"click",datum:e,x:i,y:a,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),ao("div",{})," ",o.map(e=>ao("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e},"col-label-"+e))]}),I&&"hover"===_&&(()=>{const e=I.datum,t=n[I.xField]||I.xField,o=n[I.yField]||I.yField,r=i?"function"==typeof i?i(e):e[i]:null,l=b?"function"==typeof b?b(e):e[b]:"Row "+e[lo];return so("div",{style:{position:"absolute",left:40+I.colIndex*(a+s)+I.px,top:I.rowIndex*(a+s)+I.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:[ao("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),so("div",{children:[t,": ",null!=e[I.xField]?Number(e[I.xField]).toFixed(1):"–"]}),so("div",{children:[o,": ",null!=e[I.yField]?Number(e[I.yField]).toFixed(1):"–"]}),null!=r&&so("div",{style:{opacity:.8},children:["string"==typeof i?i:"group",": ",r+""]})]})})()]})}function yo(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),ao(L,{selections:n,children:ao(po,{...e})})}yo.displayName="ScatterplotMatrix";import{useState as fo,useRef as go,useEffect as bo,useMemo as xo,useCallback as vo}from"react";import*as Ao from"react";import{jsx as wo}from"react/jsx-runtime";var ko=null,So=null;function Co(e){const[t,o]=Ao.useState(()=>ko);return Ao.useEffect(()=>{if(t)return;let e=!1;return(ko?Promise.resolve(ko):(So||(So=import("./chunk-minimapBrushOverlay-JU57U7NM.module.min.js").then(e=>ko=e.MinimapBrushOverlay).catch(e=>{throw So=null,e})),So)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?wo(t,{...e}):null}import{jsx as Lo,jsxs as Ho}from"react/jsx-runtime";function _o(e){const{data:t,width:o=600,height:n=400,margin:i,className:r,title:a,description:c,summary:h,xLabel:d,yLabel:u,xFormat:p,yFormat:y,xAccessor:f="x",yAccessor:b="y",lineBy:x,lineDataAccessor:v="coordinates",colorBy:A,colorScheme:w,curve:S="linear",lineWidth:C=2,fillArea:L=!1,areaOpacity:H=.3,showPoints:_=!1,pointRadius:R=3,enableHover:F=!0,showGrid:P=!1,showLegend:N,legendPosition:M,tooltip:O,minimap:D={},renderBefore:E=!1,onBrush:T,brushExtent:G,yExtent:z,frameProps:V={},loading:Q,loadingContent:Y,emptyContent:X}=e,q=ie(Q,o,n,Y),U=q?null:ne(t,o,n,X),J=xo(()=>I(t),[t]),[K,Z]=fo(null),ee=G??K,re=vo(e=>{G||Z(e),T?.(e)},[G,T]),ae=go(null),[se,le]=fo(null);bo(()=>{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)}},[t]);const ce=void 0!==J[0]?.[v],he=xo(()=>{if(ce)return J;if(x){const e=J.reduce((e,t)=>{const o="function"==typeof x?x(t):t[x];if(!e[o]){const t={[v]:[]};"string"==typeof x&&(t[x]=o),e[o]=t}return e[o][v].push(t),e},{});return Object.values(e)}return[{[v]:J}]},[J,x,v,ce]),de=xo(()=>ce||x?he.flatMap(e=>{const t=e[v]||[];return x&&"string"==typeof x?t.map(t=>({...t,[x]:e[x]})):t}):J,[he,v,ce,x,J]),ue=$(J,A,w),me=Ve({lineWidth:C,colorBy:A,colorScale:ue,fillArea:L,areaOpacity:H}),pe=xo(()=>{if(D.lineStyle)return D.lineStyle},[D.lineStyle]),ye=Ve({lineWidth:1,colorBy:A,colorScale:ue}),fe=pe??ye,ge=xo(()=>{if(_)return e=>{const t={r:R,fillOpacity:1};return t.fill=A?B(e.parentLine||e,A,ue):k,t}},[_,R,A,ue]),{legend:be,margin:xe,legendPosition:ve}=j({data:he,colorBy:A,colorScale:ue,showLegend:N,legendPosition:M,userMargin:i,chartWidth:o,hasTitle:!!a,axisChrome:{hasAxis:!0,hasAxisLabel:!!d}}),Ae=D.height||60,we=xo(()=>({top:D.margin?.top??0,bottom:D.margin?.bottom??20,left:D.margin?.left??xe.left,right:D.margin?.right??xe.right}),[D.margin,xe]),ke=D.brushDirection||"x",Se=xo(()=>g([{label:d||m(f),accessor:f,role:"x",format:p},{label:u||m(b),accessor:b,role:"y",format:y}]),[f,b,d,u,p,y]),Ce=s({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:b}});if(Ce)return Lo(te,{componentName:"MinimapChart",message:Ce,width:o,height:n});const Le=L?"area":"line",He={chartType:Le,data:de,xAccessor:f,yAccessor:b,groupAccessor:x||void 0,curve:S,lineStyle:me,..._&&{pointStyle:ge},size:[o,n],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe,showAxes:!0,xLabel:d,yLabel:u,xFormat:p,yFormat:y,enableHover:F,showGrid:P,...be&&{legend:be,legendPosition:ve},...a&&{title:a},...c&&{description:c},...h&&{summary:h},tooltipContent:!1===O?()=>null:W(O)||Se,...ee&&{xExtent:ee},...z&&{yExtent:z},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...V},_e={chartType:Le,data:de,xAccessor:f,yAccessor:b,groupAccessor:x||void 0,curve:S,lineStyle:fe,size:[o,Ae+we.top+we.bottom],margin:we,showAxes:D.showAxes??!1,background:D.background,enableHover:!1,...z&&{yExtent:z}},Re=Ho("div",{style:{position:"relative",width:o,overflow:"hidden"},children:[Lo(l,{ref:ae,..._e}),Lo(Co,{width:o-we.left-we.right,height:Ae,margin:we,scales:se,brushDirection:ke,extent:ee,onBrush:re})]},"minimap"),Ie=Lo("div",{style:{overflow:"hidden"},children:Lo(l,{...He})},"main");return q||U||Lo(oe,{componentName:"MinimapChart",width:o,height:n,children:Ho("div",{className:"minimap-chart"+(r?" "+r:""),children:[E?Re:Ie,E?Ie:Re]})})}_o.displayName="MinimapChart";import{useMemo as Ro,forwardRef as Io,useRef as Bo}from"react";var Fo={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 Po,jsx as No,jsxs as Mo}from"react/jsx-runtime";function Oo(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Wo=Io(function(e,t){const o=Bo(null);r(t,{variant:"xy",frameRef:o});const i=z(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:a,margin:c,className:h,xFormat:d,yFormat:u,xAccessor:p="x",yAccessor:y="y",xCenter:b,yCenter:x,quadrants:A,centerlineStyle:w={},showQuadrantLabels:S=!0,quadrantLabelSize:C=12,colorBy:L,colorScheme:H,styleRules:_,sizeBy:R,sizeRange:B=[3,15],pointRadius:F=5,pointOpacity:P=.8,tooltip:M,pointIdAccessor:O,annotations:D,frameProps:E={},selection:G,linkedHover:j,onObservation:V,onClick:$,hoverHighlight:Q,chartId:Y,loading:X,loadingContent:q,emptyContent:U,legendInteraction:J,legendPosition:K,color:ee,stroke:ne,strokeWidth:ie,opacity:ae}=e,{width:se,height:le,enableHover:ce,showGrid:he,showLegend:de,title:me,description:pe,summary:ye,accessibleTable:fe,xLabel:ge,yLabel:be}=i,xe=Ro(()=>({topLeft:Oo(Fo.topLeft,A?.topLeft),topRight:Oo(Fo.topRight,A?.topRight),bottomLeft:Oo(Fo.bottomLeft,A?.bottomLeft),bottomRight:Oo(Fo.bottomRight,A?.bottomRight)}),[A]),ve=Ro(()=>I(a),[a]),Ae=n({data:ve,rawData:a,colorBy:L,colorScheme:H,legendInteraction:J,legendPosition:K,selection:G,linkedHover:j,fallbackFields:"string"==typeof L?[L]:[],unwrapData:!1,onObservation:V,onClick:$,hoverHighlight:Q,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"QuadrantChart",chartId:Y,showLegend:de,userMargin:c,marginDefaults:i.marginDefaults,loading:X,loadingContent:q,emptyContent:U,width:se,height:le,hasTitle:!!me,axisChrome:T({showAxes:i.showAxes,xLabel:ge})});re("QuadrantChart",ve,"xAccessor",p),re("QuadrantChart",ve,"yAccessor",y);const we=Ro(()=>{if(!ve.length)return;const e="function"==typeof p?p:e=>+e[p],t="function"==typeof y?y:e=>+e[y];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!=b&&isFinite(b)&&(o>b&&(o=b),b>n&&(n=b)),null!=x&&isFinite(x)&&(i>x&&(i=x),x>r&&(r=x)),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,p,y,b,x]),ke=Ro(()=>{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?Z(e):void 0},[ve,R]),Se=Ro(()=>"function"==typeof p?p:e=>+e[p],[p]),Ce=Ro(()=>"function"==typeof y?y:e=>+e[y],[y]),Le=Ro(()=>e=>{const t=Se(e),o=Ce(e),n=null!=b?t>=b:void 0,i=null!=x?o>=x:void 0;return void 0===i||void 0===n?ee||k:i&&n?xe.topRight.color:i&&!n?xe.topLeft.color:!i&&n?xe.bottomRight.color:xe.bottomLeft.color},[Se,Ce,b,x,xe,ee]),He=Ro(()=>R?e=>N(e,R,B,ke):void 0,[R,B,ke]),_e=Ro(()=>v(p,y),[p,y]),Re=ue({colorBy:L,colorScale:Ae.colorScale,color:ee,pointRadius:F,fillOpacity:P,radiusFn:He,fallbackFill:Le,stroke:ne,strokeWidth:ie,opacity:ae,styleRules:_,ruleContext:_e,effectiveSelectionHook:Ae.effectiveSelectionHook,resolvedSelection:Ae.resolvedSelection}),Ie=Ro(()=>{if(!ve.length)return;const e=new Set;"string"==typeof p&&e.add(p),"string"==typeof y&&e.add(y),"string"==typeof L&&e.add(L),"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,p,y,L,R]),Be=Ro(()=>g([...Ie?[{label:Ie,accessor:Ie,role:"title"}]:[],{label:ge||m(p),accessor:p,role:"x",format:d},{label:be||m(y),accessor:y,role:"y",format:u},...L?[{label:m(L),accessor:L,role:"color"}]:[],...R?[{label:m(R),accessor:R,role:"size"}]:[]]),[Ie,p,y,ge,be,L,R,d,u]),Fe=s({componentName:"QuadrantChart",data:a,accessors:{xAccessor:p,yAccessor:y}}),Pe=Ro(()=>{const e={stroke:w.stroke||"#999",strokeWidth:w.strokeWidth??1,dashArray:w.strokeDasharray||[]};return[(t,o,n,i)=>{if(!n?.x||!n?.y)return;const r=i.width,a=i.height,s=null!=b?n.x(b):r/2,l=null!=x?n.y(x):a/2;if(null!=b&&!isFinite(s))return;if(null!=x&&!isFinite(l))return;const c=Math.max(0,Math.min(r,s)),h=Math.max(0,Math.min(a,l)),d=[{config:xe.topLeft,x:0,y:0,w:c,h:h},{config:xe.topRight,x:c,y:0,w:r-c,h:h},{config:xe.bottomLeft,x:0,y:h,w:c,h:a-h},{config:xe.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([])}]},[b,x,xe,w]),Ne=Ro(()=>S?[...Pe,(e,t,o,n)=>{if(!o?.x||!o?.y)return;const i=n.width,r=n.height,a=null!=b?o.x(b):i/2,s=null!=x?o.y(x):r/2;(null==b||isFinite(a))&&(null==x||isFinite(s))&&(e.font=`600 ${C}px sans-serif`,e.globalAlpha=.5,e.fillStyle=xe.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(xe.topLeft.label,8,8),e.fillStyle=xe.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(xe.topRight.label,i-8,8),e.fillStyle=xe.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(xe.bottomLeft.label,8,r-8),e.fillStyle=xe.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(xe.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:Pe,[Pe,S,C,xe,b,x]),Me=Ro(()=>{const e=E.canvasPreRenderers||[];return[...Ne,...e]},[Ne,E.canvasPreRenderers]),Oe=Ro(()=>{const e={stroke:w.stroke||"#999",strokeWidth:w.strokeWidth??1,dashArray:w.strokeDasharray?Array.isArray(w.strokeDasharray)?w.strokeDasharray.join(","):w.strokeDasharray:void 0};return[(t,o,n)=>{if(!o?.x||!o?.y)return null;const i=n.width,r=n.height,a=null!=b?o.x(b):i/2,s=null!=x?o.y(x):r/2;if(null!=b&&!isFinite(a))return null;if(null!=x&&!isFinite(s))return null;const l=Math.max(0,Math.min(i,a)),c=Math.max(0,Math.min(r,s));return Mo(Po,{children:[[{config:xe.topLeft,x:0,y:0,w:l,h:c},{config:xe.topRight,x:l,y:0,w:i-l,h:c},{config:xe.bottomLeft,x:0,y:c,w:l,h:r-c},{config:xe.bottomRight,x:l,y:c,w:i-l,h:r-c}].map((e,t)=>e.w>0&&e.h>0?No("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),No("line",{x1:l,y1:0,x2:l,y2:r,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),No("line",{x1:0,y1:c,x2:i,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),S&&Mo(Po,{children:[No("text",{x:8,y:8+C,fill:xe.topLeft.color,fontWeight:600,fontSize:C,opacity:.5,children:xe.topLeft.label}),No("text",{x:i-8,y:8+C,fill:xe.topRight.color,fontWeight:600,fontSize:C,opacity:.5,textAnchor:"end",children:xe.topRight.label}),No("text",{x:8,y:r-8,fill:xe.bottomLeft.color,fontWeight:600,fontSize:C,opacity:.5,children:xe.bottomLeft.label}),No("text",{x:i-8,y:r-8,fill:xe.bottomRight.color,fontWeight:600,fontSize:C,opacity:.5,textAnchor:"end",children:xe.bottomRight.label})]})]})}]},[b,x,xe,w,S,C]);if(Ae.earlyReturn)return Ae.earlyReturn;const We={chartType:"scatter",...null!=a&&{data:ve},xAccessor:p,yAccessor:y,colorAccessor:L||void 0,sizeAccessor:R||void 0,sizeRange:B,pointStyle:Re,colorScheme:H,size:[se,le],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ae.margin,showAxes:i.showAxes,xLabel:ge,yLabel:be,xFormat:d,yFormat:u,enableHover:ce,showGrid:he,...we&&{xExtent:we.xExtent,yExtent:we.yExtent},...Ae.legendBehaviorProps,...me&&{title:me},...pe&&{description:pe},...ye&&{summary:ye},...void 0!==fe&&{accessibleTable:fe},...h&&{className:h},...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?Be:W(M)||Be,...f({linkedHover:j,selection:G,onObservation:V,onClick:$,hoverHighlight:Q,mobileInteraction:Ae.mobileInteraction,customHoverBehavior:Ae.customHoverBehavior,customClickBehavior:Ae.customClickBehavior}),...O&&{pointIdAccessor:O},...D&&D.length>0&&{annotations:D},canvasPreRenderers:Me,...Ae.crosshairProps,...E,...Me.length>0&&{canvasPreRenderers:Me},svgPreRenderers:Oe};return Fe?No(te,{componentName:"QuadrantChart",message:Fe,width:se,height:le}):No(oe,{componentName:"QuadrantChart",width:se,height:le,children:No(l,{ref:o,...We})})});Wo.displayName="QuadrantChart";import*as Do from"react";import{useMemo as Eo,useCallback as To,forwardRef as Go,useRef as jo,useImperativeHandle as zo}from"react";import{jsx as Vo}from"react/jsx-runtime";var $o="__ma_unitized",Qo="__ma_series";function Yo(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Xo(e,t){return t[0]+e*(t[1]-t[0])}var qo=Go(function(e,t){const o=jo(null),i=jo([]),r=jo(e.series);r.current=e.series,zo(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!o.current)return;const n=e(),r=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],a=t.extent||i.current[e];if(!a)continue;const s=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(r);null!=s&&isFinite(s)&&o.current.push({...r,[$o]:Yo(s,a),[Qo]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!o.current)return;const n=e(),r=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const o=n[t],a=o.extent||i.current[t];if(!a)continue;const s=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=s&&isFinite(s)&&r.push({...e,[$o]:Yo(s,a),[Qo]:o.label||"Series "+(t+1)})}o.current.pushMany(r)},remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>o.current?.clear(),getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}},[]);const a=z(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:m="x",series:p,colorScheme:y,curve:g="monotoneX",lineWidth:b=2,tooltip:x,annotations:v,frameProps:A={},selection:k,linkedHover:C,onObservation:L,onClick:H,hoverHighlight:_,chartId:R,loading:B,loadingContent:F,emptyContent:P,legendInteraction:N,legendPosition:M,stroke:O,strokeWidth:D,opacity:E}=e,{width:G,height:j,enableHover:V,showGrid:$,showLegend:Q=!0,title:Y,description:X,summary:U,accessibleTable:J,xLabel:K}=a,Z=Eo(()=>I(c),[c]),ee=Eo(()=>I(p),[p]),re=ee,ae=2===ee.length,se=Eo(()=>ae?{...A.legendLayout,sideGutter:A.legendLayout?.sideGutter??70}:A.legendLayout,[A.legendLayout,ae]);"undefined"==typeof process||"production"===process.env?.NODE_ENV||ae||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${ee.length}. Rendering as a standard multi-line chart.`);const le=ie(B,G,j,F),ce=le?null:ne(c,G,j,P),he=q(),de=Eo(()=>{let e;if(Array.isArray(y))e=y;else if(he&&he.length>0)e=he;else{const t=w[y];e=Array.isArray(t)?t:S}return re.map((t,o)=>t.color||e[o%e.length])},[re,y,he]),ue=Eo(()=>ee.map((e,t)=>e.label||"Series "+(t+1)),[ee]),{unitizedData:me,extents:pe}=Eo(()=>{if(0===Z.length){const e=ee.map(e=>e.extent||null).filter(Boolean);return e.length===ee.length&&(i.current=e),{unitizedData:[],extents:e.length===ee.length?e:[]}}const e=ee.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]}(Z,e.yAccessor));if(i.current=e,!ae){const t=[];for(const e of Z)for(let o=0;ee.length>o;o++){const n=ee[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push({...e,[$o]:i,[Qo]:ue[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of Z)for(let n=0;2>n;n++){const i=ee[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push({...o,[$o]:Yo(r,e[n]),[Qo]:ue[n]})}return{unitizedData:t,extents:e}},[Z,ee,ae,ue]),ye=Eo(()=>{if(ae&&pe.length>=2)return[{orient:"left",label:ue[0],tickFormat:ee[0].format||(e=>{const t=Xo(e,pe[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:ue[1],tickFormat:ee[1].format||(e=>{const t=Xo(e,pe[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[ae,pe,ee,ue]),fe=Eo(()=>me.length>0?me:ue.map(e=>({[Qo]:e})),[me,ue]),ge=n({data:fe,rawData:c,colorBy:Qo,colorScheme:de,legendInteraction:N,legendPosition:M,selection:k,linkedHover:C,fallbackFields:[Qo],unwrapData:!1,onObservation:L,onClick:H,hoverHighlight:_,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"MultiAxisLineChart",chartId:R,showLegend:Q,legendLayout:se,userMargin:h,marginDefaults:ae?{...a.marginDefaults,left:70,right:70}:a.marginDefaults,loading:B,loadingContent:F,emptyContent:P,width:G,height:j,hasTitle:!!Y,axisChrome:T({showAxes:a.showAxes,xLabel:K})}),be=Eo(()=>{const e=new Map;return ue.forEach((t,o)=>e.set(t,de[o])),e},[ue,de]),xe=Ve({lineWidth:b,resolveStroke:To(e=>be.get(e[Qo])||de[0],[be,de]),stroke:O,strokeWidth:D,opacity:E,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection}),ve=Eo(()=>{if(!1===x)return()=>null;return W(x)||(e=>{const t=e.data||e,o=t[Qo],n=ue.indexOf(o),i=t[$o],r=ae&&n>=0&&pe[n]?Xo(i,pe[n]):i,a=n>=0&&ee[n]?.format?ee[n].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),s="function"==typeof m?m(t):t[m];return Do.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Do.createElement("div",{style:{fontWeight:600,marginBottom:4,color:de[n]||"inherit"}},o),Do.createElement("div",null,`${"string"==typeof m?m:"x"}: ${s}`),Do.createElement("div",null,`${o}: ${a(r)}`))})},[x,ue,de,pe,ae,ee,m]);if(ge.earlyReturn)return ge.earlyReturn;const Ae=s({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:m}}),we=ae?[0,1]:void 0,ke={chartType:"line",...null!=c&&{data:me},xAccessor:m,yAccessor:$o,groupAccessor:Qo,lineStyle:xe,colorScheme:de,size:[G,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ge.margin,showAxes:a.showAxes,...ye&&{axes:ye},xLabel:K,...ae?{}:{yLabel:ue[0]},xFormat:u,...ae&&we&&{yExtent:we},enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:$,curve:g,...ge.legendBehaviorProps,...Y&&{title:Y},...X&&{description:X},...U&&{summary:U},...void 0!==J&&{accessibleTable:J},...d&&{className:d},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:ve,...v&&{annotations:v},...f({linkedHover:C,selection:k,onObservation:L,onClick:H,hoverHighlight:_,mobileInteraction:ge.mobileInteraction,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior}),...ge.crosshairProps,...A,...se&&{legendLayout:se}};return le||ce||(Ae?Vo(te,{componentName:"MultiAxisLineChart",message:Ae,width:G,height:j}):Vo(oe,{componentName:"MultiAxisLineChart",width:G,height:j,children:Vo(l,{ref:o,...ke})}))});qo.displayName="MultiAxisLineChart";import{useMemo as Uo,forwardRef as Jo,useRef as Ko}from"react";import{jsx as Zo}from"react/jsx-runtime";var en=Jo(function(e,t){const n=Ko(null);r(t,{variant:"xy",frameRef:n});const i=z(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:a,margin:c,className:h,xFormat:d,yFormat:u,xAccessor:p="x",highAccessor:x="high",lowAccessor:v="low",openAccessor:A,closeAccessor:w,candlestickStyle:k,tooltip:S,annotations:C,xExtent:L,yExtent:H,frameProps:_={},selection:R,linkedHover:B,onObservation:P,onClick:N,chartId:M,loading:O,loadingContent:W,emptyContent:D}=e,{width:E,height:T,enableHover:G,showGrid:j,title:$,description:Q,summary:Y,accessibleTable:X,xLabel:q,yLabel:U}=i,J=ie(O,E,T,W),K=J?null:ne(a,E,T,D),Z=Uo(()=>I(a),[a]),ee=null==A||null==w;re("CandlestickChart",Z,"xAccessor",p),re("CandlestickChart",Z,"highAccessor",x),re("CandlestickChart",Z,"lowAccessor",v),ee||(re("CandlestickChart",Z,"openAccessor",A),re("CandlestickChart",Z,"closeAccessor",w));const{customHoverBehavior:ae,customClickBehavior:se,crosshairSourceId:le}=V({selection:R,linkedHover:B,onObservation:P,onClick:N,chartType:"CandlestickChart",chartId:M,mobileInteraction:i.mobileInteraction}),ce=F(B,le),he=Uo(()=>{const e=i.marginDefaults,t="sparkline"===i.mode?{...e,top:0,bottom:0}:e;return null==c?t:{...t,...o(c)}},[c,i.marginDefaults,i.mode]),de=Uo(()=>{const e=[{label:q||m(p),accessor:p,role:"x",format:d}];return ee?(e.push({label:"High",accessor:x,role:"y",format:u}),e.push({label:"Low",accessor:v,format:u})):(e.push({label:"Open",accessor:A,format:u}),e.push({label:"High",accessor:x,format:u}),e.push({label:"Low",accessor:v,format:u}),e.push({label:"Close",accessor:w,format:u})),g(e)},[p,q,d,u,x,v,A,w,ee]),ue=s({componentName:"CandlestickChart",data:a,accessors:{xAccessor:p,highAccessor:x,lowAccessor:v,...!ee&&{openAccessor:A,closeAccessor:w}}}),me={chartType:"candlestick",...null!=a&&{data:Z},xAccessor:p,yAccessor:x,highAccessor:x,lowAccessor:v,...!ee&&{openAccessor:A,closeAccessor:w},...k&&{candlestickStyle:k},scalePadding:Math.max(2,Math.min(12,Math.round(E/40))),extentPadding:E>200?.1:.02,size:[E,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he,showAxes:i.showAxes,xLabel:q,yLabel:U,xFormat:d,yFormat:u,enableHover:G,showGrid:j,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...y({title:$,description:Q,summary:Y,accessibleTable:X,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...b({tooltip:S,defaultTooltipContent:de}),...f({linkedHover:B,selection:R,onObservation:P,onClick:N,mobileInteraction:i.mobileInteraction,customHoverBehavior:ae,customClickBehavior:se}),...C&&C.length>0&&{annotations:C},...L&&{xExtent:L},...H&&{yExtent:H},...ce,..._};return J||K||(ue?Zo(te,{componentName:"CandlestickChart",message:ue,width:E,height:T}):Zo(oe,{componentName:"CandlestickChart",width:E,height:T,children:Zo(l,{ref:n,...me})}))});en.displayName="CandlestickChart";export{Re as Scatterplot,Oe as ConnectedScatterplot,Ye as LineChart,Je as XYCustomChart,ct as rankBumpData,yt as BumpChart,wt as AreaChart,Ft as DifferenceChart,Wt as StackedAreaChart,zt as Heatmap,qt as BubbleChart,yo as ScatterplotMatrix,_o as MinimapChart,Fo as DEFAULT_QUADRANTS,Wo as QuadrantChart,qo as MultiAxisLineChart,en as CandlestickChart};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{auditVisualizationControls as e}from"./chunk-chunk-FQPKOAIH.module.min.js";import{resolveAccessor as t,resolveRawAccessor as r}from"./chunk-chunk-NJETWX42.module.min.js";import{filterAnnotationsByStatus as a}from"./chunk-chunk-BNGBEY7N.module.min.js";import{getMinMax as n}from"./chunk-chunk-JJ2OOIET.module.min.js";function o(e){return i(e),e}function i(t){if(!t||"object"!=typeof t)throw Error("Chart recipe must be an object.");if("string"!=typeof t.id||""===t.id.trim())throw Error("Chart recipe requires a non-empty id.");if("string"!=typeof t.name||""===t.name.trim())throw Error(`Chart recipe "${t.id}" requires a non-empty name.`);if(!Array.isArray(t.dataRoles)||0===t.dataRoles.length)throw Error(`Chart recipe "${t.id}" requires at least one data role.`);if(!Array.isArray(t.intents)||0===t.intents.length)throw Error(`Chart recipe "${t.id}" requires at least one intent.`);for(const e of t.intents)if("string"!=typeof e&&(!e||"string"!=typeof e.id&&"string"!=typeof e.name))throw Error(`Chart recipe "${t.id}" has an intent without an id or name.`);if(!t.designContract?.whyCustom)throw Error(`Chart recipe "${t.id}" requires designContract.whyCustom.`);if(!t.accessibility||"object"!=typeof t.accessibility)throw Error(`Chart recipe "${t.id}" requires accessibility expectations.`);if(void 0!==t.controls){const r=e({controls:t.controls}).findings.filter(e=>"fail"===e.status);if(r.length>0)throw Error(`Chart recipe "${t.id}" has invalid controls: ${r.map(e=>e.message).join(" ")}`)}if("portable"===t.portability){if(!s(t.layout))throw Error(`Portable chart recipe "${t.id}" must reference a registered layout by id.`);const e=t.layoutConfigSchema??t.portabilityConfig?.schema;if(!e)throw Error(`Portable chart recipe "${t.id}" requires a serializable layout config schema.`);if(!l(e))throw Error(`Portable chart recipe "${t.id}" has a layout config schema that is not JSON-safe.`)}}function s(e){return!!e&&"object"==typeof e&&"string"==typeof e.id}function l(e,t=new Set){if(null===e)return!0;const r=typeof e;if("string"===r||"boolean"===r)return!0;if("number"===r)return Number.isFinite(e);if("object"!==r)return!1;if(t.has(e))return!1;t.add(e);const a=Array.isArray(e)?e.every(e=>l(e,t)):Object.entries(e).every(([,e])=>l(e,t));return t.delete(e),a}function c(e){return"string"==typeof e?e:e.id??e.name}function u(e){return"string"==typeof e?3:"number"==typeof e.score&&Number.isFinite(e.score)?Math.max(0,Math.min(5,e.score>1?e.score:5*e.score)):"primary"===e.strength?5:"secondary"===e.strength?3:"supporting"===e.strength?2:3}function d(e){const t=new Set(e.intents.map(c));return t.has("geo")?"geo":t.has("hierarchy")?"hierarchy":t.has("flow")?"flow":t.has("relationship")?"network":t.has("distribution")?"distribution":t.has("correlation")?"relationship":t.has("trend")||t.has("composition-over-time")?"time-series":t.has("compare-categories")||t.has("rank")||t.has("part-to-whole")?"categorical":"custom"}function h(e){const t=Object.values(e.audience?.familiarity??{}),r=t.find(e=>"number"==typeof e);if(void 0!==r)return Math.max(1,Math.min(5,Math.round(r)));const a=t.filter(e=>"string"==typeof e);return a.includes("high")?4:a.includes("medium")?3:a.includes("low")?2:e.reception?.memorableForm?3:2}function p(e,t){return"nodes"===t?e.network?.nodes??[]:"edges"===t?e.network?.edges??[]:"areas"===t?e.geo?.features??[]:"points"===t?e.geo?.points??[]:"lines"===t?e.geo?.flows??[]:e.data}function f(e,t,r){return p(e,t.source).some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,r))}function m(e,t,r){if(t.field&&f(r,t,t.field))return t.field;if("nodes"===t.source||"edges"===t.source){const e="node-id"===t.role?"id":"edge-source"===t.role?"source":"edge-target"===t.role?"target":void 0;if(e&&f(r,t,e))return e}switch(t.semanticType){case"quantitative":return r.primary.y??r.primary.size??r.primary.x;case"temporal":return r.primary.time??r.primary.x;case"nominal":case"ordinal":return r.primary.category??r.primary.series;case"identifier":{const e=p(r,t.source);return["id","key","name"].find(t=>e.some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,t)))}case"geographic":return r.hasGeo?t.field:void 0;default:return t.field}}function g(e){const t={},r=[];for(const a of e.intents){const e=c(a);e&&(t[e]=u(a),"string"!=typeof a&&a.rationale&&r.push(a.rationale))}r.push(...(e.reception?.strengths??[]).map(e=>"Reception strength: "+e));const a=e.reception?.risks??[],n=e.designContract.misuse??[],o=[...e.designContract.caveats??[],...e.caveats??[]];return{component:e.id,displayName:e.name,candidateKind:"recipe",family:d(e),renderingFamily:e.frameFamily,importPath:"semiotic/ai",rubric:{familiarity:h(e),accuracy:4,precision:a.some(e=>/precis|comparison/i.test(e))?2:3},fits:t=>function(e,t){for(const r of e.dataRoles)if(!1!==r.required&&!m(0,r,t))return`needs data role "${r.role}" (${r.semanticType})`;const r=e.audit?.maxCategories;return"number"==typeof r&&"number"==typeof t.categoryCount&&t.categoryCount>r?`${t.categoryCount} categories exceeds this recipe's declared maximum of ${r}`:null}(e,t),intentScores:t,caveats:()=>[...a,...n,...o],buildProps:t=>function(e,t){const r={};for(const a of e.dataRoles){const e=m(0,a,t);e&&a.accessor&&(r[a.accessor]=e)}const a={recipeId:e.id,layoutConfig:r};e.frameFamily.startsWith("Network")?(a.nodes=t.network?.nodes??t.data,a.edges=t.network?.edges??[]):e.frameFamily.startsWith("Geo")?(a.areas=t.geo?.features??[],a.points=t.geo?.points??t.data,a.lines=t.geo?.flows??[]):a.data=t.data;const n=e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0);return n&&(a.mobileSemantics=n),a}(e,t),mobile:e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0),recipe:e,positiveRationale:r,whyCustom:{defaultAlternative:e.designContract.defaultAlternative,reason:e.designContract.whyNotDefault??e.designContract.whyCustom,tradeoff:e.designContract.tradeoff??(a.length>0?a[0]:void 0)}}}var y=Symbol.for("semiotic.chartRecipeRegistry");function b(){const e=globalThis;return e[y]||(e[y]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[y]}function $(e){i(e),b().recipes.set(e.id,e),b().capabilities.set(e.id,g(e))}function v(e){b().recipes.delete(e),b().capabilities.delete(e)}function w(e){return b().recipes.get(e)}function C(){return Array.from(b().recipes.values())}function k(){return Array.from(b().capabilities.values())}function x(){return b().capabilities.size>0}function A(e,t){if(!e)throw Error("Recipe layout requires a non-empty id.");if("function"!=typeof t)throw Error(`Recipe layout "${e}" must be a function.`);b().layouts.set(e,t)}function S(e){b().layouts.delete(e)}function P(e){return b().layouts.get(e)}function L(e){return"string"==typeof e?w(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}var j=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","GauntletChart","CrucibleChart","ProcessFlowChart","PacketFlowChart","ChainReactionChart","BigNumber"],F=new Set(j);function R(e){return F.has(e)}function N(e){return"string"==typeof e?e:e.id??e.name}function O(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function D(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function I(e,t,r){return r??L(t.recipe)??L(t.recipeId)??w(e)}function T(e,t,r=[]){const a=e.accessor?t[e.accessor]:void 0;if("string"==typeof a&&a)return a;if(e.field)return e.field;const n=r.find(e=>e&&"object"==typeof e);if(!n)return;const o=Object.entries(n).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?o.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in n):o.find(([,e])=>"string"==typeof e)?.[0]}function B(e,t){return e.dataRoles.find(e=>e.role===t)}function M(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function E(e,t,r,a,n,o={}){const i={...o};if(t)for(const[e,r]of Object.entries(t))i[e]=r;for(const e of r.dataRoles){const r=T(e,a,n),o=t&&r?t[r]:r;void 0!==o&&(i[e.role]=o)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const r=i[t];return null==r?`{${t}}`:r+""})}var U=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),G=new Set(["data","nodes","edges","points","areas","lines","flows"]);function q(e){if(null==e)return e;if("function"==typeof e)return;if("object"!=typeof e)return e;if(e.$$typeof)return;if(Array.isArray(e))return e.map(q).filter(e=>void 0!==e);if(e instanceof Date)return e;const t={};for(const[r,a]of Object.entries(e)){if("function"==typeof a)continue;if(a&&"object"==typeof a&&a.$$typeof)continue;const e=q(a);void 0!==e&&(t[r]=e)}return t}function z(e,t){return!!G.has(e)&&("areas"!==e||"string"!=typeof t)}var H="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function V(e,t,r){const a=w(e)??L(t.recipe)??L(t.recipeId);if(a)return function(e,t,r){const a=function(e,t,r){const a={};for(const[n,o]of Object.entries(e))if(null!=o&&!U.has(n)&&"recipeId"!==n&&(t||!z(n,o)))if("function"==typeof o||o?.$$typeof){if(r)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`)}else if(l(o))a[n]=H(o);else if(r)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`);return a}(t,!1!==r?.includeData,"portable"===e.portability),n=e.intents.map(N).filter(e=>!!e),o={name:e.name,intents:n,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!l(a))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:a,manifest:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:a,manifest:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}(a,t,r);if(!R(e))throw Error(`Unknown component "${e}". Known components: ${j.join(", ")}`);const n=!1!==r?.includeData,o={};for(const[e,r]of Object.entries(t))if(null!=r&&!U.has(e)&&(n||!z(e,r))&&"function"!=typeof r&&!r?.$$typeof)try{o[e]=H(q(r))}catch{}return{component:e,props:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}function J(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=w(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...H(e.props),recipeId:e.recipeId}}}if(!R(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:H(e.props)}}function _(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function K(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const r=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(escape(atob(r)));return JSON.parse(a)}async function W(e,t="json"){const r="jsx"===t?Q(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(r)}function Q(e){const{props:t}=e,r=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&r.push(` recipeId="${e.recipeId}"`);for(const[e,a]of Object.entries(t))if("string"==typeof a)r.push(` ${e}="${a}"`);else if("boolean"==typeof a&&!0===a)r.push(" "+e);else if("boolean"==typeof a&&!1===a)r.push(` ${e}={false}`);else if("number"==typeof a)r.push(` ${e}={${a}}`);else{const t=JSON.stringify(a);r.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(a,null,2)}}`)}return r.push("/>"),r.join("\n")}function X(e){const t=Object.create(null);for(const[r,a]of e){const e=[];for(const[,t]of a.clauses){const r=Object.create(null);for(const[e,a]of Object.entries(t.fields))r[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:r})}t[r]={name:a.name,resolution:a.resolution,clauses:e}}return t}function Y(e){const t=new Map;for(const[r,a]of Object.entries(e)){const e=new Map;for(const t of a.clauses){const r=Object.create(null);for(const[e,a]of Object.entries(t.fields))r[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:r})}t.set(r,{name:a.name,resolution:a.resolution,clauses:e})}return t}function Z(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...r}=e;return{type:t,markProps:r}}function ee(e){return"nominal"===e||"ordinal"===e}function te(e){return"quantitative"===e||"temporal"===e}function re(e){return e.usermeta?.idid}function ae(e){if(!re(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:r,...a}=e,{usermeta:n,...o}=t[0];return{...a,...o}}var ne={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},oe={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},ie={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function se(e){e=ae(e);const t=[],{type:r,markProps:a}=Z(e.mark),o=e.encoding||{},i=o.x,s=o.y,l=o.color,c=o.size,u=o.theta,d=o.opacity;let h;e.data?.values?h=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||o.facet||o.row||o.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const p={};e.width&&(p.width=e.width),e.height&&(p.height=e.height);const f=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(f&&(p.title=f),l?.field&&(p.colorBy=l.field,l.scale?.scheme)){const e=ne[l.scale.scheme];e&&(p.colorScheme=e)}void 0!==d?.value&&(p.pointOpacity=d.value);const m=i?.aggregate,g=s?.aggregate;if(h&&(m||g)){const e=g?s:i,t=g?i:s,r=ie[e.aggregate];if(r&&t?.field&&e.field)h=function(e,t){const{groupBy:r,value:a,agg:o="sum"}=t,i=new Map;for(const t of e){const e=t[r]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[a]))}const s=[];for(const[e,t]of i){let a;switch(o){case"count":a=t.length;break;case"mean":a=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":a=n(t)[0];break;case"max":a=n(t)[1];break;default:a=t.reduce((e,t)=>e+t,0)}s.push({[r]:e,value:a})}return s}(h,{groupBy:t.field,value:e.field,agg:r});else if(("count"===r||"count"===e.aggregate)&&t?.field&&h){const e=new Map;for(const r of h){const a=r[t.field]+"";e.set(a,(e.get(a)||0)+1)}h=Array.from(e,([e,r])=>({[t.field]:e,value:r}))}}if(i?.bin||s?.bin){const e="Histogram";h&&(p.data=h),i?.bin?(p.valueAccessor=i.field,s?.field&&(p.categoryAccessor=s.field),i.axis?.title&&(p.valueLabel=i.axis.title)):s?.bin&&(p.valueAccessor=s.field,i?.field&&(p.categoryAccessor=i.field),s.axis?.title&&(p.valueLabel=s.axis.title));const r=i?.bin||s?.bin,a="object"==typeof r?r.maxbins:void 0;return a&&(p.bins=a),ue(e,p,t)}let y;switch(r){case"bar":y=function(e,t,r,a,n,o,i){let s;return r?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(s="StackedBarChart",a.stackBy=r.field):s="BarChart",ee(e?.type)&&te(t?.type)?(a.categoryAccessor=e.field,a.valueAccessor=i?"value":t.field,e?.axis?.title&&(a.categoryLabel=e.axis.title),t?.axis?.title&&(a.valueLabel=t.axis.title)):te(e?.type)&&ee(t?.type)?(a.categoryAccessor=t.field,a.valueAccessor=o?"value":e.field,a.orientation="horizontal",t?.axis?.title&&(a.categoryLabel=t.axis.title),e?.axis?.title&&(a.valueLabel=e.axis.title)):(e?.field&&(a.categoryAccessor=e.field),t?.field&&(a.valueAccessor=i?"value":t.field),e?.axis?.title&&(a.categoryLabel=e.axis.title),t?.axis?.title&&(a.valueLabel=t.axis.title)),n&&(a.data=n),s}(i,s,l,p,h,m,g);break;case"line":if(y="LineChart",ce(i,s,p,m,g),l?.field&&(p.lineBy=l.field),a.interpolate){const e=oe[a.interpolate];e&&(p.curve=e)}!0===a.point&&(p.showPoints=!0),h&&(p.data=h);break;case"area":if(l?.field?(y="StackedAreaChart",p.areaBy=l.field):y="AreaChart",ce(i,s,p,m,g),a.interpolate){const e=oe[a.interpolate];e&&(p.curve=e)}void 0!==a.opacity&&(p.areaOpacity=a.opacity),h&&(p.data=h);break;case"point":case"circle":case"square":c?.field?(y="BubbleChart",p.sizeBy=c.field,c.scale?.range&&(p.sizeRange=c.scale.range)):y="Scatterplot",ce(i,s,p,m,g),h&&(p.data=h);break;case"rect":y="Heatmap",i?.field&&(p.xAccessor=i.field),s?.field&&(p.yAccessor=s.field),l?.field&&(p.valueAccessor=l.field,delete p.colorBy),i?.axis?.title&&(p.xLabel=i.axis.title),s?.axis?.title&&(p.yLabel=s.axis.title),h&&(p.data=h);break;case"arc":a.innerRadius&&a.innerRadius>0?(y="DonutChart",p.innerRadius=a.innerRadius):y="PieChart",u?.field?p.valueAccessor=u.field:s?.field&&(p.valueAccessor=g?"value":s.field),l?.field&&(p.categoryAccessor=l.field),i?.field&&!u?.field&&(p.categoryAccessor=i.field),h&&(p.data=h);break;case"tick":y="DotPlot",ee(i?.type)?(p.categoryAccessor=i.field,s?.field&&(p.valueAccessor=g?"value":s.field),i?.axis?.title&&(p.categoryLabel=i.axis.title),s?.axis?.title&&(p.valueLabel=s.axis.title)):ee(s?.type)?(p.categoryAccessor=s.field,i?.field&&(p.valueAccessor=m?"value":i.field),p.orientation="horizontal",s?.axis?.title&&(p.categoryLabel=s.axis.title),i?.axis?.title&&(p.valueLabel=i.axis.title)):(i?.field&&(p.categoryAccessor=i.field),s?.field&&(p.valueAccessor=g?"value":s.field)),h&&(p.data=h);break;default:t.push(`Unsupported mark type "${r}". Defaulting to Scatterplot.`),y="Scatterplot",ce(i,s,p,m,g),h&&(p.data=h)}return ue(y,p,t)}function le(e,t={}){const r=function(e){const t=e,r=ae(e),a=r,n=[];if(Array.isArray(t.layer)&&r===e&&n.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/layer",message:"Only the single base view in an IDID-enriched annotation layer can be imported."}),void 0===a.mark)n.push({code:"MISSING_MARK",severity:"error",path:"/mark",message:"A Vega-Lite spec needs a supported single-view mark."});else{const{type:e}=Z(a.mark);new Set(["bar","line","area","point","circle","square","rect","arc","tick"]).has(e)||n.push({code:"UNSUPPORTED_MARK",severity:"error",path:"/mark",message:`Vega-Lite mark "${e||"(missing)"}" has no supported Semiotic translation.`})}Array.isArray(a.transform)&&a.transform.length>0&&n.push({code:"UNSUPPORTED_TRANSFORM",severity:"error",path:"/transform",message:"Vega-Lite transforms must be materialized before strict import."});for(const e of["hconcat","vconcat","concat","facet","repeat","params","selection"])void 0!==a[e]&&n.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/"+e,message:`Vega-Lite "${e}" is not part of the supported single-view import subset.`});return"string"==typeof a.data?.url&&n.push({code:"UNSUPPORTED_DATA_URL",severity:"error",path:"/data/url",message:"Strict import accepts inline data.values only; load URL data before importing."}),n}(e),a=r.filter(e=>"error"===e.severity),n=re(e),o={adapter:"semiotic/vega-lite",direction:"import",sourceFormat:"vega-lite",targetFormat:"semiotic-chart-config",..."string"==typeof n?.specVersion?{specVersion:n.specVersion}:{},...n?{metadata:{idid:n}}:{}};if(a.length>0&&"lossy"!==t.mode)return{status:"refused",diagnostics:r,lossReport:a.map(({code:e,message:t,path:r})=>({code:e,message:t,path:r})),provenance:o};const i=se(e),s=(i.warnings||[]).map(e=>({code:"LEGACY_TRANSLATION_WARNING",severity:"warning",message:e})),l=a.map(({code:e,message:t,path:r})=>({code:e,message:t,path:r})),c="lossy"===t.mode?r.map(e=>"error"===e.severity?{...e,severity:"warning"}:e):r;return{status:l.length>0?"lossy":"success",config:i,diagnostics:[...c,...s],lossReport:l,provenance:o}}function ce(e,t,r,a,n){e?.field&&(r.xAccessor=a?"value":e.field),t?.field&&(r.yAccessor=n?"value":t.field),e?.axis?.title&&(r.xLabel=e.axis.title),t?.axis?.title&&(r.yLabel=t.axis.title)}function ue(e,t,r){const a={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(r.length>0){a.warnings=r;for(const e of r)console.warn("[semiotic/fromVegaLite] "+e)}return a}function de(e,t,r={}){const a=D(t),n=O(t),o=r.locale??"en",i="function"==typeof e.description?e.description({data:a,config:n,locale:o}):void 0,s=i?.levels??function(e,t,r,a){const n=M(e,["nominal","ordinal"]),o=M(e,["quantitative"]),i=n?T(n,r,t):void 0,s=o?T(o,r,t):void 0,l=n?.role??i??"category",c=o?.role??s??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:h,percent:p}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(a),f=new Map;if(i&&s)for(const e of t){const t=(e[i]??"Uncategorized")+"",r=Number(e[s]);Number.isFinite(r)&&f.set(t,(f.get(t)??0)+r)}const m=[...f].sort((e,t)=>t[1]-e[1]),g=m.reduce((e,[,t])=>e+t,0),y=m[0],b=m[1],$=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,v=e.intents.map(e=>({id:N(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,w=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${C=d,C?C.charAt(0).toUpperCase()+C.slice(1):C}.`,l2:m.length>0?`${m.length} categories total ${h.format(g)}. ${y[0]} accounts for ${h.format(y[1])}${g>0?` (${p.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${h.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>m.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>$?`The total is distributed across ${m.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${p.format($)}.`,l4:`The chart is intended for ${v??"explanation"}${w?` with a ${w} audience`:""}: ${e.designContract.whyCustom}`};var C}(e,a,n,o),l=r.levels??["l1","l2","l3","l4"],c={};for(const e of l)s[e]&&(c[e]=s[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),d=r.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...d?.length?{caveats:d}:{}}}var he=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),pe=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),fe=new Set(["PieChart","DonutChart","FunnelChart"]),me=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function ge(e,t){return pe.has(e)||fe.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function ye(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const r=e[t];if("string"==typeof r&&r)return r}}function be(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}var $e={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",UnitPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PacketFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",CrucibleChart:"crucible physics chart",PhysicsCustomChart:"custom physics chart"},ve=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),we=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]);function Ce(e){return $e[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function ke(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var xe=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),Ae={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Se={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Pe=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Le={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function je(e){return Ae[e]}function Fe(e,t){const r=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,r={};for(const[e,a]of Object.entries(t.intentScores))"number"==typeof a&&Number.isFinite(a)&&(r[e]=a);return{family:t.family,intentScores:Object.keys(r).length?r:void 0}}return e}}(t);if(r?.act)return r.act;if(r?.intentScores){const e=function(e){let t,r=0;for(const[a,n]of Object.entries(e))if("number"==typeof n&&n>0)if(n>r)t=a,r=n;else if(n===r&&void 0!==t){const e=Pe.indexOf(a),r=Pe.indexOf(t);-1===e||-1!==r&&e>=r||(t=a)}return t}(r.intentScores);if(e&&Ae[e]&&(r.intentScores[e]??0)>=3)return Ae[e]}return r?.family?Se[r.family]:function(e){return fe.has(e)||"StackedAreaChart"===e?"apportioning":xe.has(e)?"relating":pe.has(e)?"comparing":me.has(e)?"characterizing":he.has(e)?"tracking":ve.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}var Re=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),Ne=new Set(["system","agent","watcher"]),Oe=new Set(["ai","agent","system","computed","dbt","great-expectations"]),De=new Set(["rule","statistical-test","llm-inference","computed"]);function Ie(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!Re.has(t.type))return!1;const r=t.provenance;return!(!r||"object"!=typeof r)&&(Ne.has(r.authorKind)||Oe.has(r.source)||De.has(r.basis))})}function Te(e="en"){let t,r;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?r.format(e):t.format(e):e+""}var Be={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function Me(e){const t=Be["string"==typeof e.type?e.type:"annotation"]||"an annotation",r=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,r=t?.authorKind??t?.source??t?.basis;return"watcher"===r?"a watcher-flagged ":"agent"===r||"ai"===r||"llm-inference"===r?"an AI-suggested ":""}(e),a=r?r+t.replace(/^an? /,""):t,n="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return n?`${a} labeled "${n}"`:a}function Ee(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const r=a(t.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;const n=r.map(Me),o=n.slice(0,5),i=n.length-o.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(o)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":l+" features"} on this chart: ${s}.`}function Ue(e,a,n={}){const o=void 0!==n.levels,i=new Set(n.levels??["l1","l2","l3"]);o||!n.capability&&!Ie(a)||i.add("l4");const s=I(e,a,n.recipe);if(s){const e=["l1","l2","l3","l4"].filter(e=>i.has(e));o||e.includes("l4")||e.push("l4");const t=de(s,a,{levels:e,locale:n.locale,audience:n.audience,includeCaveats:n.includeCaveats}),r=Ee(a);return{...t,text:r?`${r} ${t.text}`.trim():t.text,...r?{annotations:r}:{}}}const l=Te(n.locale??"en"),c=Ce(e),u=Array.isArray(a.data)?a.data:null,d=ye(a),h=we.has(e)?function(e,t){const r=e.physics&&"object"==typeof e.physics?e.physics:null,a=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,n=[e.settledProjectionRows,e.projectionRows,a?.rows,r?.settledProjectionRows,r?.projectionRows,r?.settledProjection&&"object"==typeof r.settledProjection?r.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(n)?n.map((e,r)=>{if(!e||"object"!=typeof e)return null;const a=e,n=ke(a.count??a.value??a.total??a.bodies??a.events);if(null==n)return null;const o=a.label??a.id??a.name??"container "+(r+1),i=ke(a.secondary??a.secondaryCount),s=ke(a.observed??a.observedCount);return{label:be(o,t),count:n,...null!=i?{secondary:i}:{},..."string"==typeof a.secondaryLabel&&a.secondaryLabel?{secondaryLabel:a.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(a,l):null,{measure:p,measureFallback:f,dimension:m,dimensionFallback:g}=ge(e,a),y="string"==typeof p&&p?p:f,b="string"==typeof m&&m?m:g,$={};if(we.has(e)&&function(e,t,r,a,n,o){const i=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}(e),s=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"body"}(e);if(n.has("l1")&&(a.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"UnitPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PacketFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":"CrucibleChart"===e?"A crucible physics chart that replays authored phases and events into declared products and outlets; the settled ledger, not collisions, determines the result.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!n.has("l2")&&!n.has("l3"))return;if(!r||0===r.length)return void(n.has("l2")&&(a.l2="No settled projection is loaded yet."));const l=r.reduce((e,t)=>e+t.count,0),c=r.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??r.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const d=r.reduce((e,t)=>e+(t.secondary??0),0),h=r.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(n.has("l2"))if(0===c.length)a.l2=`The settled projection contains ${o(l)} ${qe(l,s)} across ${r.length} ${qe(r.length,i)}; no ${qe(2,i)} are non-empty yet.`;else{const e=d>0?` ${o(d)} ${qe(d,s)} ${1===d?"is":"are"} marked ${h}.`:"";a.l2=`The settled projection contains ${o(l)} ${qe(l,s)} across ${r.length} ${qe(r.length,i)}; ${c.length} ${qe(c.length,i)} ${1===c.length?"is":"are"} non-empty. The largest ${i} is ${u.label} with ${o(u.count)} ${qe(u.count,s)}.${e}`}if(n.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const r=e/t*100;return(10>r?Math.round(10*r)/10:Math.round(r))+"%"}(u.count,l);a.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${o(u.count)} ${qe(u.count,s)} (${t}); ${e.label} follows with ${o(e.count)} ${qe(e.count,s)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${o(u.count)} ${qe(u.count,s)}.`}}(e,c,h,$,i,l),i.has("l1")&&!we.has(e))if(he.has(e)||pe.has(e))$.l1=`A ${c} of ${y} by ${b}`+(d?`, split by ${d}.`:".");else if(fe.has(e))$.l1=`A ${c} showing ${y} across ${b} categories.`;else if(me.has(e))$.l1=`A ${c} of the distribution of ${y}`+(d?` by ${d}.`:".");else if(ve.has(e)){const e=Array.isArray(a.nodes)?a.nodes.length:void 0,t=Array.isArray(a.edges)?a.edges.length:void 0,r=[null!=e?`${e} ${qe(e,"node")}`:null,null!=t?`${t} ${qe(t,"edge")}`:null].filter(Boolean);$.l1=`A ${c}${r.length?" with "+r.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof a.label?a.label:y;$.l1=`A single value${e?" for "+e:""}.`}else $.l1=`A ${c}.`;const v=he.has(e)||pe.has(e)||fe.has(e)||me.has(e);let w=null;if((i.has("l2")||i.has("l3")||i.has("l4"))&&v&&u&&u.length>0&&(w=function(e,t,r,a){let n=0,o=0,i=1/0,s=-1/0,l=null,c=null,u=0,d=0,h=null,p=null,f=NaN,m=NaN;for(const r of e){const e=t(r);Number.isFinite(e)&&(0===n&&(f=e,h=r),m=e,p=r,i>e&&(i=e,l=r,u=n),e>s&&(s=e,c=r,d=n),n++,o+=e)}return 0===n?null:{count:n,min:i,max:s,mean:o/n,minLabel:be(null!=l?r(l):null,a),maxLabel:be(null!=c?r(c):null,a),first:f,last:m,firstLabel:be(null!=h?r(h):null,a),lastLabel:be(null!=p?r(p):null,a),minIndex:u,maxIndex:d}}(u,t(p,f),r(m,g),l)),i.has("l2")&&v&&(u&&0!==u.length?w&&($.l2=fe.has(e)?`${w.count} segments totaling ${l(function(e){return e.mean*e.count}(w))}. Largest is ${w.maxLabel} at ${l(w.max)}; smallest is ${w.minLabel} at ${l(w.min)}.`:`${y} ranges from ${l(w.min)} (${w.minLabel}) to ${l(w.max)} (${w.maxLabel}), with a mean of ${l(w.mean)} across ${w.count} points.`):$.l2="No data is loaded yet."),i.has("l3")&&w&&!d&&he.has(e)?$.l3=function(e,t,r){const{first:a,last:n,min:o,max:i,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:p}=e,f=i-o,m=n-a;if(0===f)return`${Ge(t)} is constant at ${r(a)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${Ge(t)} ends roughly where it started (${r(a)} at ${c} to ${r(n)} at ${u}), ranging between ${r(o)} and ${r(i)}.`;const g=h>0&&p-1>h,y=d>0&&p-1>d,b=(i-Math.max(a,n))/f,$=(Math.min(a,n)-o)/f;return g&&b>.15?`Overall ${t} climbs to a peak of ${r(i)} (${s}), then falls to ${r(n)} (${u}).`:y&&$>.15?`Overall ${t} drops to a low of ${r(o)} (${l}), then recovers to ${r(n)} (${u}).`:.05>Math.abs(m)/f?`${Ge(t)} ends roughly where it started (${r(a)} at ${c} to ${r(n)} at ${u}), ranging between ${r(o)} and ${r(i)}.`:m>0?h===p-1?`Overall ${t} rises from ${r(a)} (${c}) to a peak of ${r(n)} (${u}).`:`Overall ${t} rises from ${r(a)} (${c}) to ${r(n)} (${u}), after peaking at ${r(i)} (${s}).`:d===p-1?`Overall ${t} falls from ${r(a)} (${c}) to a low of ${r(n)} (${u}).`:`Overall ${t} falls from ${r(a)} (${c}) to ${r(n)} (${u}), after dipping to ${r(o)} (${l}).`}(w,y,l):i.has("l3")&&w&&!d&&pe.has(e)&&($.l3=`The highest ${b} is ${w.maxLabel} and the lowest is ${w.minLabel}.`),i.has("l4")){const t=Ie(a)?"alerting":Fe(e,n.capability);t&&($.l4=function(e,t,r,a,n,o,i,s){const l=Le[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,d;switch(e){case"locating":u="This is a map",d="read values by location";break;case"presenting":u="This is a single-value display",d=`read ${"string"==typeof r.label&&r.label?r.label:n} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,d="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,d="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,d=`read it for whether ${o} and ${n} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,r,a,n,o){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+r;case"comparing":return`compare ${r} across ${a}`;case"ranking":return"read it top to bottom by "+r;case"apportioning":return`read each ${a}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+r;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,r){if(pe.has(r)||fe.has(r))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:a,last:n,min:o,max:i,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,p=i-o;if(p>0){const e=d>0&&h-1>d,r=u>0&&h-1>u,f=(i-Math.max(a,n))/p,m=(Math.min(a,n)-o)/p;if(e&&f>.15)return`the peak of ${t(i)} at ${l} is the point to investigate`;if(r&&m>.15)return`the dip to ${t(o)} at ${s} is the point to investigate`;if(n>=i)return`the climb to ${t(n)} at ${c} warrants a closer look`;if(o>=n)return`the drop to ${t(n)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(i)}) and ${s} (${t(o)}) — are the points to check`}(t,n,o);case"tracking":return`read it for the trajectory of ${r}, which ${function(e){const t=e.max-e.min,r=e.last-e.first;return 0===t||.05>Math.abs(r)/t?"holds roughly steady":r>0?"rises":"falls"}(t)} from ${n(t.first)} (${t.firstLabel}) to ${n(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${r} across ${a}; ${t.maxLabel} leads at ${n(t.max)}`;case"ranking":return`read it top to bottom by ${r}; ${t.maxLabel} ranks highest at ${n(t.max)}`;case"apportioning":{const e=t.mean*t.count,r=e>0?Math.round(t.max/e*100):null;return`read each ${a}'s share of the ${n(e)} total; ${t.maxLabel} is the largest at ${n(t.max)}${null!=r?` (${r}%)`:""}`}case"characterizing":return`read it for the spread of ${r}, from ${n(t.min)} to ${n(t.max)}`;default:return"read the highlighted features"}}(e,a,n,o,i,t)}return`${u}; ${d}.${function(e,t){if(!t)return"";const r=t.familiarity?.[e];return"number"!=typeof r||r>2?"":` This ${Ce(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(t,e,a,d?null:w,y,b,l,n.audience))}const C=["l1","l2","l3","l4"].filter(e=>i.has(e)&&$[e]).map(e=>$[e]).join(" "),k=Ee(a);return{text:k?`${k} ${C}`.trim():C,levels:$,...k?{annotations:k}:{}}}function Ge(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function qe(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function ze(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function He(e,t,r={}){const a=D(t),n=O(t),o=Math.max(1,r.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:a,config:n,locale:r.locale??"en"});const i=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(i?.groupByRole?B(e,i.groupByRole):void 0)??(i?.groupBy?.[0]?B(e,i.groupBy[0])??e.dataRoles.find(e=>e.field===i.groupBy?.[0]):void 0)??M(e,["nominal","ordinal"]),c=l?T(l,n,a):void 0,u=(i?.idRole?B(e,i.idRole):void 0)??M(e,["identifier"]),d=u?T(u,n,a):void 0,h={id:"root",role:"chart",label:i?.summaryTemplate?E(i.summaryTemplate,void 0,e,n,a,{count:a.length}):`${e.name}: ${a.length} ${1===a.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const f=(t,r,o)=>{const s=d?t[d]:void 0,l=i?.itemLabelTemplate?E(i.itemLabelTemplate,t,e,n,a,{count:a.length}):function(e,t,r,a){const n=M(t,["nominal","ordinal"]),o=t.dataRoles.filter(e=>"quantitative"===e.semanticType),i=n?T(n,r,a):void 0,s=[];i&&null!=e[i]&&s.push(e[i]+"");for(const t of o){const n=T(t,r,a);n&&null!=e[n]&&s.push(`${t.role}: ${e[n]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,n,a);return{id:"datum-"+ze(s??r),role:"datum",label:l,level:o,datum:t}};if(c){const e=new Map;for(const t of a){const r=(t[c]??"Uncategorized")+"",a=e.get(r);a?a.push(t):e.set(r,[t])}h.children=[...e].map(([e,t],r)=>{const a=t.slice(0,Math.max(0,o-p));p+=a.length;const n=a.map((e,t)=>f(e,1e5*r+t,3));return t.length>a.length&&n.push({id:"more-"+ze(e),role:"datum",label:`…and ${t.length-a.length} more items`,level:3}),{id:"group-"+ze(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:n}})}else{const e=a.slice(0,o);h.children=e.map((e,t)=>f(e,t,2)),a.length>e.length&&h.children.push({id:"more",role:"datum",label:`…and ${a.length-e.length} more items`,level:2})}return h}function Ve(e,n,o={}){const i=o.locale??"en",s=Math.max(1,o.maxLeaves??200),l=Te(i),c=I(e,n,o.recipe);if(c)return He(c,n,{maxLeaves:s,locale:i});const u={id:"root",role:"chart",label:Ue(e,n,{locale:i}).text||"Chart.",level:1,children:[]},d=function(e,t){const r=Array.isArray(e.annotations)?e.annotations:null;if(!r)return null;const n=a(r.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let o=0;const i=n.slice(0,t).map(e=>{const t=e.lifecycle?.status,r=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+o++,role:"annotation",level:3,label:`${a=Me(e),a?a.charAt(0).toUpperCase()+a.slice(1):a}${r}.`,datum:e};var a});n.length>t&&i.push({id:"annotation-"+o++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const s=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(n,s),h=Array.isArray(n.data)?n.data:null,p=he.has(e)||pe.has(e)||fe.has(e)||me.has(e);if(!h||0===h.length||!p)return d&&(u.children=[d]),u;const{measure:f,measureFallback:m,dimension:g,dimensionFallback:y}=ge(e,n),b=t(f,m),$=r(g,y),v="string"==typeof f&&f?f:m,w="string"==typeof g&&g?g:y,C=ye(n);let k=0;const x=e=>`${e}-${k++}`,A=(e,t)=>{const r=e.slice(0,s).map(e=>((e,t)=>{const r=b(e),a=be($(e),l);return{id:x("datum"),role:"datum",level:t,label:`${a}: ${Number.isFinite(r)?l(r):"—"}`,value:Number.isFinite(r)?r:void 0,datum:e}})(e,t));return e.length>s&&r.push({id:x("more"),role:"datum",level:t,label:`…and ${e.length-s} more points`}),r},S=[];if(he.has(e)||pe.has(e)){let t=1/0,r=-1/0,a=1/0,n=-1/0;const o=[];let i=!0;for(const e of h){const s=b(e);Number.isFinite(s)&&(t>s&&(t=s),s>r&&(r=s));const l=$(e);o.push(l),"number"==typeof l&&Number.isFinite(l)?(a>l&&(a=l),l>n&&(n=l)):i=!1}const s=new Set,c=[];for(const e of o){const t=e+"";s.has(t)||(s.add(t),c.push(e))}const u=i?`${l(a)} to ${l(n)}`:`${be(c[0],l)} to ${be(c[c.length-1],l)} (${pe.has(e)?c.length+" categories":h.length+" points"})`;S.push({id:x("axis"),role:"axis",level:2,label:`${pe.has(e)?"Category axis":"X axis"}: ${w}, ${u}.`}),t>r||S.push({id:x("axis"),role:"axis",level:2,label:`Value axis: ${v}, ${l(t)} to ${l(r)}.`})}if(C){const t=r(C,C),a=new Map;for(const e of h){const r=(t(e)??"—")+"",n=a.get(r);n?n.push(e):a.set(r,[e])}const o=[];for(const[t,r]of a){const a=Ue(e,{...n,data:r},{levels:["l2","l3"],locale:i}).text;o.push({id:x("series"),role:"series",level:2,label:`Series ${t}: ${a}`,children:A(r,3)})}u.children=[...S,...o]}else u.children=[...S,...A(h,2)];return d&&u.children.push(d),u}function Je(e,t){const r=[],a=e=>{if(r.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)a(t)};return a(e),r}function _e(e){let t=1;if(e.children)for(const r of e.children)t+=_e(r);return t}export{o as defineChartRecipe,i as validateChartRecipe,s as isRegisteredRecipeLayout,l as isJsonSafe,m as resolveRecipeRoleField,g as recipeToChartCapability,$ as registerChartRecipe,v as unregisterChartRecipe,w as getChartRecipe,C as listChartRecipes,k as getRegisteredRecipeCapabilities,x as hasRegisteredRecipeCapabilities,A as registerRecipeLayout,S as unregisterRecipeLayout,P as getRecipeLayout,L as resolveChartRecipe,N as recipeIntentId,O as recipeConfig,T as fieldForRole,V as toConfig,J as fromConfig,_ as toURL,K as fromURL,W as copyConfig,Q as configToJSX,X as serializeSelections,Y as deserializeSelections,ae as unwrapIDIDEnrichedVegaLiteSpec,se as fromVegaLite,le as fromVegaLiteResult,de as describeRecipeChart,je as communicativeActForIntent,Fe as resolveCommunicativeAct,Ue as describeChart,He as buildRecipeNavigationTree,Ve as buildNavigationTree,Je as flattenVisible,_e as countNodes};
2
+ import{auditVisualizationControls as e}from"./chunk-chunk-FQPKOAIH.module.min.js";import{resolveAccessor as t,resolveRawAccessor as r}from"./chunk-chunk-NWIGA3UK.module.min.js";import{filterAnnotationsByStatus as a}from"./chunk-chunk-FC3NZWYR.module.min.js";import{getMinMax as n}from"./chunk-chunk-2NVFEB7P.module.min.js";function o(e){return i(e),e}function i(t){if(!t||"object"!=typeof t)throw Error("Chart recipe must be an object.");if("string"!=typeof t.id||""===t.id.trim())throw Error("Chart recipe requires a non-empty id.");if("string"!=typeof t.name||""===t.name.trim())throw Error(`Chart recipe "${t.id}" requires a non-empty name.`);if(!Array.isArray(t.dataRoles)||0===t.dataRoles.length)throw Error(`Chart recipe "${t.id}" requires at least one data role.`);if(!Array.isArray(t.intents)||0===t.intents.length)throw Error(`Chart recipe "${t.id}" requires at least one intent.`);for(const e of t.intents)if("string"!=typeof e&&(!e||"string"!=typeof e.id&&"string"!=typeof e.name))throw Error(`Chart recipe "${t.id}" has an intent without an id or name.`);if(!t.designContract?.whyCustom)throw Error(`Chart recipe "${t.id}" requires designContract.whyCustom.`);if(!t.accessibility||"object"!=typeof t.accessibility)throw Error(`Chart recipe "${t.id}" requires accessibility expectations.`);if(void 0!==t.controls){const r=e({controls:t.controls}).findings.filter(e=>"fail"===e.status);if(r.length>0)throw Error(`Chart recipe "${t.id}" has invalid controls: ${r.map(e=>e.message).join(" ")}`)}if("portable"===t.portability){if(!s(t.layout))throw Error(`Portable chart recipe "${t.id}" must reference a registered layout by id.`);const e=t.layoutConfigSchema??t.portabilityConfig?.schema;if(!e)throw Error(`Portable chart recipe "${t.id}" requires a serializable layout config schema.`);if(!l(e))throw Error(`Portable chart recipe "${t.id}" has a layout config schema that is not JSON-safe.`)}}function s(e){return!!e&&"object"==typeof e&&"string"==typeof e.id}function l(e,t=new Set){if(null===e)return!0;const r=typeof e;if("string"===r||"boolean"===r)return!0;if("number"===r)return Number.isFinite(e);if("object"!==r)return!1;if(t.has(e))return!1;t.add(e);const a=Array.isArray(e)?e.every(e=>l(e,t)):Object.entries(e).every(([,e])=>l(e,t));return t.delete(e),a}function c(e){return"string"==typeof e?e:e.id??e.name}function u(e){return"string"==typeof e?3:"number"==typeof e.score&&Number.isFinite(e.score)?Math.max(0,Math.min(5,e.score>1?e.score:5*e.score)):"primary"===e.strength?5:"secondary"===e.strength?3:"supporting"===e.strength?2:3}function h(e){const t=new Set(e.intents.map(c));return t.has("geo")?"geo":t.has("hierarchy")?"hierarchy":t.has("flow")?"flow":t.has("relationship")?"network":t.has("distribution")?"distribution":t.has("correlation")?"relationship":t.has("trend")||t.has("composition-over-time")?"time-series":t.has("compare-categories")||t.has("rank")||t.has("part-to-whole")?"categorical":"custom"}function d(e){const t=Object.values(e.audience?.familiarity??{}),r=t.find(e=>"number"==typeof e);if(void 0!==r)return Math.max(1,Math.min(5,Math.round(r)));const a=t.filter(e=>"string"==typeof e);return a.includes("high")?4:a.includes("medium")?3:a.includes("low")?2:e.reception?.memorableForm?3:2}function p(e,t){return"nodes"===t?e.network?.nodes??[]:"edges"===t?e.network?.edges??[]:"areas"===t?e.geo?.features??[]:"points"===t?e.geo?.points??[]:"lines"===t?e.geo?.flows??[]:e.data}function f(e,t,r){return p(e,t.source).some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,r))}function m(e,t,r){if(t.field&&f(r,t,t.field))return t.field;if("nodes"===t.source||"edges"===t.source){const e="node-id"===t.role?"id":"edge-source"===t.role?"source":"edge-target"===t.role?"target":void 0;if(e&&f(r,t,e))return e}switch(t.semanticType){case"quantitative":return r.primary.y??r.primary.size??r.primary.x;case"temporal":return r.primary.time??r.primary.x;case"nominal":case"ordinal":return r.primary.category??r.primary.series;case"identifier":{const e=p(r,t.source);return["id","key","name"].find(t=>e.some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,t)))}case"geographic":return r.hasGeo?t.field:void 0;default:return t.field}}function g(e){const t={},r=[];for(const a of e.intents){const e=c(a);e&&(t[e]=u(a),"string"!=typeof a&&a.rationale&&r.push(a.rationale))}r.push(...(e.reception?.strengths??[]).map(e=>"Reception strength: "+e));const a=e.reception?.risks??[],n=e.designContract.misuse??[],o=[...e.designContract.caveats??[],...e.caveats??[]];return{component:e.id,displayName:e.name,candidateKind:"recipe",family:h(e),renderingFamily:e.frameFamily,importPath:"semiotic/ai",rubric:{familiarity:d(e),accuracy:4,precision:a.some(e=>/precis|comparison/i.test(e))?2:3},fits:t=>function(e,t){for(const r of e.dataRoles)if(!1!==r.required&&!m(0,r,t))return`needs data role "${r.role}" (${r.semanticType})`;const r=e.audit?.maxCategories;return"number"==typeof r&&"number"==typeof t.categoryCount&&t.categoryCount>r?`${t.categoryCount} categories exceeds this recipe's declared maximum of ${r}`:null}(e,t),intentScores:t,caveats:()=>[...a,...n,...o],buildProps:t=>function(e,t){const r={};for(const a of e.dataRoles){const e=m(0,a,t);e&&a.accessor&&(r[a.accessor]=e)}const a={recipeId:e.id,layoutConfig:r};e.frameFamily.startsWith("Network")?(a.nodes=t.network?.nodes??t.data,a.edges=t.network?.edges??[]):e.frameFamily.startsWith("Geo")?(a.areas=t.geo?.features??[],a.points=t.geo?.points??t.data,a.lines=t.geo?.flows??[]):a.data=t.data;const n=e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0);return n&&(a.mobileSemantics=n),a}(e,t),mobile:e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0),recipe:e,positiveRationale:r,whyCustom:{defaultAlternative:e.designContract.defaultAlternative,reason:e.designContract.whyNotDefault??e.designContract.whyCustom,tradeoff:e.designContract.tradeoff??(a.length>0?a[0]:void 0)}}}var y=Symbol.for("semiotic.chartRecipeRegistry");function b(){const e=globalThis;return e[y]||(e[y]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[y]}function C(e){i(e),b().recipes.set(e.id,e),b().capabilities.set(e.id,g(e))}function $(e){b().recipes.delete(e),b().capabilities.delete(e)}function v(e){return b().recipes.get(e)}function w(){return Array.from(b().recipes.values())}function k(){return Array.from(b().capabilities.values())}function S(){return b().capabilities.size>0}function x(e,t){if(!e)throw Error("Recipe layout requires a non-empty id.");if("function"!=typeof t)throw Error(`Recipe layout "${e}" must be a function.`);b().layouts.set(e,t)}function A(e){b().layouts.delete(e)}function P(e){return b().layouts.get(e)}function L(e){return"string"==typeof e?v(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}var F=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","GauntletChart","CrucibleChart","ProcessFlowChart","PacketFlowChart","ChainReactionChart","BigNumber"],R=new Set(F);function j(e){return R.has(e)}function D(e){return"string"==typeof e?e:e.id??e.name}function B(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function N(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function O(e,t,r){return r??L(t.recipe)??L(t.recipeId)??v(e)}function I(e,t,r=[]){const a=e.accessor?t[e.accessor]:void 0;if("string"==typeof a&&a)return a;if(e.field)return e.field;const n=r.find(e=>e&&"object"==typeof e);if(!n)return;const o=Object.entries(n).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?o.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in n):o.find(([,e])=>"string"==typeof e)?.[0]}function M(e,t){return e.dataRoles.find(e=>e.role===t)}function T(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function E(e,t,r,a,n,o={}){const i={...o};if(t)for(const[e,r]of Object.entries(t))i[e]=r;for(const e of r.dataRoles){const r=I(e,a,n),o=t&&r?t[r]:r;void 0!==o&&(i[e.role]=o)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const r=i[t];return null==r?`{${t}}`:r+""})}var G=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),U=new Set(["data","nodes","edges","points","areas","lines","flows"]);function H(e){if(null==e)return e;if("function"==typeof e)return;if("object"!=typeof e)return e;if(e.$$typeof)return;if(Array.isArray(e))return e.map(H).filter(e=>void 0!==e);if(e instanceof Date)return e;const t={};for(const[r,a]of Object.entries(e)){if("function"==typeof a)continue;if(a&&"object"==typeof a&&a.$$typeof)continue;const e=H(a);void 0!==e&&(t[r]=e)}return t}function q(e,t){return!!U.has(e)&&("areas"!==e||"string"!=typeof t)}var z="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function V(e,t,r){const a=v(e)??L(t.recipe)??L(t.recipeId);if(a)return function(e,t,r){const a=function(e,t,r){const a={};for(const[n,o]of Object.entries(e))if(null!=o&&!G.has(n)&&"recipeId"!==n&&(t||!q(n,o)))if("function"==typeof o||o?.$$typeof){if(r)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`)}else if(l(o))a[n]=z(o);else if(r)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`);return a}(t,!1!==r?.includeData,"portable"===e.portability),n=e.intents.map(D).filter(e=>!!e),o={name:e.name,intents:n,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!l(a))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:a,manifest:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:a,manifest:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}(a,t,r);if(!j(e))throw Error(`Unknown component "${e}". Known components: ${F.join(", ")}`);const n=!1!==r?.includeData,o={};for(const[e,r]of Object.entries(t))if(null!=r&&!G.has(e)&&(n||!q(e,r))&&"function"!=typeof r&&!r?.$$typeof)try{o[e]=z(H(r))}catch{}return{component:e,props:o,version:"1",createdAt:(new Date).toISOString(),...r?.selections?{selections:r.selections}:{}}}function _(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=v(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...z(e.props),recipeId:e.recipeId}}}if(!j(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:z(e.props)}}function J(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function K(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const r=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(escape(atob(r)));return JSON.parse(a)}async function W(e,t="json"){const r="jsx"===t?Q(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(r)}function Q(e){const{props:t}=e,r=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&r.push(` recipeId="${e.recipeId}"`);for(const[e,a]of Object.entries(t))if("string"==typeof a)r.push(` ${e}="${a}"`);else if("boolean"==typeof a&&!0===a)r.push(" "+e);else if("boolean"==typeof a&&!1===a)r.push(` ${e}={false}`);else if("number"==typeof a)r.push(` ${e}={${a}}`);else{const t=JSON.stringify(a);r.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(a,null,2)}}`)}return r.push("/>"),r.join("\n")}function X(e){const t=Object.create(null);for(const[r,a]of e){const e=[];for(const[,t]of a.clauses){const r=Object.create(null);for(const[e,a]of Object.entries(t.fields))r[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:r})}t[r]={name:a.name,resolution:a.resolution,clauses:e}}return t}function Y(e){const t=new Map;for(const[r,a]of Object.entries(e)){const e=new Map;for(const t of a.clauses){const r=Object.create(null);for(const[e,a]of Object.entries(t.fields))r[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:r})}t.set(r,{name:a.name,resolution:a.resolution,clauses:e})}return t}function Z(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...r}=e;return{type:t,markProps:r}}function ee(e){return"nominal"===e||"ordinal"===e}function te(e){return"quantitative"===e||"temporal"===e}function re(e){return e.usermeta?.idid}function ae(e){if(!re(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:r,...a}=e,{usermeta:n,...o}=t[0];return{...a,...o}}var ne={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},oe={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},ie={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function se(e){e=ae(e);const t=[],{type:r,markProps:a}=Z(e.mark),o=e.encoding||{},i=o.x,s=o.y,l=o.color,c=o.size,u=o.theta,h=o.opacity;let d;e.data?.values?d=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||o.facet||o.row||o.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const p={};e.width&&(p.width=e.width),e.height&&(p.height=e.height);const f=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(f&&(p.title=f),l?.field&&(p.colorBy=l.field,l.scale?.scheme)){const e=ne[l.scale.scheme];e&&(p.colorScheme=e)}void 0!==h?.value&&(p.pointOpacity=h.value);const m=i?.aggregate,g=s?.aggregate;if(d&&(m||g)){const e=g?s:i,t=g?i:s,r=ie[e.aggregate];if(r&&t?.field&&e.field)d=function(e,t){const{groupBy:r,value:a,agg:o="sum"}=t,i=new Map;for(const t of e){const e=t[r]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[a]))}const s=[];for(const[e,t]of i){let a;switch(o){case"count":a=t.length;break;case"mean":a=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":a=n(t)[0];break;case"max":a=n(t)[1];break;default:a=t.reduce((e,t)=>e+t,0)}s.push({[r]:e,value:a})}return s}(d,{groupBy:t.field,value:e.field,agg:r});else if(("count"===r||"count"===e.aggregate)&&t?.field&&d){const e=new Map;for(const r of d){const a=r[t.field]+"";e.set(a,(e.get(a)||0)+1)}d=Array.from(e,([e,r])=>({[t.field]:e,value:r}))}}if(i?.bin||s?.bin){const e="Histogram";d&&(p.data=d),i?.bin?(p.valueAccessor=i.field,s?.field&&(p.categoryAccessor=s.field),i.axis?.title&&(p.valueLabel=i.axis.title)):s?.bin&&(p.valueAccessor=s.field,i?.field&&(p.categoryAccessor=i.field),s.axis?.title&&(p.valueLabel=s.axis.title));const r=i?.bin||s?.bin,a="object"==typeof r?r.maxbins:void 0;return a&&(p.bins=a),ue(e,p,t)}let y;switch(r){case"bar":y=function(e,t,r,a,n,o,i){let s;return r?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(s="StackedBarChart",a.stackBy=r.field):s="BarChart",ee(e?.type)&&te(t?.type)?(a.categoryAccessor=e.field,a.valueAccessor=i?"value":t.field,e?.axis?.title&&(a.categoryLabel=e.axis.title),t?.axis?.title&&(a.valueLabel=t.axis.title)):te(e?.type)&&ee(t?.type)?(a.categoryAccessor=t.field,a.valueAccessor=o?"value":e.field,a.orientation="horizontal",t?.axis?.title&&(a.categoryLabel=t.axis.title),e?.axis?.title&&(a.valueLabel=e.axis.title)):(e?.field&&(a.categoryAccessor=e.field),t?.field&&(a.valueAccessor=i?"value":t.field),e?.axis?.title&&(a.categoryLabel=e.axis.title),t?.axis?.title&&(a.valueLabel=t.axis.title)),n&&(a.data=n),s}(i,s,l,p,d,m,g);break;case"line":if(y="LineChart",ce(i,s,p,m,g),l?.field&&(p.lineBy=l.field),a.interpolate){const e=oe[a.interpolate];e&&(p.curve=e)}!0===a.point&&(p.showPoints=!0),d&&(p.data=d);break;case"area":if(l?.field?(y="StackedAreaChart",p.areaBy=l.field):y="AreaChart",ce(i,s,p,m,g),a.interpolate){const e=oe[a.interpolate];e&&(p.curve=e)}void 0!==a.opacity&&(p.areaOpacity=a.opacity),d&&(p.data=d);break;case"point":case"circle":case"square":c?.field?(y="BubbleChart",p.sizeBy=c.field,c.scale?.range&&(p.sizeRange=c.scale.range)):y="Scatterplot",ce(i,s,p,m,g),d&&(p.data=d);break;case"rect":y="Heatmap",i?.field&&(p.xAccessor=i.field),s?.field&&(p.yAccessor=s.field),l?.field&&(p.valueAccessor=l.field,delete p.colorBy),i?.axis?.title&&(p.xLabel=i.axis.title),s?.axis?.title&&(p.yLabel=s.axis.title),d&&(p.data=d);break;case"arc":a.innerRadius&&a.innerRadius>0?(y="DonutChart",p.innerRadius=a.innerRadius):y="PieChart",u?.field?p.valueAccessor=u.field:s?.field&&(p.valueAccessor=g?"value":s.field),l?.field&&(p.categoryAccessor=l.field),i?.field&&!u?.field&&(p.categoryAccessor=i.field),d&&(p.data=d);break;case"tick":y="DotPlot",ee(i?.type)?(p.categoryAccessor=i.field,s?.field&&(p.valueAccessor=g?"value":s.field),i?.axis?.title&&(p.categoryLabel=i.axis.title),s?.axis?.title&&(p.valueLabel=s.axis.title)):ee(s?.type)?(p.categoryAccessor=s.field,i?.field&&(p.valueAccessor=m?"value":i.field),p.orientation="horizontal",s?.axis?.title&&(p.categoryLabel=s.axis.title),i?.axis?.title&&(p.valueLabel=i.axis.title)):(i?.field&&(p.categoryAccessor=i.field),s?.field&&(p.valueAccessor=g?"value":s.field)),d&&(p.data=d);break;default:t.push(`Unsupported mark type "${r}". Defaulting to Scatterplot.`),y="Scatterplot",ce(i,s,p,m,g),d&&(p.data=d)}return ue(y,p,t)}function le(e,t={}){const r=function(e){const t=e,r=ae(e),a=r,n=[];if(Array.isArray(t.layer)&&r===e&&n.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/layer",message:"Only the single base view in an IDID-enriched annotation layer can be imported."}),void 0===a.mark)n.push({code:"MISSING_MARK",severity:"error",path:"/mark",message:"A Vega-Lite spec needs a supported single-view mark."});else{const{type:e}=Z(a.mark);new Set(["bar","line","area","point","circle","square","rect","arc","tick"]).has(e)||n.push({code:"UNSUPPORTED_MARK",severity:"error",path:"/mark",message:`Vega-Lite mark "${e||"(missing)"}" has no supported Semiotic translation.`})}Array.isArray(a.transform)&&a.transform.length>0&&n.push({code:"UNSUPPORTED_TRANSFORM",severity:"error",path:"/transform",message:"Vega-Lite transforms must be materialized before strict import."});for(const e of["hconcat","vconcat","concat","facet","repeat","params","selection"])void 0!==a[e]&&n.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/"+e,message:`Vega-Lite "${e}" is not part of the supported single-view import subset.`});return"string"==typeof a.data?.url&&n.push({code:"UNSUPPORTED_DATA_URL",severity:"error",path:"/data/url",message:"Strict import accepts inline data.values only; load URL data before importing."}),n}(e),a=r.filter(e=>"error"===e.severity),n=re(e),o={adapter:"semiotic/vega-lite",direction:"import",sourceFormat:"vega-lite",targetFormat:"semiotic-chart-config",..."string"==typeof n?.specVersion?{specVersion:n.specVersion}:{},...n?{metadata:{idid:n}}:{}};if(a.length>0&&"lossy"!==t.mode)return{status:"refused",diagnostics:r,lossReport:a.map(({code:e,message:t,path:r})=>({code:e,message:t,path:r})),provenance:o};const i=se(e),s=(i.warnings||[]).map(e=>({code:"LEGACY_TRANSLATION_WARNING",severity:"warning",message:e})),l=a.map(({code:e,message:t,path:r})=>({code:e,message:t,path:r})),c="lossy"===t.mode?r.map(e=>"error"===e.severity?{...e,severity:"warning"}:e):r;return{status:l.length>0?"lossy":"success",config:i,diagnostics:[...c,...s],lossReport:l,provenance:o}}function ce(e,t,r,a,n){e?.field&&(r.xAccessor=a?"value":e.field),t?.field&&(r.yAccessor=n?"value":t.field),e?.axis?.title&&(r.xLabel=e.axis.title),t?.axis?.title&&(r.yLabel=t.axis.title)}function ue(e,t,r){const a={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(r.length>0){a.warnings=r;for(const e of r)console.warn("[semiotic/fromVegaLite] "+e)}return a}function he(e,t,r={}){const a=N(t),n=B(t),o=r.locale??"en",i="function"==typeof e.description?e.description({data:a,config:n,locale:o}):void 0,s=i?.levels??function(e,t,r,a){const n=T(e,["nominal","ordinal"]),o=T(e,["quantitative"]),i=n?I(n,r,t):void 0,s=o?I(o,r,t):void 0,l=n?.role??i??"category",c=o?.role??s??"value",u=e.encodings??[],h=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:d,percent:p}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(a),f=new Map;if(i&&s)for(const e of t){const t=(e[i]??"Uncategorized")+"",r=Number(e[s]);Number.isFinite(r)&&f.set(t,(f.get(t)??0)+r)}const m=[...f].sort((e,t)=>t[1]-e[1]),g=m.reduce((e,[,t])=>e+t,0),y=m[0],b=m[1],C=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,$=e.intents.map(e=>({id:D(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,v=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${w=h,w?w.charAt(0).toUpperCase()+w.slice(1):w}.`,l2:m.length>0?`${m.length} categories total ${d.format(g)}. ${y[0]} accounts for ${d.format(y[1])}${g>0?` (${p.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${d.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>m.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>C?`The total is distributed across ${m.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${p.format(C)}.`,l4:`The chart is intended for ${$??"explanation"}${v?` with a ${v} audience`:""}: ${e.designContract.whyCustom}`};var w}(e,a,n,o),l=r.levels??["l1","l2","l3","l4"],c={};for(const e of l)s[e]&&(c[e]=s[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),h=r.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...h?.length?{caveats:h}:{}}}var de=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),pe=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),fe=new Set(["PieChart","DonutChart","FunnelChart"]),me=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function ge(e,t){return pe.has(e)||fe.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function ye(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const r=e[t];if("string"==typeof r&&r)return r}}function be(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}var Ce={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",UnitPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PacketFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",CrucibleChart:"crucible physics chart",PhysicsCustomChart:"custom physics chart"},$e=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),ve=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]);function we(e){return Ce[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function ke(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var Se=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),xe={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Ae={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Pe=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Le={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function Fe(e){return xe[e]}function Re(e,t){const r=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,r={};for(const[e,a]of Object.entries(t.intentScores))"number"==typeof a&&Number.isFinite(a)&&(r[e]=a);return{family:t.family,intentScores:Object.keys(r).length?r:void 0}}return e}}(t);if(r?.act)return r.act;if(r?.intentScores){const e=function(e){let t,r=0;for(const[a,n]of Object.entries(e))if("number"==typeof n&&n>0)if(n>r)t=a,r=n;else if(n===r&&void 0!==t){const e=Pe.indexOf(a),r=Pe.indexOf(t);-1===e||-1!==r&&e>=r||(t=a)}return t}(r.intentScores);if(e&&xe[e]&&(r.intentScores[e]??0)>=3)return xe[e]}return r?.family?Ae[r.family]:function(e){return fe.has(e)||"StackedAreaChart"===e?"apportioning":Se.has(e)?"relating":pe.has(e)?"comparing":me.has(e)?"characterizing":de.has(e)?"tracking":$e.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}var je=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),De=new Set(["system","agent","watcher"]),Be=new Set(["ai","agent","system","computed","dbt","great-expectations"]),Ne=new Set(["rule","statistical-test","llm-inference","computed"]);function Oe(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!je.has(t.type))return!1;const r=t.provenance;return!(!r||"object"!=typeof r)&&(De.has(r.authorKind)||Be.has(r.source)||Ne.has(r.basis))})}function Ie(e="en"){let t,r;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),r=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?r.format(e):t.format(e):e+""}var Me={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function Te(e){const t=Me["string"==typeof e.type?e.type:"annotation"]||"an annotation",r=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,r=t?.authorKind??t?.source??t?.basis;return"watcher"===r?"a watcher-flagged ":"agent"===r||"ai"===r||"llm-inference"===r?"an AI-suggested ":""}(e),a=r?r+t.replace(/^an? /,""):t,n="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return n?`${a} labeled "${n}"`:a}function Ee(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const r=a(t.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;const n=r.map(Te),o=n.slice(0,5),i=n.length-o.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(o)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":l+" features"} on this chart: ${s}.`}function Ge(e,a,n={}){const o=void 0!==n.levels,i=new Set(n.levels??["l1","l2","l3"]);o||!n.capability&&!Oe(a)||i.add("l4");const s=O(e,a,n.recipe);if(s){const e=["l1","l2","l3","l4"].filter(e=>i.has(e));o||e.includes("l4")||e.push("l4");const t=he(s,a,{levels:e,locale:n.locale,audience:n.audience,includeCaveats:n.includeCaveats}),r=Ee(a);return{...t,text:r?`${r} ${t.text}`.trim():t.text,...r?{annotations:r}:{}}}const l=Ie(n.locale??"en"),c=we(e),u=Array.isArray(a.data)?a.data:null,h=ye(a),d=ve.has(e)?function(e,t){const r=e.physics&&"object"==typeof e.physics?e.physics:null,a=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,n=[e.settledProjectionRows,e.projectionRows,a?.rows,r?.settledProjectionRows,r?.projectionRows,r?.settledProjection&&"object"==typeof r.settledProjection?r.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(n)?n.map((e,r)=>{if(!e||"object"!=typeof e)return null;const a=e,n=ke(a.count??a.value??a.total??a.bodies??a.events);if(null==n)return null;const o=a.label??a.id??a.name??"container "+(r+1),i=ke(a.secondary??a.secondaryCount),s=ke(a.observed??a.observedCount);return{label:be(o,t),count:n,...null!=i?{secondary:i}:{},..."string"==typeof a.secondaryLabel&&a.secondaryLabel?{secondaryLabel:a.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(a,l):null,{measure:p,measureFallback:f,dimension:m,dimensionFallback:g}=ge(e,a),y="string"==typeof p&&p?p:f,b="string"==typeof m&&m?m:g,C={};if(ve.has(e)&&function(e,t,r,a,n,o){const i=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}(e),s=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"body"}(e);if(n.has("l1")&&(a.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"UnitPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PacketFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":"CrucibleChart"===e?"A crucible physics chart that replays authored phases and events into declared products and outlets; the settled ledger, not collisions, determines the result.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!n.has("l2")&&!n.has("l3"))return;if(!r||0===r.length)return void(n.has("l2")&&(a.l2="No settled projection is loaded yet."));const l=r.reduce((e,t)=>e+t.count,0),c=r.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??r.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const h=r.reduce((e,t)=>e+(t.secondary??0),0),d=r.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(n.has("l2"))if(0===c.length)a.l2=`The settled projection contains ${o(l)} ${He(l,s)} across ${r.length} ${He(r.length,i)}; no ${He(2,i)} are non-empty yet.`;else{const e=h>0?` ${o(h)} ${He(h,s)} ${1===h?"is":"are"} marked ${d}.`:"";a.l2=`The settled projection contains ${o(l)} ${He(l,s)} across ${r.length} ${He(r.length,i)}; ${c.length} ${He(c.length,i)} ${1===c.length?"is":"are"} non-empty. The largest ${i} is ${u.label} with ${o(u.count)} ${He(u.count,s)}.${e}`}if(n.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const r=e/t*100;return(10>r?Math.round(10*r)/10:Math.round(r))+"%"}(u.count,l);a.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${o(u.count)} ${He(u.count,s)} (${t}); ${e.label} follows with ${o(e.count)} ${He(e.count,s)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${o(u.count)} ${He(u.count,s)}.`}}(e,c,d,C,i,l),i.has("l1")&&!ve.has(e))if(de.has(e)||pe.has(e))C.l1=`A ${c} of ${y} by ${b}`+(h?`, split by ${h}.`:".");else if(fe.has(e))C.l1=`A ${c} showing ${y} across ${b} categories.`;else if(me.has(e))C.l1=`A ${c} of the distribution of ${y}`+(h?` by ${h}.`:".");else if($e.has(e)){const e=Array.isArray(a.nodes)?a.nodes.length:void 0,t=Array.isArray(a.edges)?a.edges.length:void 0,r=[null!=e?`${e} ${He(e,"node")}`:null,null!=t?`${t} ${He(t,"edge")}`:null].filter(Boolean);C.l1=`A ${c}${r.length?" with "+r.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof a.label?a.label:y;C.l1=`A single value${e?" for "+e:""}.`}else C.l1=`A ${c}.`;const $=de.has(e)||pe.has(e)||fe.has(e)||me.has(e);let v=null;if((i.has("l2")||i.has("l3")||i.has("l4"))&&$&&u&&u.length>0&&(v=function(e,t,r,a){let n=0,o=0,i=1/0,s=-1/0,l=null,c=null,u=0,h=0,d=null,p=null,f=NaN,m=NaN;for(const r of e){const e=t(r);Number.isFinite(e)&&(0===n&&(f=e,d=r),m=e,p=r,i>e&&(i=e,l=r,u=n),e>s&&(s=e,c=r,h=n),n++,o+=e)}return 0===n?null:{count:n,min:i,max:s,mean:o/n,minLabel:be(null!=l?r(l):null,a),maxLabel:be(null!=c?r(c):null,a),first:f,last:m,firstLabel:be(null!=d?r(d):null,a),lastLabel:be(null!=p?r(p):null,a),minIndex:u,maxIndex:h}}(u,t(p,f),r(m,g),l)),i.has("l2")&&$&&(u&&0!==u.length?v&&(C.l2=fe.has(e)?`${v.count} segments totaling ${l(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${l(v.max)}; smallest is ${v.minLabel} at ${l(v.min)}.`:`${y} ranges from ${l(v.min)} (${v.minLabel}) to ${l(v.max)} (${v.maxLabel}), with a mean of ${l(v.mean)} across ${v.count} points.`):C.l2="No data is loaded yet."),i.has("l3")&&v&&!h&&de.has(e)?C.l3=function(e,t,r){const{first:a,last:n,min:o,max:i,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:h,maxIndex:d,count:p}=e,f=i-o,m=n-a;if(0===f)return`${Ue(t)} is constant at ${r(a)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${Ue(t)} ends roughly where it started (${r(a)} at ${c} to ${r(n)} at ${u}), ranging between ${r(o)} and ${r(i)}.`;const g=d>0&&p-1>d,y=h>0&&p-1>h,b=(i-Math.max(a,n))/f,C=(Math.min(a,n)-o)/f;return g&&b>.15?`Overall ${t} climbs to a peak of ${r(i)} (${s}), then falls to ${r(n)} (${u}).`:y&&C>.15?`Overall ${t} drops to a low of ${r(o)} (${l}), then recovers to ${r(n)} (${u}).`:.05>Math.abs(m)/f?`${Ue(t)} ends roughly where it started (${r(a)} at ${c} to ${r(n)} at ${u}), ranging between ${r(o)} and ${r(i)}.`:m>0?d===p-1?`Overall ${t} rises from ${r(a)} (${c}) to a peak of ${r(n)} (${u}).`:`Overall ${t} rises from ${r(a)} (${c}) to ${r(n)} (${u}), after peaking at ${r(i)} (${s}).`:h===p-1?`Overall ${t} falls from ${r(a)} (${c}) to a low of ${r(n)} (${u}).`:`Overall ${t} falls from ${r(a)} (${c}) to ${r(n)} (${u}), after dipping to ${r(o)} (${l}).`}(v,y,l):i.has("l3")&&v&&!h&&pe.has(e)&&(C.l3=`The highest ${b} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),i.has("l4")){const t=Oe(a)?"alerting":Re(e,n.capability);t&&(C.l4=function(e,t,r,a,n,o,i,s){const l=Le[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,h;switch(e){case"locating":u="This is a map",h="read values by location";break;case"presenting":u="This is a single-value display",h=`read ${"string"==typeof r.label&&r.label?r.label:n} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,h="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,h="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,h=`read it for whether ${o} and ${n} move together`;break;default:u=`This is ${c} ${l} chart`,h=function(e,t,r,a,n,o){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+r;case"comparing":return`compare ${r} across ${a}`;case"ranking":return"read it top to bottom by "+r;case"apportioning":return`read each ${a}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+r;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,r){if(pe.has(r)||fe.has(r))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:a,last:n,min:o,max:i,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:h,count:d}=e,p=i-o;if(p>0){const e=h>0&&d-1>h,r=u>0&&d-1>u,f=(i-Math.max(a,n))/p,m=(Math.min(a,n)-o)/p;if(e&&f>.15)return`the peak of ${t(i)} at ${l} is the point to investigate`;if(r&&m>.15)return`the dip to ${t(o)} at ${s} is the point to investigate`;if(n>=i)return`the climb to ${t(n)} at ${c} warrants a closer look`;if(o>=n)return`the drop to ${t(n)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(i)}) and ${s} (${t(o)}) — are the points to check`}(t,n,o);case"tracking":return`read it for the trajectory of ${r}, which ${function(e){const t=e.max-e.min,r=e.last-e.first;return 0===t||.05>Math.abs(r)/t?"holds roughly steady":r>0?"rises":"falls"}(t)} from ${n(t.first)} (${t.firstLabel}) to ${n(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${r} across ${a}; ${t.maxLabel} leads at ${n(t.max)}`;case"ranking":return`read it top to bottom by ${r}; ${t.maxLabel} ranks highest at ${n(t.max)}`;case"apportioning":{const e=t.mean*t.count,r=e>0?Math.round(t.max/e*100):null;return`read each ${a}'s share of the ${n(e)} total; ${t.maxLabel} is the largest at ${n(t.max)}${null!=r?` (${r}%)`:""}`}case"characterizing":return`read it for the spread of ${r}, from ${n(t.min)} to ${n(t.max)}`;default:return"read the highlighted features"}}(e,a,n,o,i,t)}return`${u}; ${h}.${function(e,t){if(!t)return"";const r=t.familiarity?.[e];return"number"!=typeof r||r>2?"":` This ${we(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(t,e,a,h?null:v,y,b,l,n.audience))}const w=["l1","l2","l3","l4"].filter(e=>i.has(e)&&C[e]).map(e=>C[e]).join(" "),k=Ee(a);return{text:k?`${k} ${w}`.trim():w,levels:C,...k?{annotations:k}:{}}}function Ue(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function He(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function qe(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function ze(e,t,r={}){const a=N(t),n=B(t),o=Math.max(1,r.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:a,config:n,locale:r.locale??"en"});const i=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(i?.groupByRole?M(e,i.groupByRole):void 0)??(i?.groupBy?.[0]?M(e,i.groupBy[0])??e.dataRoles.find(e=>e.field===i.groupBy?.[0]):void 0)??T(e,["nominal","ordinal"]),c=l?I(l,n,a):void 0,u=(i?.idRole?M(e,i.idRole):void 0)??T(e,["identifier"]),h=u?I(u,n,a):void 0,d={id:"root",role:"chart",label:i?.summaryTemplate?E(i.summaryTemplate,void 0,e,n,a,{count:a.length}):`${e.name}: ${a.length} ${1===a.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const f=(t,r,o)=>{const s=h?t[h]:void 0,l=i?.itemLabelTemplate?E(i.itemLabelTemplate,t,e,n,a,{count:a.length}):function(e,t,r,a){const n=T(t,["nominal","ordinal"]),o=t.dataRoles.filter(e=>"quantitative"===e.semanticType),i=n?I(n,r,a):void 0,s=[];i&&null!=e[i]&&s.push(e[i]+"");for(const t of o){const n=I(t,r,a);n&&null!=e[n]&&s.push(`${t.role}: ${e[n]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,n,a);return{id:"datum-"+qe(s??r),role:"datum",label:l,level:o,datum:t}};if(c){const e=new Map;for(const t of a){const r=(t[c]??"Uncategorized")+"",a=e.get(r);a?a.push(t):e.set(r,[t])}d.children=[...e].map(([e,t],r)=>{const a=t.slice(0,Math.max(0,o-p));p+=a.length;const n=a.map((e,t)=>f(e,1e5*r+t,3));return t.length>a.length&&n.push({id:"more-"+qe(e),role:"datum",label:`…and ${t.length-a.length} more items`,level:3}),{id:"group-"+qe(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:n}})}else{const e=a.slice(0,o);d.children=e.map((e,t)=>f(e,t,2)),a.length>e.length&&d.children.push({id:"more",role:"datum",label:`…and ${a.length-e.length} more items`,level:2})}return d}function Ve(e,n,o={}){const i=o.locale??"en",s=Math.max(1,o.maxLeaves??200),l=Ie(i),c=O(e,n,o.recipe);if(c)return ze(c,n,{maxLeaves:s,locale:i});const u={id:"root",role:"chart",label:Ge(e,n,{locale:i}).text||"Chart.",level:1,children:[]},h=function(e,t){const r=Array.isArray(e.annotations)?e.annotations:null;if(!r)return null;const n=a(r.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let o=0;const i=n.slice(0,t).map(e=>{const t=e.lifecycle?.status,r=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+o++,role:"annotation",level:3,label:`${a=Te(e),a?a.charAt(0).toUpperCase()+a.slice(1):a}${r}.`,datum:e};var a});n.length>t&&i.push({id:"annotation-"+o++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const s=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(n,s),d=Array.isArray(n.data)?n.data:null,p=de.has(e)||pe.has(e)||fe.has(e)||me.has(e);if(!d||0===d.length||!p)return h&&(u.children=[h]),u;const{measure:f,measureFallback:m,dimension:g,dimensionFallback:y}=ge(e,n),b=t(f,m),C=r(g,y),$="string"==typeof f&&f?f:m,v="string"==typeof g&&g?g:y,w=ye(n);let k=0;const S=e=>`${e}-${k++}`,x=(e,t)=>{const r=e.slice(0,s).map(e=>((e,t)=>{const r=b(e),a=be(C(e),l);return{id:S("datum"),role:"datum",level:t,label:`${a}: ${Number.isFinite(r)?l(r):"—"}`,value:Number.isFinite(r)?r:void 0,datum:e}})(e,t));return e.length>s&&r.push({id:S("more"),role:"datum",level:t,label:`…and ${e.length-s} more points`}),r},A=[];if(de.has(e)||pe.has(e)){let t=1/0,r=-1/0,a=1/0,n=-1/0;const o=[];let i=!0;for(const e of d){const s=b(e);Number.isFinite(s)&&(t>s&&(t=s),s>r&&(r=s));const l=C(e);o.push(l),"number"==typeof l&&Number.isFinite(l)?(a>l&&(a=l),l>n&&(n=l)):i=!1}const s=new Set,c=[];for(const e of o){const t=e+"";s.has(t)||(s.add(t),c.push(e))}const u=i?`${l(a)} to ${l(n)}`:`${be(c[0],l)} to ${be(c[c.length-1],l)} (${pe.has(e)?c.length+" categories":d.length+" points"})`;A.push({id:S("axis"),role:"axis",level:2,label:`${pe.has(e)?"Category axis":"X axis"}: ${v}, ${u}.`}),t>r||A.push({id:S("axis"),role:"axis",level:2,label:`Value axis: ${$}, ${l(t)} to ${l(r)}.`})}if(w){const t=r(w,w),a=new Map;for(const e of d){const r=(t(e)??"—")+"",n=a.get(r);n?n.push(e):a.set(r,[e])}const o=[];for(const[t,r]of a){const a=Ge(e,{...n,data:r},{levels:["l2","l3"],locale:i}).text;o.push({id:S("series"),role:"series",level:2,label:`Series ${t}: ${a}`,children:x(r,3)})}u.children=[...A,...o]}else u.children=[...A,...x(d,2)];return h&&u.children.push(h),u}function _e(e,t){const r=[],a=e=>{if(r.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)a(t)};return a(e),r}function Je(e){let t=1;if(e.children)for(const r of e.children)t+=Je(r);return t}var Ke=new Set(["TreeDiagram","Treemap","CirclePack","OrbitDiagram"]),We=new Set(["ForceDirectedGraph","SankeyDiagram","ChordDiagram"]),Qe=new Set(["BarChart","StackedBarChart","GroupedBarChart","AreaChart","StackedAreaChart"]),Xe=new Set(["LineChart","AreaChart","StackedAreaChart"]),Ye=new Set(["BarChart","StackedBarChart","GroupedBarChart","FunnelChart"]),Ze=new Set(["LineChart","AreaChart","StackedAreaChart","ConnectedScatterplot"]),et=new Set(["PieChart","DonutChart"]),tt={PieChart:"valueAccessor",DonutChart:"valueAccessor",FunnelChart:"valueAccessor"},rt=new Set(Object.keys(tt)),at={StackedBarChart:"valueAccessor",StackedAreaChart:"yAccessor"},nt=new Set(["BigNumber"]),ot=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart"]),it=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),st=new Set(["StreamPhysicsFrame","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]),lt=new Set(["OrbitDiagram",...st]),ct=new Set(["GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart"]),ut=new Set(["GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]),ht=new Set(["RealtimeLineChart","RealtimeHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","ProcessSankey"]),dt=new Set(["MultiAxisLineChart"]),pt=new Set(["ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram"]),ft={Scatterplot:"pointRadius",BubbleChart:"pointRadius",ConnectedScatterplot:"pointRadius",QuadrantChart:"pointRadius",SwarmPlot:"pointRadius",DotPlot:"dotRadius"};export{o as defineChartRecipe,i as validateChartRecipe,s as isRegisteredRecipeLayout,l as isJsonSafe,m as resolveRecipeRoleField,g as recipeToChartCapability,C as registerChartRecipe,$ as unregisterChartRecipe,v as getChartRecipe,w as listChartRecipes,k as getRegisteredRecipeCapabilities,S as hasRegisteredRecipeCapabilities,x as registerRecipeLayout,A as unregisterRecipeLayout,P as getRecipeLayout,L as resolveChartRecipe,D as recipeIntentId,B as recipeConfig,I as fieldForRole,V as toConfig,_ as fromConfig,J as toURL,K as fromURL,W as copyConfig,Q as configToJSX,X as serializeSelections,Y as deserializeSelections,ae as unwrapIDIDEnrichedVegaLiteSpec,se as fromVegaLite,le as fromVegaLiteResult,he as describeRecipeChart,Fe as communicativeActForIntent,Re as resolveCommunicativeAct,Ge as describeChart,ze as buildRecipeNavigationTree,Ve as buildNavigationTree,_e as flattenVisible,Je as countNodes,Ke as HIERARCHY_CHARTS,We as NETWORK_CHARTS,Qe as BAR_AREA_CHARTS,Xe as TREND_SERIES_CHARTS,Ye as ORDINAL_BAR_CHARTS,Ze as CURVE_CHARTS,et as PIE_CHARTS,tt as PART_TO_WHOLE_ACCESSORS,rt as PART_TO_WHOLE_CHARTS,at as NORMALIZED_STACK_ACCESSORS,nt as VALUE_CHARTS,ot as XY_WITH_AXES_CHARTS,it as ORDINAL_CHARTS,st as PHYSICS_MOTION_CHARTS,lt as CONTINUOUS_MOTION_CHARTS,ct as PHYSICS_SETTLED_CHARTS,ut as PHYSICS_DIAGNOSTIC_CHARTS,ht as REALTIME_CHARTS,dt as DUAL_AXIS_CHARTS,pt as GEO_CHARTS,ft as POINT_TARGET_RADIUS_PROP};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{darkenColor as t,lightenColor as n}from"./chunk-chunk-2JGJ5GUG.module.min.js";import{confidenceZScore as o,fitLinearForForecast as e,forecastIntervalStats as r,getMax as a,getMinMax as s}from"./chunk-chunk-2NVFEB7P.module.min.js";var i="__forecastSegment",l="__forecastOpacity";function c(t,n,o,e){const r=n.uncertaintyOpacity,a=n.confidenceAccessor;if(!r&&!a)return;const i="object"==typeof r?r:{},c=i.min??.15,f=i.max??1;if(a){const n="function"==typeof a?a:t=>t[a];for(const o of t){const t=n(o);null!=t&&Number.isFinite(t)&&(o[l]=c+Math.max(0,Math.min(1,t))*(f-c))}return}const u=t.map(t=>{const n=o(t),r=e(t);return null!=n&&null!=r&&Number.isFinite(n)&&Number.isFinite(r)?Math.abs(n-r):NaN}),p=u.filter(t=>Number.isFinite(t));if(0===p.length)return;const[h,y]=s(p),d=y-h;t.forEach((t,n)=>{const o=u[n];Number.isFinite(o)&&(t[l]=f-(d>0?(o-h)/d:0)*(f-c))})}function f(t,n){return"function"==typeof n?n(t):!!t[n]}function u(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 p(t,n,s,l,u){return(p=l).isTraining||p.isForecast||p.isAnomaly||p.upperBounds||p.lowerBounds?function(t,n,o,e,r){const{isTraining:a,isForecast:s,isAnomaly:l,upperBounds:u,lowerBounds:p,color:h="#6366f1",bandOpacity:y=.15,anomalyColor:d="#ef4444",anomalyRadius:m=6,label:b}=e,g=t.map(t=>{let n="observed";return s&&f(t,s)?n="forecast":a&&f(t,a)&&(n="training"),{...t,[i]:n}}),k=e._groupBy,_=[];if(k){const t=new Map;for(const n of g){const o=n[k]??"__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][i]!==o[t+1][i]&&(n.push({...o[t+1],[i]:o[t][i]}),n.push({...o[t],[i]:o[t+1][i]}));_.push(...g,...n)}else for(let t=0;g.length>t;t++)_.push(g[t]),g.length-1>t&&g[t][i]!==g[t+1][i]&&(_.push({...g[t+1],[i]:g[t][i]}),_.push({...g[t],[i]:g[t+1][i]}));if(e.trainUnderline){const t=[];for(const n of _)"training"===n[i]&&t.push({...n,[i]:"training-base"});_.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 _)"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:b})}if(e.uncertaintyOpacity||e.confidenceAccessor){const t=u?"function"==typeof u?u:t=>t[u]:()=>{},n=p?"function"==typeof p?p:t=>t[p]:()=>{};c(_.filter(t=>"forecast"===t[i]),e,t,n)}if(l){const t=e.anomalyStyle,n={type:"highlight",filter:t=>f(t,l)};t?(n.style=t,n.r=m):"function"==typeof d?(n.style=t=>{const n=d(t);return{stroke:n,strokeWidth:1.5,fill:n,fillOpacity:.7}},n.r=m):(n.color=d,n.r=m,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:_,annotations:O}}(t,0,0,l,u):function(t,n,s,l,f){const{trainEnd:u,steps:p=10,confidence:h=.95,color:y="#6366f1",bandOpacity:d=.15,label:m}=l;if(null==u)return{processedData:t,annotations:[]};const b=[],g=[];for(const o of t)o[n]>u?g.push({...o,[i]:"observed"}):b.push({...o,[i]:"training"});const k=b.map(t=>[t[n],t[s]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,n)=>t[0]-n[0]),_=[],O=[];if(k.length>=3){const f=k.length,u=e(k);if(u){const{se:e,meanX:b,ssX:g}=r(k,u),w=o(h),B=t.map(t=>t[n]).filter(t=>null!=t&&isFinite(t)),F=a(B),v=k.length>1?(k[f-1][0]-k[0][0])/(f-1):1;for(let t=1;p>=t;t++){const o=F+t*v,r=u(o),a=e*Math.sqrt(1+1/f+(g>0?(o-b)**2/g:0))*w;O.push({[n]:o,[s]:r,[i]:"forecast",__forecastUpper:r+a,__forecastLower:r-a})}c(O,l,t=>t.__forecastUpper,t=>t.__forecastLower),_.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:y,fillOpacity:d,label:m})}}_.push({type:"x-threshold",x:u,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),f&&_.push({type:"anomaly-band",threshold:f.threshold??2,showBand:!1!==f.showBand,fill:f.bandColor||"#6366f1",fillOpacity:f.bandOpacity??.1,anomalyColor:f.anomalyColor||"#ef4444",anomalyRadius:f.anomalyRadius??6,label:f.label});const w=[];if(w.push(...b),b.length>0&&g.length>0&&w.push({...b[b.length-1],[i]:"observed"}),w.push(...g),O.length>0){const t=g.length>0?g[g.length-1]:b[b.length-1];t&&w.push({...t,[i]:"forecast"}),w.push(...O)}return{processedData:w,annotations:_}}(t,n,s,l,u);var p}function h(o,e){const r=e.trainDasharray??"8,4",a=e.forecastDasharray??"4,4",s=e.color||"#6366f1",c=e.trainOpacity,f=e.forecastOpacity,u=e.trainStroke,p=e.trainLinecap,h=e.trainUnderline;return e=>{const y=o(e),d=e[i];if("training"===d){let n=y.stroke;return"darken"===u?n=t(y.stroke||"#666",.5):u&&(n=u),{...y,stroke:n,strokeDasharray:r,...p&&{strokeLinecap:p},...null!=c&&{strokeOpacity:c}}}if("training-base"===d){let t=y.stroke||"#666";return"lighten"===h&&(t=n(t,.4)),{...y,stroke:t,strokeDasharray:void 0}}if("forecast"===d){const t=e[l],n=null!=t?t:f;return{...y,stroke:s,strokeDasharray:a,...null!=n&&{strokeOpacity:n}}}return y}}export{l as FORECAST_OPACITY_FIELD,i as SEGMENT_FIELD,u as buildAnomalyAnnotations,p as buildForecast,h as createSegmentLineStyle,t as darkenColor,n as lightenColor,c as stampForecastOpacity};
@@ -79,8 +79,8 @@ export { SankeyDiagram } from "./network/SankeyDiagram";
79
79
  export type { SankeyDiagramProps } from "./network/SankeyDiagram";
80
80
  export { ProcessSankey } from "./network/ProcessSankey";
81
81
  export type { ProcessSankeyProps, ProcessSankeyTick } from "./network/ProcessSankey";
82
- export { validateProcessSankey, formatProcessSankeyIssue, } from "./network/processSankey/algorithm";
83
- export type { ProcessSankeyNode as ProcessSankeyValidatorNode, ProcessSankeyEdge as ProcessSankeyValidatorEdge, ProcessSankeyIssue, } from "./network/processSankey/algorithm";
82
+ export { validateProcessSankey, formatProcessSankeyIssue, inventoryAtTime, toProcessSankeyTime, } from "./network/processSankey/algorithm";
83
+ export type { ProcessSankeyNode as ProcessSankeyValidatorNode, ProcessSankeyEdge as ProcessSankeyValidatorEdge, ProcessSankeyIssue, InventoryEdge, InventoryAtTimeOptions, ProcessSankeyTimeLike, } from "./network/processSankey/algorithm";
84
84
  export { TreeDiagram } from "./network/TreeDiagram";
85
85
  export type { TreeDiagramProps } from "./network/TreeDiagram";
86
86
  export { Treemap } from "./network/Treemap";