@motionscript/charts 0.0.0-stage → 0.1.0-alpha.0

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 (137) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +201 -0
  3. package/dist/bar-chart/bar-chart.d.ts +286 -0
  4. package/dist/bar-chart/bar-chart.d.ts.map +1 -0
  5. package/dist/bar-chart/bar-chart.js +610 -0
  6. package/dist/bar-chart/bar-chart.js.map +1 -0
  7. package/dist/bar-chart/category-axis.d.ts +77 -0
  8. package/dist/bar-chart/category-axis.d.ts.map +1 -0
  9. package/dist/bar-chart/category-axis.js +141 -0
  10. package/dist/bar-chart/category-axis.js.map +1 -0
  11. package/dist/bar-chart/chart-bars.d.ts +149 -0
  12. package/dist/bar-chart/chart-bars.d.ts.map +1 -0
  13. package/dist/bar-chart/chart-bars.js +236 -0
  14. package/dist/bar-chart/chart-bars.js.map +1 -0
  15. package/dist/bar-chart/index.d.ts +16 -0
  16. package/dist/bar-chart/index.d.ts.map +1 -0
  17. package/dist/bar-chart/index.js +12 -0
  18. package/dist/bar-chart/index.js.map +1 -0
  19. package/dist/bar-chart/shared.d.ts +146 -0
  20. package/dist/bar-chart/shared.d.ts.map +1 -0
  21. package/dist/bar-chart/shared.js +182 -0
  22. package/dist/bar-chart/shared.js.map +1 -0
  23. package/dist/browser/chunks/chunk-ZMBOBHYL.js +2 -0
  24. package/dist/browser/chunks/chunk-ZMBOBHYL.js.map +7 -0
  25. package/dist/browser/index.js +2 -0
  26. package/dist/browser/index.js.map +7 -0
  27. package/dist/browser/kit.js +2 -0
  28. package/dist/browser/kit.js.map +7 -0
  29. package/dist/browser/manifest.json +12 -0
  30. package/dist/engine.d.ts +27 -0
  31. package/dist/engine.d.ts.map +1 -0
  32. package/dist/engine.js +27 -0
  33. package/dist/engine.js.map +1 -0
  34. package/dist/index.d.ts +6 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +6 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/kit/chart-border.d.ts +28 -0
  39. package/dist/kit/chart-border.d.ts.map +1 -0
  40. package/dist/kit/chart-border.js +45 -0
  41. package/dist/kit/chart-border.js.map +1 -0
  42. package/dist/kit/chart-canvas.d.ts +56 -0
  43. package/dist/kit/chart-canvas.d.ts.map +1 -0
  44. package/dist/kit/chart-canvas.js +125 -0
  45. package/dist/kit/chart-canvas.js.map +1 -0
  46. package/dist/kit/chart-legend.d.ts +126 -0
  47. package/dist/kit/chart-legend.d.ts.map +1 -0
  48. package/dist/kit/chart-legend.js +212 -0
  49. package/dist/kit/chart-legend.js.map +1 -0
  50. package/dist/kit/shared.d.ts +251 -0
  51. package/dist/kit/shared.d.ts.map +1 -0
  52. package/dist/kit/shared.js +401 -0
  53. package/dist/kit/shared.js.map +1 -0
  54. package/dist/kit/vertical-axis.d.ts +99 -0
  55. package/dist/kit/vertical-axis.d.ts.map +1 -0
  56. package/dist/kit/vertical-axis.js +176 -0
  57. package/dist/kit/vertical-axis.js.map +1 -0
  58. package/dist/line-chart/chart-line.d.ts +91 -0
  59. package/dist/line-chart/chart-line.d.ts.map +1 -0
  60. package/dist/line-chart/chart-line.js +156 -0
  61. package/dist/line-chart/chart-line.js.map +1 -0
  62. package/dist/line-chart/chart-region.d.ts +47 -0
  63. package/dist/line-chart/chart-region.d.ts.map +1 -0
  64. package/dist/line-chart/chart-region.js +101 -0
  65. package/dist/line-chart/chart-region.js.map +1 -0
  66. package/dist/line-chart/horizontal-axis.d.ts +85 -0
  67. package/dist/line-chart/horizontal-axis.d.ts.map +1 -0
  68. package/dist/line-chart/horizontal-axis.js +158 -0
  69. package/dist/line-chart/horizontal-axis.js.map +1 -0
  70. package/dist/line-chart/index.d.ts +22 -0
  71. package/dist/line-chart/index.d.ts.map +1 -0
  72. package/dist/line-chart/index.js +19 -0
  73. package/dist/line-chart/index.js.map +1 -0
  74. package/dist/line-chart/line-chart.d.ts +347 -0
  75. package/dist/line-chart/line-chart.d.ts.map +1 -0
  76. package/dist/line-chart/line-chart.js +701 -0
  77. package/dist/line-chart/line-chart.js.map +1 -0
  78. package/dist/line-chart/shared.d.ts +171 -0
  79. package/dist/line-chart/shared.d.ts.map +1 -0
  80. package/dist/line-chart/shared.js +270 -0
  81. package/dist/line-chart/shared.js.map +1 -0
  82. package/dist/line-chart/x-scale.d.ts +84 -0
  83. package/dist/line-chart/x-scale.d.ts.map +1 -0
  84. package/dist/line-chart/x-scale.js +302 -0
  85. package/dist/line-chart/x-scale.js.map +1 -0
  86. package/dist/nodes.d.ts +20 -0
  87. package/dist/nodes.d.ts.map +1 -0
  88. package/dist/nodes.js +20 -0
  89. package/dist/nodes.js.map +1 -0
  90. package/dist/pie-chart/index.d.ts +18 -0
  91. package/dist/pie-chart/index.d.ts.map +1 -0
  92. package/dist/pie-chart/index.js +14 -0
  93. package/dist/pie-chart/index.js.map +1 -0
  94. package/dist/pie-chart/pie-chart.d.ts +170 -0
  95. package/dist/pie-chart/pie-chart.d.ts.map +1 -0
  96. package/dist/pie-chart/pie-chart.js +291 -0
  97. package/dist/pie-chart/pie-chart.js.map +1 -0
  98. package/dist/pie-chart/pie-legend.d.ts +60 -0
  99. package/dist/pie-chart/pie-legend.d.ts.map +1 -0
  100. package/dist/pie-chart/pie-legend.js +131 -0
  101. package/dist/pie-chart/pie-legend.js.map +1 -0
  102. package/dist/pie-chart/pie-ring.d.ts +266 -0
  103. package/dist/pie-chart/pie-ring.d.ts.map +1 -0
  104. package/dist/pie-chart/pie-ring.js +708 -0
  105. package/dist/pie-chart/pie-ring.js.map +1 -0
  106. package/dist/pie-chart/shared.d.ts +210 -0
  107. package/dist/pie-chart/shared.d.ts.map +1 -0
  108. package/dist/pie-chart/shared.js +240 -0
  109. package/dist/pie-chart/shared.js.map +1 -0
  110. package/package.json +69 -3
  111. package/registry.json +23 -0
  112. package/src/bar-chart/bar-chart.ts +804 -0
  113. package/src/bar-chart/category-axis.ts +177 -0
  114. package/src/bar-chart/chart-bars.ts +310 -0
  115. package/src/bar-chart/index.ts +31 -0
  116. package/src/bar-chart/shared.ts +354 -0
  117. package/src/engine.ts +26 -0
  118. package/src/index.ts +5 -0
  119. package/src/kit/chart-border.ts +61 -0
  120. package/src/kit/chart-canvas.ts +157 -0
  121. package/src/kit/chart-legend.ts +250 -0
  122. package/src/kit/shared.ts +675 -0
  123. package/src/kit/vertical-axis.ts +224 -0
  124. package/src/line-chart/chart-line.ts +208 -0
  125. package/src/line-chart/chart-region.ts +135 -0
  126. package/src/line-chart/horizontal-axis.ts +202 -0
  127. package/src/line-chart/index.ts +39 -0
  128. package/src/line-chart/line-chart.ts +894 -0
  129. package/src/line-chart/shared.ts +459 -0
  130. package/src/line-chart/x-scale.ts +367 -0
  131. package/src/nodes.ts +20 -0
  132. package/src/pie-chart/index.ts +37 -0
  133. package/src/pie-chart/pie-chart.ts +374 -0
  134. package/src/pie-chart/pie-legend.ts +159 -0
  135. package/src/pie-chart/pie-ring.ts +903 -0
  136. package/src/pie-chart/shared.ts +490 -0
  137. package/README.md +0 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/bar-chart/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,EACT,OAAO,GAQR,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,GAAG,EACH,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,IAAI,GAOL,MAAM,eAAe,CAAA;AA8BtB;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,GAAe,EACf,MAAmB,EACnB,OAAgB;IAEhB,IAAI,OAAO,GAAG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AClB,CAAS;IAET,OAAO;QACL,WAAW,EAAE,eAAe,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACjE,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;QACtC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9C,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9C,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QACnD,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC;QAChE,SAAS,EAAE;YACT,UAAU,EAAE,UAAU,CACpB,IAAI,CAAC,SAAS,CAAC,UAAU,EACzB,EAAE,CAAC,SAAS,CAAC,UAAU,EACvB,CAAC,CACF;SACF;KACF,CAAA;AACH,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,MAAiB,EACjB,KAAa;IAEb,IAAI,MAAM,CAAC,IAAI,IAAI,IAAI;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC5D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAA;IACxC,OAAO,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AACxC,CAAC","sourcesContent":["/**\n * Types and pure helpers specific to the {@link BarChart} family: how a row's\n * values become the spans its columns cover, how the value axis is scaled around\n * them, and the theme the bars add to the shared chart vocabulary.\n *\n * Everything a line or a pie chart would want too — what a series is, the axis\n * domain model, the theme leaf resolvers, the legend and plot-panel branches —\n * lives in `nodes/chart-kit/shared.ts` and is imported here.\n *\n * Kept renderer-agnostic (no `Node` imports) so the studio's inspector mapping\n * (`bar-chart-props.ts`) can build a partial {@link BarChartTheme} without\n * pulling the node classes in.\n */\n\nimport {\n fillOps,\n lerpNumber,\n shadowOps,\n strokeOps,\n textOps,\n type DataRecord,\n type Fill,\n type Shadow,\n type ShadowResolved,\n type Stroke,\n type StrokeResolved,\n type TextStyle,\n} from \"@motionscript/core\"\n\nimport {\n CHART_PALETTE,\n DEFAULT_LEGEND,\n DEFAULT_PLOT_AREA,\n DEFAULT_SERIES_FILLS,\n DEFAULT_X_AXIS,\n DEFAULT_Y_AXIS,\n SPOTLIGHT_DIM,\n lerpAxisConfig,\n lerpLegendConfig,\n lerpPlotArea,\n lerpSeriesFills,\n niceStep,\n num,\n resolveAxisConfig,\n resolveLegendConfig,\n resolvePlotArea,\n resolveSeriesFills,\n text,\n type AxisConfig,\n type ChartSeries,\n type LegendConfig,\n type LegendTheme,\n type PlotAreaConfig,\n type Range,\n} from \"../kit/shared\"\n\n/**\n * One series in a {@link BarChart}: a column of the table drawn as one bar per\n * row — side by side with its siblings within each category's slot, or stacked\n * on top of them.\n *\n * The family-wide {@link ChartSeries} under a name that says what it draws here.\n */\nexport type BarSeries = ChartSeries\n\n/**\n * One drawn bar's span in **data units**: the value its base sits at and the\n * value its far end reaches.\n *\n * A span rather than a height because that is the one shape both modes fit. A\n * grouped bar runs from zero to its value; a stacked segment runs from the\n * running total below it to that total plus its own value. Negative values fall\n * out of the same arithmetic — the span simply runs the other way — so a chart\n * with a loss in it needs no special case, only a baseline that isn't the floor.\n */\nexport interface BarSpan {\n /** Value the bar's base sits at — 0 when grouped, the running total when stacked. */\n from: number\n /** Value its far end reaches. */\n to: number\n /** The value this bar plots — `to - from`, kept for the figure printed on it. */\n value: number\n}\n\n/**\n * The spans one row's bars cover, one per series, in series order.\n *\n * Stacking is a running sum in the order the series are listed, which is also\n * the order they're drawn: series 0 sits on the baseline and each later one\n * rides on what's below it. A zero-valued series still yields a (degenerate)\n * span so the returned list stays index-aligned with the series list.\n */\nexport function barSpans(\n row: DataRecord,\n series: BarSeries[],\n stacked: boolean\n): BarSpan[] {\n let running = 0\n return series.map((s) => {\n const value = num(row, s.field)\n if (!stacked) return { from: 0, to: value, value }\n const from = running\n running += value\n return { from, to: running, value }\n })\n}\n\n/**\n * The index of the series whose segment ends a row's stack — the one that gets\n * the rounded cap, so a stack reads as one capped column rather than a pile of\n * separate boxes. `-1` when every value in the row is zero.\n *\n * Read off the *last non-zero* series rather than the last one listed, so a\n * series that happens to be 0 in this row doesn't take the cap and leave the\n * segment below it square.\n */\nexport function stackCapIndex(row: DataRecord, series: BarSeries[]): number {\n let last = -1\n for (let i = 0; i < series.length; i++) {\n if (num(row, series[i].field) !== 0) last = i\n }\n return last\n}\n\n/** The captions beneath the baseline: one per row, read off the category column. */\nexport function barCategories(data: DataRecord[], field: string): string[] {\n return data.map((row) => text(row, field))\n}\n\n/**\n * The `[min, max]` of everything the chart draws, **zero always included**.\n *\n * Zero is in the range whatever the data says, because a bar chart's baseline is\n * zero: a scale starting at 40 draws a column three times its neighbour for a\n * 10% difference, which is the classic way to lie with one. A chart that really\n * does want a cropped axis says so with an explicit range.\n */\nexport function barValueExtent(\n data: DataRecord[],\n series: BarSeries[],\n stacked: boolean\n): Range {\n let lo = 0\n let hi = 0\n for (const row of data) {\n for (const span of barSpans(row, series, stacked)) {\n lo = Math.min(lo, span.from, span.to)\n hi = Math.max(hi, span.from, span.to)\n }\n }\n return lo < hi ? [lo, hi] : [0, 1]\n}\n\n/**\n * Effective value scale: the explicit `range`, else the data's extent nudged out\n * to tidy step bounds so the markers read as round numbers.\n *\n * `divisions` is how many segments the auto-range is stepped into (one fewer\n * than the marker count), so the ticks the axis draws land on the bounds this\n * picks.\n */\nexport function resolveBarScale(\n data: DataRecord[],\n series: BarSeries[],\n stacked: boolean,\n range: Range | undefined,\n divisions: number\n): Range {\n if (range) return range\n const [lo, hi] = barValueExtent(data, series, stacked)\n const segments = Math.max(1, Math.round(divisions))\n const step = niceStep((hi - lo) / segments || 1)\n return [Math.floor(lo / step) * step, Math.ceil(hi / step) * step]\n}\n\n// ---- Theme ---------------------------------------------------------------\n\n/** How the columns themselves are drawn and how the slot is divided up. */\nexport interface BarStyleConfig {\n /**\n * Radius of a column's far-end corners, in px. Only the outer end rounds — an\n * interior stacked segment stays square, so the stack reads as one column.\n */\n cornerRadius: number\n /**\n * Fraction of its category's slot the bars fill, `[0, 1]`. The remainder is\n * the channel between one category and the next, which is what makes a bar\n * chart read as groups rather than as a solid block.\n */\n slotFill: number\n /** Gap between the grouped bars *within* one slot, in px. Ignored when stacked. */\n groupGap: number\n /** Optional outline on every column. */\n stroke: Stroke\n /** Optional drop shadow on every column. */\n shadow: Shadow\n}\n\n/** A {@link BarChart}'s full, resolved visual theme. */\nexport interface BarChartConfig {\n /**\n * Default per-series bar paint, cycled by series index (`i % length`). A\n * series' own `fill`, when set, replaces its entry outright.\n */\n seriesFills: Fill[]\n bar: BarStyleConfig\n /** The category axis beneath the baseline. */\n xAxis: AxisConfig\n /** The numeric value axis up the left. */\n yAxis: AxisConfig\n plotArea: PlotAreaConfig\n legend: LegendConfig\n /** The figure printed on each column, when the chart prints them. */\n valueStyle: TextStyle\n /** How far everything *outside* a spotlit series or category fades. */\n spotlight: { dimOpacity: number }\n}\n\n/** Author-facing partial theme — every branch optional and deep-merged. */\nexport type BarChartTheme = {\n seriesFills?: Fill[]\n bar?: Partial<BarStyleConfig>\n xAxis?: Partial<AxisConfig>\n yAxis?: Partial<AxisConfig>\n plotArea?: Partial<PlotAreaConfig>\n legend?: LegendTheme\n valueStyle?: TextStyle\n spotlight?: Partial<BarChartConfig[\"spotlight\"]>\n}\n\n/** The bar chart's out-of-the-box look. */\nexport const DEFAULT_BAR_CHART_THEME: BarChartConfig = {\n seriesFills: DEFAULT_SERIES_FILLS,\n bar: {\n cornerRadius: 6,\n slotFill: 0.72,\n groupGap: 6,\n stroke: [],\n shadow: [],\n },\n // A category axis names its slots, so its captions are set like a caption\n // rather than like a numeric marker: same size, less weight than the line\n // chart's ticks, and centred on the slot.\n xAxis: {\n ...DEFAULT_X_AXIS,\n labelStyle: { ...DEFAULT_X_AXIS.labelStyle, fontWeight: 600 },\n tickPadding: 16,\n },\n yAxis: DEFAULT_Y_AXIS,\n plotArea: DEFAULT_PLOT_AREA,\n legend: DEFAULT_LEGEND,\n valueStyle: {\n fontSize: 24,\n fontWeight: 700,\n textAlign: \"center\",\n fill: CHART_PALETTE.markerColor,\n },\n spotlight: { dimOpacity: SPOTLIGHT_DIM },\n}\n\nfunction resolveBarStyle(\n bar: Partial<BarStyleConfig> | undefined,\n previous: BarStyleConfig\n): BarStyleConfig {\n return {\n cornerRadius: bar?.cornerRadius ?? previous.cornerRadius,\n slotFill: bar?.slotFill ?? previous.slotFill,\n groupGap: bar?.groupGap ?? previous.groupGap,\n stroke: strokeOps.resolve(bar?.stroke ?? previous.stroke),\n shadow: shadowOps.resolve(bar?.shadow ?? previous.shadow),\n }\n}\n\nfunction lerpBarStyle(\n from: BarStyleConfig,\n to: BarStyleConfig,\n t: number\n): BarStyleConfig {\n return {\n cornerRadius: lerpNumber(from.cornerRadius, to.cornerRadius, t),\n slotFill: lerpNumber(from.slotFill, to.slotFill, t),\n groupGap: lerpNumber(from.groupGap, to.groupGap, t),\n stroke: strokeOps.lerp(\n from.stroke as StrokeResolved[],\n to.stroke as StrokeResolved[],\n t\n ),\n shadow: shadowOps.lerp(\n from.shadow as ShadowResolved[],\n to.shadow as ShadowResolved[],\n t\n ),\n }\n}\n\n/**\n * {@link BarChart}'s `theme` @property mapper: merges the author's partial\n * {@link BarChartTheme} onto `previous` (falling back to\n * {@link DEFAULT_BAR_CHART_THEME} on first resolution), fully resolving every\n * leaf so the tween below always has resolved data to interpolate.\n */\nexport function resolveBarChartTheme(\n theme: BarChartTheme | undefined,\n previous?: BarChartConfig\n): BarChartConfig {\n const base = previous ?? DEFAULT_BAR_CHART_THEME\n return {\n seriesFills: resolveSeriesFills(theme?.seriesFills, base.seriesFills),\n bar: resolveBarStyle(theme?.bar, base.bar),\n xAxis: resolveAxisConfig(theme?.xAxis, base.xAxis),\n yAxis: resolveAxisConfig(theme?.yAxis, base.yAxis),\n plotArea: resolvePlotArea(theme?.plotArea, base.plotArea),\n legend: resolveLegendConfig(theme?.legend, base.legend),\n valueStyle: textOps.resolveStyle(theme?.valueStyle, base.valueStyle),\n spotlight: {\n dimOpacity: theme?.spotlight?.dimOpacity ?? base.spotlight.dimOpacity,\n },\n }\n}\n\n/** {@link BarChart}'s `theme` @property tween — leaf by leaf. */\nexport function lerpBarChartTheme(\n from: BarChartConfig,\n to: BarChartConfig,\n t: number\n): BarChartConfig {\n return {\n seriesFills: lerpSeriesFills(from.seriesFills, to.seriesFills, t),\n bar: lerpBarStyle(from.bar, to.bar, t),\n xAxis: lerpAxisConfig(from.xAxis, to.xAxis, t),\n yAxis: lerpAxisConfig(from.yAxis, to.yAxis, t),\n plotArea: lerpPlotArea(from.plotArea, to.plotArea, t),\n legend: lerpLegendConfig(from.legend, to.legend, t),\n valueStyle: textOps.lerpStyle(from.valueStyle, to.valueStyle, t),\n spotlight: {\n dimOpacity: lerpNumber(\n from.spotlight.dimOpacity,\n to.spotlight.dimOpacity,\n t\n ),\n },\n }\n}\n\n/** The paint series `index` is drawn in: its own override, else the palette's entry. */\nexport function resolveBarFill(\n palette: Fill[],\n series: BarSeries,\n index: number\n): Fill {\n if (series.fill != null) return fillOps.resolve(series.fill)\n if (palette.length === 0) return \"white\"\n return palette[index % palette.length]\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{fillOps as A,lerpNumber as g,shadowOps as L,strokeOps as h,insetsOps as m,textOps as x}from"@motionscript/core";import{niceStep as Je,enterBudget as K}from"@motionscript/core/component";function Ee(t,e){return{label:t?.label??e?.label??"",range:t?.range??e?.range,ticks:t?.ticks??e?.ticks,format:t?.format??e?.format}}function Oe(t,e,r){return{label:r<.5?t.label:e.label,range:ne(t.range,e.range,r),ticks:le(t.ticks,e.ticks,r),format:r<.5?t.format:e.format}}function ne(t,e,r){return!t||!e?r<.5?t:e:[g(t[0],e[0],r),g(t[1],e[1],r)]}function le(t,e,r){if(!t||!e)return r<.5?t:e;let o=Math.max(t.length,e.length),n=[];for(let i=0;i<o;i++)n.push(g(t[i]??e[i],e[i]??t[i],r));return n}var P={plotFill:"#15130e",borderColor:"#4a4036",gridColor:"#2c2820",markerColor:"#8a7f70",regionColor:"#d99a3a"},C=["#d9603b","#8194ad","#e0a93b","#5e9d6b","#9ec85a"],X=.2;function Le(t){return t<0?0:t>1?1:t}function Te(t,e){if(e===void 0)return 0;let r=t[e];return typeof r=="number"?r:0}function Re(t,e){if(e===void 0||e==="")return"";let r=t[e];return r==null?"":String(r)}function De(t,e=[]){if(t.length===0)return[];let r=new Set(e),o=new Set,n=[];for(let i of t)for(let l of Object.keys(i))!r.has(l)&&!o.has(l)&&(o.add(l),n.push(l));return n.filter(i=>{let l=!1;for(let s of t){let d=s[i];if(!(d===void 0||d==="")){if(typeof d!="number")return!1;l=!0}}return l})}var B={fontSize:24,fontWeight:700,textAlign:"center",fill:P.markerColor},W={fontSize:30,fontWeight:600,textAlign:"center",fill:P.markerColor},z={weight:2,fill:P.gridColor},Y={labelStyle:B,titleStyle:W,lineStyle:z,tickPadding:20,titlePadding:4},T={labelStyle:{...B,fontWeight:500,textAlign:"right"},titleStyle:W,lineStyle:z,tickPadding:40,titlePadding:24},E={fill:[],stroke:{weight:6,fill:P.borderColor},shadow:[]},H={padding:0,textStyle:{fontSize:30,fontWeight:600,textAlign:"left",fill:P.markerColor},itemGap:44,markerStyle:{width:60,height:24,borderRadius:6,stroke:[],shadow:[]}},Fe=C.map(t=>({weight:4,fill:t})),Ie=C.map(t=>t);function Me(t,e){return{labelStyle:x.resolveStyle(t?.labelStyle,e.labelStyle),titleStyle:x.resolveStyle(t?.titleStyle,e.titleStyle),lineStyle:h.resolve(t?.lineStyle??e.lineStyle),tickPadding:m.resolve(t?.tickPadding??e.tickPadding,e.tickPadding),titlePadding:m.resolve(t?.titlePadding??e.titlePadding,e.titlePadding)}}function Ge(t,e,r){return{labelStyle:x.lerpStyle(t.labelStyle,e.labelStyle,r),titleStyle:x.lerpStyle(t.titleStyle,e.titleStyle,r),lineStyle:h.lerp(t.lineStyle,e.lineStyle,r),tickPadding:m.lerp(t.tickPadding,e.tickPadding,r),titlePadding:m.lerp(t.titlePadding,e.titlePadding,r)}}function Ne(t,e){return{fill:A.resolve(t?.fill??e.fill),stroke:h.resolve(t?.stroke??e.stroke),shadow:L.resolve(t?.shadow??e.shadow)}}function Ue(t,e,r){return{fill:A.lerp(t.fill,e.fill,r),stroke:h.lerp(t.stroke,e.stroke,r),shadow:L.lerp(t.shadow,e.shadow,r)}}function se(t,e){return{width:t?.width??e.width,height:t?.height??e.height,borderRadius:t?.borderRadius??e.borderRadius,stroke:h.resolve(t?.stroke??e.stroke),shadow:L.resolve(t?.shadow??e.shadow)}}function ae(t,e,r){return{width:g(t.width,e.width,r),height:g(t.height,e.height,r),borderRadius:g(t.borderRadius,e.borderRadius,r),stroke:h.lerp(t.stroke,e.stroke,r),shadow:L.lerp(t.shadow,e.shadow,r)}}function je(t,e){return{padding:m.resolve(t?.padding??e.padding,e.padding),textStyle:x.resolveStyle(t?.textStyle,e.textStyle),itemGap:t?.itemGap??e.itemGap,markerStyle:se(t?.markerStyle,e.markerStyle)}}function Ce(t,e,r){return{padding:m.lerp(t.padding,e.padding,r),textStyle:x.lerpStyle(t.textStyle,e.textStyle,r),itemGap:g(t.itemGap,e.itemGap,r),markerStyle:ae(t.markerStyle,e.markerStyle,r)}}function Xe(t,e){return(t??e).map(r=>h.resolve(r))}function Be(t,e,r){let o=Math.max(t.length,e.length),n=[];for(let i=0;i<o;i++){let l=t[i]??e[i],s=e[i]??t[i];n.push(h.lerp(l,s,r))}return n}function We(t,e){return(t??e).map(r=>A.resolve(r))}function ze(t,e,r){let o=Math.max(t.length,e.length),n=[];for(let i=0;i<o;i++){let l=t[i]??e[i],s=e[i]??t[i];n.push(A.lerp(l,s,r))}return n}function de(t,e,r){let o=t.length>0?t[r%t.length]:{weight:4,fill:"white"};if(e.fill==null)return o;let n=h.resolve(o);if(n.length===0)return{weight:4,fill:e.fill};let i=[...n];return i[i.length-1]={...i[i.length-1],fill:A.resolve(e.fill)},i}function Ye(t,e,r){let o=h.resolve(de(t,e,r));return o[o.length-1]?.fill??"white"}function He(t,e,r){return e??(t.length===0?"white":t[r%t.length])}function $(t){return Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,"")}function $e(t){let e=t*100;return Number.isInteger(e)?`${e}%`:`${e.toFixed(1).replace(/\.0$/,"")}%`}function Ke([t,e],r){let o=Math.max(2,Math.round(r));return Array.from({length:o+1},(n,i)=>t+(e-t)/o*i)}import{Graphics2D as ce,Node2D as pe,strokeOps as V,property as fe}from"@motionscript/core";import{declarePaints as ue}from"@motionscript/core/component";var he=function(t,e,r,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(l=t[s])&&(i=(n<3?l(i):n>3?l(e,r,i):l(e,r))||i);return n>3&&i&&Object.defineProperty(e,r,i),i},I=class extends pe{declareAssets(e){super.declareAssets(e),ue(this,e)}renderSelf(e){let r=this.layoutBounds.width,o=this.layoutBounds.height;r<=0||o<=0||e.draw(new ce().rect({x:0,y:0,width:r,height:o}).stroke(this.stroke))}};he([fe({default:E.stroke,mapper:V.resolve,tween:V.lerp})],I.prototype,"stroke",void 0);import{Graphics2D as M,Node2D as ge,fillOps as q,shadowOps as J,strokeOps as R,property as f}from"@motionscript/core";import{declarePaints as ye}from"@motionscript/core/component";var p=function(t,e,r,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(l=t[s])&&(i=(n<3?l(i):n>3?l(e,r,i):l(e,r))||i);return n>3&&i&&Object.defineProperty(e,r,i),i},c=class extends ge{declareAssets(e){super.declareAssets(e),ye(this,e,{strokes:[this.xGridStroke,this.yGridStroke]})}renderSelf(e){let r=this.layoutBounds.width,o=this.layoutBounds.height;if(r<=0||o<=0)return;e.draw(new M().rect({x:0,y:0,width:r,height:o}).shadow(this.shadow).fill(this.fill));let[n,i]=this.xExtent,[l,s]=this.yExtent,d=a=>i<=n?0:(a-n)/(i-n),k=a=>s<=l?0:(a-l)/(s-l),S=a=>a>1e-6&&a<1-1e-6,b=this.xGridStroke[0];if(b){let a=new M;for(let F of this.xMarkers){let _=d(F);S(_)&&a.rect({x:-r/2+_*r,y:0,width:b.weight,height:o})}e.draw(a.fill(b.fill))}let v=this.yGridStroke[0];if(v){let a=new M;for(let F of this.yMarkers){let _=k(F);S(_)&&a.rect({x:0,y:-o/2+_*o,width:r,height:v.weight})}e.draw(a.fill(v.fill))}}};p([f({default:E.fill,mapper:q.resolve,tween:q.lerp})],c.prototype,"fill",void 0);p([f({default:E.shadow,mapper:J.resolve,tween:J.lerp})],c.prototype,"shadow",void 0);p([f({default:Y.lineStyle,mapper:R.resolve,tween:R.lerp})],c.prototype,"xGridStroke",void 0);p([f({default:T.lineStyle,mapper:R.resolve,tween:R.lerp})],c.prototype,"yGridStroke",void 0);p([f({default:()=>[]})],c.prototype,"xMarkers",void 0);p([f({default:()=>[]})],c.prototype,"yMarkers",void 0);p([f({default:()=>[0,1]})],c.prototype,"xExtent",void 0);p([f({default:()=>[0,1]})],c.prototype,"yExtent",void 0);import{Rect as G,Text as Se,command as U,easeOut as N,property as j,textOps as me}from"@motionscript/core";import{drive as xe,hold as we,together as ke}from"@motionscript/core/component";var w=function(t,e,r,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(l=t[s])&&(i=(n<3?l(i):n>3?l(e,r,i):l(e,r))||i);return n>3&&i&&Object.defineProperty(e,r,i),i},u=class extends G{items=[];reveal=[];natural=[];constructor(e){super({...e,flow:"horizontal",align:"center",width:"hug",height:"hug"}),this.set({gap:this.legend.itemGap,padding:this.legend.padding}),this.reveal=this.series.map(r=>r.enabled??!0?1:0),this.natural=this.series.map(()=>0),this.items=this.series.map((r,o)=>this.buildItem(r,o));for(let r of this.items)this.add(r)}widthFor(e){let r=this.reveal[e]??0;if(r>=1){let o=this.items[e]?.measuredWidth??0;return o>0&&(this.natural[e]=o),"hug"}return r*(this.natural[e]??0)}buildItem(e,r){let o=this.legend.markerStyle,n=new G({flow:"horizontal",gap:12,align:"center",width:()=>this.widthFor(r),opacity:()=>this.reveal[r]??0,height:"hug",children:[new Se({...me.styleProps(this.legend.textStyle),text:e.label}),new G({width:o.width,height:o.height,cornerRadius:o.borderRadius,fill:this.swatches[r]??"white",stroke:o.stroke,shadow:o.shadow})]});return n.set({gapScale:()=>this.reveal[r]??0}),n}isEnabled(e){return(this.reveal[e]??0)>0}showSeries(e){let{index:r=0}=e.data??{};return this.revealTo(r,1,e.duration??.35,e.easing??N())}hideSeries(e){let{index:r=0}=e.data??{};return this.revealTo(r,0,e.duration??.35,e.easing??N())}revealTo(e,r,o,n){if(this.items[e]===void 0)return we(o);let i=this.reveal[e]??0;return xe(o,l=>{this.reveal[e]=i+(r-i)*n(l)})}spotlightSeries(e){let{index:r=0}=e.data??{},o=e.duration??.35,n=e.easing??N();return ke(...this.items.map((i,l)=>({item:i,i:l})).filter(({i})=>this.isEnabled(i)).map(({item:i,i:l})=>i.to({data:{opacity:l===r?1:X},duration:o,easing:n})))}};w([j({default:()=>[]})],u.prototype,"series",void 0);w([j({default:()=>[]})],u.prototype,"swatches",void 0);w([j({default:H})],u.prototype,"legend",void 0);w([U()],u.prototype,"showSeries",null);w([U()],u.prototype,"hideSeries",null);w([U()],u.prototype,"spotlightSeries",null);import{command as be,Node2D as ve,Rect as Q,RotatedBox as _e,Text as Z,easeOut as Ae,property as D,insetsOps as ee,textOps as te}from"@motionscript/core";import{at as re,compose as ie}from"@motionscript/core/component";var O=function(t,e,r,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(l=t[s])&&(i=(n<3?l(i):n>3?l(e,r,i):l(e,r))||i);return n>3&&i&&Object.defineProperty(e,r,i),i},oe=24,y=class extends ve{labelFor=$;markerNodes=[];labelNode=null;get sortedMarkers(){return[...this.markers].sort((e,r)=>r-e)}valueAt(e){return this.sortedMarkers[e]}fracAt(e){let r=this.valueAt(e);if(r===void 0)return 0;let[o,n]=this.range;return n<=o?0:(r-o)/(n-o)}constructor(e){super(e);let r=ee.resolve(this.axis.tickPadding).right,o=ee.resolve(this.axis.titlePadding).right;this.markerNodes=this.markers.map((i,l)=>{let s=new Z({...te.styleProps(this.axis.labelStyle),text:()=>{let d=this.valueAt(l);return d===void 0?"":this.labelFor(d)},y:()=>{let d=this.layoutBounds.height,k=(this.fracAt(l)-.5)*d,S=d/2-s.layoutBounds.height/2;return Math.min(k,S)}});return s});let n=[];this.label!==""&&(this.labelNode=new Z({...te.styleProps(this.axis.titleStyle),text:this.label}),n.push(new _e({angle:-90,width:"hug",height:"hug",children:this.labelNode}))),n.push(new Q({height:"fill",width:"hug",padding:{right:r},children:this.markerNodes})),this.add(new Q({flow:"horizontal",gap:o,children:n}))}arm(e=oe){for(let r of this.markerNodes)r.set({opacity:0,x:e});this.labelNode?.set({opacity:0,x:e})}enter(e){let{stagger:r,slide:o=oe}=e.data??{},n=e.easing??Ae(),i=this.markerNodes;if(i.length===0)return ie([]);let{step:l,per:s,caption:d}=K(e.duration,i.length,this.labelNode!==null,r);this.arm(o);let k=i.map((b,v)=>{let a=i.length-1-v;return re(a*l,b.to({data:{opacity:1,x:0},duration:s,easing:n}))}),S=(i.length-1)*l+s;return ie([...k,...this.labelNode?[re(S,this.labelNode.to({data:{opacity:1,x:0},duration:d,easing:n}))]:[]])}};O([D({default:()=>[0,1]})],y.prototype,"range",void 0);O([D({default:()=>[]})],y.prototype,"markers",void 0);O([D({default:T})],y.prototype,"axis",void 0);O([D({default:""})],y.prototype,"label",void 0);O([be()],y.prototype,"enter",null);export*from"@motionscript/core/component";export{Ee as a,Oe as b,P as c,C as d,X as e,Le as f,Te as g,Re as h,De as i,Y as j,T as k,E as l,H as m,Fe as n,Ie as o,Me as p,Ge as q,Ne as r,Ue as s,je as t,Ce as u,Xe as v,Be as w,We as x,ze as y,de as z,Ye as A,He as B,$ as C,$e as D,Ke as E,Je as F,K as G,I as H,c as I,u as J,y as K};
