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
@@ -1 +0,0 @@
1
- import{filterAnnotationsByStatus as e,resolveAccessor as t,resolveRawAccessor as n}from"./chunk-chunk-XFRBLXYM.module.min.js";var r=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),o=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),a=new Set(["PieChart","DonutChart","FunnelChart"]),i=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function s(e,t){return o.has(e)||a.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 l(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const n=e[t];if("string"==typeof n&&n)return n}}function c(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function u(e,t=new Set){if(null===e)return!0;const n=typeof e;if("string"===n||"boolean"===n)return!0;if("number"===n)return Number.isFinite(e);if("object"!==n)return!1;if(t.has(e))return!1;t.add(e);const r=Array.isArray(e)?e.every(e=>u(e,t)):Object.entries(e).every(([,e])=>u(e,t));return t.delete(e),r}var h=Symbol.for("semiotic.chartRecipeRegistry");function d(e){return function(){const e=globalThis;return e[h]||(e[h]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[h]}().recipes.get(e)}function p(e){return"string"==typeof e?d(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function f(e){return"string"==typeof e?e:e.id??e.name}function m(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function g(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 y(e,t,n){return n??p(t.recipe)??p(t.recipeId)??d(e)}function b(e,t,n=[]){const r=e.accessor?t[e.accessor]:void 0;if("string"==typeof r&&r)return r;if(e.field)return e.field;const o=n.find(e=>e&&"object"==typeof e);if(!o)return;const a=Object.entries(o).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?a.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in o):a.find(([,e])=>"string"==typeof e)?.[0]}function $(e,t){return e.dataRoles.find(e=>e.role===t)}function v(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function C(e,t,n,r,o,a={}){const i={...a};if(t)for(const[e,n]of Object.entries(t))i[e]=n;for(const e of n.dataRoles){const n=b(e,r,o),a=t&&n?t[n]:n;void 0!==a&&(i[e.role]=a)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const n=i[t];return null==n?`{${t}}`:n+""})}var w={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"},S=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),x=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]);function k(e){return w[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function A(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var P=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),j={"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"},F={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},L=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],D={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function B(e){return j[e]}function N(e,t){const n=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,n={};for(const[e,r]of Object.entries(t.intentScores))"number"==typeof r&&Number.isFinite(r)&&(n[e]=r);return{family:t.family,intentScores:Object.keys(n).length?n:void 0}}return e}}(t);if(n?.act)return n.act;if(n?.intentScores){const e=function(e){let t,n=0;for(const[r,o]of Object.entries(e))if("number"==typeof o&&o>0)if(o>n)t=r,n=o;else if(o===n&&void 0!==t){const e=L.indexOf(r),n=L.indexOf(t);-1===e||-1!==n&&e>=n||(t=r)}return t}(n.intentScores);if(e&&j[e]&&(n.intentScores[e]??0)>=3)return j[e]}return n?.family?F[n.family]:function(e){return a.has(e)||"StackedAreaChart"===e?"apportioning":P.has(e)?"relating":o.has(e)?"comparing":i.has(e)?"characterizing":r.has(e)?"tracking":S.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}var I=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),M=new Set(["system","agent","watcher"]),R=new Set(["ai","agent","system","computed","dbt","great-expectations"]),O=new Set(["rule","statistical-test","llm-inference","computed"]);function T(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||!I.has(t.type))return!1;const n=t.provenance;return!(!n||"object"!=typeof n)&&(M.has(n.authorKind)||R.has(n.source)||O.has(n.basis))})}function G(e="en"){let t,n;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?n.format(e):t.format(e):e+""}var E={"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 U(e){const t=E["string"==typeof e.type?e.type:"annotation"]||"an annotation",n=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,n=t?.authorKind??t?.source??t?.basis;return"watcher"===n?"a watcher-flagged ":"agent"===n||"ai"===n||"llm-inference"===n?"an AI-suggested ":""}(e),r=n?n+t.replace(/^an? /,""):t,o="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return o?`${r} labeled "${o}"`:r}function q(t){const n=Array.isArray(t.annotations)?t.annotations:null;if(!n||0===n.length)return;const r=e(n.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return;const o=r.map(U),a=o.slice(0,5),i=o.length-a.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]??""}(a)+(i>0?`, and ${i} more`:""),l=r.length;return`The author has marked ${1===l?"one feature":l+" features"} on this chart: ${s}.`}function z(e,u,h={}){const d=void 0!==h.levels,p=new Set(h.levels??["l1","l2","l3"]);d||!h.capability&&!T(u)||p.add("l4");const $=y(e,u,h.recipe);if($){const e=["l1","l2","l3","l4"].filter(e=>p.has(e));d||e.includes("l4")||e.push("l4");const t=function(e,t,n={}){const r=g(t),o=m(t),a=n.locale??"en",i="function"==typeof e.description?e.description({data:r,config:o,locale:a}):void 0,s=i?.levels??function(e,t,n,r){const o=v(e,["nominal","ordinal"]),a=v(e,["quantitative"]),i=o?b(o,n,t):void 0,s=a?b(a,n,t):void 0,l=o?.role??i??"category",c=a?.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})}}}(r),m=new Map;if(i&&s)for(const e of t){const t=(e[i]??"Uncategorized")+"",n=Number(e[s]);Number.isFinite(n)&&m.set(t,(m.get(t)??0)+n)}const g=[...m].sort((e,t)=>t[1]-e[1]),y=g.reduce((e,[,t])=>e+t,0),$=g[0],C=g[1],w=y>0?(($?.[1]??0)+(C?.[1]??0))/y:0,S=e.intents.map(e=>({id:f(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,x=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${k=h,k?k.charAt(0).toUpperCase()+k.slice(1):k}.`,l2:g.length>0?`${g.length} categories total ${d.format(y)}. ${$[0]} accounts for ${d.format($[1])}${y>0?` (${p.format($[1]/y)})`:""}${C?`, followed by ${C[0]} at ${d.format(C[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>g.length?$?$[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>w?`The total is distributed across ${g.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${$[0]} and ${C[0]}, which together account for ${p.format(w)}.`,l4:`The chart is intended for ${S??"explanation"}${x?` with a ${x} audience`:""}: ${e.designContract.whyCustom}`};var k}(e,r,o,a),l=n.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=n.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...h?.length?{caveats:h}:{}}}($,u,{levels:e,locale:h.locale,audience:h.audience,includeCaveats:h.includeCaveats}),n=q(u);return{...t,text:n?`${n} ${t.text}`.trim():t.text,...n?{annotations:n}:{}}}const C=G(h.locale??"en"),w=k(e),P=Array.isArray(u.data)?u.data:null,j=l(u),F=x.has(e)?function(e,t){const n=e.physics&&"object"==typeof e.physics?e.physics:null,r=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,o=[e.settledProjectionRows,e.projectionRows,r?.rows,n?.settledProjectionRows,n?.projectionRows,n?.settledProjection&&"object"==typeof n.settledProjection?n.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(o)?o.map((e,n)=>{if(!e||"object"!=typeof e)return null;const r=e,o=A(r.count??r.value??r.total??r.bodies??r.events);if(null==o)return null;const a=r.label??r.id??r.name??"container "+(n+1),i=A(r.secondary??r.secondaryCount),s=A(r.observed??r.observedCount);return{label:c(a,t),count:o,...null!=i?{secondary:i}:{},..."string"==typeof r.secondaryLabel&&r.secondaryLabel?{secondaryLabel:r.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(u,C):null,{measure:L,measureFallback:B,dimension:I,dimensionFallback:M}=s(e,u),R="string"==typeof L&&L?L:B,O="string"==typeof I&&I?I:M,E={};if(x.has(e)&&function(e,t,n,r,o,a){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(o.has("l1")&&(r.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)),!o.has("l2")&&!o.has("l3"))return;if(!n||0===n.length)return void(o.has("l2")&&(r.l2="No settled projection is loaded yet."));const l=n.reduce((e,t)=>e+t.count,0),c=n.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??n.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const h=n.reduce((e,t)=>e+(t.secondary??0),0),d=n.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(o.has("l2"))if(0===c.length)r.l2=`The settled projection contains ${a(l)} ${J(l,s)} across ${n.length} ${J(n.length,i)}; no ${J(2,i)} are non-empty yet.`;else{const e=h>0?` ${a(h)} ${J(h,s)} ${1===h?"is":"are"} marked ${d}.`:"";r.l2=`The settled projection contains ${a(l)} ${J(l,s)} across ${n.length} ${J(n.length,i)}; ${c.length} ${J(c.length,i)} ${1===c.length?"is":"are"} non-empty. The largest ${i} is ${u.label} with ${a(u.count)} ${J(u.count,s)}.${e}`}if(o.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const n=e/t*100;return(10>n?Math.round(10*n)/10:Math.round(n))+"%"}(u.count,l);r.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${a(u.count)} ${J(u.count,s)} (${t}); ${e.label} follows with ${a(e.count)} ${J(e.count,s)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${a(u.count)} ${J(u.count,s)}.`}}(e,w,F,E,p,C),p.has("l1")&&!x.has(e))if(r.has(e)||o.has(e))E.l1=`A ${w} of ${R} by ${O}`+(j?`, split by ${j}.`:".");else if(a.has(e))E.l1=`A ${w} showing ${R} across ${O} categories.`;else if(i.has(e))E.l1=`A ${w} of the distribution of ${R}`+(j?` by ${j}.`:".");else if(S.has(e)){const e=Array.isArray(u.nodes)?u.nodes.length:void 0,t=Array.isArray(u.edges)?u.edges.length:void 0,n=[null!=e?`${e} ${J(e,"node")}`:null,null!=t?`${t} ${J(t,"edge")}`:null].filter(Boolean);E.l1=`A ${w}${n.length?" with "+n.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof u.label?u.label:R;E.l1=`A single value${e?" for "+e:""}.`}else E.l1=`A ${w}.`;const U=r.has(e)||o.has(e)||a.has(e)||i.has(e);let z=null;if((p.has("l2")||p.has("l3")||p.has("l4"))&&U&&P&&P.length>0&&(z=function(e,t,n,r){let o=0,a=0,i=1/0,s=-1/0,l=null,u=null,h=0,d=0,p=null,f=null,m=NaN,g=NaN;for(const n of e){const e=t(n);Number.isFinite(e)&&(0===o&&(m=e,p=n),g=e,f=n,i>e&&(i=e,l=n,h=o),e>s&&(s=e,u=n,d=o),o++,a+=e)}return 0===o?null:{count:o,min:i,max:s,mean:a/o,minLabel:c(null!=l?n(l):null,r),maxLabel:c(null!=u?n(u):null,r),first:m,last:g,firstLabel:c(null!=p?n(p):null,r),lastLabel:c(null!=f?n(f):null,r),minIndex:h,maxIndex:d}}(P,t(L,B),n(I,M),C)),p.has("l2")&&U&&(P&&0!==P.length?z&&(E.l2=a.has(e)?`${z.count} segments totaling ${C(function(e){return e.mean*e.count}(z))}. Largest is ${z.maxLabel} at ${C(z.max)}; smallest is ${z.minLabel} at ${C(z.min)}.`:`${R} ranges from ${C(z.min)} (${z.minLabel}) to ${C(z.max)} (${z.maxLabel}), with a mean of ${C(z.mean)} across ${z.count} points.`):E.l2="No data is loaded yet."),p.has("l3")&&z&&!j&&r.has(e)?E.l3=function(e,t,n){const{first:r,last:o,min:a,max:i,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:h,maxIndex:d,count:p}=e,f=i-a,m=o-r;if(0===f)return`${H(t)} is constant at ${n(r)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${H(t)} ends roughly where it started (${n(r)} at ${c} to ${n(o)} at ${u}), ranging between ${n(a)} and ${n(i)}.`;const g=d>0&&p-1>d,y=h>0&&p-1>h,b=(i-Math.max(r,o))/f,$=(Math.min(r,o)-a)/f;return g&&b>.15?`Overall ${t} climbs to a peak of ${n(i)} (${s}), then falls to ${n(o)} (${u}).`:y&&$>.15?`Overall ${t} drops to a low of ${n(a)} (${l}), then recovers to ${n(o)} (${u}).`:.05>Math.abs(m)/f?`${H(t)} ends roughly where it started (${n(r)} at ${c} to ${n(o)} at ${u}), ranging between ${n(a)} and ${n(i)}.`:m>0?d===p-1?`Overall ${t} rises from ${n(r)} (${c}) to a peak of ${n(o)} (${u}).`:`Overall ${t} rises from ${n(r)} (${c}) to ${n(o)} (${u}), after peaking at ${n(i)} (${s}).`:h===p-1?`Overall ${t} falls from ${n(r)} (${c}) to a low of ${n(o)} (${u}).`:`Overall ${t} falls from ${n(r)} (${c}) to ${n(o)} (${u}), after dipping to ${n(a)} (${l}).`}(z,R,C):p.has("l3")&&z&&!j&&o.has(e)&&(E.l3=`The highest ${O} is ${z.maxLabel} and the lowest is ${z.minLabel}.`),p.has("l4")){const t=T(u)?"alerting":N(e,h.capability);t&&(E.l4=function(e,t,n,r,i,s,l,c){const u=D[e],h=/^[aeiou]/i.test(u)?"an":"a";let d,p;switch(e){case"locating":d="This is a map",p="read values by location";break;case"presenting":d="This is a single-value display",p=`read ${"string"==typeof n.label&&n.label?n.label:i} as the headline number`;break;case"tracing":d=`This is ${h} ${u} chart`,p="follow the movement between states";break;case"nesting":d=`This is ${h} ${u} chart`,p="read it for nested structure and how children sum into their parents";break;case"relating":d=`This is ${h} ${u} chart`,p=`read it for whether ${s} and ${i} move together`;break;default:d=`This is ${h} ${u} chart`,p=function(e,t,n,r,i,s){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 "+n;case"comparing":return`compare ${n} across ${r}`;case"ranking":return"read it top to bottom by "+n;case"apportioning":return`read each ${r}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+n;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,n){if(o.has(n)||a.has(n))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:r,last:i,min:s,max:l,minLabel:c,maxLabel:u,lastLabel:h,minIndex:d,maxIndex:p,count:f}=e,m=l-s;if(m>0){const e=p>0&&f-1>p,n=d>0&&f-1>d,o=(l-Math.max(r,i))/m,a=(Math.min(r,i)-s)/m;if(e&&o>.15)return`the peak of ${t(l)} at ${u} is the point to investigate`;if(n&&a>.15)return`the dip to ${t(s)} at ${c} is the point to investigate`;if(i>=l)return`the climb to ${t(i)} at ${h} warrants a closer look`;if(s>=i)return`the drop to ${t(i)} at ${h} warrants a closer look`}return`the extremes — ${u} (${t(l)}) and ${c} (${t(s)}) — are the points to check`}(t,i,s);case"tracking":return`read it for the trajectory of ${n}, which ${function(e){const t=e.max-e.min,n=e.last-e.first;return 0===t||.05>Math.abs(n)/t?"holds roughly steady":n>0?"rises":"falls"}(t)} from ${i(t.first)} (${t.firstLabel}) to ${i(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${n} across ${r}; ${t.maxLabel} leads at ${i(t.max)}`;case"ranking":return`read it top to bottom by ${n}; ${t.maxLabel} ranks highest at ${i(t.max)}`;case"apportioning":{const e=t.mean*t.count,n=e>0?Math.round(t.max/e*100):null;return`read each ${r}'s share of the ${i(e)} total; ${t.maxLabel} is the largest at ${i(t.max)}${null!=n?` (${n}%)`:""}`}case"characterizing":return`read it for the spread of ${n}, from ${i(t.min)} to ${i(t.max)}`;default:return"read the highlighted features"}}(e,r,i,s,l,t)}return`${d}; ${p}.${function(e,t){if(!t)return"";const n=t.familiarity?.[e];return"number"!=typeof n||n>2?"":` This ${k(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,c)}`}(t,e,u,j?null:z,R,O,C,h.audience))}const V=["l1","l2","l3","l4"].filter(e=>p.has(e)&&E[e]).map(e=>E[e]).join(" "),Q=q(u);return{text:Q?`${Q} ${V}`.trim():V,levels:E,...Q?{annotations:Q}:{}}}function H(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function J(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function V(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Q(u,h,d={}){const p=d.locale??"en",f=Math.max(1,d.maxLeaves??200),w=G(p),S=y(u,h,d.recipe);if(S)return function(e,t,n={}){const r=g(t),o=m(t),a=Math.max(1,n.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:r,config:o,locale:n.locale??"en"});const i=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(i?.groupByRole?$(e,i.groupByRole):void 0)??(i?.groupBy?.[0]?$(e,i.groupBy[0])??e.dataRoles.find(e=>e.field===i.groupBy?.[0]):void 0)??v(e,["nominal","ordinal"]),c=l?b(l,o,r):void 0,u=(i?.idRole?$(e,i.idRole):void 0)??v(e,["identifier"]),h=u?b(u,o,r):void 0,d={id:"root",role:"chart",label:i?.summaryTemplate?C(i.summaryTemplate,void 0,e,o,r,{count:r.length}):`${e.name}: ${r.length} ${1===r.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const f=(t,n,a)=>{const s=h?t[h]:void 0,l=i?.itemLabelTemplate?C(i.itemLabelTemplate,t,e,o,r,{count:r.length}):function(e,t,n,r){const o=v(t,["nominal","ordinal"]),a=t.dataRoles.filter(e=>"quantitative"===e.semanticType),i=o?b(o,n,r):void 0,s=[];i&&null!=e[i]&&s.push(e[i]+"");for(const t of a){const o=b(t,n,r);o&&null!=e[o]&&s.push(`${t.role}: ${e[o]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,o,r);return{id:"datum-"+V(s??n),role:"datum",label:l,level:a,datum:t}};if(c){const e=new Map;for(const t of r){const n=(t[c]??"Uncategorized")+"",r=e.get(n);r?r.push(t):e.set(n,[t])}d.children=[...e].map(([e,t],n)=>{const r=t.slice(0,Math.max(0,a-p));p+=r.length;const o=r.map((e,t)=>f(e,1e5*n+t,3));return t.length>r.length&&o.push({id:"more-"+V(e),role:"datum",label:`…and ${t.length-r.length} more items`,level:3}),{id:"group-"+V(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:o}})}else{const e=r.slice(0,a);d.children=e.map((e,t)=>f(e,t,2)),r.length>e.length&&d.children.push({id:"more",role:"datum",label:`…and ${r.length-e.length} more items`,level:2})}return d}(S,h,{maxLeaves:f,locale:p});const x={id:"root",role:"chart",label:z(u,h,{locale:p}).text||"Chart.",level:1,children:[]},k=function(t,n){const r=Array.isArray(t.annotations)?t.annotations:null;if(!r)return null;const o=e(r.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return null;let a=0;const i=o.slice(0,n).map(e=>{const t=e.lifecycle?.status,n=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+a++,role:"annotation",level:3,label:`${r=U(e),r?r.charAt(0).toUpperCase()+r.slice(1):r}${n}.`,datum:e};var r});o.length>n&&i.push({id:"annotation-"+a++,role:"annotation",level:3,label:`…and ${o.length-n} more annotations.`});const s=o.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(h,f),A=Array.isArray(h.data)?h.data:null,P=r.has(u)||o.has(u)||a.has(u)||i.has(u);if(!A||0===A.length||!P)return k&&(x.children=[k]),x;const{measure:j,measureFallback:F,dimension:L,dimensionFallback:D}=s(u,h),B=t(j,F),N=n(L,D),I="string"==typeof j&&j?j:F,M="string"==typeof L&&L?L:D,R=l(h);let O=0;const T=e=>`${e}-${O++}`,E=(e,t)=>{const n=e.slice(0,f).map(e=>((e,t)=>{const n=B(e),r=c(N(e),w);return{id:T("datum"),role:"datum",level:t,label:`${r}: ${Number.isFinite(n)?w(n):"—"}`,value:Number.isFinite(n)?n:void 0,datum:e}})(e,t));return e.length>f&&n.push({id:T("more"),role:"datum",level:t,label:`…and ${e.length-f} more points`}),n},q=[];if(r.has(u)||o.has(u)){let e=1/0,t=-1/0,n=1/0,r=-1/0;const a=[];let i=!0;for(const o of A){const s=B(o);Number.isFinite(s)&&(e>s&&(e=s),s>t&&(t=s));const l=N(o);a.push(l),"number"==typeof l&&Number.isFinite(l)?(n>l&&(n=l),l>r&&(r=l)):i=!1}const s=new Set,l=[];for(const e of a){const t=e+"";s.has(t)||(s.add(t),l.push(e))}const h=i?`${w(n)} to ${w(r)}`:`${c(l[0],w)} to ${c(l[l.length-1],w)} (${o.has(u)?l.length+" categories":A.length+" points"})`;q.push({id:T("axis"),role:"axis",level:2,label:`${o.has(u)?"Category axis":"X axis"}: ${M}, ${h}.`}),e>t||q.push({id:T("axis"),role:"axis",level:2,label:`Value axis: ${I}, ${w(e)} to ${w(t)}.`})}if(R){const e=n(R,R),t=new Map;for(const n of A){const r=(e(n)??"—")+"",o=t.get(r);o?o.push(n):t.set(r,[n])}const r=[];for(const[e,n]of t){const t=z(u,{...h,data:n},{levels:["l2","l3"],locale:p}).text;r.push({id:T("series"),role:"series",level:2,label:`Series ${e}: ${t}`,children:E(n,3)})}x.children=[...q,...r]}else x.children=[...q,...E(A,2)];return k&&x.children.push(k),x}function K(e,t){const n=[],r=e=>{if(n.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)r(t)};return r(e),n}function X(e){let t=1;if(e.children)for(const n of e.children)t+=X(n);return t}var _=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","PhysicsCustomChart"]);function W(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Y(e){return W(e)?e:void 0}function Z(e){const t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:void 0}function ee(e){const t=Z(e);return null==t?void 0:Math.max(0,Math.floor(t))}function te(...e){return e.map(Y).find(Boolean)}function ne(...e){return e.find(Array.isArray)}function re(e){const t={};for(const[n,r]of Object.entries(e))void 0!==r&&(t[n]=r);return t}function oe(e,t,n){return e["string"==typeof t&&t?t:n]}function ae(e){return e instanceof Date?e.toISOString():"number"==typeof e?Number.isInteger(e)?e+"":Math.round(1e3*e)/1e3+"":(e??"—")+""}function ie(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function se(e){return Number.isInteger(e)?e+"":Math.round(1e3*e)/1e3+""}function le(e,t,n){const r=e?.filter(e=>!0===Y(e)?.sensor).length,o=Y(t?.observation),a=Y(o?.sensors),i=ne(n?.activeSensors);return Math.max(r??0,a?Object.keys(a).length:0,i?.length??0)||void 0}function ce(e,t,n={}){const{capability:r,audience:o,locale:a}=n,i=n.levels??["l1","l2","l3"],s=!1!==n.includeStructure,l=N(e,r),c=z(e,t,{levels:l?[...i,"l4"]:i,locale:a,capability:r,audience:o}),{l4:u,...h}=c.levels,d=["l1","l2","l3"].map(e=>c.levels[e]).filter(Boolean).join(" "),p={levels:h,text:c.annotations?`${c.annotations} ${d}`.trim():d,...c.annotations?{annotations:c.annotations}:{}};let f;if(l&&u){const e=(m=r)?"fits"in m||"buildProps"in m?{family:m.family}:{family:m.family,intentScores:m.intentScores}:{};f={act:l,sentence:u,family:e.family,intentScores:e.intentScores}}var m;const g=s?Q(e,t,{maxLeaves:n.maxLeaves,locale:a}):void 0,y=function(e,t,n){if(!1===n)return;const r=W(n)?n:void 0,o=Y(t.physics),a=te(r?.snapshot,o?.snapshot,t.physicsSnapshot,function(e){const t=Y(e);return!!t&&(W(t.world)||"simulationState"in t||"liveBodyOrder"in t)}(t.snapshot)?t.snapshot:void 0),i=te(r?.evidence,o?.evidence,t.physicsEvidence,t.settledEvidence),s=te(r?.config,o?.config,a?.config,t.config),l=te(Y(a?.world),Y(o?.world)),c=te(Y(s?.kernel),Y(l?.options)),u=ne(l?.bodies),h=ne(l?.colliders,s?.colliders),d=ne(a?.queue,o?.queue),p=ne(a?.liveBodyOrder),f=ne(l?.springs),m=ne(a?.activeSensorPairs),g=function(e){if(!e||0===e.length)return;const t=e.map((e,t)=>{const n=Y(e);if(!n)return;const r=Z(n.count??n.value??n.total??n.bodies??n.events);if(null==r)return;const o=(n.label??n.id??n.name??"container "+(t+1))+"",a=null==n.id?void 0:n.id+"",i=Z(n.secondary??n.secondaryCount),s=Z(n.observed??n.observedCount);return re({id:a,label:o,count:r,secondary:i,secondaryLabel:"string"==typeof n.secondaryLabel?n.secondaryLabel:void 0,observed:s})}).filter(e=>null!=e);if(0===t.length)return;const n=t.reduce((e,t)=>e+t.count,0),r=t.filter(e=>e.count>0).length,o=t.slice().sort((e,t)=>t.count-e.count)[0];return{rows:t,totalCount:n,populatedCount:r,...o?{leader:o}:{}}}(function(e,t,n,r){const o=Y(e.settledProjection),a=Y(t?.settledProjection);return ne(n?.projectionRows,n?.aggregates,e.settledProjectionRows,e.projectionRows,o?.rows,t?.settledProjectionRows,t?.projectionRows,a?.rows,r?.binCounts)}(t,o,r,i)),y=function(e,t){const n=e?.map((e,t)=>{const n=Y(e);if(!n)return;const r=Z(n.count)??0,o=Z(n.total),a={label:(n.label??n.id??"sediment "+(t+1))+"",count:r};return null!=n.id&&(a.id=n.id+""),null!=o&&(a.total=o),a}).filter(e=>null!=e),r=ee(t?.bins)??n?.length??0,o=Z(t?.count)??n?.reduce((e,t)=>e+t.count,0)??0,a=Z(t?.total)??n?.reduce((e,t)=>e+(t.total??0),0),i=n?.slice().sort((e,t)=>t.count-e.count)[0];if(0!==r||0!==o||a)return{bins:r,count:o,...null!=a&&a>0?{total:a}:{},...i?{leader:i}:{}}}(ne(r?.sediment,o?.sediment,a?.sediment),te(r?.sedimentTotals,o?.sedimentTotals)),b=p?.length??u?.length??ee(i?.bodyCount),$=function(e){if(e)return e.filter(e=>!0===Y(e)?.sleeping).length}(u)??ee(i?.sleepingCount),v=d?.length,C="string"==typeof a?.simulationState?a.simulationState:void 0,w="boolean"==typeof i?.settled?i.settled:C?"settled"===C:null!=b||null!=$||null!=v?null!=b&&$===b&&0===(v??0):void 0,S=Y(c?.gravity),x=Z(S?.x),k=Z(S?.y),A=re({state:C,settled:w,elapsedSeconds:Z(a?.elapsedSeconds),paused:"boolean"==typeof a?.paused?a.paused:void 0,visible:"boolean"==typeof a?.visible?a.visible:void 0,seed:Z(c?.seed),gravity:null!=x&&null!=k?{x:x,y:k}:void 0,fixedDt:Z(s?.fixedDt??c?.fixedDt),timeScale:Z(s?.timeScale),maxSubsteps:ee(s?.maxSubsteps),liveBodies:b,sleepingBodies:$,queued:v,bodyLimit:Z(s?.bodyLimit),eviction:"string"==typeof s?.eviction?s.eviction:void 0}),P=re({colliders:h?.length,sensors:le(h,s,l),springs:f?.length,activeSensorPairs:m?.length}),j=Object.keys(P).length>0,F=_.has(e);if(!(Object.keys(A).length>0||j||g||y)||!F&&null==n)return;const L={simulation:A,...j?{geometry:P}:{},...g?{aggregates:g}:{},...y?{sediment:y}:{}},D=function(e){const t=[],n=e.simulation,r=[n.state??(n.settled?"settled":void 0),null!=n.liveBodies?`${n.liveBodies} live ${ie(n.liveBodies,"body")}`:void 0,null!=n.sleepingBodies?n.sleepingBodies+" sleeping":void 0,null!=n.queued?n.queued+" queued":void 0,null!=n.seed?"seed "+se(n.seed):void 0,n.gravity?`gravity (${se(n.gravity.x)}, ${se(n.gravity.y)})`:void 0,null!=n.fixedDt?`fixed step ${se(n.fixedDt)}s`:void 0,null!=n.timeScale?se(n.timeScale)+"x time":void 0].filter(Boolean);r.length>0&&t.push(`Physics simulation: ${r.join("; ")}.`);const o=e.geometry;if(o){const e=[null!=o.colliders?`${o.colliders} ${ie(o.colliders,"collider")}`:void 0,null!=o.sensors?`${o.sensors} ${ie(o.sensors,"sensor")}`:void 0,null!=o.springs?`${o.springs} ${ie(o.springs,"spring")}`:void 0,null!=o.activeSensorPairs?`${o.activeSensorPairs} active sensor ${ie(o.activeSensorPairs,"pair")}`:void 0].filter(Boolean);e.length>0&&t.push(`Physics geometry: ${e.join("; ")}.`)}const a=e.aggregates;if(a){const e=a.leader,n=e?` Largest is ${e.label} with ${se(e.count)}.`:"";t.push(`Physics aggregates: ${se(a.totalCount)} settled ${ie(a.totalCount,"body")} across ${a.rows.length} ${ie(a.rows.length,"container")}; ${a.populatedCount} populated.${n}`)}const i=e.sediment;if(i){const e=null!=i.total?", value total "+se(i.total):"",n=i.leader?`; largest sediment bin is ${i.leader.label} with ${se(i.leader.count)}`:"";t.push(`Physics sediment: ${i.count} retained ${ie(i.count,"body")} in ${i.bins} ${ie(i.bins,"bin")}${e}${n}.`)}return t.join(" ")}(L);return{...L,text:D}}(e,t,n.physics),b=function(e,t,n){const r=[];if("GaugeChart"===e){"number"==typeof t.value&&Number.isFinite(t.value)&&r.push(`Current value is ${ae(t.value)}.`);const e="number"==typeof t.min&&Number.isFinite(t.min)?t.min:0,n="number"==typeof t.max&&Number.isFinite(t.max)?t.max:100;r.push(`The gauge scale runs from ${ae(e)} to ${ae(n)}.`)}if("SankeyDiagram"===e||"ProcessSankey"===e){const e=Array.isArray(t.edges)?t.edges:[];if(e.length>0){r.push(`${e.length} source flow${1===e.length?"":"s"} are supplied.`);for(const o of e.slice(0,n)){const e=oe(o,t.sourceAccessor,"source"),n=oe(o,t.targetAccessor,"target"),a=oe(o,t.valueAccessor,"value");r.push(`${ae(e)} to ${ae(n)} has value ${ae(a)}.`)}}}if("Treemap"===e||"CirclePack"===e||"TreeDiagram"===e||"OrbitDiagram"===e){const e=Y(t.data),o="string"==typeof t.childrenAccessor&&t.childrenAccessor?t.childrenAccessor:"children",a="string"==typeof t.valueAccessor&&t.valueAccessor?t.valueAccessor:"value",i="string"==typeof t.nodeIdAccessor&&t.nodeIdAccessor?t.nodeIdAccessor:"string"==typeof t.nodeIDAccessor&&t.nodeIDAccessor?t.nodeIDAccessor:"name",s=[],l=e=>{const t=Array.isArray(e[o])?e[o]:[];if(0!==t.length)for(const e of t){const t=Y(e);t&&l(t)}else s.push(e)};if(e&&l(e),s.length>0){r.push(s.length+" hierarchy leaves are supplied.");for(const e of s.slice(0,n))r.push(`${ae(e[i])} has value ${ae(e[a])}.`)}}if(_.has(e)&&Array.isArray(t.data)){const n=t.data;r.push(`${n.length} observed source row${1===n.length?"":"s"} are supplied.`);const o="CollisionSwarmChart"===e?t.xAccessor:t.valueAccessor,a="CollisionSwarmChart"===e?"x":"value",i=n.map(e=>Z(oe(e,o,a))).filter(e=>null!=e);i.length>0&&r.push(`Observed ${"string"==typeof o?o:a} ranges from ${ae(Math.min(...i))} to ${ae(Math.max(...i))}.`)}if(0!==r.length)return{source:"chart-props",statements:r,text:"Exact chart-prop facts: "+r.join(" ")}}(e,t,Math.max(1,n.maxLeaves??200)),$=[p.text,f?.sentence,y?.text,b?.text].filter(Boolean).join(" ");return{component:e,description:p,intent:f,structure:g,physics:y,facts:b,text:$}}var ue=["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"],he=new Set(ue);function de(e){return he.has(e)}var pe=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"]),fe=new Set(["data","nodes","edges","points","areas","lines","flows"]);function me(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(me).filter(e=>void 0!==e);if(e instanceof Date)return e;const t={};for(const[n,r]of Object.entries(e)){if("function"==typeof r)continue;if(r&&"object"==typeof r&&r.$$typeof)continue;const e=me(r);void 0!==e&&(t[n]=e)}return t}function ge(e,t){return!!fe.has(e)&&("areas"!==e||"string"!=typeof t)}var ye="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function be(e,t,n){const r=d(e)??p(t.recipe)??p(t.recipeId);if(r)return function(e,t,n){const r=function(e,t,n){const r={};for(const[o,a]of Object.entries(e))if(null!=a&&!pe.has(o)&&"recipeId"!==o&&(t||!ge(o,a)))if("function"==typeof a||a?.$$typeof){if(n)throw Error(`Portable recipe prop "${o}" is not JSON-safe.`)}else if(u(a))r[o]=ye(a);else if(n)throw Error(`Portable recipe prop "${o}" is not JSON-safe.`);return r}(t,!1!==n?.includeData,"portable"===e.portability),o=e.intents.map(f).filter(e=>!!e),a={name:e.name,intents:o,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!u(r))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:r,manifest:a,version:"1",createdAt:(new Date).toISOString(),...n?.selections?{selections:n.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:r,manifest:a,version:"1",createdAt:(new Date).toISOString(),...n?.selections?{selections:n.selections}:{}}}(r,t,n);if(!de(e))throw Error(`Unknown component "${e}". Known components: ${ue.join(", ")}`);const o=!1!==n?.includeData,a={};for(const[e,n]of Object.entries(t))if(null!=n&&!pe.has(e)&&(o||!ge(e,n))&&"function"!=typeof n&&!n?.$$typeof)try{a[e]=ye(me(n))}catch{}return{component:e,props:a,version:"1",createdAt:(new Date).toISOString(),...n?.selections?{selections:n.selections}:{}}}function $e(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=d(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:{...ye(e.props),recipeId:e.recipeId}}}if(!de(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:ye(e.props)}}function ve(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ce(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 n=t.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(escape(atob(n)));return JSON.parse(r)}async function we(e,t="json"){const n="jsx"===t?Se(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(n)}function Se(e){const{props:t}=e,n=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&n.push(` recipeId="${e.recipeId}"`);for(const[e,r]of Object.entries(t))if("string"==typeof r)n.push(` ${e}="${r}"`);else if("boolean"==typeof r&&!0===r)n.push(" "+e);else if("boolean"==typeof r&&!1===r)n.push(` ${e}={false}`);else if("number"==typeof r)n.push(` ${e}={${r}}`);else{const t=JSON.stringify(r);n.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(r,null,2)}}`)}return n.push("/>"),n.join("\n")}export{d as getChartRecipe,f as recipeIntentId,m as recipeConfig,b as fieldForRole,B as communicativeActForIntent,N as resolveCommunicativeAct,z as describeChart,Q as buildNavigationTree,K as flattenVisible,X as countNodes,ce as buildReaderGrounding,be as toConfig,$e as fromConfig,ve as toURL,Ce as fromURL,we as copyConfig,Se as configToJSX};
@@ -1 +0,0 @@
1
- var e={fresh:1,aging:1.5,stale:3};function t(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}function n(e,t){return e===t}function r(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function s(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function o(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function i(e,t={}){const n=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,s=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&s.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&s.has(t)&&!r)})}export{n as accessorsEquivalent,r as resolveAccessor,s as resolveRawAccessor,o as resolveStringAccessor,e as DEFAULT_LIFECYCLE_THRESHOLDS,t as bandFromAge,i as filterAnnotationsByStatus};