poetry-charts 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +6 -0
  3. data/CHANGELOG.md +3 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +94 -0
  6. data/THIRD_PARTY_NOTICES.md +39 -0
  7. data/app/assets/stylesheets/poetry-charts.css +117 -0
  8. data/app/components/poetry/charts/adapter_chart/component.html.erb +6 -0
  9. data/app/components/poetry/charts/adapter_chart/component.rb +99 -0
  10. data/app/components/poetry/charts/adapter_chart/preview.rb +37 -0
  11. data/app/components/poetry/charts/adapter_chart/style.rb +16 -0
  12. data/app/components/poetry/charts/area_chart/component.html.erb +75 -0
  13. data/app/components/poetry/charts/area_chart/component.rb +251 -0
  14. data/app/components/poetry/charts/area_chart/preview.rb +95 -0
  15. data/app/components/poetry/charts/area_chart/style.rb +29 -0
  16. data/app/components/poetry/charts/bar_chart/component.html.erb +95 -0
  17. data/app/components/poetry/charts/bar_chart/component.rb +318 -0
  18. data/app/components/poetry/charts/bar_chart/preview.rb +115 -0
  19. data/app/components/poetry/charts/bar_chart/style.rb +28 -0
  20. data/app/components/poetry/charts/bar_math.rb +95 -0
  21. data/app/components/poetry/charts/cartesian_family.rb +105 -0
  22. data/app/components/poetry/charts/chart_family.rb +58 -0
  23. data/app/components/poetry/charts/composed_chart/component.html.erb +95 -0
  24. data/app/components/poetry/charts/composed_chart/component.rb +309 -0
  25. data/app/components/poetry/charts/composed_chart/preview.rb +62 -0
  26. data/app/components/poetry/charts/composed_chart/style.rb +24 -0
  27. data/app/components/poetry/charts/container/component.html.erb +4 -0
  28. data/app/components/poetry/charts/container/component.rb +80 -0
  29. data/app/components/poetry/charts/container/preview.rb +45 -0
  30. data/app/components/poetry/charts/container/style.rb +22 -0
  31. data/app/components/poetry/charts/error_bars.rb +35 -0
  32. data/app/components/poetry/charts/legend_content/component.html.erb +10 -0
  33. data/app/components/poetry/charts/legend_content/component.rb +122 -0
  34. data/app/components/poetry/charts/legend_content/preview.rb +23 -0
  35. data/app/components/poetry/charts/legend_content/style.rb +26 -0
  36. data/app/components/poetry/charts/line_chart/component.html.erb +85 -0
  37. data/app/components/poetry/charts/line_chart/component.rb +252 -0
  38. data/app/components/poetry/charts/line_chart/preview.rb +115 -0
  39. data/app/components/poetry/charts/line_chart/style.rb +28 -0
  40. data/app/components/poetry/charts/live.rb +296 -0
  41. data/app/components/poetry/charts/motion.rb +98 -0
  42. data/app/components/poetry/charts/pie_chart/component.html.erb +36 -0
  43. data/app/components/poetry/charts/pie_chart/component.rb +256 -0
  44. data/app/components/poetry/charts/pie_chart/preview.rb +100 -0
  45. data/app/components/poetry/charts/pie_chart/style.rb +19 -0
  46. data/app/components/poetry/charts/polar_family.rb +95 -0
  47. data/app/components/poetry/charts/radar_chart/component.html.erb +73 -0
  48. data/app/components/poetry/charts/radar_chart/component.rb +329 -0
  49. data/app/components/poetry/charts/radar_chart/preview.rb +97 -0
  50. data/app/components/poetry/charts/radar_chart/style.rb +21 -0
  51. data/app/components/poetry/charts/radial_bar_chart/component.html.erb +65 -0
  52. data/app/components/poetry/charts/radial_bar_chart/component.rb +424 -0
  53. data/app/components/poetry/charts/radial_bar_chart/preview.rb +99 -0
  54. data/app/components/poetry/charts/radial_bar_chart/style.rb +27 -0
  55. data/app/components/poetry/charts/reference_marks.rb +156 -0
  56. data/app/components/poetry/charts/scatter_chart/component.html.erb +55 -0
  57. data/app/components/poetry/charts/scatter_chart/component.rb +396 -0
  58. data/app/components/poetry/charts/scatter_chart/preview.rb +93 -0
  59. data/app/components/poetry/charts/scatter_chart/style.rb +22 -0
  60. data/app/components/poetry/charts/tooltip_content/component.html.erb +19 -0
  61. data/app/components/poetry/charts/tooltip_content/component.rb +168 -0
  62. data/app/components/poetry/charts/tooltip_content/preview.rb +39 -0
  63. data/app/components/poetry/charts/tooltip_content/style.rb +31 -0
  64. data/app/components/poetry/charts/tooltip_layer/component.html.erb +6 -0
  65. data/app/components/poetry/charts/tooltip_layer/component.rb +61 -0
  66. data/app/components/poetry/charts/tooltip_layer/style.rb +13 -0
  67. data/app/components/poetry/charts/tooltip_wiring.rb +167 -0
  68. data/app/helpers/poetry/charts/components_helper.rb +125 -0
  69. data/app/javascript/poetry/charts/adapter_controller.js +75 -0
  70. data/app/javascript/poetry/charts/adapter_registry.js +52 -0
  71. data/app/javascript/poetry/charts/adapters/chartjs.js +86 -0
  72. data/app/javascript/poetry/charts/d3.js +14 -0
  73. data/app/javascript/poetry/charts/index.js +67 -0
  74. data/app/javascript/poetry/charts/live/renderer.js +456 -0
  75. data/app/javascript/poetry/charts/live_controller.js +195 -0
  76. data/app/javascript/poetry/charts/motion/flip.js +169 -0
  77. data/app/javascript/poetry/charts/motion/sector.js +62 -0
  78. data/app/javascript/poetry/charts/motion/tween.js +105 -0
  79. data/app/javascript/poetry/charts/motion_controller.js +230 -0
  80. data/app/javascript/poetry/charts/tooltip_controller.js +331 -0
  81. data/app/javascript/poetry/charts/window_controller.js +195 -0
  82. data/config/component_descriptions.yml +14 -0
  83. data/config/component_registry.yml +3055 -0
  84. data/config/controllers_manifest.json +100 -0
  85. data/config/importmap.rb +10 -0
  86. data/lib/poetry/charts/cartesian.rb +277 -0
  87. data/lib/poetry/charts/config.rb +149 -0
  88. data/lib/poetry/charts/engine.rb +76 -0
  89. data/lib/poetry/charts/geometry/area.rb +68 -0
  90. data/lib/poetry/charts/geometry/curve.rb +327 -0
  91. data/lib/poetry/charts/geometry/line.rb +64 -0
  92. data/lib/poetry/charts/geometry/nice_ticks.rb +220 -0
  93. data/lib/poetry/charts/geometry/path.rb +96 -0
  94. data/lib/poetry/charts/geometry/scale/band.rb +81 -0
  95. data/lib/poetry/charts/geometry/scale/linear.rb +127 -0
  96. data/lib/poetry/charts/geometry/stack.rb +129 -0
  97. data/lib/poetry/charts/geometry/ticks.rb +103 -0
  98. data/lib/poetry/charts/geometry.rb +66 -0
  99. data/lib/poetry/charts/polar.rb +179 -0
  100. data/lib/poetry/charts/spec.rb +108 -0
  101. data/lib/poetry/charts/theme_style.rb +53 -0
  102. data/lib/poetry/charts/version.rb +8 -0
  103. data/lib/poetry/charts.rb +114 -0
  104. data/lib/poetry-charts.rb +4 -0
  105. data/themes/default.css +146 -0
  106. data/themes/luma.css +139 -0
  107. data/themes/lyra.css +140 -0
  108. data/themes/maia.css +139 -0
  109. data/themes/mira.css +139 -0
  110. data/themes/nova.css +139 -0
  111. data/themes/rhea.css +139 -0
  112. data/themes/sera.css +140 -0
  113. data/themes/vega.css +144 -0
  114. data/vendor/d3-kernel/LICENSE-d3.txt +17 -0
  115. data/vendor/d3-kernel/LICENSE-decimal.js-light.txt +25 -0
  116. data/vendor/d3-kernel/LICENSE-recharts.txt +26 -0
  117. data/vendor/d3-kernel/README.md +30 -0
  118. data/vendor/d3-kernel/build.mjs +66 -0
  119. data/vendor/d3-kernel/entry.js +27 -0
  120. data/vendor/d3-kernel/recharts/state/cartesianAxisSlice.ts +6 -0
  121. data/vendor/d3-kernel/recharts/util/scale/getNiceTickValues.ts +310 -0
  122. data/vendor/d3-kernel/recharts/util/scale/util/arithmetic.ts +54 -0
  123. data/vendor/d3-kernel/recharts/util/types.ts +5 -0
  124. metadata +186 -0
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Poetry
4
+ module Charts
5
+ # The poetry_chart_* view helpers - the agent-facing chart surface,
6
+ # from the chart-root dispatcher down to the per-family helpers.
7
+ module ComponentsHelper
8
+ # Chart type symbols mapped to their component class names - the
9
+ # dispatch table behind poetry_chart.
10
+ CHART_TYPES = {
11
+ area: "Poetry::Charts::AreaChart::Component",
12
+ line: "Poetry::Charts::LineChart::Component",
13
+ bar: "Poetry::Charts::BarChart::Component",
14
+ pie: "Poetry::Charts::PieChart::Component",
15
+ radial: "Poetry::Charts::RadialBarChart::Component",
16
+ radar: "Poetry::Charts::RadarChart::Component",
17
+ scatter: "Poetry::Charts::ScatterChart::Component",
18
+ composed: "Poetry::Charts::ComposedChart::Component"
19
+ }.freeze
20
+
21
+ # Renders a chart of the given type through one dispatcher; the block
22
+ # receives the chart component for slot composition. Unknown types
23
+ # raise with the list of known ones.
24
+ #
25
+ # @example
26
+ # <%= poetry_chart(:area, data: data, config: config) do |c| %>
27
+ # <% c.with_area data_key: :desktop %>
28
+ # <% end %>
29
+ #
30
+ # @param type [Symbol, String] one of the CHART_TYPES keys
31
+ # @param engine [Symbol, nil] when set, routes the call to the
32
+ # client-side adapter mount, which takes series:/axes: arguments
33
+ # (the closed spec) instead of slots
34
+ # @see Poetry::Charts::AdapterChart::Component
35
+ def poetry_chart(type, engine: nil, **, &block)
36
+ # The one-word swap: engine: routes the same call to
37
+ # the adapter mount, which consumes the closed spec instead of slots.
38
+ if engine
39
+ if block
40
+ raise ArgumentError,
41
+ "the adapter path takes series:/axes: arguments (the closed spec), not slots"
42
+ end
43
+ return render(Poetry::Charts::AdapterChart::Component.new(type: type, engine: engine, **))
44
+ end
45
+
46
+ component = CHART_TYPES[type.to_sym] or
47
+ raise ArgumentError, "unknown chart type #{type.inspect} (one of #{CHART_TYPES.keys.join(", ")})"
48
+ render(component.constantize.new(**), &block)
49
+ end
50
+
51
+ # Renders an area chart - filled trends over an ordered axis,
52
+ # optionally stacked.
53
+ #
54
+ # @example
55
+ # <%= poetry_area_chart(data: data, config: config) do |c| %>
56
+ # <% c.with_area data_key: :desktop %>
57
+ # <% end %>
58
+ #
59
+ # @see Poetry::Charts::AreaChart::Component
60
+ def poetry_area_chart(**, &)
61
+ render(Poetry::Charts::AreaChart::Component.new(**), &)
62
+ end
63
+
64
+ # Renders a line chart - one stroked curve per series.
65
+ #
66
+ # @example
67
+ # <%= poetry_line_chart(data: data, config: config) do |c| %>
68
+ # <% c.with_line data_key: :desktop %>
69
+ # <% end %>
70
+ #
71
+ # @see Poetry::Charts::LineChart::Component
72
+ def poetry_line_chart(**, &)
73
+ render(Poetry::Charts::LineChart::Component.new(**), &)
74
+ end
75
+
76
+ # Renders a bar chart - grouped or stacked rectangles per category.
77
+ #
78
+ # @example
79
+ # <%= poetry_bar_chart(data: data, config: config) do |c| %>
80
+ # <% c.with_bar data_key: :desktop %>
81
+ # <% end %>
82
+ #
83
+ # @see Poetry::Charts::BarChart::Component
84
+ def poetry_bar_chart(**, &)
85
+ render(Poetry::Charts::BarChart::Component.new(**), &)
86
+ end
87
+
88
+ # Renders the chart container - the sized, theme-scoped wrapper that
89
+ # emits var(--color-<key>) for every configured series and hosts the
90
+ # chart plus its tooltip and legend.
91
+ #
92
+ # @example
93
+ # <%= poetry_chart_container(config: config, class: "h-64") do %>
94
+ # <%= poetry_area_chart(data: data, config: config) %>
95
+ # <% end %>
96
+ #
97
+ # @see Poetry::Charts::Container::Component
98
+ def poetry_chart_container(**, &)
99
+ render(Poetry::Charts::Container::Component.new(**), &)
100
+ end
101
+
102
+ # Renders the tooltip panel a chart's hover layer positions and fills -
103
+ # place it inside the container alongside the chart.
104
+ #
105
+ # @example
106
+ # <%= poetry_chart_tooltip_content(indicator: :line) %>
107
+ #
108
+ # @see Poetry::Charts::TooltipContent::Component
109
+ def poetry_chart_tooltip_content(**, &)
110
+ render(Poetry::Charts::TooltipContent::Component.new(**), &)
111
+ end
112
+
113
+ # Renders a standalone legend for the configured series - a swatch
114
+ # plus label per entry.
115
+ #
116
+ # @example
117
+ # <%= poetry_chart_legend_content(config: config) %>
118
+ #
119
+ # @see Poetry::Charts::LegendContent::Component
120
+ def poetry_chart_legend_content(**, &)
121
+ render(Poetry::Charts::LegendContent::Component.new(**), &)
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,75 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+ import { chartAdapter } from "@poetry/charts/adapter_registry"
3
+
4
+ // The adapter mount: reads the FROZEN chart-spec v1 the
5
+ // server embedded, hands it to the registered engine adapter, and owns
6
+ // the lifecycle - render on connect, destroy on disconnect (Turbo-safe),
7
+ // themeChanged on dark-mode flips. The helpers close the canvas gap:
8
+ // resolveColor turns var(--color-key)/var(--chart-N) into concrete
9
+ // values at paint time (CSS variables cannot reach a canvas).
10
+ export default class ChartAdapterController extends Controller {
11
+ // The events this controller dispatches (manifest surface;
12
+ // events_declaration.test.js enforces the list stays honest).
13
+ static events = ["poetry--charts--adapter:rendered"]
14
+
15
+ static targets = ["mount", "spec"]
16
+ static values = { engine: String }
17
+
18
+ /**
19
+ * Mounts the declared engine: parses the embedded spec, validates the
20
+ * adapter and its type support (console errors, never throws - a
21
+ * chart must not take the page down), renders, and arms the dark-mode
22
+ * observer.
23
+ */
24
+ connect() {
25
+ const adapter = chartAdapter(this.engineValue)
26
+ if (!adapter) {
27
+ console.error(`poetry-charts: no adapter registered for engine ${JSON.stringify(this.engineValue)} - ` +
28
+ "register one with registerChartAdapter(name, adapter) before charts connect")
29
+ return
30
+ }
31
+
32
+ this.adapter = adapter
33
+ this.spec = JSON.parse(this.specTarget.textContent)
34
+
35
+ if (adapter.supports && !adapter.supports.includes(this.spec.type)) {
36
+ console.error(`poetry-charts: the ${this.engineValue} adapter does not support ${this.spec.type} charts ` +
37
+ `(supports: ${adapter.supports.join(", ")})`)
38
+ return
39
+ }
40
+
41
+ this.instance = adapter.render(this.mountTarget, this.spec, this.#helpers())
42
+ this.#observeTheme()
43
+ this.dispatch("rendered", { detail: { engine: this.engineValue, degradations: adapter.degradations ?? [] } })
44
+ }
45
+
46
+ /** Destroys the engine instance and stops the theme observer. */
47
+ disconnect() {
48
+ this.observer?.disconnect()
49
+ if (this.instance != null) this.adapter?.destroy(this.instance, this.mountTarget)
50
+ this.instance = null
51
+ }
52
+
53
+ // Dark-mode flips re-enter the adapter (canvas engines must repaint -
54
+ // resolved colors are frozen pixels, unlike our SVG's live CSS vars).
55
+ #observeTheme() {
56
+ if (typeof this.adapter.themeChanged !== "function") return
57
+
58
+ this.observer = new MutationObserver(() => {
59
+ this.instance = this.adapter.themeChanged(this.instance, this.spec, this.#helpers()) ?? this.instance
60
+ })
61
+ this.observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] })
62
+ }
63
+
64
+ #helpers() {
65
+ const scope = this.element.closest("[data-chart]") ?? this.element
66
+ return {
67
+ // var(--color-desktop) / var(--chart-1) / #hex -> a concrete color.
68
+ resolveColor: (color) => {
69
+ const match = /^var\((--[\w-]+)\)$/.exec(color ?? "")
70
+ if (!match) return color
71
+ return getComputedStyle(scope).getPropertyValue(match[1]).trim() || color
72
+ },
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,52 @@
1
+ // The BYO-engine seam: adapters register by name and
2
+ // implement the duck-typed protocol over the FROZEN chart-spec v1 -
3
+ //
4
+ // {
5
+ // render(el, spec, helpers) -> instance (required)
6
+ // destroy(instance, el) (required)
7
+ // update(instance, spec) (optional - live updates)
8
+ // themeChanged(instance, spec, helpers) (optional - dark-mode repaint)
9
+ // degradations: ["..."] (declared, never discovered)
10
+ // supports: ["area", "bar", ...] (optional type allowlist)
11
+ // }
12
+ //
13
+ // The spec is closed: no engine-specific key ever enters it - a
14
+ // pass-through options bag would leak engine keys into every call site.
15
+ // Engine-specific styling lives INSIDE the adapter.
16
+
17
+ const adapters = new Map()
18
+
19
+ /**
20
+ * Registers an engine adapter under a name. The adapter must implement
21
+ * the duck-typed protocol above; a missing render/destroy throws at
22
+ * registration, never at first chart.
23
+ *
24
+ * @param {string} name - the engine value charts declare
25
+ * @param {Object} adapter
26
+ * @throws {Error} when render or destroy is missing
27
+ */
28
+ export function registerChartAdapter(name, adapter) {
29
+ if (typeof adapter?.render !== "function" || typeof adapter?.destroy !== "function") {
30
+ throw new Error(`chart adapter ${name} must implement render(el, spec) and destroy(instance, el)`)
31
+ }
32
+ adapters.set(name, adapter)
33
+ }
34
+
35
+ /**
36
+ * The registered adapter for a name.
37
+ *
38
+ * @param {string} name
39
+ * @returns {Object | undefined}
40
+ */
41
+ export function chartAdapter(name) {
42
+ return adapters.get(name)
43
+ }
44
+
45
+ /**
46
+ * The registered adapter names, in registration order.
47
+ *
48
+ * @returns {string[]}
49
+ */
50
+ export function registeredAdapters() {
51
+ return [...adapters.keys()]
52
+ }
@@ -0,0 +1,86 @@
1
+ // The Chart.js reference adapter: the proof of the seam,
2
+ // and the documented escape valve for the one case the SVG default is
3
+ // weak on (huge point counts - canvas draws one bitmap). poetry ships NO
4
+ // Chart.js: the host imports it and passes the constructor in -
5
+ //
6
+ // import Chart from "chart.js/auto"
7
+ // import { registerChartAdapter, createChartJsAdapter } from "@poetry/charts"
8
+ // registerChartAdapter("chartjs", createChartJsAdapter(Chart))
9
+ //
10
+ // Declared degradations (the canvas tax, stated instead of discovered):
11
+ // tooltips/legends fall back to Chart.js's built-ins (poetry's HTML chrome
12
+ // cannot overlay per-point without the engine's hit data), CSS variables
13
+ // resolve to frozen pixels at paint (dark-mode flips repaint the whole
14
+ // chart), and per-part data-slot styling does not exist on a bitmap.
15
+ /**
16
+ * Builds the Chart.js adapter around a host-supplied constructor
17
+ * (poetry ships NO Chart.js - the header shows the wiring).
18
+ *
19
+ * @param {Function} Chart - the Chart.js constructor (chart.js/auto)
20
+ * @returns {Object} the adapter, ready for registerChartAdapter
21
+ */
22
+ export function createChartJsAdapter(Chart) {
23
+ const TYPES = { area: "line", line: "line", bar: "bar", pie: "pie", radar: "radar" }
24
+
25
+ function config(spec, helpers) {
26
+ const type = TYPES[spec.type]
27
+ const categoryKey = spec.axes?.x?.dataKey ?? spec.axes?.y?.dataKey
28
+ const labels = spec.data.map((row) => (categoryKey ? row[categoryKey] : ""))
29
+
30
+ const datasets = spec.series.map((series) => {
31
+ const key = series.dataKey
32
+ const color = helpers.resolveColor(colorFor(spec, key))
33
+ return {
34
+ label: spec.config?.[key]?.label ?? key,
35
+ data: spec.data.map((row) => row[key] ?? null),
36
+ backgroundColor: color,
37
+ borderColor: color,
38
+ fill: spec.type === "area",
39
+ stack: series.stack ?? undefined,
40
+ }
41
+ })
42
+
43
+ return {
44
+ type,
45
+ data: { labels, datasets },
46
+ options: {
47
+ responsive: true,
48
+ maintainAspectRatio: false,
49
+ indexAxis: spec.type === "bar" && spec.axes?.y?.dataKey ? "y" : "x",
50
+ plugins: { legend: { display: spec.series.length > 1 } },
51
+ },
52
+ }
53
+ }
54
+
55
+ function colorFor(spec, key) {
56
+ return spec.config?.[key]?.color ?? `var(--color-${key})`
57
+ }
58
+
59
+ return {
60
+ supports: Object.keys(TYPES),
61
+ degradations: [
62
+ "tooltip and legend chrome fall back to Chart.js built-ins",
63
+ "CSS variables resolve to frozen pixels at paint; theme flips repaint",
64
+ "no per-part data-slot styling on canvas",
65
+ "radial charts unsupported (no Chart.js equivalent)",
66
+ ],
67
+
68
+ render(el, spec, helpers) {
69
+ const canvas = document.createElement("canvas")
70
+ el.replaceChildren(canvas)
71
+ return new Chart(canvas, config(spec, helpers))
72
+ },
73
+
74
+ destroy(instance) {
75
+ instance?.destroy()
76
+ },
77
+
78
+ themeChanged(instance, spec, helpers) {
79
+ const el = instance.canvas.parentElement
80
+ instance.destroy()
81
+ const canvas = document.createElement("canvas")
82
+ el.replaceChildren(canvas)
83
+ return new Chart(canvas, config(spec, helpers))
84
+ },
85
+ }
86
+ }
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * @poetry/charts/d3 - the vendored DOM-free geometry kernel (the opt-in live mode).
3
+ * Bundles, unmodified:
4
+ * d3-array 3.2.4, d3-scale 4.0.2, d3-shape 3.2.0,
5
+ * d3-interpolate 3.0.1, d3-format 3.1.2,
6
+ * d3-time 3.1.0, d3-time-format 4.1.0
7
+ * - Copyright 2010-2023 Mike Bostock, ISC license (https://github.com/d3)
8
+ * decimal.js-light 2.5.1
9
+ * - Copyright Michael Mclaughlin, MIT license
10
+ * getNiceTickValues from recharts v3.9.2 (verbatim)
11
+ * - Copyright (c) Recharts Group, MIT license (https://github.com/recharts/recharts)
12
+ * Rebuild: npm run vendor:d3 (source: vendor/d3-kernel/).
13
+ */
14
+ var Oo=Object.create;var jr=Object.defineProperty;var Po=Object.getOwnPropertyDescriptor;var Ho=Object.getOwnPropertyNames;var Yo=Object.getPrototypeOf,qo=Object.prototype.hasOwnProperty;var Wo=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Bo=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var zo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ho(t))!qo.call(e,o)&&o!==r&&jr(e,o,{get:()=>t[o],enumerable:!(n=Po(t,o))||n.enumerable});return e};var Qr=(e,t,r)=>(r=e!=null?Oo(Yo(e)):{},zo(t||!e||!e.__esModule?jr(r,"default",{value:e,enumerable:!0}):r,e));var N,p=Wo(()=>{N={"d3-array":"3.2.4","d3-scale":"4.0.2","d3-shape":"3.2.0","d3-interpolate":"3.0.1","d3-format":"3.1.2","d3-time":"3.1.0","d3-time-format":"4.1.0","decimal.js-light":"2.5.1"}});var Br=Bo((Fo,rr)=>{p();(function(e){"use strict";var t=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},n=!0,o="[DecimalError] ",i=o+"Invalid argument: ",a=o+"Exponent out of range: ",u=Math.floor,d=Math.pow,l=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y,x=1e7,w=7,_=9007199254740991,F=u(_/w),M={};M.absoluteValue=M.abs=function(){var f=new this.constructor(this);return f.s&&(f.s=1),f},M.comparedTo=M.cmp=function(f){var s,g,c,h,m=this;if(f=new m.constructor(f),m.s!==f.s)return m.s||-f.s;if(m.e!==f.e)return m.e>f.e^m.s<0?1:-1;for(c=m.d.length,h=f.d.length,s=0,g=c<h?c:h;s<g;++s)if(m.d[s]!==f.d[s])return m.d[s]>f.d[s]^m.s<0?1:-1;return c===h?0:c>h^m.s<0?1:-1},M.decimalPlaces=M.dp=function(){var f=this,s=f.d.length-1,g=(s-f.e)*w;if(s=f.d[s],s)for(;s%10==0;s/=10)g--;return g<0?0:g},M.dividedBy=M.div=function(f){return L(this,new this.constructor(f))},M.dividedToIntegerBy=M.idiv=function(f){var s=this,g=s.constructor;return q(L(s,new g(f),0,1),g.precision)},M.equals=M.eq=function(f){return!this.cmp(f)},M.exponent=function(){return Y(this)},M.greaterThan=M.gt=function(f){return this.cmp(f)>0},M.greaterThanOrEqualTo=M.gte=function(f){return this.cmp(f)>=0},M.isInteger=M.isint=function(){return this.e>this.d.length-2},M.isNegative=M.isneg=function(){return this.s<0},M.isPositive=M.ispos=function(){return this.s>0},M.isZero=function(){return this.s===0},M.lessThan=M.lt=function(f){return this.cmp(f)<0},M.lessThanOrEqualTo=M.lte=function(f){return this.cmp(f)<1},M.logarithm=M.log=function(f){var s,g=this,c=g.constructor,h=c.precision,m=h+5;if(f===void 0)f=new c(10);else if(f=new c(f),f.s<1||f.eq(y))throw Error(o+"NaN");if(g.s<1)throw Error(o+(g.s?"NaN":"-Infinity"));return g.eq(y)?new c(0):(n=!1,s=L(J(g,m),J(f,m),m),n=!0,q(s,h))},M.minus=M.sub=function(f){var s=this;return f=new s.constructor(f),s.s==f.s?K(s,f):z(s,(f.s=-f.s,f))},M.modulo=M.mod=function(f){var s,g=this,c=g.constructor,h=c.precision;if(f=new c(f),!f.s)throw Error(o+"NaN");return g.s?(n=!1,s=L(g,f,0,1).times(f),n=!0,g.minus(s)):q(new c(g),h)},M.naturalExponential=M.exp=function(){return O(this)},M.naturalLogarithm=M.ln=function(){return J(this)},M.negated=M.neg=function(){var f=new this.constructor(this);return f.s=-f.s||0,f},M.plus=M.add=function(f){var s=this;return f=new s.constructor(f),s.s==f.s?z(s,f):K(s,(f.s=-f.s,f))},M.precision=M.sd=function(f){var s,g,c,h=this;if(f!==void 0&&f!==!!f&&f!==1&&f!==0)throw Error(i+f);if(s=Y(h)+1,c=h.d.length-1,g=c*w+1,c=h.d[c],c){for(;c%10==0;c/=10)g--;for(c=h.d[0];c>=10;c/=10)g++}return f&&s>g?s:g},M.squareRoot=M.sqrt=function(){var f,s,g,c,h,m,v,T=this,k=T.constructor;if(T.s<1){if(!T.s)return new k(0);throw Error(o+"NaN")}for(f=Y(T),n=!1,h=Math.sqrt(+T),h==0||h==1/0?(s=B(T.d),(s.length+f)%2==0&&(s+="0"),h=Math.sqrt(s),f=u((f+1)/2)-(f<0||f%2),h==1/0?s="5e"+f:(s=h.toExponential(),s=s.slice(0,s.indexOf("e")+1)+f),c=new k(s)):c=new k(h.toString()),g=k.precision,h=v=g+3;;)if(m=c,c=m.plus(L(T,m,v+2)).times(.5),B(m.d).slice(0,v)===(s=B(c.d)).slice(0,v)){if(s=s.slice(v-3,v+1),h==v&&s=="4999"){if(q(m,g+1,0),m.times(m).eq(T)){c=m;break}}else if(s!="9999")break;v+=4}return n=!0,q(c,g)},M.times=M.mul=function(f){var s,g,c,h,m,v,T,k,C,A=this,$=A.constructor,G=A.d,S=(f=new $(f)).d;if(!A.s||!f.s)return new $(0);for(f.s*=A.s,g=A.e+f.e,k=G.length,C=S.length,k<C&&(m=G,G=S,S=m,v=k,k=C,C=v),m=[],v=k+C,c=v;c--;)m.push(0);for(c=C;--c>=0;){for(s=0,h=k+c;h>c;)T=m[h]+S[c]*G[h-c-1]+s,m[h--]=T%x|0,s=T/x|0;m[h]=(m[h]+s)%x|0}for(;!m[--v];)m.pop();return s?++g:m.shift(),f.d=m,f.e=g,n?q(f,$.precision):f},M.toDecimalPlaces=M.todp=function(f,s){var g=this,c=g.constructor;return g=new c(g),f===void 0?g:(R(f,0,t),s===void 0?s=c.rounding:R(s,0,8),q(g,f+Y(g)+1,s))},M.toExponential=function(f,s){var g,c=this,h=c.constructor;return f===void 0?g=E(c,!0):(R(f,0,t),s===void 0?s=h.rounding:R(s,0,8),c=q(new h(c),f+1,s),g=E(c,!0,f+1)),g},M.toFixed=function(f,s){var g,c,h=this,m=h.constructor;return f===void 0?E(h):(R(f,0,t),s===void 0?s=m.rounding:R(s,0,8),c=q(new m(h),f+Y(h)+1,s),g=E(c.abs(),!1,f+Y(c)+1),h.isneg()&&!h.isZero()?"-"+g:g)},M.toInteger=M.toint=function(){var f=this,s=f.constructor;return q(new s(f),Y(f)+1,s.rounding)},M.toNumber=function(){return+this},M.toPower=M.pow=function(f){var s,g,c,h,m,v,T=this,k=T.constructor,C=12,A=+(f=new k(f));if(!f.s)return new k(y);if(T=new k(T),!T.s){if(f.s<1)throw Error(o+"Infinity");return T}if(T.eq(y))return T;if(c=k.precision,f.eq(y))return q(T,c);if(s=f.e,g=f.d.length-1,v=s>=g,m=T.s,v){if((g=A<0?-A:A)<=_){for(h=new k(y),s=Math.ceil(c/w+4),n=!1;g%2&&(h=h.times(T),I(h.d,s)),g=u(g/2),g!==0;)T=T.times(T),I(T.d,s);return n=!0,f.s<0?new k(y).div(h):q(h,c)}}else if(m<0)throw Error(o+"NaN");return m=m<0&&f.d[Math.max(s,g)]&1?-1:1,T.s=1,n=!1,h=f.times(J(T,c+C)),n=!0,h=O(h),h.s=m,h},M.toPrecision=function(f,s){var g,c,h=this,m=h.constructor;return f===void 0?(g=Y(h),c=E(h,g<=m.toExpNeg||g>=m.toExpPos)):(R(f,1,t),s===void 0?s=m.rounding:R(s,0,8),h=q(new m(h),f,s),g=Y(h),c=E(h,f<=g||g<=m.toExpNeg,f)),c},M.toSignificantDigits=M.tosd=function(f,s){var g=this,c=g.constructor;return f===void 0?(f=c.precision,s=c.rounding):(R(f,1,t),s===void 0?s=c.rounding:R(s,0,8)),q(new c(g),f,s)},M.toString=M.valueOf=M.val=M.toJSON=function(){var f=this,s=Y(f),g=f.constructor;return E(f,s<=g.toExpNeg||s>=g.toExpPos)};function z(f,s){var g,c,h,m,v,T,k,C,A=f.constructor,$=A.precision;if(!f.s||!s.s)return s.s||(s=new A(f)),n?q(s,$):s;if(k=f.d,C=s.d,v=f.e,h=s.e,k=k.slice(),m=v-h,m){for(m<0?(c=k,m=-m,T=C.length):(c=C,h=v,T=k.length),v=Math.ceil($/w),T=v>T?v+1:T+1,m>T&&(m=T,c.length=1),c.reverse();m--;)c.push(0);c.reverse()}for(T=k.length,m=C.length,T-m<0&&(m=T,c=C,C=k,k=c),g=0;m;)g=(k[--m]=k[m]+C[m]+g)/x|0,k[m]%=x;for(g&&(k.unshift(g),++h),T=k.length;k[--T]==0;)k.pop();return s.d=k,s.e=h,n?q(s,$):s}function R(f,s,g){if(f!==~~f||f<s||f>g)throw Error(i+f)}function B(f){var s,g,c,h=f.length-1,m="",v=f[0];if(h>0){for(m+=v,s=1;s<h;s++)c=f[s]+"",g=w-c.length,g&&(m+=X(g)),m+=c;v=f[s],c=v+"",g=w-c.length,g&&(m+=X(g))}else if(v===0)return"0";for(;v%10===0;)v/=10;return m+v}var L=(function(){function f(c,h){var m,v=0,T=c.length;for(c=c.slice();T--;)m=c[T]*h+v,c[T]=m%x|0,v=m/x|0;return v&&c.unshift(v),c}function s(c,h,m,v){var T,k;if(m!=v)k=m>v?1:-1;else for(T=k=0;T<m;T++)if(c[T]!=h[T]){k=c[T]>h[T]?1:-1;break}return k}function g(c,h,m){for(var v=0;m--;)c[m]-=v,v=c[m]<h[m]?1:0,c[m]=v*x+c[m]-h[m];for(;!c[0]&&c.length>1;)c.shift()}return function(c,h,m,v){var T,k,C,A,$,G,S,H,U,b,te,V,ie,ne,ce,Xe,me,Dt,Ct=c.constructor,Lo=c.s==h.s?1:-1,ge=c.d,ee=h.d;if(!c.s)return new Ct(c);if(!h.s)throw Error(o+"Division by zero");for(k=c.e-h.e,me=ee.length,ce=ge.length,S=new Ct(Lo),H=S.d=[],C=0;ee[C]==(ge[C]||0);)++C;if(ee[C]>(ge[C]||0)&&--k,m==null?V=m=Ct.precision:v?V=m+(Y(c)-Y(h))+1:V=m,V<0)return new Ct(0);if(V=V/w+2|0,C=0,me==1)for(A=0,ee=ee[0],V++;(C<ce||A)&&V--;C++)ie=A*x+(ge[C]||0),H[C]=ie/ee|0,A=ie%ee|0;else{for(A=x/(ee[0]+1)|0,A>1&&(ee=f(ee,A),ge=f(ge,A),me=ee.length,ce=ge.length),ne=me,U=ge.slice(0,me),b=U.length;b<me;)U[b++]=0;Dt=ee.slice(),Dt.unshift(0),Xe=ee[0],ee[1]>=x/2&&++Xe;do A=0,T=s(ee,U,me,b),T<0?(te=U[0],me!=b&&(te=te*x+(U[1]||0)),A=te/Xe|0,A>1?(A>=x&&(A=x-1),$=f(ee,A),G=$.length,b=U.length,T=s($,U,G,b),T==1&&(A--,g($,me<G?Dt:ee,G))):(A==0&&(T=A=1),$=ee.slice()),G=$.length,G<b&&$.unshift(0),g(U,$,b),T==-1&&(b=U.length,T=s(ee,U,me,b),T<1&&(A++,g(U,me<b?Dt:ee,b))),b=U.length):T===0&&(A++,U=[0]),H[C++]=A,T&&U[0]?U[b++]=ge[ne]||0:(U=[ge[ne]],b=1);while((ne++<ce||U[0]!==void 0)&&V--)}return H[0]||H.shift(),S.e=k,q(S,v?m+Y(S)+1:m)}})();function O(f,s){var g,c,h,m,v,T,k=0,C=0,A=f.constructor,$=A.precision;if(Y(f)>16)throw Error(a+Y(f));if(!f.s)return new A(y);for(s==null?(n=!1,T=$):T=s,v=new A(.03125);f.abs().gte(.1);)f=f.times(v),C+=5;for(c=Math.log(d(2,C))/Math.LN10*2+5|0,T+=c,g=h=m=new A(y),A.precision=T;;){if(h=q(h.times(f),T),g=g.times(++k),v=m.plus(L(h,g,T)),B(v.d).slice(0,T)===B(m.d).slice(0,T)){for(;C--;)m=q(m.times(m),T);return A.precision=$,s==null?(n=!0,q(m,$)):m}m=v}}function Y(f){for(var s=f.e*w,g=f.d[0];g>=10;g/=10)s++;return s}function D(f,s,g){if(s>f.LN10.sd())throw n=!0,g&&(f.precision=g),Error(o+"LN10 precision limit exceeded");return q(new f(f.LN10),s)}function X(f){for(var s="";f--;)s+="0";return s}function J(f,s){var g,c,h,m,v,T,k,C,A,$=1,G=10,S=f,H=S.d,U=S.constructor,b=U.precision;if(S.s<1)throw Error(o+(S.s?"NaN":"-Infinity"));if(S.eq(y))return new U(0);if(s==null?(n=!1,C=b):C=s,S.eq(10))return s==null&&(n=!0),D(U,C);if(C+=G,U.precision=C,g=B(H),c=g.charAt(0),m=Y(S),Math.abs(m)<15e14){for(;c<7&&c!=1||c==1&&g.charAt(1)>3;)S=S.times(f),g=B(S.d),c=g.charAt(0),$++;m=Y(S),c>1?(S=new U("0."+g),m++):S=new U(c+"."+g.slice(1))}else return k=D(U,C+2,b).times(m+""),S=J(new U(c+"."+g.slice(1)),C-G).plus(k),U.precision=b,s==null?(n=!0,q(S,b)):S;for(T=v=S=L(S.minus(y),S.plus(y),C),A=q(S.times(S),C),h=3;;){if(v=q(v.times(A),C),k=T.plus(L(v,new U(h),C)),B(k.d).slice(0,C)===B(T.d).slice(0,C))return T=T.times(2),m!==0&&(T=T.plus(D(U,C+2,b).times(m+""))),T=L(T,new U($),C),U.precision=b,s==null?(n=!0,q(T,b)):T;T=k,h+=2}}function ue(f,s){var g,c,h;for((g=s.indexOf("."))>-1&&(s=s.replace(".","")),(c=s.search(/e/i))>0?(g<0&&(g=c),g+=+s.slice(c+1),s=s.substring(0,c)):g<0&&(g=s.length),c=0;s.charCodeAt(c)===48;)++c;for(h=s.length;s.charCodeAt(h-1)===48;)--h;if(s=s.slice(c,h),s){if(h-=c,g=g-c-1,f.e=u(g/w),f.d=[],c=(g+1)%w,g<0&&(c+=w),c<h){for(c&&f.d.push(+s.slice(0,c)),h-=w;c<h;)f.d.push(+s.slice(c,c+=w));s=s.slice(c),c=w-s.length}else c-=h;for(;c--;)s+="0";if(f.d.push(+s),n&&(f.e>F||f.e<-F))throw Error(a+g)}else f.s=0,f.e=0,f.d=[0];return f}function q(f,s,g){var c,h,m,v,T,k,C,A,$=f.d;for(v=1,m=$[0];m>=10;m/=10)v++;if(c=s-v,c<0)c+=w,h=s,C=$[A=0];else{if(A=Math.ceil((c+1)/w),m=$.length,A>=m)return f;for(C=m=$[A],v=1;m>=10;m/=10)v++;c%=w,h=c-w+v}if(g!==void 0&&(m=d(10,v-h-1),T=C/m%10|0,k=s<0||$[A+1]!==void 0||C%m,k=g<4?(T||k)&&(g==0||g==(f.s<0?3:2)):T>5||T==5&&(g==4||k||g==6&&(c>0?h>0?C/d(10,v-h):0:$[A-1])%10&1||g==(f.s<0?8:7))),s<1||!$[0])return k?(m=Y(f),$.length=1,s=s-m-1,$[0]=d(10,(w-s%w)%w),f.e=u(-s/w)||0):($.length=1,$[0]=f.e=f.s=0),f;if(c==0?($.length=A,m=1,A--):($.length=A+1,m=d(10,w-c),$[A]=h>0?(C/d(10,v-h)%d(10,h)|0)*m:0),k)for(;;)if(A==0){($[0]+=m)==x&&($[0]=1,++f.e);break}else{if($[A]+=m,$[A]!=x)break;$[A--]=0,m=1}for(c=$.length;$[--c]===0;)$.pop();if(n&&(f.e>F||f.e<-F))throw Error(a+Y(f));return f}function K(f,s){var g,c,h,m,v,T,k,C,A,$,G=f.constructor,S=G.precision;if(!f.s||!s.s)return s.s?s.s=-s.s:s=new G(f),n?q(s,S):s;if(k=f.d,$=s.d,c=s.e,C=f.e,k=k.slice(),v=C-c,v){for(A=v<0,A?(g=k,v=-v,T=$.length):(g=$,c=C,T=k.length),h=Math.max(Math.ceil(S/w),T)+2,v>h&&(v=h,g.length=1),g.reverse(),h=v;h--;)g.push(0);g.reverse()}else{for(h=k.length,T=$.length,A=h<T,A&&(T=h),h=0;h<T;h++)if(k[h]!=$[h]){A=k[h]<$[h];break}v=0}for(A&&(g=k,k=$,$=g,s.s=-s.s),T=k.length,h=$.length-T;h>0;--h)k[T++]=0;for(h=$.length;h>v;){if(k[--h]<$[h]){for(m=h;m&&k[--m]===0;)k[m]=x-1;--k[m],k[h]+=x}k[h]-=$[h]}for(;k[--T]===0;)k.pop();for(;k[0]===0;k.shift())--c;return k[0]?(s.d=k,s.e=c,n?q(s,S):s):new G(0)}function E(f,s,g){var c,h=Y(f),m=B(f.d),v=m.length;return s?(g&&(c=g-v)>0?m=m.charAt(0)+"."+m.slice(1)+X(c):v>1&&(m=m.charAt(0)+"."+m.slice(1)),m=m+(h<0?"e":"e+")+h):h<0?(m="0."+X(-h-1)+m,g&&(c=g-v)>0&&(m+=X(c))):h>=v?(m+=X(h+1-v),g&&(c=g-h-1)>0&&(m=m+"."+X(c))):((c=h+1)<v&&(m=m.slice(0,c)+"."+m.slice(c)),g&&(c=g-v)>0&&(h+1===v&&(m+="."),m+=X(c))),f.s<0?"-"+m:m}function I(f,s){if(f.length>s)return f.length=s,!0}function P(f){var s,g,c;function h(m){var v=this;if(!(v instanceof h))return new h(m);if(v.constructor=h,m instanceof h){v.s=m.s,v.e=m.e,v.d=(m=m.d)?m.slice():m;return}if(typeof m=="number"){if(m*0!==0)throw Error(i+m);if(m>0)v.s=1;else if(m<0)m=-m,v.s=-1;else{v.s=0,v.e=0,v.d=[0];return}if(m===~~m&&m<1e7){v.e=0,v.d=[m];return}return ue(v,m.toString())}else if(typeof m!="string")throw Error(i+m);if(m.charCodeAt(0)===45?(m=m.slice(1),v.s=-1):v.s=1,l.test(m))ue(v,m);else throw Error(i+m)}if(h.prototype=M,h.ROUND_UP=0,h.ROUND_DOWN=1,h.ROUND_CEIL=2,h.ROUND_FLOOR=3,h.ROUND_HALF_UP=4,h.ROUND_HALF_DOWN=5,h.ROUND_HALF_EVEN=6,h.ROUND_HALF_CEIL=7,h.ROUND_HALF_FLOOR=8,h.clone=P,h.config=h.set=re,f===void 0&&(f={}),f)for(c=["precision","rounding","toExpNeg","toExpPos","LN10"],s=0;s<c.length;)f.hasOwnProperty(g=c[s++])||(f[g]=this[g]);return h.config(f),h}function re(f){if(!f||typeof f!="object")throw Error(o+"Object expected");var s,g,c,h=["precision",1,t,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(s=0;s<h.length;s+=3)if((c=f[g=h[s]])!==void 0)if(u(c)===c&&c>=h[s+1]&&c<=h[s+2])this[g]=c;else throw Error(i+g+": "+c);if((c=f[g="LN10"])!==void 0)if(c==Math.LN10)this[g]=new this(c);else throw Error(i+g+": "+c);return this}r=P(r),r.default=r.Decimal=r,y=new r(1),typeof define=="function"&&define.amd?define(function(){return r}):typeof rr<"u"&&rr.exports?rr.exports=r:(e||(e=typeof self<"u"&&self&&self.self==self?self:Function("return this")()),e.Decimal=r)})(Fo)});p();p();p();p();function Fe(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}p();p();function nr(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Se(e){let t,r,n;e.length!==2?(t=Fe,r=(u,d)=>Fe(e(u),d),n=(u,d)=>e(u)-d):(t=e===Fe||e===nr?e:Xo,r=e,n=e);function o(u,d,l=0,y=u.length){if(l<y){if(t(d,d)!==0)return y;do{let x=l+y>>>1;r(u[x],d)<0?l=x+1:y=x}while(l<y)}return l}function i(u,d,l=0,y=u.length){if(l<y){if(t(d,d)!==0)return y;do{let x=l+y>>>1;r(u[x],d)<=0?l=x+1:y=x}while(l<y)}return l}function a(u,d,l=0,y=u.length){let x=o(u,d,l,y-1);return x>l&&n(u[x-1],d)>-n(u[x],d)?x-1:x}return{left:o,center:a,right:i}}function Xo(){return 0}p();function or(e){return e===null?NaN:+e}var Gr=Se(Fe),Jr=Gr.right,Zo=Gr.left,jo=Se(or).center,ir=Jr;p();function ar(e,t){let r,n;if(t===void 0)for(let o of e)o!=null&&(r===void 0?o>=o&&(r=n=o):(r>o&&(r=o),n<o&&(n=o)));else{let o=-1;for(let i of e)(i=t(i,++o,e))!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n<i&&(n=i)))}return[r,n]}p();var Ze=class extends Map{constructor(t,r=Jo){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,o]of t)this.set(n,o)}get(t){return super.get(Kr(this,t))}has(t){return super.has(Kr(this,t))}set(t,r){return super.set(Qo(this,t),r)}delete(t){return super.delete(Go(this,t))}};function Kr({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function Qo({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function Go({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function Jo(e){return e!==null&&typeof e=="object"?e.valueOf():e}p();var Ko=Math.sqrt(50),ei=Math.sqrt(10),ti=Math.sqrt(2);function At(e,t,r){let n=(t-e)/Math.max(0,r),o=Math.floor(Math.log10(n)),i=n/Math.pow(10,o),a=i>=Ko?10:i>=ei?5:i>=ti?2:1,u,d,l;return o<0?(l=Math.pow(10,-o)/a,u=Math.round(e*l),d=Math.round(t*l),u/l<e&&++u,d/l>t&&--d,l=-l):(l=Math.pow(10,o)*a,u=Math.round(e/l),d=Math.round(t/l),u*l<e&&++u,d*l>t&&--d),d<u&&.5<=r&&r<2?At(e,t,r*2):[u,d,l]}function st(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];let n=t<e,[o,i,a]=n?At(t,e,r):At(e,t,r);if(!(i>=o))return[];let u=i-o+1,d=new Array(u);if(n)if(a<0)for(let l=0;l<u;++l)d[l]=(i-l)/-a;else for(let l=0;l<u;++l)d[l]=(i-l)*a;else if(a<0)for(let l=0;l<u;++l)d[l]=(o+l)/-a;else for(let l=0;l<u;++l)d[l]=(o+l)*a;return d}function je(e,t,r){return t=+t,e=+e,r=+r,At(e,t,r)[2]}function Ee(e,t,r){t=+t,e=+e,r=+r;let n=t<e,o=n?je(t,e,r):je(e,t,r);return(n?-1:1)*(o<0?1/-o:o)}p();function ur(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}return r}p();function fr(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}return r}p();function lt(e,t,r){e=+e,t=+t,r=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+r;for(var n=-1,o=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(o);++n<o;)i[n]=e+n*r;return i}p();p();p();function Ne(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}p();var en=Symbol("implicit");function Ut(){var e=new Ze,t=[],r=[],n=en;function o(i){let a=e.get(i);if(a===void 0){if(n!==en)return n;e.set(i,a=t.push(i)-1)}return r[a%r.length]}return o.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new Ze;for(let a of i)e.has(a)||e.set(a,t.push(a)-1);return o},o.range=function(i){return arguments.length?(r=Array.from(i),o):r.slice()},o.unknown=function(i){return arguments.length?(n=i,o):n},o.copy=function(){return Ut(t,r).unknown(n)},Ne.apply(o,arguments),o}function ct(){var e=Ut().unknown(void 0),t=e.domain,r=e.range,n=0,o=1,i,a,u=!1,d=0,l=0,y=.5;delete e.unknown;function x(){var w=t().length,_=o<n,F=_?o:n,M=_?n:o;i=(M-F)/Math.max(1,w-d+l*2),u&&(i=Math.floor(i)),F+=(M-F-i*(w-d))*y,a=i*(1-d),u&&(F=Math.round(F),a=Math.round(a));var z=lt(w).map(function(R){return F+i*R});return r(_?z.reverse():z)}return e.domain=function(w){return arguments.length?(t(w),x()):t()},e.range=function(w){return arguments.length?([n,o]=w,n=+n,o=+o,x()):[n,o]},e.rangeRound=function(w){return[n,o]=w,n=+n,o=+o,u=!0,x()},e.bandwidth=function(){return a},e.step=function(){return i},e.round=function(w){return arguments.length?(u=!!w,x()):u},e.padding=function(w){return arguments.length?(d=Math.min(1,l=+w),x()):d},e.paddingInner=function(w){return arguments.length?(d=Math.min(1,w),x()):d},e.paddingOuter=function(w){return arguments.length?(l=+w,x()):l},e.align=function(w){return arguments.length?(y=Math.max(0,Math.min(1,w)),x()):y},e.copy=function(){return ct(t(),[n,o]).round(u).paddingInner(d).paddingOuter(l).align(y)},Ne.apply(x(),arguments)}function tn(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return tn(t())},e}function rn(){return tn(ct.apply(null,arguments).paddingInner(1))}p();p();p();p();p();p();p();function $t(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function sr(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function ht(){}var mt=.7,Rt=1/mt,Qe="\\s*([+-]?\\d+)\\s*",pt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ri=/^#([0-9a-f]{3,8})$/,ni=new RegExp(`^rgb\\(${Qe},${Qe},${Qe}\\)$`),oi=new RegExp(`^rgb\\(${xe},${xe},${xe}\\)$`),ii=new RegExp(`^rgba\\(${Qe},${Qe},${Qe},${pt}\\)$`),ai=new RegExp(`^rgba\\(${xe},${xe},${xe},${pt}\\)$`),ui=new RegExp(`^hsl\\(${pt},${xe},${xe}\\)$`),fi=new RegExp(`^hsla\\(${pt},${xe},${xe},${pt}\\)$`),nn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};$t(ht,ke,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:on,formatHex:on,formatHex8:si,formatHsl:li,formatRgb:an,toString:an});function on(){return this.rgb().formatHex()}function si(){return this.rgb().formatHex8()}function li(){return mn(this).formatHsl()}function an(){return this.rgb().formatRgb()}function ke(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=ri.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?un(t):r===3?new se(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Ft(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Ft(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=ni.exec(e))?new se(t[1],t[2],t[3],1):(t=oi.exec(e))?new se(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ii.exec(e))?Ft(t[1],t[2],t[3],t[4]):(t=ai.exec(e))?Ft(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ui.exec(e))?ln(t[1],t[2]/100,t[3]/100,1):(t=fi.exec(e))?ln(t[1],t[2]/100,t[3]/100,t[4]):nn.hasOwnProperty(e)?un(nn[e]):e==="transparent"?new se(NaN,NaN,NaN,0):null}function un(e){return new se(e>>16&255,e>>8&255,e&255,1)}function Ft(e,t,r,n){return n<=0&&(e=t=r=NaN),new se(e,t,r,n)}function ci(e){return e instanceof ht||(e=ke(e)),e?(e=e.rgb(),new se(e.r,e.g,e.b,e.opacity)):new se}function Ge(e,t,r,n){return arguments.length===1?ci(e):new se(e,t,r,n??1)}function se(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}$t(se,Ge,sr(ht,{brighter(e){return e=e==null?Rt:Math.pow(Rt,e),new se(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?mt:Math.pow(mt,e),new se(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new se(Ie(this.r),Ie(this.g),Ie(this.b),It(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:fn,formatHex:fn,formatHex8:mi,formatRgb:sn,toString:sn}));function fn(){return`#${Re(this.r)}${Re(this.g)}${Re(this.b)}`}function mi(){return`#${Re(this.r)}${Re(this.g)}${Re(this.b)}${Re((isNaN(this.opacity)?1:this.opacity)*255)}`}function sn(){let e=It(this.opacity);return`${e===1?"rgb(":"rgba("}${Ie(this.r)}, ${Ie(this.g)}, ${Ie(this.b)}${e===1?")":`, ${e})`}`}function It(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ie(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Re(e){return e=Ie(e),(e<16?"0":"")+e.toString(16)}function ln(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new pe(e,t,r,n)}function mn(e){if(e instanceof pe)return new pe(e.h,e.s,e.l,e.opacity);if(e instanceof ht||(e=ke(e)),!e)return new pe;if(e instanceof pe)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,o=Math.min(t,r,n),i=Math.max(t,r,n),a=NaN,u=i-o,d=(i+o)/2;return u?(t===i?a=(r-n)/u+(r<n)*6:r===i?a=(n-t)/u+2:a=(t-r)/u+4,u/=d<.5?i+o:2-i-o,a*=60):u=d>0&&d<1?0:a,new pe(a,u,d,e.opacity)}function pn(e,t,r,n){return arguments.length===1?mn(e):new pe(e,t,r,n??1)}function pe(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}$t(pe,pn,sr(ht,{brighter(e){return e=e==null?Rt:Math.pow(Rt,e),new pe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?mt:Math.pow(mt,e),new pe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,o=2*r-n;return new se(lr(e>=240?e-240:e+120,o,n),lr(e,o,n),lr(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new pe(cn(this.h),Et(this.s),Et(this.l),It(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=It(this.opacity);return`${e===1?"hsl(":"hsla("}${cn(this.h)}, ${Et(this.s)*100}%, ${Et(this.l)*100}%${e===1?")":`, ${e})`}`}}));function cn(e){return e=(e||0)%360,e<0?e+360:e}function Et(e){return Math.max(0,Math.min(1,e||0))}function lr(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}p();p();function cr(e,t,r,n,o){var i=e*e,a=i*e;return((1-3*e+3*i-a)*t+(4-6*i+3*a)*r+(1+3*e+3*i-3*a)*n+a*o)/6}function hn(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),o=e[n],i=e[n+1],a=n>0?e[n-1]:2*o-i,u=n<t-1?e[n+2]:2*i-o;return cr((r-n/t)*t,a,o,i,u)}}p();function dn(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),o=e[(n+t-1)%t],i=e[n%t],a=e[(n+1)%t],u=e[(n+2)%t];return cr((r-n/t)*t,o,i,a,u)}}p();p();var dt=e=>()=>e;function pi(e,t){return function(r){return e+r*t}}function hi(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function gn(e){return(e=+e)==1?Lt:function(t,r){return r-t?hi(t,r,e):dt(isNaN(t)?r:t)}}function Lt(e,t){var r=t-e;return r?pi(e,r):dt(isNaN(e)?t:e)}var mr=(function e(t){var r=gn(t);function n(o,i){var a=r((o=Ge(o)).r,(i=Ge(i)).r),u=r(o.g,i.g),d=r(o.b,i.b),l=Lt(o.opacity,i.opacity);return function(y){return o.r=a(y),o.g=u(y),o.b=d(y),o.opacity=l(y),o+""}}return n.gamma=e,n})(1);function xn(e){return function(t){var r=t.length,n=new Array(r),o=new Array(r),i=new Array(r),a,u;for(a=0;a<r;++a)u=Ge(t[a]),n[a]=u.r||0,o[a]=u.g||0,i[a]=u.b||0;return n=e(n),o=e(o),i=e(i),u.opacity=1,function(d){return u.r=n(d),u.g=o(d),u.b=i(d),u+""}}}var Af=xn(hn),Uf=xn(dn);p();p();function Ot(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),o;return function(i){for(o=0;o<r;++o)n[o]=e[o]*(1-i)+t[o]*i;return n}}function Pt(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yn(e,t){return(Pt(t)?Ot:pr)(e,t)}function pr(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,o=new Array(n),i=new Array(r),a;for(a=0;a<n;++a)o[a]=_e(e[a],t[a]);for(;a<r;++a)i[a]=t[a];return function(u){for(a=0;a<n;++a)i[a]=o[a](u);return i}}p();function wn(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}p();function Me(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}p();function bn(e,t){var r={},n={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?r[o]=_e(e[o],t[o]):n[o]=t[o];return function(i){for(o in r)n[o]=r[o](i);return n}}p();var dr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hr=new RegExp(dr.source,"g");function di(e){return function(){return e}}function gi(e){return function(t){return e(t)+""}}function Mn(e,t){var r=dr.lastIndex=hr.lastIndex=0,n,o,i,a=-1,u=[],d=[];for(e=e+"",t=t+"";(n=dr.exec(e))&&(o=hr.exec(t));)(i=o.index)>r&&(i=t.slice(r,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(o=o[0])?u[a]?u[a]+=o:u[++a]=o:(u[++a]=null,d.push({i:a,x:Me(n,o)})),r=hr.lastIndex;return r<t.length&&(i=t.slice(r),u[a]?u[a]+=i:u[++a]=i),u.length<2?d[0]?gi(d[0].x):di(t):(t=d.length,function(l){for(var y=0,x;y<t;++y)u[(x=d[y]).i]=x.x(l);return u.join("")})}function _e(e,t){var r=typeof t,n;return t==null||r==="boolean"?dt(t):(r==="number"?Me:r==="string"?(n=ke(t))?(t=n,mr):Mn:t instanceof ke?mr:t instanceof Date?wn:Pt(t)?Ot:Array.isArray(t)?pr:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?bn:Me)(e,t)}p();function gr(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}p();function xr(e){return function(){return e}}p();function yr(e){return+e}var vn=[0,1];function Je(e){return e}function wr(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:xr(isNaN(t)?NaN:.5)}function xi(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function yi(e,t,r){var n=e[0],o=e[1],i=t[0],a=t[1];return o<n?(n=wr(o,n),i=r(a,i)):(n=wr(n,o),i=r(i,a)),function(u){return i(n(u))}}function wi(e,t,r){var n=Math.min(e.length,t.length)-1,o=new Array(n),i=new Array(n),a=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++a<n;)o[a]=wr(e[a],e[a+1]),i[a]=r(t[a],t[a+1]);return function(u){var d=ir(e,u,1,n)-1;return i[d](o[d](u))}}function Ht(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function bi(){var e=vn,t=vn,r=_e,n,o,i,a=Je,u,d,l;function y(){var w=Math.min(e.length,t.length);return a!==Je&&(a=xi(e[0],e[w-1])),u=w>2?wi:yi,d=l=null,x}function x(w){return w==null||isNaN(w=+w)?i:(d||(d=u(e.map(n),t,r)))(n(a(w)))}return x.invert=function(w){return a(o((l||(l=u(t,e.map(n),Me)))(w)))},x.domain=function(w){return arguments.length?(e=Array.from(w,yr),y()):e.slice()},x.range=function(w){return arguments.length?(t=Array.from(w),y()):t.slice()},x.rangeRound=function(w){return t=Array.from(w),r=gr,y()},x.clamp=function(w){return arguments.length?(a=w?!0:Je,y()):a!==Je},x.interpolate=function(w){return arguments.length?(r=w,y()):r},x.unknown=function(w){return arguments.length?(i=w,x):i},function(w,_){return n=w,o=_,y()}}function gt(){return bi()(Je,Je)}p();p();p();p();p();p();function Tn(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Le(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ye(e){return e=Le(Math.abs(e)),e?e[1]:NaN}p();function Sn(e,t){return function(r,n){for(var o=r.length,i=[],a=0,u=e[0],d=0;o>0&&u>0&&(d+u+1>n&&(u=Math.max(1,n-d)),i.push(r.substring(o-=u,o+u)),!((d+=u+1)>n));)u=e[a=(a+1)%e.length];return i.reverse().join(t)}}p();function Nn(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}p();var Mi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function De(e){if(!(t=Mi.exec(e)))throw new Error("invalid format: "+e);var t;return new Yt({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}De.prototype=Yt.prototype;function Yt(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Yt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};p();function kn(e){e:for(var t=e.length,r=1,n=-1,o;r<t;++r)switch(e[r]){case".":n=o=r;break;case"0":n===0&&(n=r),o=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(o+1):e}p();p();var xt;function _n(e,t){var r=Le(e,t);if(!r)return xt=void 0,e.toPrecision(t);var n=r[0],o=r[1],i=o-(xt=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,a=n.length;return i===a?n:i>a?n+new Array(i-a+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+Le(e,Math.max(0,t+i-1))[0]}p();function br(e,t){var r=Le(e,t);if(!r)return e+"";var n=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+new Array(o-n.length+2).join("0")}var Mr={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Tn,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>br(e*100,t),r:br,s:_n,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};p();function vr(e){return e}var Dn=Array.prototype.map,Cn=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function An(e){var t=e.grouping===void 0||e.thousands===void 0?vr:Sn(Dn.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?vr:Nn(Dn.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"\u2212":e.minus+"",d=e.nan===void 0?"NaN":e.nan+"";function l(x,w){x=De(x);var _=x.fill,F=x.align,M=x.sign,z=x.symbol,R=x.zero,B=x.width,L=x.comma,O=x.precision,Y=x.trim,D=x.type;D==="n"?(L=!0,D="g"):Mr[D]||(O===void 0&&(O=12),Y=!0,D="g"),(R||_==="0"&&F==="=")&&(R=!0,_="0",F="=");var X=(w&&w.prefix!==void 0?w.prefix:"")+(z==="$"?r:z==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),J=(z==="$"?n:/[%p]/.test(D)?a:"")+(w&&w.suffix!==void 0?w.suffix:""),ue=Mr[D],q=/[defgprs%]/.test(D);O=O===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,O)):Math.max(0,Math.min(20,O));function K(E){var I=X,P=J,re,f,s;if(D==="c")P=ue(E)+P,E="";else{E=+E;var g=E<0||1/E<0;if(E=isNaN(E)?d:ue(Math.abs(E),O),Y&&(E=kn(E)),g&&+E==0&&M!=="+"&&(g=!1),I=(g?M==="("?M:u:M==="-"||M==="("?"":M)+I,P=(D==="s"&&!isNaN(E)&&xt!==void 0?Cn[8+xt/3]:"")+P+(g&&M==="("?")":""),q){for(re=-1,f=E.length;++re<f;)if(s=E.charCodeAt(re),48>s||s>57){P=(s===46?o+E.slice(re+1):E.slice(re))+P,E=E.slice(0,re);break}}}L&&!R&&(E=t(E,1/0));var c=I.length+E.length+P.length,h=c<B?new Array(B-c+1).join(_):"";switch(L&&R&&(E=t(h+E,h.length?B-P.length:1/0),h=""),F){case"<":E=I+E+P+h;break;case"=":E=I+h+E+P;break;case"^":E=h.slice(0,c=h.length>>1)+I+E+P+h.slice(c);break;default:E=h+I+E+P;break}return i(E)}return K.toString=function(){return x+""},K}function y(x,w){var _=Math.max(-8,Math.min(8,Math.floor(ye(w)/3)))*3,F=Math.pow(10,-_),M=l((x=De(x),x.type="f",x),{suffix:Cn[8+_/3]});return function(z){return M(F*z)}}return{format:l,formatPrefix:y}}var qt,yt,Wt;Tr({thousands:",",grouping:[3],currency:["$",""]});function Tr(e){return qt=An(e),yt=qt.format,Wt=qt.formatPrefix,qt}p();function Sr(e){return Math.max(0,-ye(Math.abs(e)))}p();function Nr(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ye(t)/3)))*3-ye(Math.abs(e)))}p();function kr(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ye(t)-ye(e))+1}function _r(e,t,r,n){var o=Ee(e,t,r),i;switch(n=De(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=Nr(o,a))&&(n.precision=i),Wt(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=kr(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=Sr(o))&&(n.precision=i-(n.type==="%")*2);break}}return yt(n)}function vi(e){var t=e.domain;return e.ticks=function(r){var n=t();return st(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return _r(o[0],o[o.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),o=0,i=n.length-1,a=n[o],u=n[i],d,l,y=10;for(u<a&&(l=a,a=u,u=l,l=o,o=i,i=l);y-- >0;){if(l=je(a,u,r),l===d)return n[o]=a,n[i]=u,t(n);if(l>0)a=Math.floor(a/l)*l,u=Math.ceil(u/l)*l;else if(l<0)a=Math.ceil(a*l)/l,u=Math.floor(u*l)/l;else break;d=l}return e},e}function Bt(){var e=gt();return e.copy=function(){return Ht(e,Bt())},Ne.apply(e,arguments),vi(e)}p();function Dr(e,t){e=e.slice();var r=0,n=e.length-1,o=e[r],i=e[n],a;return i<o&&(a=r,r=n,n=a,a=o,o=i,i=a),e[r]=t.floor(o),e[n]=t.ceil(i),e}p();p();p();var Cr=new Date,Ar=new Date;function Q(e,t,r,n){function o(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return o.floor=i=>(e(i=new Date(+i)),i),o.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),o.round=i=>{let a=o(i),u=o.ceil(i);return i-a<u-i?a:u},o.offset=(i,a)=>(t(i=new Date(+i),a==null?1:Math.floor(a)),i),o.range=(i,a,u)=>{let d=[];if(i=o.ceil(i),u=u==null?1:Math.floor(u),!(i<a)||!(u>0))return d;let l;do d.push(l=new Date(+i)),t(i,u),e(i);while(l<i&&i<a);return d},o.filter=i=>Q(a=>{if(a>=a)for(;e(a),!i(a);)a.setTime(a-1)},(a,u)=>{if(a>=a)if(u<0)for(;++u<=0;)for(;t(a,-1),!i(a););else for(;--u>=0;)for(;t(a,1),!i(a););}),r&&(o.count=(i,a)=>(Cr.setTime(+i),Ar.setTime(+a),e(Cr),e(Ar),Math.floor(r(Cr,Ar))),o.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?o.filter(n?a=>n(a)%i===0:a=>o.count(0,a)%i===0):o)),o}p();var wt=Q(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);wt.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Q(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):wt);var Yl=wt.range;p();var we=Q(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),Un=we.range;p();var Ke=Q(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),Ti=Ke.range,zt=Q(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),Si=zt.range;p();var et=Q(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),Ni=et.range,Vt=Q(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),ki=Vt.range;p();var ve=Q(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),_i=ve.range,Mt=Q(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),Di=Mt.range,Xt=Q(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),Ci=Xt.range;p();function He(e){return Q(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Te=He(0),tt=He(1),Fn=He(2),En=He(3),Ce=He(4),Rn=He(5),In=He(6),Ln=Te.range,Ai=tt.range,Ui=Fn.range,$i=En.range,Fi=Ce.range,Ei=Rn.range,Ri=In.range;function Ye(e){return Q(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var qe=Ye(0),rt=Ye(1),On=Ye(2),Pn=Ye(3),Ae=Ye(4),Hn=Ye(5),Yn=Ye(6),qn=qe.range,Ii=rt.range,Li=On.range,Oi=Pn.range,Pi=Ae.range,Hi=Hn.range,Yi=Yn.range;p();var nt=Q(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),qi=nt.range,Zt=Q(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),Wi=Zt.range;p();var le=Q(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());le.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Q(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});var Bi=le.range,he=Q(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());he.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Q(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});var zi=he.range;p();function Bn(e,t,r,n,o,i){let a=[[we,1,1e3],[we,5,5*1e3],[we,15,15*1e3],[we,30,30*1e3],[i,1,6e4],[i,5,5*6e4],[i,15,15*6e4],[i,30,30*6e4],[o,1,36e5],[o,3,3*36e5],[o,6,6*36e5],[o,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function u(l,y,x){let w=y<l;w&&([l,y]=[y,l]);let _=x&&typeof x.range=="function"?x:d(l,y,x),F=_?_.range(l,+y+1):[];return w?F.reverse():F}function d(l,y,x){let w=Math.abs(y-l)/x,_=Se(([,,z])=>z).right(a,w);if(_===a.length)return e.every(Ee(l/31536e6,y/31536e6,x));if(_===0)return wt.every(Math.max(Ee(l,y,x),1));let[F,M]=a[w/a[_-1][2]<a[_][2]/w?_-1:_];return F.every(M)}return[u,d]}var[Xi,Zi]=Bn(he,Zt,qe,Xt,Vt,zt),[Ur,$r]=Bn(le,nt,Te,ve,et,Ke);p();p();p();function Fr(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Er(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function vt(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function Rr(e){var t=e.dateTime,r=e.date,n=e.time,o=e.periods,i=e.days,a=e.shortDays,u=e.months,d=e.shortMonths,l=Tt(o),y=St(o),x=Tt(i),w=St(i),_=Tt(a),F=St(a),M=Tt(u),z=St(u),R=Tt(d),B=St(d),L={a:s,A:g,b:c,B:h,c:null,d:Qn,e:Qn,f:xa,g:_a,G:Ca,H:ha,I:da,j:ga,L:to,m:ya,M:wa,p:m,q:v,Q:Kn,s:eo,S:ba,u:Ma,U:va,V:Ta,w:Sa,W:Na,x:null,X:null,y:ka,Y:Da,Z:Aa,"%":Jn},O={a:T,A:k,b:C,B:A,c:null,d:Gn,e:Gn,f:Ea,g:Ba,G:Va,H:Ua,I:$a,j:Fa,L:no,m:Ra,M:Ia,p:$,q:G,Q:Kn,s:eo,S:La,u:Oa,U:Pa,V:Ha,w:Ya,W:qa,x:null,X:null,y:Wa,Y:za,Z:Xa,"%":Jn},Y={a:q,A:K,b:E,B:I,c:P,d:Zn,e:Zn,f:la,g:Xn,G:Vn,H:jn,I:jn,j:aa,L:sa,m:ia,M:ua,p:ue,q:oa,Q:ma,s:pa,S:fa,u:Ki,U:ea,V:ta,w:Ji,W:ra,x:re,X:f,y:Xn,Y:Vn,Z:na,"%":ca};L.x=D(r,L),L.X=D(n,L),L.c=D(t,L),O.x=D(r,O),O.X=D(n,O),O.c=D(t,O);function D(S,H){return function(U){var b=[],te=-1,V=0,ie=S.length,ne,ce,Xe;for(U instanceof Date||(U=new Date(+U));++te<ie;)S.charCodeAt(te)===37&&(b.push(S.slice(V,te)),(ce=zn[ne=S.charAt(++te)])!=null?ne=S.charAt(++te):ce=ne==="e"?" ":"0",(Xe=H[ne])&&(ne=Xe(U,ce)),b.push(ne),V=te+1);return b.push(S.slice(V,te)),b.join("")}}function X(S,H){return function(U){var b=vt(1900,void 0,1),te=J(b,S,U+="",0),V,ie;if(te!=U.length)return null;if("Q"in b)return new Date(b.Q);if("s"in b)return new Date(b.s*1e3+("L"in b?b.L:0));if(H&&!("Z"in b)&&(b.Z=0),"p"in b&&(b.H=b.H%12+b.p*12),b.m===void 0&&(b.m="q"in b?b.q:0),"V"in b){if(b.V<1||b.V>53)return null;"w"in b||(b.w=1),"Z"in b?(V=Er(vt(b.y,0,1)),ie=V.getUTCDay(),V=ie>4||ie===0?rt.ceil(V):rt(V),V=Mt.offset(V,(b.V-1)*7),b.y=V.getUTCFullYear(),b.m=V.getUTCMonth(),b.d=V.getUTCDate()+(b.w+6)%7):(V=Fr(vt(b.y,0,1)),ie=V.getDay(),V=ie>4||ie===0?tt.ceil(V):tt(V),V=ve.offset(V,(b.V-1)*7),b.y=V.getFullYear(),b.m=V.getMonth(),b.d=V.getDate()+(b.w+6)%7)}else("W"in b||"U"in b)&&("w"in b||(b.w="u"in b?b.u%7:"W"in b?1:0),ie="Z"in b?Er(vt(b.y,0,1)).getUTCDay():Fr(vt(b.y,0,1)).getDay(),b.m=0,b.d="W"in b?(b.w+6)%7+b.W*7-(ie+5)%7:b.w+b.U*7-(ie+6)%7);return"Z"in b?(b.H+=b.Z/100|0,b.M+=b.Z%100,Er(b)):Fr(b)}}function J(S,H,U,b){for(var te=0,V=H.length,ie=U.length,ne,ce;te<V;){if(b>=ie)return-1;if(ne=H.charCodeAt(te++),ne===37){if(ne=H.charAt(te++),ce=Y[ne in zn?H.charAt(te++):ne],!ce||(b=ce(S,U,b))<0)return-1}else if(ne!=U.charCodeAt(b++))return-1}return b}function ue(S,H,U){var b=l.exec(H.slice(U));return b?(S.p=y.get(b[0].toLowerCase()),U+b[0].length):-1}function q(S,H,U){var b=_.exec(H.slice(U));return b?(S.w=F.get(b[0].toLowerCase()),U+b[0].length):-1}function K(S,H,U){var b=x.exec(H.slice(U));return b?(S.w=w.get(b[0].toLowerCase()),U+b[0].length):-1}function E(S,H,U){var b=R.exec(H.slice(U));return b?(S.m=B.get(b[0].toLowerCase()),U+b[0].length):-1}function I(S,H,U){var b=M.exec(H.slice(U));return b?(S.m=z.get(b[0].toLowerCase()),U+b[0].length):-1}function P(S,H,U){return J(S,t,H,U)}function re(S,H,U){return J(S,r,H,U)}function f(S,H,U){return J(S,n,H,U)}function s(S){return a[S.getDay()]}function g(S){return i[S.getDay()]}function c(S){return d[S.getMonth()]}function h(S){return u[S.getMonth()]}function m(S){return o[+(S.getHours()>=12)]}function v(S){return 1+~~(S.getMonth()/3)}function T(S){return a[S.getUTCDay()]}function k(S){return i[S.getUTCDay()]}function C(S){return d[S.getUTCMonth()]}function A(S){return u[S.getUTCMonth()]}function $(S){return o[+(S.getUTCHours()>=12)]}function G(S){return 1+~~(S.getUTCMonth()/3)}return{format:function(S){var H=D(S+="",L);return H.toString=function(){return S},H},parse:function(S){var H=X(S+="",!1);return H.toString=function(){return S},H},utcFormat:function(S){var H=D(S+="",O);return H.toString=function(){return S},H},utcParse:function(S){var H=X(S+="",!0);return H.toString=function(){return S},H}}}var zn={"-":"",_:" ",0:"0"},oe=/^\s*\d+/,ji=/^%/,Qi=/[\\^$*+?|[\]().{}]/g;function j(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",i=o.length;return n+(i<r?new Array(r-i+1).join(t)+o:o)}function Gi(e){return e.replace(Qi,"\\$&")}function Tt(e){return new RegExp("^(?:"+e.map(Gi).join("|")+")","i")}function St(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Ji(e,t,r){var n=oe.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Ki(e,t,r){var n=oe.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function ea(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function ta(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function ra(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function Vn(e,t,r){var n=oe.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function Xn(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function na(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function oa(e,t,r){var n=oe.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function ia(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Zn(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function aa(e,t,r){var n=oe.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function jn(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function ua(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function fa(e,t,r){var n=oe.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function sa(e,t,r){var n=oe.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function la(e,t,r){var n=oe.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function ca(e,t,r){var n=ji.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function ma(e,t,r){var n=oe.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function pa(e,t,r){var n=oe.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function Qn(e,t){return j(e.getDate(),t,2)}function ha(e,t){return j(e.getHours(),t,2)}function da(e,t){return j(e.getHours()%12||12,t,2)}function ga(e,t){return j(1+ve.count(le(e),e),t,3)}function to(e,t){return j(e.getMilliseconds(),t,3)}function xa(e,t){return to(e,t)+"000"}function ya(e,t){return j(e.getMonth()+1,t,2)}function wa(e,t){return j(e.getMinutes(),t,2)}function ba(e,t){return j(e.getSeconds(),t,2)}function Ma(e){var t=e.getDay();return t===0?7:t}function va(e,t){return j(Te.count(le(e)-1,e),t,2)}function ro(e){var t=e.getDay();return t>=4||t===0?Ce(e):Ce.ceil(e)}function Ta(e,t){return e=ro(e),j(Ce.count(le(e),e)+(le(e).getDay()===4),t,2)}function Sa(e){return e.getDay()}function Na(e,t){return j(tt.count(le(e)-1,e),t,2)}function ka(e,t){return j(e.getFullYear()%100,t,2)}function _a(e,t){return e=ro(e),j(e.getFullYear()%100,t,2)}function Da(e,t){return j(e.getFullYear()%1e4,t,4)}function Ca(e,t){var r=e.getDay();return e=r>=4||r===0?Ce(e):Ce.ceil(e),j(e.getFullYear()%1e4,t,4)}function Aa(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+j(t/60|0,"0",2)+j(t%60,"0",2)}function Gn(e,t){return j(e.getUTCDate(),t,2)}function Ua(e,t){return j(e.getUTCHours(),t,2)}function $a(e,t){return j(e.getUTCHours()%12||12,t,2)}function Fa(e,t){return j(1+Mt.count(he(e),e),t,3)}function no(e,t){return j(e.getUTCMilliseconds(),t,3)}function Ea(e,t){return no(e,t)+"000"}function Ra(e,t){return j(e.getUTCMonth()+1,t,2)}function Ia(e,t){return j(e.getUTCMinutes(),t,2)}function La(e,t){return j(e.getUTCSeconds(),t,2)}function Oa(e){var t=e.getUTCDay();return t===0?7:t}function Pa(e,t){return j(qe.count(he(e)-1,e),t,2)}function oo(e){var t=e.getUTCDay();return t>=4||t===0?Ae(e):Ae.ceil(e)}function Ha(e,t){return e=oo(e),j(Ae.count(he(e),e)+(he(e).getUTCDay()===4),t,2)}function Ya(e){return e.getUTCDay()}function qa(e,t){return j(rt.count(he(e)-1,e),t,2)}function Wa(e,t){return j(e.getUTCFullYear()%100,t,2)}function Ba(e,t){return e=oo(e),j(e.getUTCFullYear()%100,t,2)}function za(e,t){return j(e.getUTCFullYear()%1e4,t,4)}function Va(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Ae(e):Ae.ceil(e),j(e.getUTCFullYear()%1e4,t,4)}function Xa(){return"+0000"}function Jn(){return"%"}function Kn(e){return+e}function eo(e){return Math.floor(+e/1e3)}var ot,Nt,Ir,io,ao;Lr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Lr(e){return ot=Rr(e),Nt=ot.format,Ir=ot.parse,io=ot.utcFormat,ao=ot.utcParse,ot}function Za(e){return new Date(e)}function ja(e){return e instanceof Date?+e:+new Date(+e)}function uo(e,t,r,n,o,i,a,u,d,l){var y=gt(),x=y.invert,w=y.domain,_=l(".%L"),F=l(":%S"),M=l("%I:%M"),z=l("%I %p"),R=l("%a %d"),B=l("%b %d"),L=l("%B"),O=l("%Y");function Y(D){return(d(D)<D?_:u(D)<D?F:a(D)<D?M:i(D)<D?z:n(D)<D?o(D)<D?R:B:r(D)<D?L:O)(D)}return y.invert=function(D){return new Date(x(D))},y.domain=function(D){return arguments.length?w(Array.from(D,ja)):w().map(Za)},y.ticks=function(D){var X=w();return e(X[0],X[X.length-1],D??10)},y.tickFormat=function(D,X){return X==null?Y:l(X)},y.nice=function(D){var X=w();return(!D||typeof D.range!="function")&&(D=t(X[0],X[X.length-1],D??10)),D?w(Dr(X,D)):y},y.copy=function(){return Ht(y,uo(e,t,r,n,o,i,a,u,d,l))},y}function Or(){return Ne.apply(uo(Ur,$r,le,nt,Te,ve,et,Ke,we,Nt).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}p();p();p();function W(e){return function(){return e}}p();var Pr=Math.abs,ae=Math.atan2,Ue=Math.cos,fo=Math.max,jt=Math.min,de=Math.sin,We=Math.sqrt,fe=1e-12,it=Math.PI,kt=it/2,at=2*it;function so(e){return e>1?0:e<-1?it:Math.acos(e)}function Hr(e){return e>=1?kt:e<=-1?-kt:Math.asin(e)}p();p();p();var Yr=Math.PI,qr=2*Yr,Be=1e-6,Qa=qr-Be;function lo(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function Ga(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return lo;let r=10**t;return function(n){this._+=n[0];for(let o=1,i=n.length;o<i;++o)this._+=Math.round(arguments[o]*r)/r+n[o]}}var ze=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?lo:Ga(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,o){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+o}`}bezierCurveTo(t,r,n,o,i,a){this._append`C${+t},${+r},${+n},${+o},${this._x1=+i},${this._y1=+a}`}arcTo(t,r,n,o,i){if(t=+t,r=+r,n=+n,o=+o,i=+i,i<0)throw new Error(`negative radius: ${i}`);let a=this._x1,u=this._y1,d=n-t,l=o-r,y=a-t,x=u-r,w=y*y+x*x;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(w>Be)if(!(Math.abs(x*d-l*y)>Be)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let _=n-a,F=o-u,M=d*d+l*l,z=_*_+F*F,R=Math.sqrt(M),B=Math.sqrt(w),L=i*Math.tan((Yr-Math.acos((M+w-z)/(2*R*B)))/2),O=L/B,Y=L/R;Math.abs(O-1)>Be&&this._append`L${t+O*y},${r+O*x}`,this._append`A${i},${i},0,0,${+(x*_>y*F)},${this._x1=t+Y*d},${this._y1=r+Y*l}`}}arc(t,r,n,o,i,a){if(t=+t,r=+r,n=+n,a=!!a,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(o),d=n*Math.sin(o),l=t+u,y=r+d,x=1^a,w=a?o-i:i-o;this._x1===null?this._append`M${l},${y}`:(Math.abs(this._x1-l)>Be||Math.abs(this._y1-y)>Be)&&this._append`L${l},${y}`,n&&(w<0&&(w=w%qr+qr),w>Qa?this._append`A${n},${n},0,1,${x},${t-u},${r-d}A${n},${n},0,1,${x},${this._x1=l},${this._y1=y}`:w>Be&&this._append`A${n},${n},0,${+(w>=Yr)},${x},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+o}h${-n}Z`}toString(){return this._}};function co(){return new ze}co.prototype=ze.prototype;function ut(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new ze(t)}function Ja(e){return e.innerRadius}function Ka(e){return e.outerRadius}function eu(e){return e.startAngle}function tu(e){return e.endAngle}function ru(e){return e&&e.padAngle}function nu(e,t,r,n,o,i,a,u){var d=r-e,l=n-t,y=a-o,x=u-i,w=x*d-y*l;if(!(w*w<fe))return w=(y*(t-i)-x*(e-o))/w,[e+w*d,t+w*l]}function Qt(e,t,r,n,o,i,a){var u=e-r,d=t-n,l=(a?i:-i)/We(u*u+d*d),y=l*d,x=-l*u,w=e+y,_=t+x,F=r+y,M=n+x,z=(w+F)/2,R=(_+M)/2,B=F-w,L=M-_,O=B*B+L*L,Y=o-i,D=w*M-F*_,X=(L<0?-1:1)*We(fo(0,Y*Y*O-D*D)),J=(D*L-B*X)/O,ue=(-D*B-L*X)/O,q=(D*L+B*X)/O,K=(-D*B+L*X)/O,E=J-z,I=ue-R,P=q-z,re=K-R;return E*E+I*I>P*P+re*re&&(J=q,ue=K),{cx:J,cy:ue,x01:-y,y01:-x,x11:J*(o/Y-1),y11:ue*(o/Y-1)}}function mo(){var e=Ja,t=Ka,r=W(0),n=null,o=eu,i=tu,a=ru,u=null,d=ut(l);function l(){var y,x,w=+e.apply(this,arguments),_=+t.apply(this,arguments),F=o.apply(this,arguments)-kt,M=i.apply(this,arguments)-kt,z=Pr(M-F),R=M>F;if(u||(u=y=d()),_<w&&(x=_,_=w,w=x),!(_>fe))u.moveTo(0,0);else if(z>at-fe)u.moveTo(_*Ue(F),_*de(F)),u.arc(0,0,_,F,M,!R),w>fe&&(u.moveTo(w*Ue(M),w*de(M)),u.arc(0,0,w,M,F,R));else{var B=F,L=M,O=F,Y=M,D=z,X=z,J=a.apply(this,arguments)/2,ue=J>fe&&(n?+n.apply(this,arguments):We(w*w+_*_)),q=jt(Pr(_-w)/2,+r.apply(this,arguments)),K=q,E=q,I,P;if(ue>fe){var re=Hr(ue/w*de(J)),f=Hr(ue/_*de(J));(D-=re*2)>fe?(re*=R?1:-1,O+=re,Y-=re):(D=0,O=Y=(F+M)/2),(X-=f*2)>fe?(f*=R?1:-1,B+=f,L-=f):(X=0,B=L=(F+M)/2)}var s=_*Ue(B),g=_*de(B),c=w*Ue(Y),h=w*de(Y);if(q>fe){var m=_*Ue(L),v=_*de(L),T=w*Ue(O),k=w*de(O),C;if(z<it)if(C=nu(s,g,T,k,m,v,c,h)){var A=s-C[0],$=g-C[1],G=m-C[0],S=v-C[1],H=1/de(so((A*G+$*S)/(We(A*A+$*$)*We(G*G+S*S)))/2),U=We(C[0]*C[0]+C[1]*C[1]);K=jt(q,(w-U)/(H-1)),E=jt(q,(_-U)/(H+1))}else K=E=0}X>fe?E>fe?(I=Qt(T,k,s,g,_,E,R),P=Qt(m,v,c,h,_,E,R),u.moveTo(I.cx+I.x01,I.cy+I.y01),E<q?u.arc(I.cx,I.cy,E,ae(I.y01,I.x01),ae(P.y01,P.x01),!R):(u.arc(I.cx,I.cy,E,ae(I.y01,I.x01),ae(I.y11,I.x11),!R),u.arc(0,0,_,ae(I.cy+I.y11,I.cx+I.x11),ae(P.cy+P.y11,P.cx+P.x11),!R),u.arc(P.cx,P.cy,E,ae(P.y11,P.x11),ae(P.y01,P.x01),!R))):(u.moveTo(s,g),u.arc(0,0,_,B,L,!R)):u.moveTo(s,g),!(w>fe)||!(D>fe)?u.lineTo(c,h):K>fe?(I=Qt(c,h,m,v,w,-K,R),P=Qt(s,g,T,k,w,-K,R),u.lineTo(I.cx+I.x01,I.cy+I.y01),K<q?u.arc(I.cx,I.cy,K,ae(I.y01,I.x01),ae(P.y01,P.x01),!R):(u.arc(I.cx,I.cy,K,ae(I.y01,I.x01),ae(I.y11,I.x11),!R),u.arc(0,0,w,ae(I.cy+I.y11,I.cx+I.x11),ae(P.cy+P.y11,P.cx+P.x11),R),u.arc(P.cx,P.cy,K,ae(P.y11,P.x11),ae(P.y01,P.x01),!R))):u.arc(0,0,w,Y,O,R)}if(u.closePath(),y)return u=null,y+""||null}return l.centroid=function(){var y=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,x=(+o.apply(this,arguments)+ +i.apply(this,arguments))/2-it/2;return[Ue(x)*y,de(x)*y]},l.innerRadius=function(y){return arguments.length?(e=typeof y=="function"?y:W(+y),l):e},l.outerRadius=function(y){return arguments.length?(t=typeof y=="function"?y:W(+y),l):t},l.cornerRadius=function(y){return arguments.length?(r=typeof y=="function"?y:W(+y),l):r},l.padRadius=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:W(+y),l):n},l.startAngle=function(y){return arguments.length?(o=typeof y=="function"?y:W(+y),l):o},l.endAngle=function(y){return arguments.length?(i=typeof y=="function"?y:W(+y),l):i},l.padAngle=function(y){return arguments.length?(a=typeof y=="function"?y:W(+y),l):a},l.context=function(y){return arguments.length?(u=y??null,l):u},l}p();p();var xm=Array.prototype.slice;function $e(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}p();function po(e){this._context=e}po.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ft(e){return new po(e)}p();p();function Gt(e){return e[0]}function Jt(e){return e[1]}function Kt(e,t){var r=W(!0),n=null,o=ft,i=null,a=ut(u);e=typeof e=="function"?e:e===void 0?Gt:W(e),t=typeof t=="function"?t:t===void 0?Jt:W(t);function u(d){var l,y=(d=$e(d)).length,x,w=!1,_;for(n==null&&(i=o(_=a())),l=0;l<=y;++l)!(l<y&&r(x=d[l],l,d))===w&&((w=!w)?i.lineStart():i.lineEnd()),w&&i.point(+e(x,l,d),+t(x,l,d));if(_)return i=null,_+""||null}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:W(+d),u):e},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:W(+d),u):t},u.defined=function(d){return arguments.length?(r=typeof d=="function"?d:W(!!d),u):r},u.curve=function(d){return arguments.length?(o=d,n!=null&&(i=o(n)),u):o},u.context=function(d){return arguments.length?(d==null?n=i=null:i=o(n=d),u):n},u}function ho(e,t,r){var n=null,o=W(!0),i=null,a=ft,u=null,d=ut(l);e=typeof e=="function"?e:e===void 0?Gt:W(+e),t=typeof t=="function"?t:t===void 0?W(0):W(+t),r=typeof r=="function"?r:r===void 0?Jt:W(+r);function l(x){var w,_,F,M=(x=$e(x)).length,z,R=!1,B,L=new Array(M),O=new Array(M);for(i==null&&(u=a(B=d())),w=0;w<=M;++w){if(!(w<M&&o(z=x[w],w,x))===R)if(R=!R)_=w,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),F=w-1;F>=_;--F)u.point(L[F],O[F]);u.lineEnd(),u.areaEnd()}R&&(L[w]=+e(z,w,x),O[w]=+t(z,w,x),u.point(n?+n(z,w,x):L[w],r?+r(z,w,x):O[w]))}if(B)return u=null,B+""||null}function y(){return Kt().defined(o).curve(a).context(i)}return l.x=function(x){return arguments.length?(e=typeof x=="function"?x:W(+x),n=null,l):e},l.x0=function(x){return arguments.length?(e=typeof x=="function"?x:W(+x),l):e},l.x1=function(x){return arguments.length?(n=x==null?null:typeof x=="function"?x:W(+x),l):n},l.y=function(x){return arguments.length?(t=typeof x=="function"?x:W(+x),r=null,l):t},l.y0=function(x){return arguments.length?(t=typeof x=="function"?x:W(+x),l):t},l.y1=function(x){return arguments.length?(r=x==null?null:typeof x=="function"?x:W(+x),l):r},l.lineX0=l.lineY0=function(){return y().x(e).y(t)},l.lineY1=function(){return y().x(e).y(r)},l.lineX1=function(){return y().x(n).y(t)},l.defined=function(x){return arguments.length?(o=typeof x=="function"?x:W(!!x),l):o},l.curve=function(x){return arguments.length?(a=x,i!=null&&(u=a(i)),l):a},l.context=function(x){return arguments.length?(x==null?i=u=null:u=a(i=x),l):i},l}p();p();function go(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}p();function xo(e){return e}function yo(){var e=xo,t=go,r=null,n=W(0),o=W(at),i=W(0);function a(u){var d,l=(u=$e(u)).length,y,x,w=0,_=new Array(l),F=new Array(l),M=+n.apply(this,arguments),z=Math.min(at,Math.max(-at,o.apply(this,arguments)-M)),R,B=Math.min(Math.abs(z)/l,i.apply(this,arguments)),L=B*(z<0?-1:1),O;for(d=0;d<l;++d)(O=F[_[d]=d]=+e(u[d],d,u))>0&&(w+=O);for(t!=null?_.sort(function(Y,D){return t(F[Y],F[D])}):r!=null&&_.sort(function(Y,D){return r(u[Y],u[D])}),d=0,x=w?(z-l*L)/w:0;d<l;++d,M=R)y=_[d],O=F[y],R=M+(O>0?O*x:0)+L,F[y]={data:u[y],index:d,value:O,startAngle:M,endAngle:R,padAngle:B};return F}return a.value=function(u){return arguments.length?(e=typeof u=="function"?u:W(+u),a):e},a.sortValues=function(u){return arguments.length?(t=u,r=null,a):t},a.sort=function(u){return arguments.length?(r=u,t=null,a):r},a.startAngle=function(u){return arguments.length?(n=typeof u=="function"?u:W(+u),a):n},a.endAngle=function(u){return arguments.length?(o=typeof u=="function"?u:W(+u),a):o},a.padAngle=function(u){return arguments.length?(i=typeof u=="function"?u:W(+u),a):i},a}p();function wo(e){return e<0?-1:1}function bo(e,t,r){var n=e._x1-e._x0,o=t-e._x1,i=(e._y1-e._y0)/(n||o<0&&-0),a=(r-e._y1)/(o||n<0&&-0),u=(i*o+a*n)/(n+o);return(wo(i)+wo(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(u))||0}function Mo(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Wr(e,t,r){var n=e._x0,o=e._y0,i=e._x1,a=e._y1,u=(i-n)/3;e._context.bezierCurveTo(n+u,o+u*t,i-u,a-u*r,i,a)}function er(e){this._context=e}er.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Wr(this,this._t0,Mo(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Wr(this,Mo(this,r=bo(this,e,t)),r);break;default:Wr(this,this._t0,r=bo(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function ou(e){this._context=new vo(e)}(ou.prototype=Object.create(er.prototype)).point=function(e,t){er.prototype.point.call(this,t,e)};function vo(e){this._context=e}vo.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,o,i){this._context.bezierCurveTo(t,e,n,r,i,o)}};function To(e){return new er(e)}p();function No(e){this._context=e}No.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=So(e),o=So(t),i=0,a=1;a<r;++i,++a)this._context.bezierCurveTo(n[0][i],o[0][i],n[1][i],o[1][i],e[a],t[a]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function So(e){var t,r=e.length-1,n,o=new Array(r),i=new Array(r),a=new Array(r);for(o[0]=0,i[0]=2,a[0]=e[0]+2*e[1],t=1;t<r-1;++t)o[t]=1,i[t]=4,a[t]=4*e[t]+2*e[t+1];for(o[r-1]=2,i[r-1]=7,a[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=o[t]/i[t-1],i[t]-=n,a[t]-=n*a[t-1];for(o[r-1]=a[r-1]/i[r-1],t=r-2;t>=0;--t)o[t]=(a[t]-o[t+1])/i[t];for(i[r-1]=(e[r]+o[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-o[t+1];return[o,i]}function ko(e){return new No(e)}p();function tr(e,t){this._context=e,this._t=t}tr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function _o(e){return new tr(e,.5)}function Do(e){return new tr(e,0)}function Co(e){return new tr(e,1)}p();p();function Ve(e,t){if((a=e.length)>1)for(var r=1,n,o,i=e[t[0]],a,u=i.length;r<a;++r)for(o=i,i=e[t[r]],n=0;n<u;++n)i[n][1]+=i[n][0]=isNaN(o[n][1])?o[n][0]:o[n][1]}p();function _t(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function iu(e,t){return e[t]}function au(e){let t=[];return t.key=e,t}function Ao(){var e=W([]),t=_t,r=Ve,n=iu;function o(i){var a=Array.from(e.apply(this,arguments),au),u,d=a.length,l=-1,y;for(let x of i)for(u=0,++l;u<d;++u)(a[u][l]=[0,+n(x,a[u].key,l,i)]).data=x;for(u=0,y=$e(t(a));u<d;++u)a[y[u]].index=u;return r(a,y),a}return o.keys=function(i){return arguments.length?(e=typeof i=="function"?i:W(Array.from(i)),o):e},o.value=function(i){return arguments.length?(n=typeof i=="function"?i:W(+i),o):n},o.order=function(i){return arguments.length?(t=i==null?_t:typeof i=="function"?i:W(Array.from(i)),o):t},o.offset=function(i){return arguments.length?(r=i??Ve,o):r},o}p();function Uo(e,t){if((n=e.length)>0){for(var r,n,o=0,i=e[0].length,a;o<i;++o){for(a=r=0;r<n;++r)a+=e[r][o][1]||0;if(a)for(r=0;r<n;++r)e[r][o][1]/=a}Ve(e,t)}}p();function $o(e,t){if((d=e.length)>0)for(var r,n=0,o,i,a,u,d,l=e[t[0]].length;n<l;++n)for(a=u=0,r=0;r<d;++r)(i=(o=e[t[r]][n])[1]-o[0])>0?(o[0]=a,o[1]=a+=i):i<0?(o[1]=u,o[0]=u+=i):(o[0]=0,o[1]=i)}p();var Z=Qr(Br(),1);p();var zr=Qr(Br(),1);function Vr(e){let t;return e===0?t=1:t=Math.floor(new zr.default(e).abs().log(10).toNumber())+1,t}function Xr(e,t,r){let n=new zr.default(e),o=0,i=[];for(;n.lt(t)&&o<1e5;)i.push(n.toNumber()),n=n.add(r),o++;return i}var Eo=([e,t])=>{let[r,n]=[e,t];return e>t&&([r,n]=[t,e]),[r,n]},Zr=(e,t,r)=>{if(e.lte(0))return new Z.default(0);let n=Vr(e.toNumber()),o=new Z.default(10).pow(n),i=e.div(o),a=n!==1?.05:.1,d=new Z.default(Math.ceil(i.div(a).toNumber())).add(r).mul(a).mul(o);return t?new Z.default(d.toNumber()):new Z.default(Math.ceil(d.toNumber()))},Ro=(e,t,r)=>{if(e.lte(0))return new Z.default(0);let n=[1,2,2.5,5],o=e.toNumber(),i=Math.floor(new Z.default(o).abs().log(10).toNumber()),a=new Z.default(10).pow(i),u=e.div(a).toNumber(),d=n.findIndex(x=>x>=u-1e-10);if(d===-1&&(a=a.mul(10),d=0),d+=r,d>=n.length){let x=Math.floor(d/n.length);d%=n.length,a=a.mul(new Z.default(10).pow(x))}let l=n[d]??1,y=new Z.default(l).mul(a);return t?y:new Z.default(Math.ceil(y.toNumber()))},uu=(e,t,r)=>{let n=new Z.default(1),o=new Z.default(e);if(!o.isint()&&r){let u=Math.abs(e);u<1?(n=new Z.default(10).pow(Vr(e)-1),o=new Z.default(Math.floor(o.div(n).toNumber())).mul(n)):u>1&&(o=new Z.default(Math.floor(e)))}else e===0?o=new Z.default(Math.floor((t-1)/2)):r||(o=new Z.default(Math.floor(e)));let i=Math.floor((t-1)/2),a=[];for(let u=0;u<t;u++)a.push(o.add(new Z.default(u-i).mul(n)).toNumber());return a},Io=(e,t,r,n,o=0,i=Zr)=>{if(!Number.isFinite((t-e)/(r-1)))return{step:new Z.default(0),tickMin:new Z.default(0),tickMax:new Z.default(0)};let a=i(new Z.default(t).sub(e).div(r-1),n,o),u;e<=0&&t>=0?u=new Z.default(0):(u=new Z.default(e).add(t).div(2),u=u.sub(new Z.default(u).mod(a)));let d=Math.ceil(u.sub(e).div(a).toNumber()),l=Math.ceil(new Z.default(t).sub(u).div(a).toNumber()),y=d+l+1;return y>r?Io(e,t,r,n,o+1,i):(y<r&&(l=t>0?l+(r-y):l,d=t>0?d:d+(r-y)),{step:a,tickMin:u.sub(new Z.default(d).mul(a)),tickMax:u.add(new Z.default(l).mul(a))})},fu=([e,t],r=6,n=!0,o="auto")=>{let i=Math.max(r,2),[a,u]=Eo([e,t]);if(a===-1/0||u===1/0){let _=u===1/0?[a,...Array(r-1).fill(1/0)]:[...Array(r-1).fill(-1/0),u];return e>t?_.reverse():_}if(a===u)return uu(a,r,n);let d=o==="snap125"?Ro:Zr,{step:l,tickMin:y,tickMax:x}=Io(a,u,i,n,0,d),w=Xr(y,x.add(new Z.default(.1).mul(l)),l);return e>t?w.reverse():w},su=([e,t],r,n=!0,o="auto")=>{let[i,a]=Eo([e,t]);if(i===-1/0||a===1/0)return[e,t];if(i===a)return[i];let u=o==="snap125"?Ro:Zr,d=Math.max(r,2),l=u(new Z.default(a).sub(i).div(d-1),n,0),y=[...Xr(new Z.default(i),new Z.default(a),l),a];if(n===!1){y=y.map(w=>Math.round(w));let x=y.length-1;x>0&&y[x]===y[x-1]&&(y=y.slice(0,x))}return e>t?y.reverse():y};var P0=N;export{P0 as KERNEL_VERSIONS,mo as arc,ho as area,Se as bisector,ft as curveLinear,To as curveMonotoneX,ko as curveNatural,_o as curveStep,Co as curveStepAfter,Do as curveStepBefore,ar as extent,yt as format,fu as getNiceTickValues,su as getTickValuesFixedDomain,_e as interpolate,yn as interpolateArray,Me as interpolateNumber,Kt as line,ur as max,fr as min,yo as pie,lt as range,ct as scaleBand,Bt as scaleLinear,rn as scalePoint,Or as scaleTime,Ao as stack,$o as stackOffsetDiverging,Uo as stackOffsetExpand,Ve as stackOffsetNone,_t as stackOrderNone,je as tickIncrement,Ee as tickStep,st as ticks,Nt as timeFormat,Ir as timeParse};
@@ -0,0 +1,67 @@
1
+ // @poetry/charts - poetry-charts' Stimulus chrome controllers + the
2
+ // BYO-engine adapter seam, one source shipped over two channels:
3
+ // importmap-first (the engine pins this tree; zero build) and this same
4
+ // tree as the npm package for bundler hosts.
5
+
6
+ import ChartTooltipController from "@poetry/charts/tooltip_controller"
7
+ import ChartAdapterController from "@poetry/charts/adapter_controller"
8
+ import ChartMotionController from "@poetry/charts/motion_controller"
9
+ import ChartLiveController from "@poetry/charts/live_controller"
10
+ import ChartWindowController from "@poetry/charts/window_controller"
11
+ import { registerChartAdapter, chartAdapter, registeredAdapters } from "@poetry/charts/adapter_registry"
12
+ import { createChartJsAdapter } from "@poetry/charts/adapters/chartjs"
13
+
14
+ export {
15
+ ChartTooltipController,
16
+ ChartAdapterController,
17
+ ChartMotionController,
18
+ ChartLiveController,
19
+ ChartWindowController,
20
+ registerChartAdapter,
21
+ chartAdapter,
22
+ registeredAdapters,
23
+ createChartJsAdapter,
24
+ }
25
+
26
+ /**
27
+ * The bundler-host one-liner: registers the five chart controllers on
28
+ * the host's Stimulus application (importmap hosts get the same
29
+ * registrations via the engine's pins) and installs the morph guard
30
+ * below.
31
+ *
32
+ * @param {import("@hotwired/stimulus").Application} application
33
+ */
34
+ export function registerPoetryChartsControllers(application) {
35
+ application.register("poetry--charts--tooltip", ChartTooltipController)
36
+ application.register("poetry--charts--adapter", ChartAdapterController)
37
+ application.register("poetry--charts--motion", ChartMotionController)
38
+ application.register("poetry--charts--live", ChartLiveController)
39
+ application.register("poetry--charts--window", ChartWindowController)
40
+ installMorphGuard()
41
+ }
42
+
43
+ // Turbo page morphs (idiomorph) can rebuild an inline <svg> root in the
44
+ // XHTML namespace - an HTMLUnknownElement whose children are real SVG
45
+ // nodes but paint NOTHING (computed styles normal, every bbox 0x0). The
46
+ // corrupted subtree is REPLACED, not morphed, so no per-element event
47
+ // offers an interception point - instead, after every page morph, any
48
+ // chart svg in the wrong namespace is reparsed through the HTML parser
49
+ // (innerHTML handles svg foreign content correctly). This listener is
50
+ // registered at application boot, so it runs BEFORE the motion
51
+ // controller's own turbo:morph restart re-queries the svg.
52
+ const SVG_NS = "http://www.w3.org/2000/svg"
53
+ let morphGuardInstalled = false
54
+ function installMorphGuard() {
55
+ if (morphGuardInstalled || typeof document === "undefined") return
56
+ morphGuardInstalled = true
57
+
58
+ document.addEventListener("turbo:morph", () => {
59
+ for (const svg of document.querySelectorAll('[data-slot="chart-svg"]')) {
60
+ if (svg.namespaceURI === SVG_NS) continue
61
+ const holder = document.createElement("div")
62
+ holder.innerHTML = svg.outerHTML
63
+ const repaired = holder.querySelector("svg")
64
+ if (repaired) svg.replaceWith(repaired)
65
+ }
66
+ })
67
+ }