2
+ //# sourceMappingURL=chunk-ZMBOBHYL.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/kit/shared.ts", "../../../src/kit/chart-border.ts", "../../../src/kit/chart-canvas.ts", "../../../src/kit/chart-legend.ts", "../../../src/kit/vertical-axis.ts", "../../../src/engine.ts"],
4
+ "sourcesContent": ["/**\n * The vocabulary every chart node shares: what a *series* is, how an axis is\n * scaled and formatted, and the theme leaves each chart's own theme is assembled\n * from.\n *\n * This module exists because the three chart types are three ways of drawing the\n * same table. A line chart, a bar chart and a pie chart disagree about almost\n * everything visible — polylines against columns against wedges — and agree\n * about almost everything underneath: a series is a column with a caption and a\n * paint, a marker is a number formatted one way, a legend is a swatch beside a\n * label, and a theme is a tree of paints with one mapper and one tween. Writing\n * that three times would mean three answers to \"how does a chart round its axis\"\n * within one app.\n *\n * Kept renderer-agnostic (no `Node` imports) so the studio's own inspector\n * mappings can build a partial theme without pulling the node classes in, the\n * same way `line-chart-props.ts` always has.\n *\n * **Two conventions run through every resolver and lerp below**, inherited from\n * the shape system's `resolveStroke`/`resolveShadow`:\n *\n * - A **mapper** merges the author's loose, partial input onto a `previous`\n * resolved value and resolves every leaf, so the tween always has resolved\n * data to interpolate. It is idempotent.\n * - A **tween** interpolates two resolved values leaf by leaf. Categorical\n * fields (`fontFamily`, `textAlign`) and fields that are `undefined` on either\n * side **step at the midpoint**, because there is no meaningful in-between and\n * defaulting the missing side to 0 would animate a font weight down to nothing\n * on the way to \"unset\".\n */\n\nimport {\n fillOps,\n lerpNumber,\n shadowOps,\n strokeOps,\n insetsOps,\n textOps,\n type DataRecord,\n type Fill,\n type FillResolved,\n type Insets,\n type InsetsResolved,\n type Shadow,\n type ShadowResolved,\n type Stroke,\n type StrokeResolved,\n type TextStyle,\n} from \"@motionscript/core\"\n\n/**\n * One series of a chart: a column of the table, captioned and painted.\n *\n * `field` names the column carrying this series' values. What that becomes is\n * the chart's business — a traced polyline, a column of bars, a wedge — but the\n * three questions asked of it are the same everywhere: which column, what to\n * call it, what to paint it, and whether it is currently drawn.\n *\n * `fill` is an **override**: omit it and the series takes the theme palette's\n * entry for its own index, which is what makes a chart nobody has themed come\n * out in five distinct colours rather than five identical ones.\n */\nexport interface ChartSeries {\n /** Key into each data row for this series' value. */\n field: string\n /** Legend caption for this series. */\n label: string\n /**\n * Paint override for this series' mark and its legend swatch. Omit to take\n * the theme palette's entry for this series' index.\n */\n fill?: Fill\n /** Whether the series shows by default. Defaults to `true`. */\n enabled?: boolean\n}\n\n/** A `[min, max]` numeric range in data units. */\nexport type Range = [min: number, max: number]\n\n/**\n * One axis's *data* domain — what it shows — as opposed to {@link AxisConfig},\n * which is how it's *styled*. Every field is optional: `range`/`ticks` derive\n * from the plotted data when omitted, and `label` defaults to `\"\"`.\n */\nexport interface AxisDomainConfig {\n /** Caption drawn alongside the axis. Pass `\"\"` (the default) to hide it. */\n label?: string\n /** `[min, max]` of the scale. Derived from the data bounds when omitted. */\n range?: Range\n /** Tick values (in data units). Derived (five evenly-spaced) when omitted. */\n ticks?: number[]\n /**\n * How a tick value is written down — a `number-format` pattern such as\n * `#,##0.00` or `$#,##0`.\n *\n * Here rather than in {@link AxisConfig} because it is a statement about the\n * *numbers*, not about the ink they are set in: `$` on a revenue axis says\n * what the column holds, and it has to survive a re-theme. It sits beside\n * `range` and `ticks` for the same reason those do.\n */\n format?: string\n}\n\n/**\n * An axis domain's @property mapper: merges the author's partial input onto\n * `previous`, so a later partial `.set({ yAxis: {...} })` patches\n * `label`/`range`/`ticks` independently. `range`/`ticks` staying `undefined`\n * after the merge is the auto-derive signal the scale getters read.\n */\nexport function resolveAxisDomain(\n domain: AxisDomainConfig | undefined,\n previous?: AxisDomainConfig\n): AxisDomainConfig {\n return {\n label: domain?.label ?? previous?.label ?? \"\",\n range: domain?.range ?? previous?.range,\n ticks: domain?.ticks ?? previous?.ticks,\n format: domain?.format ?? previous?.format,\n }\n}\n\n/**\n * An axis domain's @property tween: interpolates `range`/`ticks` numerically\n * (pairwise by index for `ticks`), so a `to` command that restates a range\n * rescales the plot smoothly. `label`, and either field when one side is in\n * auto-derive mode, step at the midpoint.\n */\nexport function lerpAxisDomain(\n from: AxisDomainConfig,\n to: AxisDomainConfig,\n t: number\n): AxisDomainConfig {\n return {\n label: t < 0.5 ? from.label : to.label,\n range: lerpOptionalRange(from.range, to.range, t),\n ticks: lerpOptionalTicks(from.ticks, to.ticks, t),\n // Steps at the midpoint with the caption, for the same reason: there is no\n // halfway between `$#,##0` and `0.0%`.\n format: t < 0.5 ? from.format : to.format,\n }\n}\n\nfunction lerpOptionalRange(\n from: Range | undefined,\n to: Range | undefined,\n t: number\n): Range | undefined {\n if (!from || !to) return t < 0.5 ? from : to\n return [lerpNumber(from[0], to[0], t), lerpNumber(from[1], to[1], t)]\n}\n\nfunction lerpOptionalTicks(\n from: number[] | undefined,\n to: number[] | undefined,\n t: number\n): number[] | undefined {\n if (!from || !to) return t < 0.5 ? from : to\n const n = Math.max(from.length, to.length)\n const out: number[] = []\n for (let i = 0; i < n; i++) {\n out.push(lerpNumber(from[i] ?? to[i], to[i] ?? from[i], t))\n }\n return out\n}\n\n/**\n * The low-level colour tokens the default themes are built from — a dark plot\n * panel with warm-grey axis furniture.\n */\nexport const CHART_PALETTE = {\n /** Fill of the plot panel behind the marks. */\n plotFill: \"#15130e\",\n /** Colour of the plot's thick border. */\n borderColor: \"#4a4036\",\n /** Colour of the faint grid lines spanning the plot. */\n gridColor: \"#2c2820\",\n /** Colour of the numeric axis markers, axis captions, and legend labels. */\n markerColor: \"#8a7f70\",\n /** Colour of a spotlit region's dashed rules and its wash. */\n regionColor: \"#d99a3a\",\n} as const\n\n/** The out-of-the-box series palette, cycled by series index. */\nexport const DEFAULT_SERIES_COLORS = [\n \"#d9603b\",\n \"#8194ad\",\n \"#e0a93b\",\n \"#5e9d6b\",\n \"#9ec85a\",\n] as const\n\n/**\n * Opacity an *un*-spotlighted series fades to — its mark and its legend entry\n * alike, so the two dim together.\n */\nexport const SPOTLIGHT_DIM = 0.2\n\n/** Clamp a number into `[0, 1]` — the range every reveal signal here runs in. */\nexport function clampUnit(value: number): number {\n return value < 0 ? 0 : value > 1 ? 1 : value\n}\n\n// ---- Row readers ---------------------------------------------------------\n\n/**\n * Read a numeric field off a row, defaulting missing/non-numeric values to 0.\n *\n * A column left as strings silently plots as 0, which is why the CSV parser's\n * numeric auto-coercion matters — a quoted or unit-suffixed column won't plot\n * until it's coerced.\n */\nexport function num(row: DataRecord, field: string | undefined): number {\n if (field === undefined) return 0\n const v = row[field]\n return typeof v === \"number\" ? v : 0\n}\n\n/**\n * Read a field off a row as its caption — the counterpart to {@link num} for\n * the columns a chart *names* things by rather than measures them by (a bar's\n * category, a wedge's slice). A missing cell reads as empty rather than as the\n * string `\"undefined\"`.\n */\nexport function text(row: DataRecord, field: string | undefined): string {\n if (field === undefined || field === \"\") return \"\"\n const v = row[field]\n return v === undefined || v === null ? \"\" : String(v)\n}\n\n/**\n * Every column that holds numbers across `data`, in header order, skipping the\n * names in `exclude` (typically the category column).\n *\n * A column counts as numeric only if every non-empty cell in it is a number, so\n * a stray text cell leaves the column out rather than plotting zeros. This is\n * what lets a chart plot \"every other column\" without the author naming twenty\n * fields.\n */\nexport function numericFields(\n data: DataRecord[],\n exclude: string[] = []\n): string[] {\n if (data.length === 0) return []\n const skip = new Set(exclude)\n const seen = new Set<string>()\n const order: string[] = []\n for (const row of data)\n for (const key of Object.keys(row))\n if (!skip.has(key) && !seen.has(key)) {\n seen.add(key)\n order.push(key)\n }\n\n return order.filter((key) => {\n let sawValue = false\n for (const row of data) {\n const v = row[key]\n if (v === undefined || v === \"\") continue\n if (typeof v !== \"number\") return false\n sawValue = true\n }\n return sawValue\n })\n}\n\n// ---- Theme branches ------------------------------------------------------\n\n/** One axis's (x or y) style vocabulary. */\nexport interface AxisConfig {\n /** Style of each marker along the axis. */\n labelStyle: TextStyle\n /** Style of the axis caption. */\n titleStyle: TextStyle\n /**\n * This axis's direction of the plot's internal grid — weight+fill honoured,\n * dash/cap/join ignored (grid lines are drawn as filled rects).\n */\n lineStyle: Stroke\n /**\n * Gap between the plot and the marker row. Only the side facing the plot is\n * read — `.top` for a horizontal axis, `.right` for a vertical one.\n */\n tickPadding: Insets\n /** Gap between the marker row and the caption, read the same side. */\n titlePadding: Insets\n}\n\n/** A legend's per-series colour swatch — a rounded chip, not the caption. */\nexport interface LegendMarkerConfig {\n width: number\n height: number\n borderRadius: number\n stroke: Stroke\n shadow: Shadow\n}\n\n/** A legend's visual theme. */\nexport interface LegendConfig {\n padding: Insets\n /** Caption style — only the swatch carries the series colour. */\n textStyle: TextStyle\n /** Gap between legend entries. */\n itemGap: number\n markerStyle: LegendMarkerConfig\n}\n\n/** The plot panel a cartesian chart draws its marks over. */\nexport interface PlotAreaConfig {\n stroke: Stroke\n fill: Fill\n shadow: Shadow\n}\n\nconst AXIS_LABEL_STYLE: TextStyle = {\n fontSize: 24,\n fontWeight: 700,\n textAlign: \"center\",\n fill: CHART_PALETTE.markerColor,\n}\nconst AXIS_TITLE_STYLE: TextStyle = {\n fontSize: 30,\n fontWeight: 600,\n textAlign: \"center\",\n fill: CHART_PALETTE.markerColor,\n}\nconst AXIS_LINE_STYLE: Stroke = { weight: 2, fill: CHART_PALETTE.gridColor }\n\n/** The default styling of a horizontal (marker row beneath the plot) axis. */\nexport const DEFAULT_X_AXIS: AxisConfig = {\n labelStyle: AXIS_LABEL_STYLE,\n titleStyle: AXIS_TITLE_STYLE,\n lineStyle: AXIS_LINE_STYLE,\n tickPadding: 20,\n titlePadding: 4,\n}\n\n/** The default styling of a vertical (marker column beside the plot) axis. */\nexport const DEFAULT_Y_AXIS: AxisConfig = {\n labelStyle: { ...AXIS_LABEL_STYLE, fontWeight: 500, textAlign: \"right\" },\n titleStyle: AXIS_TITLE_STYLE,\n lineStyle: AXIS_LINE_STYLE,\n tickPadding: 40,\n titlePadding: 24,\n}\n\n/**\n * The default plot panel: **unpainted**, framed. A chart reads against the\n * stage rather than punching a panel into it, which is the look the family was\n * designed at.\n */\nexport const DEFAULT_PLOT_AREA: PlotAreaConfig = {\n fill: [],\n stroke: { weight: 6, fill: CHART_PALETTE.borderColor },\n shadow: [],\n}\n\n/** The default legend styling, shared by every chart that draws one. */\nexport const DEFAULT_LEGEND: LegendConfig = {\n padding: 0,\n textStyle: {\n fontSize: 30,\n fontWeight: 600,\n textAlign: \"left\",\n fill: CHART_PALETTE.markerColor,\n },\n itemGap: 44,\n markerStyle: {\n width: 60,\n height: 24,\n borderRadius: 6,\n stroke: [],\n shadow: [],\n },\n}\n\n/** The default per-series stroke palette — {@link DEFAULT_SERIES_COLORS}, drawn 4px. */\nexport const DEFAULT_SERIES_STROKES: Stroke[] = DEFAULT_SERIES_COLORS.map(\n (fill) => ({ weight: 4, fill })\n)\n\n/** The default per-series fill palette — the same colours, as solid paint. */\nexport const DEFAULT_SERIES_FILLS: Fill[] = DEFAULT_SERIES_COLORS.map(\n (fill) => fill\n)\n\n// ---- Theme branch resolvers ----------------------------------------------\n// Each chart type assembles its own theme out of these, so \"the axis furniture\"\n// means one thing across the family and each chart still declares only the\n// branches it actually draws.\n\nexport function resolveAxisConfig(\n axis: Partial<AxisConfig> | undefined,\n previous: AxisConfig\n): AxisConfig {\n return {\n labelStyle: textOps.resolveStyle(axis?.labelStyle, previous.labelStyle),\n titleStyle: textOps.resolveStyle(axis?.titleStyle, previous.titleStyle),\n lineStyle: strokeOps.resolve(axis?.lineStyle ?? previous.lineStyle),\n tickPadding: insetsOps.resolve(\n axis?.tickPadding ?? previous.tickPadding,\n previous.tickPadding as InsetsResolved\n ),\n titlePadding: insetsOps.resolve(\n axis?.titlePadding ?? previous.titlePadding,\n previous.titlePadding as InsetsResolved\n ),\n }\n}\n\nexport function lerpAxisConfig(\n from: AxisConfig,\n to: AxisConfig,\n t: number\n): AxisConfig {\n return {\n labelStyle: textOps.lerpStyle(from.labelStyle, to.labelStyle, t),\n titleStyle: textOps.lerpStyle(from.titleStyle, to.titleStyle, t),\n lineStyle: strokeOps.lerp(\n from.lineStyle as StrokeResolved[],\n to.lineStyle as StrokeResolved[],\n t\n ),\n tickPadding: insetsOps.lerp(\n from.tickPadding as InsetsResolved,\n to.tickPadding as InsetsResolved,\n t\n ),\n titlePadding: insetsOps.lerp(\n from.titlePadding as InsetsResolved,\n to.titlePadding as InsetsResolved,\n t\n ),\n }\n}\n\nexport function resolvePlotArea(\n plotArea: Partial<PlotAreaConfig> | undefined,\n previous: PlotAreaConfig\n): PlotAreaConfig {\n return {\n fill: fillOps.resolve(plotArea?.fill ?? previous.fill),\n stroke: strokeOps.resolve(plotArea?.stroke ?? previous.stroke),\n shadow: shadowOps.resolve(plotArea?.shadow ?? previous.shadow),\n }\n}\n\nexport function lerpPlotArea(\n from: PlotAreaConfig,\n to: PlotAreaConfig,\n t: number\n): PlotAreaConfig {\n return {\n fill: fillOps.lerp(\n from.fill as FillResolved[],\n to.fill as FillResolved[],\n t\n ),\n stroke: strokeOps.lerp(\n from.stroke as StrokeResolved[],\n to.stroke as StrokeResolved[],\n t\n ),\n shadow: shadowOps.lerp(\n from.shadow as ShadowResolved[],\n to.shadow as ShadowResolved[],\n t\n ),\n }\n}\n\nfunction resolveLegendMarkerConfig(\n marker: Partial<LegendMarkerConfig> | undefined,\n previous: LegendMarkerConfig\n): LegendMarkerConfig {\n return {\n width: marker?.width ?? previous.width,\n height: marker?.height ?? previous.height,\n borderRadius: marker?.borderRadius ?? previous.borderRadius,\n stroke: strokeOps.resolve(marker?.stroke ?? previous.stroke),\n shadow: shadowOps.resolve(marker?.shadow ?? previous.shadow),\n }\n}\n\nfunction lerpLegendMarkerConfig(\n from: LegendMarkerConfig,\n to: LegendMarkerConfig,\n t: number\n): LegendMarkerConfig {\n return {\n width: lerpNumber(from.width, to.width, t),\n height: lerpNumber(from.height, to.height, t),\n borderRadius: lerpNumber(from.borderRadius, to.borderRadius, t),\n stroke: strokeOps.lerp(\n from.stroke as StrokeResolved[],\n to.stroke as StrokeResolved[],\n t\n ),\n shadow: shadowOps.lerp(\n from.shadow as ShadowResolved[],\n to.shadow as ShadowResolved[],\n t\n ),\n }\n}\n\n/** A legend theme as the author may state it — every branch optional. */\nexport type LegendTheme = Partial<Omit<LegendConfig, \"markerStyle\">> & {\n markerStyle?: Partial<LegendMarkerConfig>\n}\n\nexport function resolveLegendConfig(\n legend: LegendTheme | undefined,\n previous: LegendConfig\n): LegendConfig {\n return {\n padding: insetsOps.resolve(\n legend?.padding ?? previous.padding,\n previous.padding as InsetsResolved\n ),\n textStyle: textOps.resolveStyle(legend?.textStyle, previous.textStyle),\n itemGap: legend?.itemGap ?? previous.itemGap,\n markerStyle: resolveLegendMarkerConfig(\n legend?.markerStyle,\n previous.markerStyle\n ),\n }\n}\n\nexport function lerpLegendConfig(\n from: LegendConfig,\n to: LegendConfig,\n t: number\n): LegendConfig {\n return {\n padding: insetsOps.lerp(\n from.padding as InsetsResolved,\n to.padding as InsetsResolved,\n t\n ),\n textStyle: textOps.lerpStyle(from.textStyle, to.textStyle, t),\n itemGap: lerpNumber(from.itemGap, to.itemGap, t),\n markerStyle: lerpLegendMarkerConfig(from.markerStyle, to.markerStyle, t),\n }\n}\n\n/** A whole-palette override replaces the previous palette outright. */\nexport function resolveSeriesStrokes(\n styles: Stroke[] | undefined,\n previous: Stroke[]\n): Stroke[] {\n return (styles ?? previous).map((s) => strokeOps.resolve(s))\n}\n\n/** Pairwise by index; a palette that grows/shrinks holds the longer side's tail. */\nexport function lerpSeriesStrokes(\n from: Stroke[],\n to: Stroke[],\n t: number\n): Stroke[] {\n const n = Math.max(from.length, to.length)\n const out: Stroke[] = []\n for (let i = 0; i < n; i++) {\n const a = (from[i] ?? to[i]) as StrokeResolved[]\n const b = (to[i] ?? from[i]) as StrokeResolved[]\n out.push(strokeOps.lerp(a, b, t))\n }\n return out\n}\n\n/** The fill-palette twin of {@link resolveSeriesStrokes}, for filled marks. */\nexport function resolveSeriesFills(\n fills: Fill[] | undefined,\n previous: Fill[]\n): Fill[] {\n return (fills ?? previous).map((f) => fillOps.resolve(f))\n}\n\n/** The fill-palette twin of {@link lerpSeriesStrokes}. */\nexport function lerpSeriesFills(from: Fill[], to: Fill[], t: number): Fill[] {\n const n = Math.max(from.length, to.length)\n const out: Fill[] = []\n for (let i = 0; i < n; i++) {\n const a = (from[i] ?? to[i]) as FillResolved[]\n const b = (to[i] ?? from[i]) as FillResolved[]\n out.push(fillOps.lerp(a, b, t))\n }\n return out\n}\n\n// ---- Per-series paint ----------------------------------------------------\n\n/**\n * The effective stroke for series `index`: the palette's entry at\n * `index % palette.length`, with the series' own `fill`, if set, overriding just\n * the last (topmost) layer's colour.\n */\nexport function resolveSeriesStroke(\n palette: Stroke[],\n series: ChartSeries,\n index: number\n): Stroke {\n const entry: Stroke =\n palette.length > 0\n ? palette[index % palette.length]\n : { weight: 4, fill: \"white\" }\n if (series.fill == null) return entry\n const layers = strokeOps.resolve(entry)\n if (layers.length === 0) return { weight: 4, fill: series.fill }\n const next = [...layers]\n next[next.length - 1] = {\n ...next[next.length - 1],\n fill: fillOps.resolve(series.fill),\n }\n return next\n}\n\n/**\n * The effective *colour* for series `index` — the same colour\n * {@link resolveSeriesStroke} draws its line in — for contexts (a legend\n * swatch) that only need the fill.\n */\nexport function resolveSeriesFill(\n palette: Stroke[],\n series: ChartSeries,\n index: number\n): Fill {\n const layers = strokeOps.resolve(resolveSeriesStroke(palette, series, index))\n return layers[layers.length - 1]?.fill ?? \"white\"\n}\n\n/**\n * The effective paint for mark `index` of a **filled** chart (a bar, a wedge):\n * the series' own `fill` when it carries one, else the palette's entry for its\n * index, cycled.\n *\n * The stroke twin above has to reach inside a stroke to swap one layer's colour;\n * a filled mark has no such geometry wrapped around its paint, so an override is\n * simply the whole answer.\n */\nexport function resolvePalettePaint(\n palette: Fill[],\n override: Fill | undefined,\n index: number\n): Fill {\n if (override != null) return override\n if (palette.length === 0) return \"white\"\n return palette[index % palette.length]\n}\n\n// ---- Scales and formatting -----------------------------------------------\n\n\n/** Format a marker value: integers plain, otherwise trimmed to one decimal. */\nexport function formatMarker(value: number): string {\n if (Number.isInteger(value)) return String(value)\n return value.toFixed(1).replace(/\\.0$/, \"\")\n}\n\n/** Format a fraction in `[0, 1]` as a percentage: integers plain, else one decimal. */\nexport function formatPercent(fraction: number): string {\n const pct = fraction * 100\n if (Number.isInteger(pct)) return `${pct}%`\n return `${pct.toFixed(1).replace(/\\.0$/, \"\")}%`\n}\n\n/** `markerCount` evenly-spaced tick values across `[min, max]`, ends inclusive. */\nexport function markerValues([min, max]: Range, markerCount: number): number[] {\n const n = Math.max(2, Math.round(markerCount))\n return Array.from({ length: n + 1 }, (_, i) => min + ((max - min) / n) * i)\n}\n\n// Lifted into the engine, because a graph and a diagram want them too — see\n// `@motionscript/core/component`. Re-exported so a chart, and anything that\n// copied one, still reaches them where it always did.\nexport { niceStep, enterBudget } from \"@motionscript/core/component\"\n", "import {\n type AssetScope,\n Graphics2D,\n Node2D,\n strokeOps,\n property,\n type Node2DProps,\n type RenderContext2D,\n type Stroke,\n} from \"@motionscript/core\"\n\nimport { DEFAULT_PLOT_AREA } from \"./shared\"\nimport { declarePaints } from \"@motionscript/core/component\"\n\nexport interface ChartBorderProps extends Node2DProps {\n /**\n * The plot's thick frame stroke. The stroke resolver's default `align` is\n * `'inside'`, so the whole weight sits within the layout box unless the theme\n * overrides it.\n */\n stroke: Stroke\n}\n\n/**\n * The thick **frame** around a cartesian chart's plot: an empty rect wearing an\n * inside stroke, sized from its allocated `layoutBounds`.\n *\n * Split out of {@link ChartCanvas} (the filled + gridded backdrop) so it can be\n * placed *after* the marks in the tree — the box then frames the plot **over**\n * them, so a line or a column running to the edge tucks cleanly under the border\n * rather than sitting on top of it.\n */\nexport class ChartBorder extends Node2D<ChartBorderProps> {\n @property({\n default: DEFAULT_PLOT_AREA.stroke,\n mapper: strokeOps.resolve,\n tween: strokeOps.lerp,\n })\n declare stroke: Stroke\n\n /**\n * This node extends `Node2D` rather than `ShapeNode`, so nothing declares the\n * paint props it carries — see {@link declarePaints}.\n */\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets)\n declarePaints(this, assets)\n }\n\n protected renderSelf(ctx: RenderContext2D): void {\n const W = this.layoutBounds.width\n const H = this.layoutBounds.height\n if (W <= 0 || H <= 0) return\n\n // Empty rect (no fill) with the themed stroke, so the frame sits over the\n // marks but the box interior stays clear.\n ctx.draw(\n new Graphics2D().rect({ x: 0, y: 0, width: W, height: H }).stroke(this.stroke)\n )\n }\n}\n", "import {\n type AssetScope,\n Graphics2D,\n Node2D,\n fillOps,\n shadowOps,\n strokeOps,\n property,\n type Fill,\n type Node2DProps,\n type RenderContext2D,\n type Shadow,\n type Stroke,\n type StrokeResolved,\n} from \"@motionscript/core\"\n\nimport {\n DEFAULT_PLOT_AREA,\n DEFAULT_X_AXIS,\n DEFAULT_Y_AXIS,\n type Range,\n} from \"./shared\"\nimport { declarePaints } from \"@motionscript/core/component\"\n\nexport interface ChartCanvasProps extends Node2DProps {\n /** Fill of the plot panel behind the marks. */\n fill: Fill\n /** Drop shadow of the panel. Default none. */\n shadow: Shadow\n /** Stroke of the vertical grid lines (one per {@link xMarkers}). */\n xGridStroke: Stroke\n /** Stroke of the horizontal grid lines (one per {@link yMarkers}). */\n yGridStroke: Stroke\n /**\n * Data-unit x positions to draw a vertical grid line at — one per horizontal\n * axis marker, so a line lands under every marker regardless of spacing.\n * Positions at (or past) an {@link xExtent} edge coincide with the border and\n * are skipped. Pass an empty list for a chart whose horizontal axis is\n * categorical and so has no numeric position to rule at.\n */\n xMarkers: number[]\n /** Data-unit y positions to draw a horizontal grid line at. */\n yMarkers: number[]\n /** `[min, max]` of the horizontal scale — maps {@link xMarkers} into the panel. */\n xExtent: Range\n /** `[min, max]` of the vertical scale — maps {@link yMarkers} into the panel. */\n yExtent: Range\n}\n\n/**\n * The plot **backdrop** of a cartesian chart: a filled panel with a grid of\n * faint lines spanning both directions across it. Drawn as one {@link Graphics2D}\n * command list, sized from its allocated `layoutBounds` and centred on the node\n * origin.\n *\n * The thick frame is a **separate** {@link ChartBorder} node so it can be drawn\n * *over* the marks while this panel sits under them. Grid lines are placed from\n * the axis marker positions (in data units) mapped into the panel through\n * {@link ChartCanvasProps.xExtent}/`yExtent` — so each line lands under its\n * marker whether or not the markers are evenly spaced.\n */\nexport class ChartCanvas extends Node2D<ChartCanvasProps> {\n @property({\n default: DEFAULT_PLOT_AREA.fill,\n mapper: fillOps.resolve,\n tween: fillOps.lerp,\n })\n declare fill: Fill\n @property({\n default: DEFAULT_PLOT_AREA.shadow,\n mapper: shadowOps.resolve,\n tween: shadowOps.lerp,\n })\n declare shadow: Shadow\n @property({\n default: DEFAULT_X_AXIS.lineStyle,\n mapper: strokeOps.resolve,\n tween: strokeOps.lerp,\n })\n declare xGridStroke: Stroke\n @property({\n default: DEFAULT_Y_AXIS.lineStyle,\n mapper: strokeOps.resolve,\n tween: strokeOps.lerp,\n })\n declare yGridStroke: Stroke\n @property({ default: () => [] as number[] }) declare xMarkers: number[]\n @property({ default: () => [] as number[] }) declare yMarkers: number[]\n @property({ default: () => [0, 1] as Range }) declare xExtent: Range\n @property({ default: () => [0, 1] as Range }) declare yExtent: Range\n\n /**\n * This node extends `Node2D` rather than `ShapeNode`, so nothing declares the\n * paint props it carries — see {@link declarePaints}. The grid strokes are\n * named past the conventional slots, so they are passed explicitly.\n */\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets)\n declarePaints(this, assets, {\n strokes: [this.xGridStroke as StrokeResolved[], this.yGridStroke as StrokeResolved[]],\n })\n }\n\n protected renderSelf(ctx: RenderContext2D): void {\n const W = this.layoutBounds.width\n const H = this.layoutBounds.height\n if (W <= 0 || H <= 0) return\n\n // Plot panel, centred on the origin (node space is y-up, origin centre).\n ctx.draw(\n new Graphics2D()\n .rect({ x: 0, y: 0, width: W, height: H })\n .shadow(this.shadow)\n .fill(this.fill)\n )\n\n const [xMin, xMax] = this.xExtent\n const [yMin, yMax] = this.yExtent\n // Fraction of a marker across its extent; guard a zero-width extent.\n const xFrac = (v: number) => (xMax <= xMin ? 0 : (v - xMin) / (xMax - xMin))\n const yFrac = (v: number) => (yMax <= yMin ? 0 : (v - yMin) / (yMax - yMin))\n // Skip markers landing on (or outside) the edges — they'd sit under the border.\n const interior = (f: number) => f > 1e-6 && f < 1 - 1e-6\n\n const xStroke = (this.xGridStroke as StrokeResolved[])[0]\n if (xStroke) {\n const xGrid = new Graphics2D()\n for (const v of this.xMarkers) {\n const f = xFrac(v)\n if (!interior(f)) continue\n xGrid.rect({\n x: -W / 2 + f * W,\n y: 0,\n width: xStroke.weight,\n height: H,\n })\n }\n ctx.draw(xGrid.fill(xStroke.fill))\n }\n\n const yStroke = (this.yGridStroke as StrokeResolved[])[0]\n if (yStroke) {\n const yGrid = new Graphics2D()\n for (const v of this.yMarkers) {\n const f = yFrac(v)\n if (!interior(f)) continue\n yGrid.rect({\n x: 0,\n y: -H / 2 + f * H,\n width: W,\n height: yStroke.weight,\n })\n }\n ctx.draw(yGrid.fill(yStroke.fill))\n }\n }\n}\n", "import {\n Rect,\n Text,\n command,\n easeOut,\n property,\n textOps,\n type CommandArgs,\n type EasingFunction,\n type Fill,\n type NodeConfig,\n type RectProps,\n} from \"@motionscript/core\"\n\nimport { drive, hold, together, type Seekable } from \"@motionscript/core/component\"\n\nimport {\n DEFAULT_LEGEND,\n SPOTLIGHT_DIM,\n type ChartSeries,\n type LegendConfig,\n} from \"./shared\"\n\nexport interface ChartLegendProps extends RectProps {\n /**\n * One entry per series: legend `label`, its `enabled` default, and — through\n * {@link ChartLegendProps.swatches} — the colour its chip is painted. A series\n * that starts enabled (the default) is added to the row up front; one that\n * starts `false` is hidden until a later {@link ChartLegend.showSeries}.\n */\n series: ChartSeries[]\n /**\n * The swatch colour for each series, by index — resolved by the chart, whose\n * business it is whether a series' colour comes out of a stroke palette (a\n * line) or a fill palette (a bar). Shorter than the series list means the\n * missing entries fall back to white.\n */\n swatches: Fill[]\n /** Padding, caption style, gaps, and swatch geometry — see {@link LegendConfig}. */\n legend: LegendConfig\n}\n\n/**\n * The legend of a chart: a **horizontal-flow row of entries**, one per series, laid out\n * left-to-right with the theme's `itemGap`. Each entry pairs the series label\n * with a rounded colour swatch; only the swatch carries the series colour, the\n * caption reads in the legend's neutral ink.\n *\n * {@link showSeries}/{@link hideSeries} flip a series on or off — showing one\n * adds its entry back into the row at its stable series position and grows it\n * in, hiding one shrinks it away and removes it. So the row only ever holds the\n * currently-enabled series, in series order, and closes the gap when one leaves.\n *\n * This node *is* the row, so the parent places it (centred below the chart) and\n * it hugs its entries.\n */\nexport class ChartLegend extends Rect {\n @property({ default: () => [] as ChartSeries[] }) declare series: ChartSeries[]\n @property({ default: () => [] as Fill[] }) declare swatches: Fill[]\n @property({ default: DEFAULT_LEGEND }) declare legend: LegendConfig\n\n /** One entry per series. **Every** entry is a child — see {@link reveal}. */\n private items: Rect[] = []\n /**\n * How far each entry is shown, `0`–`1`. Drives its width, opacity and gap\n * together, so `0` is an entry that takes no room and `1` is one at its\n * natural size.\n *\n * This replaces adding and removing the entry from the row, which is what\n * `showSeries`/`hideSeries` used to do. That could not be a command: a command\n * is asked what it looks like at a time, and \"is this node a child\" is not a\n * value a time can produce — the tree either contains it or it doesn't, and\n * getting there means having run the add. Collapsed-but-present is the same\n * picture reached by a route that *is* a function of `t`.\n *\n * A plain array rather than reactive props because the count is the series\n * count, which is data. The entries' props are bound to it, so writing one\n * still moves the layout.\n */\n private reveal: number[] = []\n /**\n * Each entry's natural width, last time it was fully shown.\n *\n * A collapse needs numeric endpoints — `lerpSizeInput` snaps between a token\n * and a number rather than interpolating — and `\"hug\"` is not a number until\n * something measures it. Refreshed on every frame an entry is at full reveal\n * (see {@link widthFor}), so it is current by the time a hide starts, and it\n * tracks a relabelled series or a restyled legend without being told.\n */\n private natural: number[] = []\n\n constructor(props?: NodeConfig<ChartLegend, ChartLegendProps>) {\n // `flow` after the spread, with the rest of the geometry: this class *is*\n // the row, so the direction is its own answer and not the caller's. It has\n // to be stated — a `Rect` given no flow lays its children out `freeform`,\n // which stacks every entry on the same spot. One series looks perfect that\n // way and three look like one smeared caption, so the failure only shows up\n // on the charts that most need a legend.\n super({\n ...(props as RectProps),\n flow: \"horizontal\",\n align: \"center\",\n width: \"hug\",\n height: \"hug\",\n })\n\n // Structure is one entry per series, so it's composed here from the resolved\n // props super() applied. Fixed row geometry last, so it wins over super().\n this.set({ gap: this.legend.itemGap, padding: this.legend.padding })\n\n this.reveal = this.series.map((s) => ((s.enabled ?? true) ? 1 : 0))\n this.natural = this.series.map(() => 0)\n this.items = this.series.map((s, i) => this.buildItem(s, i))\n\n // All of them, in series order. Order is now fixed rather than depending on\n // which siblings happen to be shown, so an entry always comes back where it\n // belongs and `insertionIndex` has nothing left to compute.\n for (const item of this.items) this.add(item)\n }\n\n /**\n * An entry's width for its current reveal.\n *\n * `\"hug\"` at full reveal rather than the pinned number, so a shown entry stays\n * responsive to its own content; the number only takes over while it is\n * collapsing, which is the only time a token cannot express it.\n *\n * Records the natural width as a side effect, which is the honest place for it:\n * this runs inside a binding, so it is already reading the layout every frame,\n * and the value it wants is the one the layout just produced. It writes a plain\n * array rather than a signal, so nothing is invalidated by it.\n */\n private widthFor(index: number): number | \"hug\" {\n const shown = this.reveal[index] ?? 0\n if (shown >= 1) {\n const measured = this.items[index]?.measuredWidth ?? 0\n if (measured > 0) this.natural[index] = measured\n return \"hug\"\n }\n return shown * (this.natural[index] ?? 0)\n }\n\n /** One entry: the series caption beside its colour swatch. */\n private buildItem(series: ChartSeries, index: number): Rect {\n const marker = this.legend.markerStyle\n const item = new Rect({ flow: \"horizontal\",\n gap: 12,\n align: \"center\",\n // Bound to the reveal, so showing and hiding is a number moving rather\n // than a child arriving and leaving.\n width: () => this.widthFor(index),\n opacity: () => this.reveal[index] ?? 0,\n height: \"hug\",\n children: [\n new Text({\n ...textOps.styleProps(this.legend.textStyle),\n text: series.label,\n }),\n new Rect({\n width: marker.width,\n height: marker.height,\n cornerRadius: marker.borderRadius,\n fill: this.swatches[index] ?? \"white\",\n stroke: marker.stroke,\n shadow: marker.shadow,\n }),\n ],\n })\n // `gapScale` is a `Node` prop rather than a container one, so it is bound here\n // instead of in the config. It tracks the reveal so the flanking gap closes\n // with the entry rather than snapping when it reaches zero.\n item.set({ gapScale: () => this.reveal[index] ?? 0 })\n return item\n }\n\n /** True if series `index` is showing at all — see {@link reveal}. */\n isEnabled(index: number): boolean {\n return (this.reveal[index] ?? 0) > 0\n }\n\n /**\n * Grow series `index`'s entry back in at its series-order position, the\n * siblings sliding over to make room.\n *\n * A reveal tween rather than an animated `addChildAt`. The entry never left —\n * see {@link reveal} — so there is no add to have happened, and the whole\n * thing is a function of `t`.\n */\n @command()\n showSeries(args: CommandArgs<{ index: number }>): Seekable {\n const { index = 0 } = args.data ?? {}\n return this.revealTo(index, 1, args.duration ?? 0.35, args.easing ?? easeOut())\n }\n\n /**\n * Shrink series `index`'s entry away, the gap closing behind it — the mirror\n * of {@link showSeries}.\n */\n @command()\n hideSeries(args: CommandArgs<{ index: number }>): Seekable {\n const { index = 0 } = args.data ?? {}\n return this.revealTo(index, 0, args.duration ?? 0.35, args.easing ?? easeOut())\n }\n\n /**\n * Ramp one entry's reveal to `target`.\n *\n * `from` is read when the command is built, which for a driven scene is with\n * the node in the state its own start time implies — so a hide that follows a\n * show starts where the show left it rather than at whatever the node happens\n * to hold now.\n */\n private revealTo(\n index: number,\n target: number,\n duration: number,\n easing: EasingFunction\n ): Seekable {\n if (this.items[index] === undefined) return hold(duration)\n const from = this.reveal[index] ?? 0\n return drive(duration, (t) => {\n this.reveal[index] = from + (target - from) * easing(t)\n })\n }\n\n /**\n * Dim every entry but series `index` to {@link SPOTLIGHT_DIM} and bring that\n * one back to full — the legend half of a chart's `spotlightSeries`. Entries\n * stay in place; only their opacity moves, so the row doesn't reflow.\n *\n * Only the currently-shown entries are touched — a hidden series' entry is\n * left as {@link hideSeries} left it.\n */\n @command()\n spotlightSeries(args: CommandArgs<{ index: number }>): Seekable {\n const { index = 0 } = args.data ?? {}\n const duration = args.duration ?? 0.35\n const easing = args.easing ?? easeOut()\n // Opacity only, on entries that are already in the row — no membership\n // changes, so unlike {@link showSeries} this is a plain function of `t`.\n return together(\n ...this.items\n .map((item, i) => ({ item, i }))\n .filter(({ i }) => this.isEnabled(i))\n .map(({ item, i }) =>\n item.to({ data: { opacity: i === index ? 1 : SPOTLIGHT_DIM }, duration, easing })\n )\n )\n }\n}\n", "import {\n command,\n Node2D,\n Rect,\n RotatedBox,\n Text,\n easeOut,\n property,\n insetsOps,\n textOps,\n type CommandArgs,\n type NodeConfig,\n type Node2DProps,\n} from \"@motionscript/core\"\n\nimport {\n DEFAULT_Y_AXIS,\n enterBudget,\n formatMarker,\n type AxisConfig,\n type Range,\n} from \"./shared\"\nimport { at, compose, type Seekable } from \"@motionscript/core/component\"\n\nexport interface VerticalAxisProps extends Node2DProps {\n /** `[min, max]` of the vertical scale the markers are positioned within. */\n range: Range\n /**\n * Tick values (in data units) to draw up the axis, each placed by its fraction\n * across {@link VerticalAxisProps.range}. Need not be evenly spaced or include\n * the ends.\n */\n markers: number[]\n /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */\n axis: AxisConfig\n /**\n * Rotated caption drawn in the gutter to the left of the marker column. Empty\n * string (the default) hides it — no caption node is built and no label gutter\n * is reserved.\n */\n label: string\n}\n\n/** How far a marker starts to the right of its slot when it enters, in px. */\nconst SLIDE = 24\n\n/** How a tick value is captioned — see {@link VerticalAxis.labelFor}. */\nexport type MarkerLabel = (value: number) => string\n\n/**\n * The numeric vertical axis shared by the cartesian charts: a **column of\n * {@link Text} nodes**, one per marker value, running top-to-bottom (highest\n * value at the top). Pure layout — no `Graphics` — so the markers are real text\n * nodes the scene can measure, restyle, or animate individually.\n *\n * Each marker is positioned so its centre lands exactly on its value's fraction\n * across `range` within the axis's filled height, so unevenly-spaced markers\n * land where their values fall. Both the caption and the position are *bound*,\n * not snapshotted: a chart that rescales its axes (see `LineChart.zoomTo`)\n * tweens `range`/`markers` live. Only the marker **count** is fixed at\n * construction.\n *\n * {@link enter} staggers them in **bottom-to-top**: each marker starts pushed a\n * little to the right and transparent, then fades and slides left into place.\n * The resting state is the landed one, so a chart that is never told to enter\n * still reads as a finished chart.\n */\nexport class VerticalAxis extends Node2D<VerticalAxisProps> {\n @property({ default: () => [0, 1] as Range }) declare range: Range\n @property({ default: () => [] as number[] }) declare markers: number[]\n @property({ default: DEFAULT_Y_AXIS }) declare axis: AxisConfig\n @property({ default: \"\" }) declare label: string\n\n /**\n * How a tick value is captioned. Defaults to the bare numeric reading; a\n * chart with a number format on this axis replaces it (see `number-format`).\n *\n * A plain field rather than a `@property`, for the reason the horizontal\n * axis's twin spells out: it is a policy, not a value, and there is nothing\n * to tween between two formatters.\n */\n labelFor: MarkerLabel = formatMarker\n\n /** One text node per marker, ordered top → bottom, for the staggered enter. */\n private markerNodes: Text[] = []\n /** The caption node, or null when `label` is empty. Entered after the markers. */\n private labelNode: Text | null = null\n\n /** The live tick values, top → bottom (highest first) — re-read every frame. */\n private get sortedMarkers(): number[] {\n return [...this.markers].sort((a, b) => b - a)\n }\n\n /**\n * Tick `i`'s value, or `undefined` once the live `markers` list is shorter\n * than the column of text nodes built for it — a slot with no value renders as\n * empty text rather than repeating its neighbour.\n */\n private valueAt(index: number): number | undefined {\n return this.sortedMarkers[index]\n }\n\n /** Tick `i`'s fraction across the live `range`, 0 at the bottom edge. */\n private fracAt(index: number): number {\n const v = this.valueAt(index)\n if (v === undefined) return 0\n const [min, max] = this.range\n return max <= min ? 0 : (v - min) / (max - min)\n }\n\n constructor(props?: NodeConfig<VerticalAxis, VerticalAxisProps>) {\n super(props)\n\n // Composed from plain props (range/markers/label) — no context needed, so\n // it's built here. super() applied the props, so the reads below resolve.\n const tickPad = insetsOps.resolve(this.axis.tickPadding).right\n const titlePad = insetsOps.resolve(this.axis.titlePadding).right\n\n this.markerNodes = this.markers.map((_, i) => {\n const marker: Text = new Text({\n ...textOps.styleProps(this.axis.labelStyle),\n text: () => {\n const v = this.valueAt(i)\n return v === undefined ? \"\" : this.labelFor(v)\n },\n y: () => {\n // Node2D space is y-up, so the fraction runs from the bottom.\n const height = this.layoutBounds.height\n const centred = (this.fracAt(i) - 0.5) * height\n // Held inside the axis's top edge — the backstop for a chart whose\n // headroom is smaller than its marker text is tall, which a theme with\n // much larger markers can arrange. Only the top, because what lies\n // below the axis is the chart's own horizontal axis and legend.\n const limit = height / 2 - marker.layoutBounds.height / 2\n return Math.min(centred, limit)\n },\n })\n return marker\n })\n\n const children: Node2D[] = []\n if (this.label !== \"\") {\n this.labelNode = new Text({\n ...textOps.styleProps(this.axis.titleStyle),\n text: this.label,\n })\n // Node2D space is y-up and rotation is clockwise, so -90° reads bottom-to-top.\n children.push(\n new RotatedBox({\n angle: -90,\n width: \"hug\",\n height: \"hug\",\n children: this.labelNode,\n })\n )\n }\n children.push(\n new Rect({\n height: \"fill\",\n width: \"hug\",\n padding: { right: tickPad },\n children: this.markerNodes,\n })\n )\n\n this.add(new Rect({ flow: \"horizontal\", gap: titlePad, children }))\n }\n\n /**\n * Primes every marker (and the caption) at its pre-entrance state: shifted\n * right and transparent. Idempotent, and separate from {@link enter} so the\n * chart can arm its whole composition before the first frame is drawn.\n */\n arm(slide = SLIDE): void {\n for (const marker of this.markerNodes) marker.set({ opacity: 0, x: slide })\n this.labelNode?.set({ opacity: 0, x: slide })\n }\n\n /**\n * Stagger the markers in bottom to top, then slide the caption in from the\n * right after them.\n *\n * A {@link Seekable} rather than a generator — see the note on the horizontal\n * axis's `enter`. The offsets were always static; expressing them as `wait`\n * inside a generator is what made them reachable only by running it.\n *\n * `args.duration` is the **whole** entrance, not one marker's slide: the\n * stagger and the caption are carved out of it rather than added on top. See\n * {@link enterBudget} for why that distinction matters here.\n *\n * `args.data.stagger` is seconds between successive markers (derived when\n * omitted); `args.data.slide` is the starting rightward offset in px.\n */\n @command()\n enter(args: CommandArgs<{ stagger?: number; slide?: number }> & { duration: number }): Seekable {\n const { stagger, slide = SLIDE } = args.data ?? {}\n const easing = args.easing ?? easeOut()\n const nodes = this.markerNodes\n if (nodes.length === 0) return compose([])\n const { step, per, caption } = enterBudget(\n args.duration,\n nodes.length,\n this.labelNode !== null,\n stagger\n )\n\n this.arm(slide)\n\n // Bottom marker leads: markerNodes is top → bottom, so walk it in reverse.\n const markers = nodes.map((node, i) => {\n const order = nodes.length - 1 - i // bottom-most = 0\n return at(order * step, node.to({ data: { opacity: 1, x: 0 }, duration: per, easing }))\n })\n const lastMarkerEnds = (nodes.length - 1) * step + per\n\n // Once every marker has landed, the caption slides in from the right.\n return compose([\n ...markers,\n ...(this.labelNode\n ? [at(lastMarkerEnds, this.labelNode.to({ data: { opacity: 1, x: 0 }, duration: caption, easing }))]\n : []),\n ])\n }\n}\n", "/**\n * The chart **kit**: everything the three charts share, and the one thing a\n * copied chart does not copy.\n *\n * `ms add line-chart` writes `line-chart/*` into your project and rewrites its\n * reach for these to `@motionscript/charts`, so the plot panel, the value\n * axis, the legend and the number formatting stay a real dependency. That is\n * not a size decision — it is the only arrangement that works.\n *\n * A chart identifies its own parts, and the engine keys signal machinery to\n * class identity: `@property` installs against the class it was applied with,\n * and the renderer asks `instanceof` about what it is drawing. Copy\n * `VerticalAxis` alongside your fork and there are now two of it — two classes\n * answering one name, and whichever one your chart did not get renders as\n * nothing at all, with no error. Keeping the kit external makes that\n * impossible rather than unlikely.\n *\n * It also means a fix to the axis reaches a forked chart without a re-add,\n * which is the half of the bargain you get back for it.\n */\nexport * from \"./kit/shared\"\nexport * from \"./kit/chart-border\"\nexport * from \"./kit/chart-canvas\"\nexport * from \"./kit/chart-legend\"\nexport * from \"./kit/vertical-axis\"\nexport * from \"@motionscript/core/component\"\n"],
5
+ "mappings": "AA+BA,OACE,WAAAA,EACA,cAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,WAAAC,MAWK,qBAknBP,OAAS,YAAAC,GAAU,eAAAC,MAAmB,+BArjBhC,SAAUC,GACdC,EACAC,EAA2B,CAE3B,MAAO,CACL,MAAOD,GAAQ,OAASC,GAAU,OAAS,GAC3C,MAAOD,GAAQ,OAASC,GAAU,MAClC,MAAOD,GAAQ,OAASC,GAAU,MAClC,OAAQD,GAAQ,QAAUC,GAAU,OAExC,CAQM,SAAUC,GACdC,EACAC,EACAC,EAAS,CAET,MAAO,CACL,MAAOA,EAAI,GAAMF,EAAK,MAAQC,EAAG,MACjC,MAAOE,GAAkBH,EAAK,MAAOC,EAAG,MAAOC,CAAC,EAChD,MAAOE,GAAkBJ,EAAK,MAAOC,EAAG,MAAOC,CAAC,EAGhD,OAAQA,EAAI,GAAMF,EAAK,OAASC,EAAG,OAEvC,CAEA,SAASE,GACPH,EACAC,EACAC,EAAS,CAET,MAAI,CAACF,GAAQ,CAACC,EAAWC,EAAI,GAAMF,EAAOC,EACnC,CAACZ,EAAWW,EAAK,CAAC,EAAGC,EAAG,CAAC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AUL,EAAM,IAAI,CAACM,EAAMrB,IAAK,CACpC,IAAMsB,EAAQP,EAAM,OAAS,EAAIf,EACjC,OAAOjB,GAAGuC,EAAQN,EAAMK,EAAK,GAAG,CAAE,KAAM,CAAE,QAAS,EAAG,EAAG,CAAC,EAAI,SAAUJ,EAAK,OAAAJ,CAAM,CAAE,CAAC,CACxF,CAAC,EACKU,GAAkBR,EAAM,OAAS,GAAKC,EAAOC,EAGnD,OAAOjC,GAAQ,CACb,GAAGoC,EACH,GAAI,KAAK,UACL,CAACrC,GAAGwC,EAAgB,KAAK,UAAU,GAAG,CAAE,KAAM,CAAE,QAAS,EAAG,EAAG,CAAC,EAAI,SAAUL,EAAS,OAAAL,CAAM,CAAE,CAAC,CAAC,EACjG,CAAA,EACL,CACH,GA1JsDW,EAAA,CAArDC,EAAS,CAAE,QAAS,IAAM,CAAC,EAAG,CAAC,CAAU,CAAE,+BACSD,EAAA,CAApDC,EAAS,CAAE,QAAS,IAAM,CAAA,CAAc,CAAE,iCACID,EAAA,CAA9CC,EAAS,CAAE,QAASC,CAAc,CAAE,8BACFF,EAAA,CAAlCC,EAAS,CAAE,QAAS,EAAE,CAAE,+BA2HzBD,EAAA,CADCG,GAAO,6BCxKV,WAAc",
6
+ "names": ["fillOps", "lerpNumber", "shadowOps", "strokeOps", "insetsOps", "textOps", "niceStep", "enterBudget", "resolveAxisDomain", "domain", "previous", "lerpAxisDomain", "from", "to", "t", "lerpOptionalRange", "lerpOptionalTicks", "n", "out", "CHART_PALETTE", "DEFAULT_SERIES_COLORS", "SPOTLIGHT_DIM", "clampUnit", "value", "num", "row", "field", "v", "text", "numericFields", "data", "exclude", "skip", "seen", "order", "key", "sawValue", "AXIS_LABEL_STYLE", "AXIS_TITLE_STYLE", "AXIS_LINE_STYLE", "DEFAULT_X_AXIS", "DEFAULT_Y_AXIS", "DEFAULT_PLOT_AREA", "DEFAULT_LEGEND", "DEFAULT_SERIES_STROKES", "fill", "DEFAULT_SERIES_FILLS", "resolveAxisConfig", "axis", "lerpAxisConfig", "resolvePlotArea", "plotArea", "lerpPlotArea", "resolveLegendMarkerConfig", "marker", "lerpLegendMarkerConfig", "resolveLegendConfig", "legend", "lerpLegendConfig", "resolveSeriesStrokes", "styles", "s", "lerpSeriesStrokes", "a", "b", "resolveSeriesFills", "fills", "f", "lerpSeriesFills", "resolveSeriesStroke", "palette", "series", "index", "entry", "layers", "next", "resolveSeriesFill", "resolvePalettePaint", "override", "formatMarker", "formatPercent", "fraction", "pct", "markerValues", "min", "max", "markerCount", "_", "Graphics2D", "Node2D", "strokeOps", "property", "declarePaints", "ChartBorder", "Node2D", "assets", "ctx", "W", "H", "Graphics2D", "__decorate", "property", "DEFAULT_PLOT_AREA", "strokeOps", "Graphics2D", "Node2D", "fillOps", "shadowOps", "strokeOps", "property", "declarePaints", "ChartCanvas", "Node2D", "assets", "ctx", "W", "H", "Graphics2D", "xMin", "xMax", "yMin", "yMax", "xFrac", "v", "yFrac", "interior", "f", "xStroke", "xGrid", "yStroke", "yGrid", "__decorate", "property", "DEFAULT_PLOT_AREA", "fillOps", "shadowOps", "DEFAULT_X_AXIS", "strokeOps", "DEFAULT_Y_AXIS", "Rect", "Text", "command", "easeOut", "property", "textOps", "drive", "hold", "together", "ChartLegend", "Rect", "props", "s", "i", "item", "index", "shown", "measured", "series", "marker", "Text", "textOps", "args", "easeOut", "target", "duration", "easing", "hold", "from", "drive", "t", "together", "SPOTLIGHT_DIM", "__decorate", "property", "DEFAULT_LEGEND", "command", "command", "Node2D", "Rect", "RotatedBox", "Text", "easeOut", "property", "insetsOps", "textOps", "at", "compose", "SLIDE", "VerticalAxis", "Node2D", "formatMarker", "a", "b", "index", "v", "min", "max", "props", "tickPad", "insetsOps", "titlePad", "_", "i", "marker", "Text", "textOps", "height", "centred", "limit", "children", "RotatedBox", "Rect", "slide", "args", "stagger", "easing", "easeOut", "nodes", "step", "per", "caption", "enterBudget", "markers", "node", "order", "lastMarkerEnds", "__decorate", "property", "DEFAULT_Y_AXIS", "command"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{A as Ct,B as br,C as F,D as Ce,E as z,F as Oe,G as Pe,H as Fe,I as De,J as Ie,K as le,a as ee,b as te,c as O,d as xr,e as P,f,g as E,h as ie,i as vr,j as H,k as Re,l as Te,m as X,n as _t,o as Ee,p as se,q as re,r as _e,s as Me,t as oe,u as ne,v as Mt,w as Lt,x as Le,y as ke,z as kt}from"./chunks/chunk-ZMBOBHYL.js";import{command as $,node as Zi,Node2D as Ji,Rect as ve,easeOut as q,property as Y}from"@motionscript/core";import{formatNumber as Qi}from"@motionscript/core/component";import{Graphics2D as st,Node2D as Ni,command as Gi,easeOut as Dt,strokeOps as It,property as ce}from"@motionscript/core";import{Fills as Ci,fillOps as Ot,lerpNumber as Oi,strokeOps as Pt}from"@motionscript/core";var ae={left:0,right:0,bottom:0,top:0,xBounded:!1,yBounded:!1};function he(o){return o.right>o.left&&o.top>o.bottom}function Ze(o,e,t,i){if(!o||o.x===void 0&&o.y===void 0)return ae;let r=(c,[p,u],R,C)=>{if(c===void 0||u<=p)return[R,C,!1];let U=Math.min(c[0],c[1]),Li=Math.max(c[0],c[1]),Et=ki=>R+(ki-p)/(u-p)*(C-R);return[Math.max(R,Math.min(C,Et(U))),Math.max(R,Math.min(C,Et(Li))),!0]},[s,n,l]=r(o.x,t,e.left,e.right),[a,h,d]=r(o.y,i,e.bottom,e.top);return{left:s,right:n,bottom:a,top:h,xBounded:l,yBounded:d}}function Je(o,e){if(o.length<2||!he(e))return[];let t=[],i=[];for(let r=1;r<o.length;r++){let s=Fi(o[r-1],o[r],e);if(!s){i.length>=2&&t.push(i),i=[];continue}let[n,l]=s;i.length>0&&Pi(i[i.length-1],n)?i.push(l):(i.length>=2&&t.push(i),i=[n,l])}return i.length>=2&&t.push(i),t}function Pi(o,e){return Math.abs(o.x-e.x)<.5&&Math.abs(o.y-e.y)<.5}function Fi(o,e,t){let i=e.x-o.x,r=e.y-o.y,s=0,n=1,l=[[-i,o.x-t.left],[i,t.right-o.x],[-r,o.y-t.bottom],[r,t.top-o.y]];for(let[a,h]of l){if(a===0){if(h<0)return null;continue}let d=h/a;if(a<0){if(d>n)return null;d>s&&(s=d)}else{if(d<s)return null;d<n&&(n=d)}}return[{x:o.x+s*i,y:o.y+s*r},{x:o.x+n*i,y:o.y+n*r}]}var Di={...X,markerStyle:{...X.markerStyle,width:20,height:20,borderRadius:6}},J={seriesStyles:_t,xAxis:H,yAxis:Re,plotArea:Te,legend:Di,region:{stroke:{weight:3,fill:O.regionColor,dash:[14,12],cap:"butt"},fill:Ci.color(O.regionColor,{opacity:.08}),dimOpacity:P}};function Ii(o,e){return{stroke:Pt.resolve(o?.stroke??e.stroke),fill:Ot.resolve(o?.fill??e.fill),dimOpacity:o?.dimOpacity??e.dimOpacity}}function Bi(o,e,t){return{stroke:Pt.lerp(o.stroke,e.stroke,t),fill:Ot.lerp(o.fill,e.fill,t),dimOpacity:Oi(o.dimOpacity,e.dimOpacity,t)}}function Qe(o,e){let t=e??J;return{seriesStyles:Mt(o?.seriesStyles,t.seriesStyles),xAxis:se(o?.xAxis,t.xAxis),yAxis:se(o?.yAxis,t.yAxis),plotArea:_e(o?.plotArea,t.plotArea),legend:oe(o?.legend,t.legend),region:Ii(o?.region,t.region)}}function et(o,e,t){return{seriesStyles:Lt(o.seriesStyles,e.seriesStyles,t),xAxis:re(o.xAxis,e.xAxis,t),yAxis:re(o.yAxis,e.yAxis,t),plotArea:Me(o.plotArea,e.plotArea,t),legend:ne(o.legend,e.legend,t),region:Bi(o.region,e.region,t)}}function tt(o,e,t){return o.map((i,r)=>[e.at(r),E(i,t.field)]).sort((i,r)=>i[0]-r[0])}function Ft(o,e){let t=1/0,i=-1/0;for(let r of o)for(let s of e){let n=E(r,s.field);n<t&&(t=n),n>i&&(i=n)}return t<=i?[t,i]:[0,1]}function it(o,e,t,i){if(t)return t;let[r,s]=Ft(o,e),n=Math.max(1,Math.round(i)),l=Oe((s-r)/n||1);return[Math.floor(r/l)*l,Math.ceil(s/l)*l]}import{declarePaints as Ui}from"@motionscript/core/component";var Q=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_=class extends Ni{declareAssets(e){super.declareAssets(e),Ui(this,e)}renderSelf(e){if(!this.enabled)return;let t=this.points;if(t.length<2)return;let i=Math.max(0,Math.min(1,this.progress));if(i<=0)return;let r=this.tracePoints(t,i);if(r.length<2)return;let s=this.stroke,n=(s[0]?.weight??0)*2,l=this.spotlight;if(!he(l)){e.draw(new st().line({points:r,radius:n}).stroke(s));return}e.draw(new st().line({points:r,radius:n}).stroke(s).opacity(Math.max(0,Math.min(1,this.dimOpacity))));for(let a of Je(r,l))e.draw(new st().line({points:a,radius:n}).stroke(s))}tracePoints(e,t){if(t>=1||e.length<2)return e;if(t<=0)return[];let i=[],r=0;for(let l=1;l<e.length;l++){let a=Math.hypot(e[l].x-e[l-1].x,e[l].y-e[l-1].y);i.push(a),r+=a}if(r===0)return e;let s=r*t,n=[e[0]];for(let l=0;l<i.length;l++)if(s>=i[l])n.push(e[l+1]),s-=i[l];else{let a=i[l]===0?0:s/i[l];n.push({x:e[l].x+(e[l+1].x-e[l].x)*a,y:e[l].y+(e[l+1].y-e[l].y)*a});break}return n}enter(e){return this.enterFrom(0,e.duration,e.easing??Dt())}enterFrom(e,t,i=Dt(),r=1){return this.command(s=>{let n=e+(r-e)*s;return{progress:n,enabled:n>0}},t,i)}};Q([ce({default:()=>[]})],_.prototype,"points",void 0);Q([ce({default:[],mapper:It.resolve,tween:It.lerp})],_.prototype,"stroke",void 0);Q([ce({default:1})],_.prototype,"progress",void 0);Q([ce({default:!0})],_.prototype,"enabled",void 0);Q([ce({default:()=>ae})],_.prototype,"spotlight",void 0);Q([ce({default:P})],_.prototype,"dimOpacity",void 0);Q([Gi()],_.prototype,"enter",null);import{Graphics2D as Bt,Node2D as Hi,fillOps as Nt,strokeOps as Gt,property as Ne}from"@motionscript/core";import{declarePaints as Xi}from"@motionscript/core/component";var Be=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},j=class extends Hi{declareAssets(e){super.declareAssets(e),Xi(this,e)}renderSelf(e){let t=this.box;if(!he(t))return;let i=Math.max(0,Math.min(1,this.reveal));if(i<=0)return;let r=t.right-t.left,s=t.top-t.bottom,n=(t.left+t.right)/2,l=(t.bottom+t.top)/2;if(this.fill.length>0&&e.draw(new Bt().rect({x:n,y:l,width:r,height:s}).fill(this.fill).opacity(i)),this.stroke.length===0)return;let d=c=>e.draw(new Bt().line({points:c}).stroke(this.stroke).opacity(i));if(t.xBounded){let c=s/2*i;for(let p of[t.left,t.right])d([{x:p,y:l-c},{x:p,y:l+c}])}if(t.yBounded){let c=r/2*i;for(let p of[t.bottom,t.top])d([{x:n-c,y:p},{x:n+c,y:p}])}}};Be([Ne({default:()=>ae})],j.prototype,"box",void 0);Be([Ne({default:J.region.stroke,mapper:Gt.resolve,tween:Gt.lerp})],j.prototype,"stroke",void 0);Be([Ne({default:J.region.fill,mapper:Nt.resolve,tween:Nt.lerp})],j.prototype,"fill",void 0);Be([Ne({default:0})],j.prototype,"reveal",void 0);import{command as zi,Node2D as ji,Rect as Ut,Text as Ht,easeOut as Yi,property as Ge,insetsOps as Xt,textOps as zt}from"@motionscript/core";import{at as jt,compose as Yt}from"@motionscript/core/component";var xe=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Wt=24,D=class extends ji{labelFor=F;markerNodes=[];labelNode=null;get sortedMarkers(){return[...this.markers].sort((e,t)=>e-t)}valueAt(e){return this.sortedMarkers[e]}fracAt(e){let t=this.valueAt(e);if(t===void 0)return 0;let[i,r]=this.range;return r<=i?0:(t-i)/(r-i)}constructor(e){super(e);let t=Xt.resolve(this.axis.tickPadding).top,i=Xt.resolve(this.axis.titlePadding).top;this.markerNodes=this.markers.map((s,n)=>{let l=new Ht({...zt.styleProps(this.axis.labelStyle),text:()=>{let a=this.valueAt(n);return a===void 0?"":this.labelFor(a)},x:()=>{let a=this.layoutBounds.width,h=(this.fracAt(n)-.5)*a,d=a/2-l.layoutBounds.width/2;return Math.min(h,d)}});return l});let r=[new Ut({width:"fill",height:"hug",padding:{top:t},children:this.markerNodes})];this.label!==""&&(this.labelNode=new Ht({...zt.styleProps(this.axis.titleStyle),text:this.label}),r.push(this.labelNode)),this.add(new Ut({flow:"vertical",gap:i,height:"hug",width:"fill",children:r}))}arm(e=Wt){for(let t of this.markerNodes)t.set({opacity:0,y:e});this.labelNode?.set({opacity:0,y:e})}enter(e){let{stagger:t,slide:i=Wt}=e.data??{},r=e.duration,s=e.easing??Yi(),n=this.markerNodes;if(n.length===0)return Yt([]);let{step:l,per:a,caption:h}=Pe(r,n.length,this.labelNode!==null,t);this.arm(i);let d=n.map((p,u)=>jt(u*l,p.to({data:{opacity:1,y:0},duration:a,easing:s}))),c=n.length===0?0:(n.length-1)*l+a;return Yt([...d,...this.labelNode?[jt(c,this.labelNode.to({data:{opacity:1,y:0},duration:h,easing:s}))]:[]])}};xe([Ge({default:()=>[0,1]})],D.prototype,"range",void 0);xe([Ge({default:()=>[]})],D.prototype,"markers",void 0);xe([Ge({default:H})],D.prototype,"axis",void 0);xe([Ge({default:""})],D.prototype,"label",void 0);xe([zi()],D.prototype,"enter",null);import{formatNumber as Wi}from"@motionscript/core/component";var Ue=864e5,Zt=["january","february","march","april","may","june","july","august","september","october","november","december"],Vt=2024;function Kt(o){return o.length<3?-1:Zt.findIndex(e=>e.startsWith(o))}function Vi(o,e){let t=Date.UTC(o,0,4),i=(new Date(t).getUTCDay()+6)%7;return t-i*Ue+(e-1)*7*Ue}function Jt(o){if(typeof o!="string")return null;let e=o.trim().toLowerCase();if(e==="")return null;let t=/^(\d{4})[-/](\d{1,2})(?:[-/](\d{1,2}))?$/.exec(e);if(t){let n=Number(t[2]),l=t[3]===void 0?1:Number(t[3]);return n<1||n>12||l<1||l>31?null:Date.UTC(Number(t[1]),n-1,l)}let i=/^(?:(\d{4})[-\s]?)?w(?:ee)?k?[-\s]?(\d{1,2})$/.exec(e);if(i){let n=Number(i[2]);return n<1||n>53?null:Vi(i[1]===void 0?Vt:Number(i[1]),n)}let r=/^(?:(\d{4})[-\s]+)?([a-z]+)(?:[-\s]+(\d{4}))?$/.exec(e);if(r){let n=Kt(r[2]);if(n>=0){let l=r[1]??r[3],a=l===void 0?Vt:Number(l);return Date.UTC(a,n,1)}}let s=/^(?:(\d{1,2})[-\s]+([a-z]+)|([a-z]+)[-\s]+(\d{1,2}),?)[-\s]+(\d{4})$/.exec(e);if(s){let n=Kt(s[2]??s[3]),l=Number(s[1]??s[4]);if(n>=0&&l>=1&&l<=31)return Date.UTC(Number(s[5]),n,l)}return null}function Qt(o,e){let t=new Date(o),i=t.getUTCFullYear(),r=Zt[t.getUTCMonth()].slice(0,3),s=r.charAt(0).toUpperCase()+r.slice(1);return e>4*365*Ue?String(i):e>60*Ue?`${s} ${i}`:`${s} ${t.getUTCDate()}`}function Ki(o,e){let t=!1;for(let i of o){let r=i[e];if(!(r==null||r==="")){if(typeof r!="number")return!1;t=!0}}return t}function qi(o,e){let t=[],i=!1;for(let n of o){let l=n[e];if(l==null||l===""){t.push(null);continue}let a=Jt(l);if(a===null)return null;t.push(a),i=!0}if(!i)return null;let s=t.find(n=>n!==null);return t.map(n=>n===null?s:s=n)}function qt(o){let e=1/0,t=-1/0;for(let i of o)i<e&&(e=i),i>t&&(t=i);return e<=t?[e,t]:[0,1]}function $t(o,[e,t],i){let r=o.filter(a=>a>=e&&a<=t),s=[...new Set(r)].sort((a,h)=>a-h);if(s.length===0)return z([e,t],i);let n=a=>s.reduce((h,d)=>Math.abs(d-a)<Math.abs(h-a)?d:h),l=[];for(let a of z([e,t],i)){let h=n(a);l[l.length-1]!==h&&l.push(h)}return l}function $i(o,e,t,i){let r=o.indexOf(t);return r>=0?e[r]:i(t)}function rt(o,e,t){if(e!==""&&Ki(o,e)){let n=o.map(l=>E(l,e));return{kind:"numeric",at:l=>n[l]??0,extent:qt(n),label:l=>t===void 0?F(l):Wi(l,t),ticks:z}}let i=o.map(n=>ie(n,e)),r=e===""?null:qi(o,e);if(r){let n=qt(r),l=n[1]-n[0];return{kind:"time",at:a=>r[a]??0,extent:n,label:a=>$i(r,i,a,h=>Qt(h,l)),ticks:(a,h)=>$t(r,a,h)}}let s=o.map((n,l)=>l);return{kind:"ordinal",at:n=>n,extent:s.length>0?[0,s.length-1]:[0,1],label:n=>i[Math.round(n)]??"",ticks:(n,l)=>$t(s,n,l)}}import{hold as He,sequence as ei,together as be}from"@motionscript/core/component";var v=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},I,es=24,ot={key:"seriesIndex",kind:"series",default:0,min:0,step:1},ts=20,ti=.35,is=.5,ss=.15,g=class extends Ji{static{I=this}vAxis;hAxis;plotRect;legend=null;lines=[];get resolvedTheme(){return this.theme}static DEFAULT_MARKERS=5;get xColumn(){return rt(this.data,this.xField,this.xAxis.format)}get xScale(){return this.xAxis.range??this.xColumn.extent}get yScale(){let e=(this.yAxis.ticks?.length??I.DEFAULT_MARKERS)-1;return it(this.data,this.series,this.yAxis.range,e)}get resolvedYMarkers(){return this.yAxis.ticks??z(this.yScale,I.DEFAULT_MARKERS-1)}get resolvedXMarkers(){return this.xAxis.ticks??this.xColumn.ticks(this.xScale,I.DEFAULT_MARKERS-1)}plotSize(){let{width:e,height:t}=this.plotRect.layoutBounds;return{width:e,height:t}}seriesPixels(e){let t=this.series[e];if(!t)return[];let i=tt(this.data,this.xColumn,t);if(i.length===0)return[];let{width:r,height:s}=this.plotSize(),[n,l]=this.xScale,[a,h]=this.yScale,d=p=>l<=n?0:((p-n)/(l-n)-.5)*r,c=p=>h<=a?0:((p-a)/(h-a)-.5)*s;return i.map(([p,u])=>({x:d(p),y:c(u)}))}hasCallout(){let e=this.region;return e!=null&&(e.x!==void 0||e.y!==void 0)}regionBox(){let{width:e,height:t}=this.plotSize();return Ze(this.region,{left:-e/2,right:e/2,bottom:-t/2,top:t/2},this.xScale,this.yScale)}constructor(e){super(e);let t=this.series.map(n=>n.enabled??!0),i=this.showLegend!==!1;this.vAxis=new le({range:()=>this.yScale,markers:()=>this.resolvedYMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.yAxis.label??"",width:"hug",height:"fill"}),this.vAxis.labelFor=n=>this.yAxis.format===void 0?F(n):Qi(n,this.yAxis.format),this.hAxis=new D({range:()=>this.xScale,markers:()=>this.resolvedXMarkers,axis:()=>this.resolvedTheme.xAxis,label:this.xAxis.label??"",width:"fill",height:"hug"}),this.hAxis.labelFor=n=>this.xColumn.label(n),this.lines=this.series.map((n,l)=>new _({points:()=>this.seriesPixels(l),stroke:()=>kt(this.resolvedTheme.seriesStyles,n,l),enabled:t[l],spotlight:()=>this.regionBox(),dimOpacity:()=>1-(1-this.resolvedTheme.region.dimOpacity)*this.regionReveal})),i&&(this.legend=new Ie({series:this.series,swatches:()=>this.series.map((n,l)=>Ct(this.resolvedTheme.seriesStyles,n,l)),legend:()=>this.resolvedTheme.legend})),this.plotRect=new ve({clip:!0,children:[new De({fill:()=>this.resolvedTheme.plotArea.fill,shadow:()=>this.resolvedTheme.plotArea.shadow,xGridStroke:()=>this.resolvedTheme.xAxis.lineStyle,yGridStroke:()=>this.resolvedTheme.yAxis.lineStyle,xMarkers:()=>this.resolvedXMarkers,yMarkers:()=>this.resolvedYMarkers,xExtent:()=>this.xScale,yExtent:()=>this.yScale}),new j({box:()=>this.regionBox(),stroke:()=>this.resolvedTheme.region.stroke,fill:()=>this.resolvedTheme.region.fill,reveal:()=>this.regionReveal}),...this.lines,new Fe({stroke:()=>this.resolvedTheme.plotArea.stroke})]});let r=new le({opacity:0,range:()=>this.yScale,markers:()=>this.resolvedYMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.yAxis.label??"",width:"hug",height:0}),s=[this.hAxis];this.legend&&s.push(this.legend),this.add(new ve({flow:"vertical",width:"fill",height:"fill",padding:{top:es},children:[new ve({flow:"horizontal",height:"fill",width:"fill",children:[this.vAxis,this.plotRect]}),new ve({flow:"horizontal",width:"fill",children:[r,new ve({flow:"vertical",width:"fill",gap:20,children:s})]})]}))}arm(){this.vAxis.arm(),this.hAxis.arm();for(let e of this.lines)e.set({progress:0});this.legend?.set({opacity:0,y:-ts})}enter(e){let t=e.duration,i=e.easing??q();this.arm();let r=this.hasCallout()&&this.regionReveal===0,s=r?t*.75:t,n=be(this.vAxis.enter({data:{slide:24},duration:s*ti,easing:i}),this.hAxis.enter({data:{slide:24},duration:s*ti,easing:i})),l=be(...this.lines.map(d=>d.enter({duration:s*is,easing:i}))),a=this.legend?[this.legend.to({data:{opacity:1,y:0},duration:s*ss,easing:i})]:[],h=ei(n,l,...a);return r?ei(h,this.command(d=>({regionReveal:d}),t*.25,i)):h}spotlightRegion(e){let t=I.regionArg(e.data),i=e.duration??.5,r=e.easing??q(),s=this.regionReveal,n=this.region;return t.x===void 0&&t.y===void 0?this.clearRegion({duration:i,easing:r}):s<=0||!this.hasCallout()?this.command(l=>({region:t,regionReveal:s+(1-s)*l}),i,r):this.command(l=>l<.5?{region:n,regionReveal:s*(1-r(l*2))}:{region:t,regionReveal:r(l*2-1)},i)}clearRegion(e={}){let t=e.duration??.5,i=e.easing??q(),r=this.regionReveal;return r===0?this.command(()=>({region:null,regionReveal:0}),t):this.command(s=>s>=1?{region:null,regionReveal:0}:{regionReveal:r*(1-s)},t,i)}home=null;static regionArg(e){let t=e?.region;return t!=null&&typeof t=="object"?t:{}}static span([e,t]){return e<=t?[e,t]:[t,e]}static rescale(e,t){let i=I.span(e),r=Math.max(2,t.length);return{range:i,ticks:z(i,r-1)}}zoomTo(e){let t=I.regionArg(e.data),i=e.duration??.8,r=e.easing??q();if(!t.x&&!t.y)return He(i);this.home??={x:{label:this.xAxis.label,range:this.xScale,ticks:this.resolvedXMarkers},y:{label:this.yAxis.label,range:this.yScale,ticks:this.resolvedYMarkers}};let s={};return t.x&&(s.xAxis=I.rescale(t.x,this.resolvedXMarkers)),t.y&&(s.yAxis=I.rescale(t.y,this.resolvedYMarkers)),this.to({data:s,duration:i,easing:r})}resetZoom(e={}){let t=e.duration??.8,i=e.easing??q(),r=this.home;return r?(this.home=null,this.to({data:{xAxis:r.x,yAxis:r.y},duration:t,easing:i})):He(t)}showSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??q(),s=this.lines[t];return s?be(s.enterFrom(0,i,r),...this.legend?[this.legend.showSeries({data:{index:t},duration:i,easing:r})]:[]):He(i)}hideSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??q(),s=this.lines[t];return s?be(s.enterFrom(1,i,r,0),...this.legend?[this.legend.hideSeries({data:{index:t},duration:i,easing:r})]:[]):He(i)}spotlightSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??q();return be(...this.lines.map((s,n)=>s.to({data:{opacity:n===t?1:P},duration:i,easing:r})),...this.legend?[this.legend.spotlightSeries({data:{index:t},duration:i,easing:r})]:[])}};v([Y({default:()=>[],kind:"dataset"})],g.prototype,"data",void 0);v([Y({default:""})],g.prototype,"xField",void 0);v([Y({default:()=>[],kind:"series"})],g.prototype,"series",void 0);v([Y({default:{},mapper:ee,tween:te})],g.prototype,"xAxis",void 0);v([Y({default:{},mapper:ee,tween:te})],g.prototype,"yAxis",void 0);v([Y({default:J,mapper:Qe,tween:et})],g.prototype,"theme",void 0);v([Y({default:null})],g.prototype,"region",void 0);v([Y({default:0})],g.prototype,"regionReveal",void 0);v([Y({default:!0,animatable:!1})],g.prototype,"showLegend",void 0);v([$()],g.prototype,"enter",null);v([$({args:[{key:"region",kind:"region",properties:{x:{kind:"range",default:!0,defaultMin:0,defaultMax:100},y:{kind:"range",default:!1,defaultMin:0,defaultMax:100}}}]})],g.prototype,"spotlightRegion",null);v([$()],g.prototype,"clearRegion",null);v([$({args:[{key:"region",kind:"region",properties:{x:{kind:"range",default:!0,defaultMin:0,defaultMax:100},y:{kind:"range",default:!1,defaultMin:0,defaultMax:100}}}]})],g.prototype,"zoomTo",null);v([$()],g.prototype,"resetZoom",null);v([$({args:[ot]})],g.prototype,"showSeries",null);v([$({args:[ot]})],g.prototype,"hideSeries",null);v([$({args:[ot]})],g.prototype,"spotlightSeries",null);g=I=v([Zi({key:"lineChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:760,height:460}})],g);import{command as pe,node as As,Node2D as ws,Rect as Ae,easeOut as de,property as k}from"@motionscript/core";import{formatNumber as Rs}from"@motionscript/core/component";import{drive as fi,hold as gi,sequence as Ts,together as pt}from"@motionscript/core/component";import{command as rs,Node2D as os,Rect as nt,Text as ii,easeOut as ns,property as Xe,insetsOps as si,textOps as ri}from"@motionscript/core";import{at as oi,compose as ls,hold as as}from"@motionscript/core/component";var Se=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},ni=24,B=class extends os{captionNodes=[];labelNode=null;slotCenter(e){let t=this.categories.length;if(t<=0)return 0;let i=this.layoutBounds.width;return-i/2+i/t*(e+.5)}constructor(e){super(e);let t=si.resolve(this.axis.tickPadding).top,i=si.resolve(this.axis.titlePadding).top,r=this.categories.map((n,l)=>{let a=new ii({...ri.styleProps(this.axis.labelStyle),text:n});return this.captionNodes.push(a),new nt({width:"hug",height:"hug",flow:"freeform",opacity:()=>f(this.dims[l]??1),x:()=>this.slotCenter(l),children:[a]})}),s=[new nt({width:"fill",height:"hug",padding:{top:t},children:r})];this.label!==""&&(this.labelNode=new ii({...ri.styleProps(this.axis.titleStyle),text:this.label}),s.push(this.labelNode)),this.add(new nt({flow:"vertical",gap:i,height:"hug",width:"fill",children:s}))}arm(e=ni){for(let t of this.captionNodes)t.set({opacity:0,y:e});this.labelNode?.set({opacity:0,y:e})}enter(e){let{stagger:t,slide:i=ni}=e.data??{},r=e.easing??ns(),s=this.captionNodes;if(s.length===0)return as(e.duration);let{step:n,per:l,caption:a}=Pe(e.duration,s.length,this.labelNode!==null,t);this.arm(i);let h=(s.length-1)*n+l;return ls([...s.map((d,c)=>oi(c*n,d.to({data:{opacity:1,y:0},duration:l,easing:r}))),...this.labelNode?[oi(h,this.labelNode.to({data:{opacity:1,y:0},duration:a,easing:r}))]:[]])}};Se([Xe({default:()=>[]})],B.prototype,"categories",void 0);Se([Xe({default:H})],B.prototype,"axis",void 0);Se([Xe({default:""})],B.prototype,"label",void 0);Se([Xe({default:()=>[]})],B.prototype,"dims",void 0);Se([rs()],B.prototype,"enter",null);import{command as ps,Graphics2D as us,Node2D as fs,Text as gs,easeOut as ms,fillOps as di,shadowOps as pi,strokeOps as ui,property as L,textOps as ys}from"@motionscript/core";import{fillOps as hs,lerpNumber as ze,shadowOps as li,strokeOps as ai,textOps as hi}from"@motionscript/core";function je(o,e,t){let i=0;return e.map(r=>{let s=E(o,r.field);if(!t)return{from:0,to:s,value:s};let n=i;return i+=s,{from:n,to:i,value:s}})}function lt(o,e){let t=-1;for(let i=0;i<e.length;i++)E(o,e[i].field)!==0&&(t=i);return t}function at(o,e){return o.map(t=>ie(t,e))}function ci(o,e,t){let i=0,r=0;for(let s of o)for(let n of je(s,e,t))i=Math.min(i,n.from,n.to),r=Math.max(r,n.from,n.to);return i<r?[i,r]:[0,1]}function ht(o,e,t,i,r){if(i)return i;let[s,n]=ci(o,e,t),l=Math.max(1,Math.round(r)),a=Oe((n-s)/l||1);return[Math.floor(s/a)*a,Math.ceil(n/a)*a]}var W={seriesFills:Ee,bar:{cornerRadius:6,slotFill:.72,groupGap:6,stroke:[],shadow:[]},xAxis:{...H,labelStyle:{...H.labelStyle,fontWeight:600},tickPadding:16},yAxis:Re,plotArea:Te,legend:X,valueStyle:{fontSize:24,fontWeight:700,textAlign:"center",fill:O.markerColor},spotlight:{dimOpacity:P}};function cs(o,e){return{cornerRadius:o?.cornerRadius??e.cornerRadius,slotFill:o?.slotFill??e.slotFill,groupGap:o?.groupGap??e.groupGap,stroke:ai.resolve(o?.stroke??e.stroke),shadow:li.resolve(o?.shadow??e.shadow)}}function ds(o,e,t){return{cornerRadius:ze(o.cornerRadius,e.cornerRadius,t),slotFill:ze(o.slotFill,e.slotFill,t),groupGap:ze(o.groupGap,e.groupGap,t),stroke:ai.lerp(o.stroke,e.stroke,t),shadow:li.lerp(o.shadow,e.shadow,t)}}function ct(o,e){let t=e??W;return{seriesFills:Le(o?.seriesFills,t.seriesFills),bar:cs(o?.bar,t.bar),xAxis:se(o?.xAxis,t.xAxis),yAxis:se(o?.yAxis,t.yAxis),plotArea:_e(o?.plotArea,t.plotArea),legend:oe(o?.legend,t.legend),valueStyle:hi.resolveStyle(o?.valueStyle,t.valueStyle),spotlight:{dimOpacity:o?.spotlight?.dimOpacity??t.spotlight.dimOpacity}}}function dt(o,e,t){return{seriesFills:ke(o.seriesFills,e.seriesFills,t),bar:ds(o.bar,e.bar,t),xAxis:re(o.xAxis,e.xAxis,t),yAxis:re(o.yAxis,e.yAxis,t),plotArea:Me(o.plotArea,e.plotArea,t),legend:ne(o.legend,e.legend,t),valueStyle:hi.lerpStyle(o.valueStyle,e.valueStyle,t),spotlight:{dimOpacity:ze(o.spotlight.dimOpacity,e.spotlight.dimOpacity,t)}}}function Ye(o,e,t){return e.fill!=null?hs.resolve(e.fill):o.length===0?"white":o[t%o.length]}import{declarePaints as xs}from"@motionscript/core/component";var M=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},vs=10,bs=1.6,Ss=24,S=class extends fs{labelFor=F;constructor(e){if(super(e),!!this.showValues)for(let t=0;t<this.bars.length;t++)this.add(new gs({...ys.styleProps(this.valueStyle),text:()=>this.captionAt(t),x:()=>this.bars[t]?.x??0,y:()=>this.captionY(t),opacity:()=>this.dimAt(t)}))}dimAt(e){return this.enabled?f(this.dims[e]??1):0}endsAt(e){let t=this.bars[e];if(!t)return null;let i=f(this.growth),r=this.baseline+(t.from-this.baseline)*i,s=this.baseline+(t.to-this.baseline)*i;return{base:r,end:s}}get valueSize(){let e=this.valueStyle.fontSize;return typeof e=="number"?e:Ss}captionAt(e){let t=this.bars[e];if(!t||t.value===0)return"";if(this.insideAt(e)){let i=this.endsAt(e);if(!i||Math.abs(i.end-i.base)<this.valueSize*bs)return""}return this.labelFor(t.value)}insideAt(e){let t=this.bars[e];return t!==void 0&&Math.abs(t.from-this.baseline)>.5}captionY(e){let t=this.endsAt(e);if(!t)return 0;if(this.insideAt(e))return(t.base+t.end)/2;let i=t.end>=t.base?1:-1;return t.end+i*(vs+this.valueSize/2)}declareAssets(e){super.declareAssets(e),xs(this,e,{fills:this.barShadow.map(t=>t.fill),strokes:[this.barStroke]})}renderSelf(e){if(this.enabled)for(let t=0;t<this.bars.length;t++){let i=this.bars[t],r=this.endsAt(t);if(!r||i.width<=0)continue;let s=Math.abs(r.end-r.base);if(s<=0)continue;let n=i.round?Math.min(this.cornerRadius,s):0,l=new us,a=l.rect({x:i.x,y:(r.base+r.end)/2,width:i.width,height:s,cornerRadius:n>0?r.end>=r.base?{bottomLeft:n,bottomRight:n,topLeft:0,topRight:0}:{topLeft:n,topRight:n,bottomLeft:0,bottomRight:0}:0});a.shadow(this.barShadow),a.fill(this.fill),a.stroke(this.barStroke),e.draw(l.opacity(this.dimAt(t)))}}enter(e){return this.command(t=>({growth:t}),e.duration,e.easing??ms())}};M([L({default:()=>[]})],S.prototype,"bars",void 0);M([L({default:0})],S.prototype,"baseline",void 0);M([L({default:[],mapper:di.resolve,tween:di.lerp})],S.prototype,"fill",void 0);M([L({default:W.bar.stroke,mapper:ui.resolve,tween:ui.lerp})],S.prototype,"barStroke",void 0);M([L({default:W.bar.shadow,mapper:pi.resolve,tween:pi.lerp})],S.prototype,"barShadow",void 0);M([L({default:W.bar.cornerRadius})],S.prototype,"cornerRadius",void 0);M([L({default:1})],S.prototype,"growth",void 0);M([L({default:()=>[]})],S.prototype,"dims",void 0);M([L({default:!1})],S.prototype,"showValues",void 0);M([L({default:W.valueStyle})],S.prototype,"valueStyle",void 0);M([L({default:!0})],S.prototype,"enabled",void 0);M([ps()],S.prototype,"enter",null);var b=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},We,Es=64,_s=40,Ms=56,Ls=34,ks=30,Cs=24,Os=20,Ps=20,mi=.35,Fs=.5,Ds=.15,m=class extends ws{static{We=this}vAxis;cAxis;legend=null;barSets=[];get resolvedTheme(){return this.theme}static DEFAULT_MARKERS=5;get valueScale(){let e=(this.valueAxis.ticks?.length??We.DEFAULT_MARKERS)-1;return ht(this.data,this.series,this.stacked,this.valueAxis.range,e)}valueLabel(e){let t=this.valueAxis.format;return t===void 0?F(e):Rs(e,t)}get resolvedMarkers(){return this.valueAxis.ticks??z(this.valueScale,We.DEFAULT_MARKERS-1)}get hasValueLabel(){return this.valueAxis.label!==""}get hasCategoryLabel(){return this.categoryAxis.label!==""}get leftInset(){return Es+(this.hasValueLabel?Ls:0)}get bottomInset(){return _s+(this.hasCategoryLabel?ks:0)}plotBox(){let e=this.layoutBounds.width,t=this.layoutBounds.height,i=t/2,r=-t/2+(this.legend?Ms:0),s=-e/2+this.leftInset,n=e/2-Os,l=i-Cs,a=r+this.bottomInset;return{left:s,right:n,top:l,bottom:a}}plotSize(){let{left:e,right:t,top:i,bottom:r}=this.plotBox();return{w:t-e,h:i-r}}valueToY(e){let[t,i]=this.valueScale,{h:r}=this.plotSize();return i<=t?-r/2:((e-t)/(i-t)-.5)*r}get baselinePx(){let[e,t]=this.valueScale;return this.valueToY(Math.min(Math.max(0,e),t))}get slotWidth(){let e=this.data.length;return e>0?this.plotSize().w/e:0}slotCenter(e){return-this.plotSize().w/2+this.slotWidth*(e+.5)}get slotInner(){return this.slotWidth*f(this.resolvedTheme.bar.slotFill)}weightAt(e){return Math.max(0,this.weights[e]??1)}get totalWeight(){let e=0;for(let t=0;t<this.series.length;t++)e+=this.weightAt(t);return e>0?e:1}weightBefore(e){let t=0;for(let i=0;i<e;i++)t+=this.weightAt(i);return t}seriesBars(e){let t=this.series[e];if(!t)return[];let i=this.stacked,r=this.slotInner,s=this.resolvedTheme.bar.groupGap,n=r/this.totalWeight,l=this.weightAt(e);return this.data.map((a,h)=>{let c=je(i?this.weightedRow(a):a,this.series,i)[e]??{from:0,to:0,value:0},p=i?lt(a,this.series):e,u=this.slotCenter(h)-r/2,R=i?this.slotCenter(h):u+n*this.weightBefore(e)+n*l/2,C=i?r:Math.max(0,n*l-(this.series.length>1?s:0));return{x:R,width:C,from:this.valueToY(c.from),to:this.valueToY(c.to),round:p===e,value:E(a,t.field)}})}weightedRow(e){let t={...e};return this.series.forEach((i,r)=>{let s=e[i.field];typeof s=="number"&&(t[i.field]=s*this.weightAt(r))}),t}categoryDims(){let e=f(this.spotlightReveal),t=this.resolvedTheme.spotlight.dimOpacity,i=this.spotlight;return this.data.map((r,s)=>e<=0||i===s?1:1-(1-t)*e)}constructor(e){super(e);let t=this.series.map(a=>a.enabled??!0);this.weights=t.map(a=>a?1:0);let i=e?.showLegend!==!1,r=e?.showValues===!0;this.vAxis=new le({range:()=>this.valueScale,markers:()=>this.resolvedMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.valueAxis.label??"",width:"hug",height:"fill"}),this.vAxis.labelFor=a=>this.valueLabel(a),this.cAxis=new B({categories:at(this.data,this.categoryField),axis:()=>this.resolvedTheme.xAxis,label:this.categoryAxis.label??"",dims:()=>this.categoryDims(),width:"fill",height:"hug"}),this.barSets=this.series.map((a,h)=>new S({bars:()=>this.seriesBars(h),baseline:()=>this.baselinePx,fill:()=>Ye(this.resolvedTheme.seriesFills,a,h),barStroke:()=>this.resolvedTheme.bar.stroke,barShadow:()=>this.resolvedTheme.bar.shadow,cornerRadius:()=>this.resolvedTheme.bar.cornerRadius,growth:()=>this.growth,dims:()=>this.categoryDims(),showValues:r,valueStyle:this.resolvedTheme.valueStyle,enabled:t[h]}));for(let a of this.barSets)a.labelFor=h=>this.valueLabel(h);i&&(this.legend=new Ie({series:this.series,swatches:()=>this.series.map((a,h)=>Ye(this.resolvedTheme.seriesFills,a,h)),legend:()=>this.resolvedTheme.legend}));let s=new Ae({clip:!0,children:[new De({fill:()=>this.resolvedTheme.plotArea.fill,shadow:()=>this.resolvedTheme.plotArea.shadow,xGridStroke:()=>this.resolvedTheme.xAxis.lineStyle,yGridStroke:()=>this.resolvedTheme.yAxis.lineStyle,xMarkers:[],yMarkers:()=>this.resolvedMarkers,xExtent:()=>[0,1],yExtent:()=>this.valueScale}),...this.barSets,new Fe({stroke:()=>this.resolvedTheme.plotArea.stroke})]}),n=new le({opacity:0,range:()=>this.valueScale,markers:()=>this.resolvedMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.valueAxis.label??"",width:"hug",height:0}),l=[this.cAxis];this.legend&&l.push(this.legend),this.add(new Ae({flow:"vertical",width:"fill",height:"fill",children:[new Ae({flow:"horizontal",height:"fill",width:"fill",children:[this.vAxis,s]}),new Ae({flow:"horizontal",width:"fill",children:[n,new Ae({flow:"vertical",width:"fill",gap:20,children:l})]})]}))}arm(){this.vAxis.arm(),this.cAxis.arm(),this.growth=0,this.legend?.set({opacity:0,y:-Ps})}enter(e){let{duration:t}=e,i=e.easing??de();return this.arm(),Ts(pt(this.vAxis.enter({data:{slide:24},duration:t*mi,easing:i}),this.cAxis.enter({data:{slide:24},duration:t*mi,easing:i})),this.riseBars(t*Fs,i),...this.legend?[this.legend.to({data:{opacity:1,y:0},duration:t*Ds,easing:i})]:[])}riseBars(e,t){return this.command(i=>({growth:i}),e,t)}showSeries(e){let{seriesIndex:t=0}=e.data??{};return this.toggleSeries(t,1,e.duration??.35,e.easing??de())}hideSeries(e){let{seriesIndex:t=0}=e.data??{};return this.toggleSeries(t,0,e.duration??.35,e.easing??de())}toggleSeries(e,t,i,r){let s=this.barSets[e];return s?pt(this.tweenWeight(e,t,i,r),fi(i,n=>{let l=n>=1?t:Math.max(t,1-n);s.set({enabled:t>0||l>0})}),...this.legend?[t>0?this.legend.showSeries({data:{index:e},duration:i,easing:r}):this.legend.hideSeries({data:{index:e},duration:i,easing:r})]:[]):gi(i)}spotlightSeries(e){let{seriesIndex:t=0}=e.data??{},i=e.duration??.35,r=e.easing??de(),s=this.resolvedTheme.spotlight.dimOpacity;return pt(...this.barSets.map((n,l)=>n.to({data:{opacity:l===t?1:s},duration:i,easing:r})),...this.legend?[this.legend.spotlightSeries({data:{index:t},duration:i,easing:r})]:[])}tweenWeight(e,t,i,r){let s=this.series.map((l,a)=>this.weightAt(a)),n=s[e]??1;return n===t?gi(i):fi(i,l=>{let a=[...s];a[e]=n+(t-n)*r(l),this.weights=a})}spotlightCategory(e){let{categoryIndex:t=0}=e.data??{},i=e.duration??.4,r=e.easing??de();if(t<0||t>=this.data.length)return this.holdSpotlight(i);let s=this.spotlightReveal;return this.command(n=>({spotlight:t,spotlightReveal:s+(1-s)*n}),i,r)}clearCategory(e){let t=e.duration??.4,i=e.easing??de(),r=this.spotlightReveal;return r===0?this.holdSpotlight(t):this.command(s=>s>=1?{spotlight:null,spotlightReveal:0}:{spotlightReveal:r*(1-s)},t,i)}holdSpotlight(e){return this.command(()=>({}),e)}};b([k({default:()=>[]})],m.prototype,"data",void 0);b([k({default:""})],m.prototype,"categoryField",void 0);b([k({default:()=>[]})],m.prototype,"series",void 0);b([k({default:!1})],m.prototype,"stacked",void 0);b([k({default:{},mapper:ee,tween:te})],m.prototype,"valueAxis",void 0);b([k({default:{},mapper:ee,tween:te})],m.prototype,"categoryAxis",void 0);b([k({default:W,mapper:ct,tween:dt})],m.prototype,"theme",void 0);b([k({default:1})],m.prototype,"growth",void 0);b([k({default:()=>[]})],m.prototype,"weights",void 0);b([k({default:null})],m.prototype,"spotlight",void 0);b([k({default:0})],m.prototype,"spotlightReveal",void 0);b([pe()],m.prototype,"enter",null);b([pe({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],m.prototype,"showSeries",null);b([pe({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],m.prototype,"hideSeries",null);b([pe({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],m.prototype,"spotlightSeries",null);b([pe({args:[{key:"categoryIndex",kind:"number",default:0,min:0,step:1}]})],m.prototype,"spotlightCategory",null);b([pe()],m.prototype,"clearCategory",null);m=We=b([As({key:"barChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:760,height:460}})],m);import{Rect as cr,command as ye,node as dr,Node2D as pr,easeOut as me,property as G}from"@motionscript/core";import{command as Is,Rect as Ve,Text as Bs,easeOut as Ns,property as ut,textOps as Gs}from"@motionscript/core";import{at as Us,compose as Hs,hold as Xs}from"@motionscript/core/component";var Ke=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},zs=16,V=class extends Ve{items=[];constructor(e){super({...e,flow:"vertical",align:"centerLeft",width:"hug",height:"hug"}),this.set({gap:this.legend.itemGap/3,padding:this.legend.padding});for(let t=0;t<this.slices.length;t++){let i=this.buildItem(this.slices[t]);this.items.push(i),this.add(new Ve({width:"hug",height:"hug",flow:"freeform",opacity:()=>f(this.dims[t]??1),children:[i]}))}}buildItem(e){let t=this.legend.markerStyle;return new Ve({flow:"horizontal",gap:12,align:"center",width:"hug",height:"hug",children:[new Ve({width:t.height,height:t.height,cornerRadius:t.borderRadius,fill:e.fill,stroke:t.stroke,shadow:t.shadow}),new Bs({...Gs.styleProps(this.legend.textStyle),text:e.category})]})}arm(e=zs){for(let t of this.items)t.set({opacity:0,x:e})}enter(e){let t=e.duration,i=e.easing??Ns(),r=this.items;if(r.length===0)return Xs(t);this.arm();let s=t/(1+Math.max(0,r.length-1)/5),n=s/5;return Hs(r.map((l,a)=>Us(a*n,l.to({data:{opacity:1,x:0},duration:s,easing:i}))))}};Ke([ut({default:()=>[]})],V.prototype,"slices",void 0);Ke([ut({default:X})],V.prototype,"legend",void 0);Ke([ut({default:()=>[]})],V.prototype,"dims",void 0);Ke([Is()],V.prototype,"enter",null);import{Rect as bt,command as Rt,Graphics2D as vi,Node2D as Zs,PathBuilder as Js,Text as fe,easeOut as St,fillOps as Qs,property as T,strokeOps as er,textOps as ge}from"@motionscript/core";import{lerpNumber as we,shadowOps as yi,strokeOps as qe,textOps as N}from"@motionscript/core";function gt(o,e,t,i){return o.map((r,s)=>({category:ie(r,e),value:E(r,t),fill:i.length>0?i[s%i.length]:"white"}))}var js=Math.PI/180;function mt(o){return o.value>0&&Number.isFinite(o.value)?o.value:0}function xi(o){let e=0;for(let t of o)e+=mt(t);return e}function ue(o,e){return{x:o*Math.sin(e),y:o*Math.cos(e)}}function yt(o,e){let t=xi(o);if(t<=0)return[];let i=[],r=e*js;return o.forEach((s,n)=>{let l=mt(s);if(l<=0)return;let a=l/t,h=r,d=h+a*Math.PI*2;r=d,i.push({index:n,a0:h,a1:d,mid:(h+d)/2,fraction:a})}),i}function $e(o,e,t,i){o.sort((n,l)=>l.ideal-n.ideal);let r=t;for(let n of o)n.y=Math.min(n.ideal,r),r=n.y-e;let s=i;for(let n=o.length-1;n>=0;n--)o[n].y=Math.max(o[n].y,s),s=o[n].y+e;return o}var ft={fontSize:26,fontWeight:600,textAlign:"center",fill:O.markerColor},K={sliceFills:Ee,ring:{gap:6,holeRadius:.6,startAngle:0,selectedGrow:1.08,stroke:[],shadow:[]},label:{textStyle:ft,percentStyle:{...ft,fontWeight:700},insideStyle:{...ft,fontWeight:800,fill:"#15130e"},leaderStroke:{weight:2,fill:O.markerColor}},center:{labelStyle:{fontSize:46,fontWeight:800,textAlign:"center",fill:O.markerColor},captionStyle:{fontSize:22,fontWeight:500,textAlign:"center",fill:O.markerColor}},legend:X,spotlight:{dimOpacity:P}};function Ys(o,e){return{gap:o?.gap??e.gap,holeRadius:o?.holeRadius??e.holeRadius,startAngle:o?.startAngle??e.startAngle,selectedGrow:o?.selectedGrow??e.selectedGrow,stroke:qe.resolve(o?.stroke??e.stroke),shadow:yi.resolve(o?.shadow??e.shadow)}}function Ws(o,e,t){return{gap:we(o.gap,e.gap,t),holeRadius:we(o.holeRadius,e.holeRadius,t),startAngle:we(o.startAngle,e.startAngle,t),selectedGrow:we(o.selectedGrow,e.selectedGrow,t),stroke:qe.lerp(o.stroke,e.stroke,t),shadow:yi.lerp(o.shadow,e.shadow,t)}}function Vs(o,e){return{textStyle:N.resolveStyle(o?.textStyle,e.textStyle),percentStyle:N.resolveStyle(o?.percentStyle,e.percentStyle),insideStyle:N.resolveStyle(o?.insideStyle,e.insideStyle),leaderStroke:qe.resolve(o?.leaderStroke??e.leaderStroke)}}function Ks(o,e,t){return{textStyle:N.lerpStyle(o.textStyle,e.textStyle,t),percentStyle:N.lerpStyle(o.percentStyle,e.percentStyle,t),insideStyle:N.lerpStyle(o.insideStyle,e.insideStyle,t),leaderStroke:qe.lerp(o.leaderStroke,e.leaderStroke,t)}}function qs(o,e){return{labelStyle:N.resolveStyle(o?.labelStyle,e.labelStyle),captionStyle:N.resolveStyle(o?.captionStyle,e.captionStyle)}}function $s(o,e,t){return{labelStyle:N.lerpStyle(o.labelStyle,e.labelStyle,t),captionStyle:N.lerpStyle(o.captionStyle,e.captionStyle,t)}}function xt(o,e){let t=e??K;return{sliceFills:Le(o?.sliceFills,t.sliceFills),ring:Ys(o?.ring,t.ring),label:Vs(o?.label,t.label),center:qs(o?.center,t.center),legend:oe(o?.legend,t.legend),spotlight:{dimOpacity:o?.spotlight?.dimOpacity??t.spotlight.dimOpacity}}}function vt(o,e,t){return{sliceFills:ke(o.sliceFills,e.sliceFills,t),ring:Ws(o.ring,e.ring,t),label:Ks(o.label,e.label,t),center:$s(o.center,e.center,t),legend:ne(o.legend,e.legend,t),spotlight:{dimOpacity:we(o.spotlight.dimOpacity,e.spotlight.dimOpacity,t)}}}import{declarePaints as tr}from"@motionscript/core/component";var w=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},bi=12,ir=14,At=.62,sr=6,Si=34,Ai=26,wi=8,rr=.18,or=240,nr=8,Ri=2,Ti=.44,wt=.62,lr=.78,ar=.9,Ei=.001,_i=26;function Z(o,e=_i){let t=o.fontSize;return typeof t=="number"?t:e}function hr(o,e,t,i,r,s){let n=new Js,l=e-o,a=Math.max(2,Math.ceil(Math.abs(l)/(Math.PI*2)*or)),h=c=>c<=0?0:Math.min(r/c,l/2.2),d=(c,p)=>{let u=h(c),R=o+u,C=e-u,U=ue(c,R+(C-R)*p/a);return{x:U.x+s,y:U.y}};if(t<=0){n.moveTo(s,0);for(let c=0;c<=a;c++){let p=d(i,c);n.lineTo(p.x,p.y)}return n.close(),n}for(let c=0;c<=a;c++){let p=d(i,c);c===0?n.moveTo(p.x,p.y):n.lineTo(p.x,p.y)}for(let c=a;c>=0;c--){let p=d(t,c);n.lineTo(p.x,p.y)}return n.close(),n}var y=class extends Zs{fills=[];constructor(e){if(super(e),this.fills=this.slices.map(t=>Qs.resolve(t.fill)),this.labelPlacement!=="none"&&this.labelMode!=="none")for(let t of this.arcs)this.addLabel(t);this.hasCenterLabel&&this.addCenterLabel()}addLabel(e){let t=this.slices[e.index],i=()=>f(this.labelReveal)*this.sliceOpacity(e.index),r=this.labelMode==="both"||this.labelMode==="category",s=this.labelMode==="both"||this.labelMode==="percent";if(this.labelPlacement==="inside"){let h=[];s&&h.push(new fe({...ge.styleProps(this.label.insideStyle),text:Ce(e.fraction),fontSize:()=>this.insideFont})),r&&h.push(new fe({...ge.styleProps(this.label.insideStyle),text:t.category,fontSize:()=>this.labelMode==="category"?this.insideFont:this.insideFont*Ti})),this.add(new bt({flow:"vertical",width:"hug",height:"hug",gap:0,align:"center",opacity:i,center:()=>this.insideAnchor(e.index),children:h}));return}let n=this.sideOf(e.mid),l=()=>this.placementFor(e.index)?.text??{x:0,y:0},a=[];r&&a.push(new fe({...ge.styleProps(this.label.textStyle),text:t.category,textAlign:n>0?"left":"right"})),s&&a.push(new fe({...ge.styleProps(this.label.percentStyle),text:Ce(e.fraction),textAlign:n>0?"left":"right"})),this.add(new bt({flow:"vertical",width:"hug",height:"hug",gap:2,align:n>0?"centerLeft":"centerRight",opacity:i,centerLeft:n>0?l:void 0,centerRight:n>0?void 0:l,children:a}))}addCenterLabel(){let e=[];this.centerLabel!==""&&e.push(new fe({...ge.styleProps(this.centerStyle.labelStyle),text:this.centerLabel,fontSize:()=>this.centerFont})),this.centerCaption!==""&&e.push(new fe({...ge.styleProps(this.centerStyle.captionStyle),text:this.centerCaption,fontSize:()=>this.centerFont*(Z(this.centerStyle.captionStyle,22)/Z(this.centerStyle.labelStyle,46))})),this.add(new bt({flow:"vertical",width:"hug",height:"hug",gap:2,align:"center",opacity:()=>f(this.centerReveal),center:()=>({x:this.centerX,y:0}),children:e}))}get arcs(){return yt(this.slices,this.ring.startAngle)}sideOf(e){return Math.sin(e)>=0?1:-1}get hasLeaderLabels(){return this.labelPlacement==="leader"&&this.labelMode!=="none"&&this.arcs.length>0}insideRoom(e){let t=this.outerRadius,i=this.holeRadius,r=i>0?t-i:t*(1-wt)*2,s=i>0?(i+t)/2:t*wt,n=Math.abs(Math.sin(e.mid)),l=Math.abs(Math.cos(e.mid)),a=n>Ei?r/n:1/0,h=l>Ei?(e.a1-e.a0)*s/l:1/0;return Math.max(0,Math.min(a,h))}insideGlyphs(e){let t=this.slices[e.index]?.category.length??0,i=this.labelMode==="both"||this.labelMode==="percent"?Ce(e.fraction).length:0,r=this.labelMode==="category"?t:this.labelMode==="both"?t*Ti:0;return Math.max(1,i,r)}get insideFont(){let e=Z(this.label.insideStyle,_i*1.9);for(let t of this.arcs){let i=this.insideRoom(t)*ar/(this.insideGlyphs(t)*At);e=Math.min(e,i)}return Math.max(1,e)}get hasCenterLabel(){return this.centerLabel!==""||this.centerCaption!==""}get centerFont(){let e=Z(this.centerStyle.labelStyle,46),t=this.holeRadius;if(t<=0)return e;let i=Z(this.centerStyle.captionStyle,22)/Math.max(1,e),r=Math.max(1,this.centerLabel.length,this.centerCaption.length*i);return Math.min(e,t*2*lr/(r*At))}get growFactor(){return Math.max(1,Math.min(1.6,this.ring.selectedGrow))}get maxPop(){return this.outerRadius*(this.growFactor-1)}get labelRowHeight(){if(!this.hasLeaderLabels)return 0;let e=Z(this.label.textStyle)*1.25,t=Z(this.label.percentStyle)*1.25;return this.labelMode==="both"?e+t+2:this.labelMode==="category"?e:t}captionGlyphs(e){let t=this.labelMode==="percent"||this.labelMode==="both"?4:0,i=this.labelMode==="category"||this.labelMode==="both"?this.slices[e]?.category.length??0:0;return Math.max(t,i)}get labelGutters(){let e={left:Ri,right:Ri};if(!this.hasLeaderLabels)return e;let t=Z(this.label.textStyle)*At;for(let i of this.arcs){let r=Si+Ai+wi+this.captionGlyphs(i.index)*t+ir,s=this.sideOf(i.mid)>0?"right":"left";e[s]=Math.max(e[s],r)}return e}get centerX(){let{left:e,right:t}=this.labelGutters;return(e-t)/2}get outerRadius(){let{left:e,right:t}=this.labelGutters,i=Math.min((this.layoutBounds.width-e-t)/2,this.layoutBounds.height/2-this.labelRowHeight-4);return Math.max(0,i/this.growFactor)}get holeRadius(){let e=this.ring.holeRadius;if(e<=0)return 0;let t=e<1?e*this.outerRadius:e;return Math.min(t,this.outerRadius*.95)}get elbowRadius(){return this.outerRadius+this.maxPop+Si}popOf(e){return f(this.pops[e]??0)}anchorRadius(e){return this.outerRadius+this.maxPop*this.popOf(e)}bandMidRadius(e){let t=this.anchorRadius(e),i=this.holeRadius;return i>0?(i+t)/2:t*wt}insideAnchor(e){let t=this.arcs.find(r=>r.index===e);if(t===void 0)return{x:this.centerX,y:0};let i=ue(this.bandMidRadius(e),t.mid);return{x:i.x+this.centerX,y:i.y}}get selectionStrength(){let e=0;for(let t=0;t<this.slices.length;t++)e=Math.max(e,this.popOf(t));return e}sliceOpacity(e){let t=this.selectionStrength;return t<=0?1:1-(1-f(this.dimOpacity))*t*(1-this.popOf(e))}placements(){if(!this.hasLeaderLabels)return[];let e=this.arcs;if(e.length===0||this.outerRadius<=0)return[];let t=this.elbowRadius,i=this.labelRowHeight,r=this.layoutBounds.height/2-i/2,s=-r,n=this.centerX,l=[],a=[];for(let h of e){let d=this.sideOf(h.mid),c=ue(t,h.mid).y;(d>0?l:a).push({index:h.index,side:d,mid:h.mid,ideal:c,y:c})}return $e(l,i+bi,r,s),$e(a,i+bi,r,s),[...l,...a].map(h=>{let d=ue(this.anchorRadius(h.index)+sr,h.mid),c=Math.sqrt(Math.max(0,t*t-h.y*h.y)),p=n+h.side*Math.max(c,t*rr),u=n+h.side*(t+Ai);return{index:h.index,side:h.side,leader:[{x:d.x+n,y:d.y},{x:p,y:h.y},{x:u,y:h.y}],text:{x:u+h.side*wi,y:h.y}}})}placementFor(e){return this.placements().find(t=>t.index===e)}declareAssets(e){super.declareAssets(e),tr(this,e,{fills:this.fills,strokes:[er.resolve(this.label.leaderStroke)]})}renderSelf(e){let t=this.outerRadius;if(t<=0)return;let i=this.arcs;if(i.length===0)return;let r=f(this.growth),s=this.ring.startAngle*(Math.PI/180)+Math.PI*2*r,n=this.holeRadius,l=Math.max(0,this.ring.gap)/2,a=this.centerX,h=t+this.maxPop+1+Math.abs(a),d=[-h,-h,h,h],c=h*2;for(let u of i){let R=Math.min(u.a1,s);if(R<=u.a0)continue;let C=hr(u.a0,R,n,this.anchorRadius(u.index),l,a),U=new vi().path(C.toPathState({centerBounds:d,width:c,height:c}));U.shadow(this.ring.shadow),U.fill(this.fills[u.index]??[]),U.stroke(this.ring.stroke),e.draw(U.opacity(this.sliceOpacity(u.index)))}let p=f(this.labelReveal);if(!(p<=.001))for(let u of this.placements())e.draw(new vi().line({points:u.leader,radius:nr}).stroke(this.label.leaderStroke).opacity(p*this.sliceOpacity(u.index)))}sweep(e){return this.command(t=>({growth:t}),e.duration,e.easing??St())}revealLabels(e){return this.command(t=>({labelReveal:t}),e.duration,e.easing??St())}revealCenter(e={}){let t=f(this.centerReveal);return this.command(i=>({centerReveal:t+(1-t)*i}),e.duration??.6,e.easing??St())}};w([T({default:()=>[]})],y.prototype,"slices",void 0);w([T({default:K.ring})],y.prototype,"ring",void 0);w([T({default:K.label})],y.prototype,"label",void 0);w([T({default:K.center})],y.prototype,"centerStyle",void 0);w([T({default:"percent"})],y.prototype,"labelMode",void 0);w([T({default:"leader"})],y.prototype,"labelPlacement",void 0);w([T({default:1})],y.prototype,"growth",void 0);w([T({default:1})],y.prototype,"labelReveal",void 0);w([T({default:()=>[]})],y.prototype,"pops",void 0);w([T({default:K.spotlight.dimOpacity})],y.prototype,"dimOpacity",void 0);w([T({default:""})],y.prototype,"centerLabel",void 0);w([T({default:""})],y.prototype,"centerCaption",void 0);w([T({default:1})],y.prototype,"centerReveal",void 0);w([Rt()],y.prototype,"sweep",null);w([Rt()],y.prototype,"revealLabels",null);w([Rt()],y.prototype,"revealCenter",null);import{drive as ur,hold as Mi,sequence as fr,together as gr}from"@motionscript/core/component";var A=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},mr=.65,Tt=.35,x=class extends pr{ring;legend=null;get resolvedTheme(){return this.theme}get slices(){return gt(this.data,this.categoryField,this.valueField,this.resolvedTheme.sliceFills)}sliceDims(){let e=0;for(let i=0;i<this.data.length;i++)e=Math.max(e,this.popAt(i));let t=this.resolvedTheme.spotlight.dimOpacity;return e<=0?this.data.map(()=>1):this.data.map((i,r)=>1-(1-f(t))*e*(1-this.popAt(r)))}popAt(e){return f(this.pops[e]??0)}constructor(e){super(e);let t=this.slices,i=e?.showLegend!==!1;this.pops=t.map(()=>0),this.ring=new y({width:"fill",height:"fill",slices:t,ring:()=>this.resolvedTheme.ring,label:()=>this.resolvedTheme.label,centerStyle:()=>this.resolvedTheme.center,labelMode:this.labelMode,labelPlacement:this.labelPlacement,pops:()=>this.pops,dimOpacity:()=>this.resolvedTheme.spotlight.dimOpacity,centerLabel:this.centerLabel,centerCaption:this.centerCaption,centerReveal:e?.showCenter===!1?0:1});let r=[this.ring];i&&(this.legend=new V({slices:t,legend:()=>this.resolvedTheme.legend,dims:()=>this.sliceDims()}),r.push(this.legend)),this.add(new cr({flow:"horizontal",width:"fill",height:"fill",gap:this.gap,align:"center",children:r}))}arm(){this.ring.set({growth:0,labelReveal:0}),this.legend?.arm()}enter(e){let t=e.duration,i=e.easing??me();return this.arm(),fr(this.ring.sweep({duration:t*mr,easing:i}),gr(this.ring.revealLabels({duration:t*Tt,easing:i}),this.legend?this.legend.enter({duration:t*Tt,easing:i}):Mi(t*Tt)))}revealCenter(e={}){return this.ring.revealCenter({duration:e.duration??.6,easing:e.easing??me()})}isSelected(e){return this.popAt(e)>.5}selectSlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??me();return this.tweenPops(s=>s===t?1:this.popAt(s),i,r)}deselectSlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??me();return this.tweenPops(s=>s===t?0:this.popAt(s),i,r)}selectOnlySlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??me();return this.tweenPops(s=>s===t?1:0,i,r)}clearSelection(e={}){let t=e.duration??.45,i=e.easing??me();return this.tweenPops(()=>0,t,i)}tweenPops(e,t,i){let r=this.data.map((n,l)=>this.popAt(l)),s=this.data.map((n,l)=>f(e(l)));return r.every((n,l)=>n===s[l])?Mi(t):ur(t,n=>{let l=i(n);this.pops=r.map((a,h)=>a+(s[h]-a)*l)})}};A([G({default:()=>[]})],x.prototype,"data",void 0);A([G({default:""})],x.prototype,"categoryField",void 0);A([G({default:""})],x.prototype,"valueField",void 0);A([G({default:K,mapper:xt,tween:vt})],x.prototype,"theme",void 0);A([G({default:"percent"})],x.prototype,"labelMode",void 0);A([G({default:"leader"})],x.prototype,"labelPlacement",void 0);A([G({default:40})],x.prototype,"gap",void 0);A([G({default:""})],x.prototype,"centerLabel",void 0);A([G({default:""})],x.prototype,"centerCaption",void 0);A([G({default:()=>[]})],x.prototype,"pops",void 0);A([ye()],x.prototype,"enter",null);A([ye()],x.prototype,"revealCenter",null);A([ye({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],x.prototype,"selectSlice",null);A([ye({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],x.prototype,"deselectSlice",null);A([ye({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],x.prototype,"selectOnlySlice",null);A([ye()],x.prototype,"clearSelection",null);x=A([dr({key:"pieChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:680,height:480}})],x);var yr=[g,m,x];export{m as BarChart,O as CHART_PALETTE,B as CategoryAxis,S as ChartBars,Fe as ChartBorder,De as ChartCanvas,Ie as ChartLegend,_ as ChartLine,j as ChartRegion,W as DEFAULT_BAR_CHART_THEME,J as DEFAULT_CHART_THEME,X as DEFAULT_LEGEND,K as DEFAULT_PIE_CHART_THEME,Te as DEFAULT_PLOT_AREA,xr as DEFAULT_SERIES_COLORS,Ee as DEFAULT_SERIES_FILLS,_t as DEFAULT_SERIES_STROKES,H as DEFAULT_X_AXIS,Re as DEFAULT_Y_AXIS,ae as EMPTY_REGION_BOX,D as HorizontalAxis,g as LineChart,yr as NODES,x as PieChart,V as PieLegend,y as PieRing,P as SPOTLIGHT_DIM,le as VerticalAxis,at as barCategories,je as barSpans,ci as barValueExtent,f as clampUnit,Je as clipPolylineToBox,Pe as enterBudget,Qt as formatInstant,F as formatMarker,Ce as formatPercent,he as hasRegion,re as lerpAxisConfig,te as lerpAxisDomain,dt as lerpBarChartTheme,et as lerpChartTheme,ne as lerpLegendConfig,vt as lerpPieChartTheme,Me as lerpPlotArea,ke as lerpSeriesFills,Lt as lerpSeriesStrokes,z as markerValues,Oe as niceStep,E as num,vr as numericFields,Jt as parseInstant,yt as pieArcs,$e as relaxLabels,se as resolveAxisConfig,ee as resolveAxisDomain,ct as resolveBarChartTheme,Ye as resolveBarFill,ht as resolveBarScale,Qe as resolveChartTheme,oe as resolveLegendConfig,br as resolvePalettePaint,xt as resolvePieChartTheme,gt as resolvePieSlices,_e as resolvePlotArea,Ze as resolveRegionBox,Ct as resolveSeriesFill,Le as resolveSeriesFills,kt as resolveSeriesStroke,Mt as resolveSeriesStrokes,rt as resolveXScale,it as resolveYScale,ue as ringPoint,tt as seriesPoints,xi as sliceTotal,mt as sliceValue,lt as stackCapIndex,ie as text,Ft as yExtent};
2
+ //# sourceMappingURL=index.js.map