From 3ec9c9b56b6ea1876b9510ee96d12c69fd1bc6d6 Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Wed, 14 Feb 2024 13:02:11 -0500 Subject: [PATCH] Scaffold out the UI for individual account page (#461) * Add `AccountBalance` table for account views * Scaffold out account UI * Add D3 line chart scaffolding * Style fixes --- app/controllers/accounts_controller.rb | 35 ++- .../controllers/line_chart_controller.js | 258 ++++++++++++++++++ app/javascript/tailwindColors.js | 141 ++++++++++ app/models/account.rb | 1 + app/models/account_balance.rb | 3 + app/views/accounts/show.html.erb | 116 +++++++- app/views/layouts/application.html.erb | 2 +- config/importmap.rb | 39 +++ config/tailwind.config.js | 26 +- .../20240212150110_create_account_balances.rb | 14 + db/schema.rb | 14 +- test/fixtures/account_balances.yml | 13 + test/models/account_balance_test.rb | 7 + vendor/javascript/d3-array.js | 2 + vendor/javascript/d3-axis.js | 2 + vendor/javascript/d3-brush.js | 2 + vendor/javascript/d3-chord.js | 2 + vendor/javascript/d3-color.js | 2 + vendor/javascript/d3-contour.js | 2 + vendor/javascript/d3-delaunay.js | 2 + vendor/javascript/d3-dispatch.js | 2 + vendor/javascript/d3-drag.js | 2 + vendor/javascript/d3-dsv.js | 2 + vendor/javascript/d3-ease.js | 2 + vendor/javascript/d3-fetch.js | 2 + vendor/javascript/d3-force.js | 2 + vendor/javascript/d3-format.js | 2 + vendor/javascript/d3-geo.js | 2 + vendor/javascript/d3-hierarchy.js | 2 + vendor/javascript/d3-interpolate.js | 2 + vendor/javascript/d3-path.js | 2 + vendor/javascript/d3-polygon.js | 2 + vendor/javascript/d3-quadtree.js | 2 + vendor/javascript/d3-random.js | 2 + vendor/javascript/d3-scale-chromatic.js | 2 + vendor/javascript/d3-scale.js | 2 + vendor/javascript/d3-selection.js | 2 + vendor/javascript/d3-shape.js | 2 + vendor/javascript/d3-time-format.js | 2 + vendor/javascript/d3-time.js | 2 + vendor/javascript/d3-timer.js | 2 + vendor/javascript/d3-transition.js | 2 + vendor/javascript/d3-zoom.js | 2 + vendor/javascript/d3.js | 1 + vendor/javascript/delaunator.js | 2 + vendor/javascript/internmap.js | 2 + vendor/javascript/robust-predicates.js | 2 + 47 files changed, 724 insertions(+), 12 deletions(-) create mode 100644 app/javascript/controllers/line_chart_controller.js create mode 100644 app/javascript/tailwindColors.js create mode 100644 app/models/account_balance.rb create mode 100644 db/migrate/20240212150110_create_account_balances.rb create mode 100644 test/fixtures/account_balances.yml create mode 100644 test/models/account_balance_test.rb create mode 100644 vendor/javascript/d3-array.js create mode 100644 vendor/javascript/d3-axis.js create mode 100644 vendor/javascript/d3-brush.js create mode 100644 vendor/javascript/d3-chord.js create mode 100644 vendor/javascript/d3-color.js create mode 100644 vendor/javascript/d3-contour.js create mode 100644 vendor/javascript/d3-delaunay.js create mode 100644 vendor/javascript/d3-dispatch.js create mode 100644 vendor/javascript/d3-drag.js create mode 100644 vendor/javascript/d3-dsv.js create mode 100644 vendor/javascript/d3-ease.js create mode 100644 vendor/javascript/d3-fetch.js create mode 100644 vendor/javascript/d3-force.js create mode 100644 vendor/javascript/d3-format.js create mode 100644 vendor/javascript/d3-geo.js create mode 100644 vendor/javascript/d3-hierarchy.js create mode 100644 vendor/javascript/d3-interpolate.js create mode 100644 vendor/javascript/d3-path.js create mode 100644 vendor/javascript/d3-polygon.js create mode 100644 vendor/javascript/d3-quadtree.js create mode 100644 vendor/javascript/d3-random.js create mode 100644 vendor/javascript/d3-scale-chromatic.js create mode 100644 vendor/javascript/d3-scale.js create mode 100644 vendor/javascript/d3-selection.js create mode 100644 vendor/javascript/d3-shape.js create mode 100644 vendor/javascript/d3-time-format.js create mode 100644 vendor/javascript/d3-time.js create mode 100644 vendor/javascript/d3-timer.js create mode 100644 vendor/javascript/d3-transition.js create mode 100644 vendor/javascript/d3-zoom.js create mode 100644 vendor/javascript/d3.js create mode 100644 vendor/javascript/delaunator.js create mode 100644 vendor/javascript/internmap.js create mode 100644 vendor/javascript/robust-predicates.js diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index e1c4d234..5417530b 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -9,7 +9,9 @@ class AccountsController < ApplicationController end def show - @account = Current.family.accounts.find(params[:id]) + # Temporary while dummy data is being used + # @account = Current.family.accounts.find(params[:id]) + @account = sample_account end def create @@ -23,9 +25,40 @@ class AccountsController < ApplicationController end end + + private def account_params params.require(:account).permit(:name, :accountable_type, :original_balance, :original_currency, :subtype) end + + def sample_account + OpenStruct.new( + id: 1, + name: "Sample Account", + original_balance: BigDecimal("1115181"), + original_currency: "USD", + converted_balance: BigDecimal("1115181"), # Assuming conversion rate is 1 for simplicity + converted_currency: "USD", + dollar_change: BigDecimal("1553.43"), # Added dollar change + percent_change: BigDecimal("0.9"), # Added percent change + subtype: "Checking", + accountable_type: "Depository", + balances: sample_balances + ) + end + + def sample_balances + 4.times.map do |i| + OpenStruct.new( + date: "Feb #{12 + i} 2024", + description: "Manually entered", + amount: BigDecimal("1000") + (i * BigDecimal("100")), + change: i == 3 ? -50 : (i == 2 ? 0 : 100 + (i * 10)), + percentage_change: i == 3 ? -5 : (i == 2 ? 0 : 10 + i), + icon: i == 3 ? "arrow-down" : (i == 2 ? "minus" : (i.even? ? "arrow-down" : "arrow-up")) + ) + end + end end diff --git a/app/javascript/controllers/line_chart_controller.js b/app/javascript/controllers/line_chart_controller.js new file mode 100644 index 00000000..4dc93236 --- /dev/null +++ b/app/javascript/controllers/line_chart_controller.js @@ -0,0 +1,258 @@ +import { Controller } from "@hotwired/stimulus"; +import tailwindColors from "@maybe/tailwindcolors"; +import * as d3 from "d3"; + +// Connects to data-controller="line-chart" +export default class extends Controller { + connect() { + this.drawChart(); + } + + drawChart() { + // TODO: Replace with live data through controller targets + const data = [ + { + date: new Date(2021, 0, 1), + value: 985000, + formatted: "$985,000", + change: { value: "$0", direction: "none", percentage: "0%" }, + }, + { + date: new Date(2021, 1, 1), + value: 990000, + formatted: "$990,000", + change: { value: "$5,000", direction: "up", percentage: "0.51%" }, + }, + { + date: new Date(2021, 2, 1), + value: 995000, + formatted: "$995,000", + change: { value: "$5,000", direction: "up", percentage: "0.51%" }, + }, + { + date: new Date(2021, 3, 1), + value: 1000000, + formatted: "$1,000,000", + change: { value: "$5,000", direction: "up", percentage: "0.50%" }, + }, + { + date: new Date(2021, 4, 1), + value: 1005000, + formatted: "$997,000", + change: { value: "$3,000", direction: "down", percentage: "-0.30%" }, + }, + { + date: new Date(2021, 5, 1), + value: 1010000, + formatted: "$1,010,000", + change: { value: "$5,000", direction: "up", percentage: "0.50%" }, + }, + { + date: new Date(2021, 6, 1), + value: 1050000, + formatted: "$1,050,000", + change: { value: "$40,000", direction: "up", percentage: "3.96%" }, + }, + { + date: new Date(2021, 7, 1), + value: 1080000, + formatted: "$1,080,000", + change: { value: "$30,000", direction: "up", percentage: "2.86%" }, + }, + { + date: new Date(2021, 8, 1), + value: 1100000, + formatted: "$1,100,000", + change: { value: "$20,000", direction: "up", percentage: "1.85%" }, + }, + { + date: new Date(2021, 9, 1), + value: 1115181, + formatted: "$1,115,181", + change: { value: "$15,181", direction: "up", percentage: "1.38%" }, + }, + ]; + + const initialDimensions = { + width: document.querySelector("#lineChart").clientWidth, + height: document.querySelector("#lineChart").clientHeight, + }; + + const svg = d3 + .select("#lineChart") + .append("svg") + .attr("width", initialDimensions.width) + .attr("height", initialDimensions.height) + .attr("viewBox", [ + 0, + 0, + initialDimensions.width, + initialDimensions.height, + ]) + .attr("style", "max-width: 100%; height: auto; height: intrinsic;"); + + const margin = { top: 20, right: 0, bottom: 30, left: 0 }, + width = +svg.attr("width") - margin.left - margin.right, + height = +svg.attr("height") - margin.top - margin.bottom, + g = svg + .append("g") + .attr("transform", `translate(${margin.left},${margin.top})`); + + // X-Axis + const x = d3 + .scaleTime() + .rangeRound([0, width]) + .domain(d3.extent(data, (d) => d.date)); + + const PADDING = 0.15; // 15% padding on top and bottom of data + const dataMin = d3.min(data, (d) => d.value); + const dataMax = d3.max(data, (d) => d.value); + const padding = (dataMax - dataMin) * PADDING; + + // Y-Axis + const y = d3 + .scaleLinear() + .rangeRound([height, 0]) + .domain([dataMin - padding, dataMax + padding]); + + // X-Axis labels + g.append("g") + .attr("transform", `translate(0,${height})`) + .call( + d3 + .axisBottom(x) + .tickValues([data[0].date, data[data.length - 1].date]) + .tickSize(0) + .tickFormat(d3.timeFormat("%b %Y")) + ) + .select(".domain") + .remove(); + + g.selectAll(".tick text") + .style("fill", tailwindColors.gray[500]) + .style("font-size", "12px") + .style("font-weight", "500") + .attr("text-anchor", "middle") + .attr("dx", (d, i) => { + // We know we only have 2 values + return i === 0 ? "5em" : "-5em"; + }) + .attr("dy", "0em"); + + // Line + const line = d3 + .line() + .x((d) => x(d.date)) + .y((d) => y(d.value)); + + g.append("path") + .datum(data) + .attr("fill", "none") + .attr("stroke", tailwindColors.green[500]) + .attr("stroke-linejoin", "round") + .attr("stroke-linecap", "round") + .attr("stroke-width", 1.5) + .attr("class", "line-chart-path") + .attr("d", line); + + const tooltip = d3 + .select("#lineChart") + .append("div") + .style("position", "absolute") + .style("padding", "8px") + .style("font", "14px Inter, sans-serif") + .style("background", tailwindColors.white) + .style("border", `1px solid ${tailwindColors["alpha-black"][100]}`) + .style("border-radius", "10px") + .style("pointer-events", "none") + .style("opacity", 0); // Starts as hidden + + // Helper to find the closest data point to the mouse + const bisectDate = d3.bisector(function (d) { + return d.date; + }).left; + + // Create an invisible rectangle that captures mouse events (regular SVG elements don't capture mouse events by default) + g.append("rect") + .attr("width", width) + .attr("height", height) + .attr("fill", "none") + .attr("pointer-events", "all") + // When user hovers over the chart, show the tooltip and a circle at the closest data point + .on("mousemove", (event) => { + tooltip.style("opacity", 1); + + const [xPos] = d3.pointer(event); + + const x0 = bisectDate(data, x.invert(xPos)); + const d0 = data[x0 - 1]; + const d1 = data[x0]; + const d = xPos - x(d0.date) > x(d1.date) - xPos ? d1 : d0; + + g.selectAll(".data-point-circle").remove(); // Remove existing circles to ensure only one is shown at a time + g.append("circle") + .attr("class", "data-point-circle") + .attr("cx", x(d.date)) + .attr("cy", y(d.value)) + .attr("r", 8) + .attr("fill", tailwindColors.green[500]) + .attr("fill-opacity", "0.1"); + + g.append("circle") + .attr("class", "data-point-circle") + .attr("cx", x(d.date)) + .attr("cy", y(d.value)) + .attr("r", 3) + .attr("fill", tailwindColors.green[500]); + + tooltip + .html( + `
${d3.timeFormat("%b %Y")(d.date)}
+
+ + + + ${d.formatted} ${ + d.change.direction === "up" + ? "+" + : d.change.direction === "down" + ? "-" + : "" + }${d.change.value} (${d.change.percentage}) + +
` + ) + .style("left", event.pageX + 10 + "px") + .style("top", event.pageY - 10 + "px"); + + g.selectAll(".guideline").remove(); // Remove existing line to ensure only one is shown at a time + g.append("line") + .attr("class", "guideline") + .attr("x1", x(d.date)) + .attr("y1", 0) + .attr("x2", x(d.date)) + .attr("y2", height) + .attr("stroke", tailwindColors.gray[300]) + .attr("stroke-dasharray", "4, 4"); + }) + .on("mouseout", () => { + g.selectAll(".guideline").remove(); + g.selectAll(".data-point-circle").remove(); + tooltip.style("opacity", 0); + }); + } +} diff --git a/app/javascript/tailwindColors.js b/app/javascript/tailwindColors.js new file mode 100644 index 00000000..6031ee02 --- /dev/null +++ b/app/javascript/tailwindColors.js @@ -0,0 +1,141 @@ +/** + * To keep consistent styling across the app, this file can be imported in + * Stimulus controllers to reference our color palette. Mostly used for D3 charts. + */ +export default { + transparent: "transparent", + current: "currentColor", + white: "#ffffff", + black: "#0B0B0B", + success: "#10A861", + warning: "#F79009", + error: "#F13636", + gray: { + 25: "#FAFAFA", + 50: "#F5F5F5", + 100: "#F0F0F0", + 200: "#E5E5E5", + 300: "#D6D6D6", + 400: "#A3A3A3", + 500: "#737373", + 600: "#525252", + 700: "#3D3D3D", + 800: "#212121", + 900: "#141414", + }, + "alpha-white": { + 25: "rgba(255, 255, 255, 0.03)", + 50: "rgba(255, 255, 255, 0.05)", + 100: "rgba(255, 255, 255, 0.08)", + 200: "rgba(255, 255, 255, 0.1)", + 300: "rgba(255, 255, 255, 0.15)", + 400: "rgba(255, 255, 255, 0.2)", + 500: "rgba(255, 255, 255, 0.3)", + 600: "rgba(255, 255, 255, 0.4)", + 700: "rgba(255, 255, 255, 0.5)", + 800: "rgba(255, 255, 255, 0.6)", + 900: "rgba(255, 255, 255, 0.7)", + }, + "alpha-black": { + 25: "rgba(20, 20, 20, 0.03)", + 50: "rgba(20, 20, 20, 0.05)", + 100: "rgba(20, 20, 20, 0.08)", + 200: "rgba(20, 20, 20, 0.1)", + 300: "rgba(20, 20, 20, 0.15)", + 400: "rgba(20, 20, 20, 0.2)", + 500: "rgba(20, 20, 20, 0.3)", + 600: "rgba(20, 20, 20, 0.4)", + 700: "rgba(20, 20, 20, 0.5)", + 800: "rgba(20, 20, 20, 0.6)", + 900: "rgba(20, 20, 20, 0.7)", + }, + red: { + 25: "#FFFBFB", + 50: "#FFF1F0", + 100: "#FFDEDB", + 200: "#FEB9B3", + 300: "#F88C86", + 400: "#ED4E4E", + 500: "#F13636", + 600: "#EC2222", + 700: "#C91313", + 800: "#A40E0E", + 900: "#7E0707", + }, + green: { + 25: "#F6FEF9", + 50: "#ECFDF3", + 100: "#D1FADF", + 200: "#A6F4C5", + 300: "#6CE9A6", + 400: "#32D583", + 500: "#12B76A", + 600: "#10A861", + 700: "#078C52", + 800: "#05603A", + 900: "#054F31", + }, + yellow: { + 25: "#FFFCF5", + 50: "#FFFAEB", + 100: "#FEF0C7", + 200: "#FEDF89", + 300: "#FEC84B", + 400: "#FDB022", + 500: "#F79009", + 600: "#DC6803", + 700: "#B54708", + 800: "#93370D", + 900: "#7A2E0E", + }, + cyan: { + 25: "#F5FEFF", + 50: "#ECFDFF", + 100: "#CFF9FE", + 200: "#A5F0FC", + 300: "#67E3F9", + 400: "#22CCEE", + 500: "#06AED4", + 600: "#088AB2", + 700: "#0E7090", + 800: "#155B75", + 900: "#155B75", + }, + blue: { + 25: "#F5FAFF", + 50: "#EFF8FF", + 100: "#D1E9FF", + 200: "#B2DDFF", + 300: "#84CAFF", + 400: "#53B1FD", + 500: "#2E90FA", + 600: "#1570EF", + 700: "#175CD3", + 800: "#1849A9", + 900: "#194185", + }, + indigo: { + 25: "#F5F8FF", + 50: "#EFF4FF", + 100: "#E0EAFF", + 200: "#C7D7FE", + 300: "#A4BCFD", + 400: "#8098F9", + 500: "#6172F3", + 600: "#444CE7", + 700: "#3538CD", + 800: "#2D31A6", + 900: "#2D3282", + }, + violet: { + 25: "#FBFAFF", + 50: "#F5F3FF", + 100: "#ECE9FE", + 200: "#DDD6FE", + 300: "#C3B5FD", + 400: "#A48AFB", + 500: "#875BF7", + 600: "#7839EE", + 700: "#6927DA", + }, +}; diff --git a/app/models/account.rb b/app/models/account.rb index 218f59ed..61eeebd4 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,5 +1,6 @@ class Account < ApplicationRecord belongs_to :family + has_many :account_balances delegated_type :accountable, types: Accountable::TYPES, dependent: :destroy diff --git a/app/models/account_balance.rb b/app/models/account_balance.rb new file mode 100644 index 00000000..ded2bc15 --- /dev/null +++ b/app/models/account_balance.rb @@ -0,0 +1,3 @@ +class AccountBalance < ApplicationRecord + belongs_to :account +end diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index fee2bfaf..3c73ac33 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -1,2 +1,114 @@ -

<%= @account.name %>

- +
+
+
+
+ <%= @account.name[0].upcase %> +
+

<%= @account.name %>

+
+
+
+
+ USD $ + <%= lucide_icon("chevron-down", class: "w-5 h-5 text-gray-500") %> +
+
+
+ <%= lucide_icon("more-horizontal", class: "w-5 h-5 text-gray-500") %> +
+
+
+
+
+
+

Total Value

+ <%# TODO: Will need a normalized way to split a formatted monetary value into these 3 parts %> +

+ <%= number_to_currency(@account.converted_balance)[0] %> + <%= number_with_delimiter(@account.converted_balance.round) %> + .<%= number_to_currency(@account.converted_balance, precision: 2)[-2, 2] %> +

+ <% if @account.dollar_change == 0 %> +

+ No change vs last month +

+ <% else %> +

+ <%= @account.dollar_change > 0 ? '+' : '-' %><%= number_to_currency(@account.dollar_change.abs, precision: 2) %> + + (<%= lucide_icon(@account.dollar_change > 0 ? 'arrow-up' : 'arrow-down', class: "w-4 h-4 align-text-bottom inline") %> + <%= @account.percent_change %>%) + + vs last month +

+ <% end %> +
+
+
+ 1M + <%= lucide_icon("chevron-down", class: "w-5 h-5 text-gray-500") %> +
+
+
+
+
+
+
+
+
+

History

+ +
+
+
+
+
+ DATE +
+
VALUE
+
CHANGE
+
+
+
+ <% @account.balances.each_with_index do |balance, index| %> +
+
+
+
+ <%= lucide_icon(balance.icon, class: "w-4 h-4 #{balance.change > 0 ? 'text-green-500' : balance.change < 0 ? 'text-red-500' : 'text-gray-500'}") %> +
+
+

<%= balance.date %>

+

<%= balance.description %>

+
+
+
<%= number_to_currency(balance.amount, precision: 2) %>
+
+ <% if balance.change == 0 %> + No change + <% else %> + <%= balance.change > 0 ? '+' : '' %>$<%= balance.change.abs %> + + (<%= lucide_icon(balance.icon, class: "w-4 h-4 align-text-bottom inline") %> <%= balance.percentage_change %>%) + <% end %> +
+
+ <%= lucide_icon("more-horizontal", class: "w-5 h-5 text-gray-500") %> +
+
+ <% if index < @account.balances.size - 1 %> +
+ <% end %> +
+ <% end %> +
+ +
+
+
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 780e9bf8..c7714e09 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -81,7 +81,7 @@ <% end %> -
+
<%= yield %>
diff --git a/config/importmap.rb b/config/importmap.rb index 43c52ce7..e1512eb7 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -6,3 +6,42 @@ pin "@hotwired/stimulus", to: "stimulus.min.js" pin "@hotwired/stimulus-loading", to: "stimulus-loading.js" pin_all_from "app/javascript/controllers", under: "controllers" pin "@github/hotkey", to: "@github--hotkey.js" # @3.1.0 + +# Custom namespace for local files +pin "@maybe/tailwindcolors", to: "tailwindColors.js" + +# D3 packages +pin "d3" # @7.8.5 +pin "d3-array" # @3.2.4 +pin "d3-axis" # @3.0.0 +pin "d3-brush" # @3.0.0 +pin "d3-chord" # @3.0.1 +pin "d3-color" # @3.1.0 +pin "d3-contour" # @4.0.2 +pin "d3-delaunay" # @6.0.4 +pin "d3-dispatch" # @3.0.1 +pin "d3-drag" # @3.0.0 +pin "d3-dsv" # @3.0.1 +pin "d3-ease" # @3.0.1 +pin "d3-fetch" # @3.0.1 +pin "d3-force" # @3.0.0 +pin "d3-format" # @3.1.0 +pin "d3-geo" # @3.1.0 +pin "d3-hierarchy" # @3.1.2 +pin "d3-interpolate" # @3.0.1 +pin "d3-path" # @3.1.0 +pin "d3-polygon" # @3.0.1 +pin "d3-quadtree" # @3.0.1 +pin "d3-random" # @3.0.1 +pin "d3-scale" # @4.0.2 +pin "d3-scale-chromatic" # @3.0.0 +pin "d3-selection" # @3.0.0 +pin "d3-shape" # @3.2.0 +pin "d3-time" # @3.1.0 +pin "d3-time-format" # @4.1.0 +pin "d3-timer" # @3.0.1 +pin "d3-transition" # @3.0.1 +pin "d3-zoom" # @3.0.0 +pin "delaunator" # @5.0.1 +pin "internmap" # @2.0.3 +pin "robust-predicates" # @3.0.2 diff --git a/config/tailwind.config.js b/config/tailwind.config.js index 47779fa2..e5c954f8 100644 --- a/config/tailwind.config.js +++ b/config/tailwind.config.js @@ -197,6 +197,18 @@ module.exports = { "2xl": "0px 24px 48px -12px rgba(11, 11, 11, 0.12)", "3xl": "0px 32px 64px -12px rgba(11, 11, 11, 0.14)", }, + borderRadius: { + none: "0", + full: "9999px", + xs: "2px", + sm: "4px", + md: "8px", + DEFAULT: "8px", + lg: "10px", + xl: "12px", + "2xl": "16px", + "3xl": "24px", + }, extend: { fontFamily: { display: ["Inter var", ...defaultTheme.fontFamily.sans], @@ -205,14 +217,14 @@ module.exports = { "2xs": ".625rem", }, keyframes: { - 'appear-then-fade': { - '0%,100%': { opacity: 0 }, - '5%,90%': { opacity: 1 }, + "appear-then-fade": { + "0%,100%": { opacity: 0 }, + "5%,90%": { opacity: 1 }, }, - 'stroke-fill': { - to: { 'stroke-dashoffset': 0 }, - } - } + "stroke-fill": { + to: { "stroke-dashoffset": 0 }, + }, + }, }, }, plugins: [ diff --git a/db/migrate/20240212150110_create_account_balances.rb b/db/migrate/20240212150110_create_account_balances.rb new file mode 100644 index 00000000..3e915147 --- /dev/null +++ b/db/migrate/20240212150110_create_account_balances.rb @@ -0,0 +1,14 @@ +class CreateAccountBalances < ActiveRecord::Migration[7.2] + def change + create_table :account_balances, id: :uuid do |t| + t.references :account, null: false, type: :uuid, foreign_key: { on_delete: :cascade } + t.date :date, null: false + t.decimal :balance, precision: 19, scale: 4, null: false + t.string :currency, default: "USD", null: false + + t.timestamps + end + + add_index :account_balances, [ :account_id, :date ], unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 142dcdd0..c4cf32ff 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,11 +10,22 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_02_10_155058) do +ActiveRecord::Schema[7.2].define(version: 2024_02_12_150110) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" + create_table "account_balances", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.uuid "account_id", null: false + t.date "date", null: false + t.decimal "balance", precision: 19, scale: 4, null: false + t.string "currency", default: "USD", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["account_id", "date"], name: "index_account_balances_on_account_id_and_date", unique: true + t.index ["account_id"], name: "index_account_balances_on_account_id" + end + create_table "account_credits", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -195,6 +206,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_02_10_155058) do t.index ["family_id"], name: "index_users_on_family_id" end + add_foreign_key "account_balances", "accounts", on_delete: :cascade add_foreign_key "accounts", "families" add_foreign_key "users", "families" end diff --git a/test/fixtures/account_balances.yml b/test/fixtures/account_balances.yml new file mode 100644 index 00000000..bf597587 --- /dev/null +++ b/test/fixtures/account_balances.yml @@ -0,0 +1,13 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + account: dylan_checking + date: 2024-02-12 + balance: 9.99 + currency: MyString + +two: + account: richards_savings + date: 2024-02-12 + balance: 9.99 + currency: MyString diff --git a/test/models/account_balance_test.rb b/test/models/account_balance_test.rb new file mode 100644 index 00000000..639fc6ca --- /dev/null +++ b/test/models/account_balance_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class AccountBalanceTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/vendor/javascript/d3-array.js b/vendor/javascript/d3-array.js new file mode 100644 index 00000000..4b35f1e6 --- /dev/null +++ b/vendor/javascript/d3-array.js @@ -0,0 +1,2 @@ +import{InternMap as t,InternSet as n}from"internmap";export{InternMap,InternSet}from"internmap";function ascending(t,n){return null==t||null==n?NaN:tn?1:t>=n?0:NaN}function descending(t,n){return null==t||null==n?NaN:nt?1:n>=t?0:NaN}function bisector(t){let n,e,r;if(2!==t.length){n=ascending;e=(n,e)=>ascending(t(n),e);r=(n,e)=>t(n)-e}else{n=t===ascending||t===descending?t:zero;e=t;r=t}function left(t,r,o=0,i=t.length){if(o>>1;e(t[n],r)<0?o=n+1:i=n}while(o>>1;e(t[n],r)<=0?o=n+1:i=n}while(oe&&r(t[i-1],n)>-r(t[i],n)?i-1:i}return{left:left,center:center,right:right}}function zero(){return 0}function number(t){return null===t?NaN:+t}function*numbers(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}const e=bisector(ascending);const r=e.right;const o=e.left;const i=bisector(number).center;function blur(t,n){if(!((n=+n)>=0))throw new RangeError("invalid r");let e=t.length;if(!((e=Math.floor(e))>=0))throw new RangeError("invalid length");if(!e||!n)return t;const r=blurf(n);const o=t.slice();r(t,o,0,e,1);r(o,t,0,e,1);r(t,o,0,e,1);return t}const f=Blur2(blurf);const u=Blur2(blurfImage);function Blur2(t){return function(n,e,r=e){if(!((e=+e)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:o,width:i,height:f}=n;if(!((i=Math.floor(i))>=0))throw new RangeError("invalid width");if(!((f=Math.floor(void 0!==f?f:o.length/i))>=0))throw new RangeError("invalid height");if(!i||!f||!e&&!r)return n;const u=e&&t(e);const l=r&&t(r);const c=o.slice();if(u&&l){blurh(u,c,o,i,f);blurh(u,o,c,i,f);blurh(u,c,o,i,f);blurv(l,o,c,i,f);blurv(l,c,o,i,f);blurv(l,o,c,i,f)}else if(u){blurh(u,o,c,i,f);blurh(u,c,o,i,f);blurh(u,o,c,i,f)}else if(l){blurv(l,o,c,i,f);blurv(l,c,o,i,f);blurv(l,o,c,i,f)}return n}}function blurh(t,n,e,r,o){for(let i=0,f=r*o;i{r<<=2,o<<=2,i<<=2;n(t,e,r+0,o+0,i);n(t,e,r+1,o+1,i);n(t,e,r+2,o+2,i);n(t,e,r+3,o+3,i)}}function blurf(t){const n=Math.floor(t);if(n===t)return bluri(t);const e=t-n;const r=2*t+1;return(t,o,i,f,u)=>{if(!((f-=u)>=i))return;let l=n*o[i];const c=u*n;const s=c+u;for(let t=i,n=i+c;t{if(!((i-=f)>=o))return;let u=t*r[o];const l=f*t;for(let t=o,n=o+l;t=n&&++e;else{let r=-1;for(let o of t)null!=(o=n(o,++r,t))&&(o=+o)>=o&&++e}return e}function length$1(t){return 0|t.length}function empty(t){return!(t>0)}function arrayify(t){return"object"!==typeof t||"length"in t?t:Array.from(t)}function reducer(t){return n=>t(...n)}function cross(...t){const n="function"===typeof t[t.length-1]&&reducer(t.pop());t=t.map(arrayify);const e=t.map(length$1);const r=t.length-1;const o=new Array(r+1).fill(0);const i=[];if(r<0||e.some(empty))return i;while(true){i.push(o.map(((n,e)=>t[e][n])));let f=r;while(++o[f]===e[f]){if(0===f)return n?i.map(n):i;o[f--]=0}}}function cumsum(t,n){var e=0,r=0;return Float64Array.from(t,void 0===n?t=>e+=+t||0:o=>e+=+n(o,r++,t)||0)}function variance(t,n){let e=0;let r;let o=0;let i=0;if(void 0===n){for(let n of t)if(null!=n&&(n=+n)>=n){r=n-o;o+=r/++e;i+=r*(n-o)}}else{let f=-1;for(let u of t)if(null!=(u=n(u,++f,t))&&(u=+u)>=u){r=u-o;o+=r/++e;i+=r*(u-o)}}if(e>1)return i/(e-1)}function deviation(t,n){const e=variance(t,n);return e?Math.sqrt(e):e}function extent(t,n){let e;let r;if(void 0===n){for(const n of t)if(null!=n)if(void 0===e)n>=n&&(e=r=n);else{e>n&&(e=n);r=i&&(e=r=i);else{e>i&&(e=i);r0){i=t[--o];while(o>0){n=i;e=t[--o];i=n+e;r=e-(i-n);if(r)break}if(o>0&&(r<0&&t[o-1]<0||r>0&&t[o-1]>0)){e=2*r;n=i+e;e==n-i&&(i=n)}}return i}}function fsum(t,n){const e=new Adder;if(void 0===n)for(let n of t)(n=+n)&&e.add(n);else{let r=-1;for(let o of t)(o=+n(o,++r,t))&&e.add(o)}return+e}function fcumsum(t,n){const e=new Adder;let r=-1;return Float64Array.from(t,void 0===n?t=>e.add(+t||0):o=>e.add(+n(o,++r,t)||0))}function identity(t){return t}function group(t,...n){return nest(t,identity,identity,n)}function groups(t,...n){return nest(t,Array.from,identity,n)}function flatten$1(t,n){for(let e=1,r=n.length;et.pop().map((([n,e])=>[...t,n,e]))));return t}function flatGroup(t,...n){return flatten$1(groups(t,...n),n)}function flatRollup(t,n,...e){return flatten$1(rollups(t,n,...e),e)}function rollup(t,n,...e){return nest(t,identity,n,e)}function rollups(t,n,...e){return nest(t,Array.from,n,e)}function index(t,...n){return nest(t,identity,unique,n)}function indexes(t,...n){return nest(t,Array.from,unique,n)}function unique(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function nest(n,e,r,o){return function regroup(n,i){if(i>=o.length)return r(n);const f=new t;const u=o[i++];let l=-1;for(const t of n){const e=u(t,++l,n);const r=f.get(e);r?r.push(t):f.set(e,[t])}for(const[t,n]of f)f.set(t,regroup(n,i));return e(f)}(n,0)}function permute(t,n){return Array.from(n,(n=>t[n]))}function sort(t,...n){if("function"!==typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[e]=n;if(e&&2!==e.length||n.length>1){const r=Uint32Array.from(t,((t,n)=>n));if(n.length>1){n=n.map((n=>t.map(n)));r.sort(((t,e)=>{for(const r of n){const n=ascendingDefined(r[t],r[e]);if(n)return n}}))}else{e=t.map(e);r.sort(((t,n)=>ascendingDefined(e[t],e[n])))}return permute(t,r)}return t.sort(compareDefined(e))}function compareDefined(t=ascending){if(t===ascending)return ascendingDefined;if("function"!==typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}function ascendingDefined(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(tn?1:0)}function groupSort(t,n,e){return(2!==n.length?sort(rollup(t,n,e),(([t,n],[e,r])=>ascending(n,r)||ascending(t,e))):sort(group(t,e),(([t,e],[r,o])=>n(e,o)||ascending(t,r)))).map((([t])=>t))}var l=Array.prototype;var c=l.slice;l.map;function constant(t){return()=>t}const s=Math.sqrt(50),a=Math.sqrt(10),h=Math.sqrt(2);function tickSpec(t,n,e){const r=(n-t)/Math.max(0,e),o=Math.floor(Math.log10(r)),i=r/Math.pow(10,o),f=i>=s?10:i>=a?5:i>=h?2:1;let u,l,c;if(o<0){c=Math.pow(10,-o)/f;u=Math.round(t*c);l=Math.round(n*c);u/cn&&--l;c=-c}else{c=Math.pow(10,o)*f;u=Math.round(t/c);l=Math.round(n/c);u*cn&&--l}return l0))return[];if(t===n)return[t];const r=n=o))return[];const u=i-o+1,l=new Array(u);if(r)if(f<0)for(let t=0;t0){t=Math.floor(t/o)*o;n=Math.ceil(n/o)*o}else if(o<0){t=Math.ceil(t*o)/o;n=Math.floor(n*o)/o}r=o}}function thresholdSturges(t){return Math.max(1,Math.ceil(Math.log(count(t))/Math.LN2)+1)}function bin(){var t=identity,n=extent,e=thresholdSturges;function histogram(o){Array.isArray(o)||(o=Array.from(o));var i,f,u,l=o.length,c=new Array(l);for(i=0;i=h)if(t>=h&&n===extent){const t=tickIncrement(a,h,e);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else d.pop()}var m=d.length,p=0,g=m;while(d[p]<=a)++p;while(d[g-1]>h)--g;(p||g0?d[i-1]:a;y.x1=i0)for(i=0;i=n)&&(e=n);else{let r=-1;for(let o of t)null!=(o=n(o,++r,t))&&(e=o)&&(e=o)}return e}function maxIndex(t,n){let e;let r=-1;let o=-1;if(void 0===n)for(const n of t){++o;null!=n&&(e=n)&&(e=n,r=o)}else for(let i of t)null!=(i=n(i,++o,t))&&(e=i)&&(e=i,r=o);return r}function min(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let o of t)null!=(o=n(o,++r,t))&&(e>o||void 0===e&&o>=o)&&(e=o)}return e}function minIndex(t,n){let e;let r=-1;let o=-1;if(void 0===n)for(const n of t){++o;null!=n&&(e>n||void 0===e&&n>=n)&&(e=n,r=o)}else for(let i of t)null!=(i=n(i,++o,t))&&(e>i||void 0===e&&i>=i)&&(e=i,r=o);return r}function quickselect(t,n,e=0,r=Infinity,o){n=Math.floor(n);e=Math.floor(Math.max(0,e));r=Math.floor(Math.min(t.length-1,r));if(!(e<=n&&n<=r))return t;o=void 0===o?ascendingDefined:compareDefined(o);while(r>e){if(r-e>600){const i=r-e+1;const f=n-e+1;const u=Math.log(i);const l=.5*Math.exp(2*u/3);const c=.5*Math.sqrt(u*l*(i-l)/i)*(f-i/2<0?-1:1);const s=Math.max(e,Math.floor(n-f*l/i+c));const a=Math.min(r,Math.floor(n+(i-f)*l/i+c));quickselect(t,n,s,a,o)}const i=t[n];let f=e;let u=r;swap(t,e,n);o(t[r],i)>0&&swap(t,e,r);while(f0)--u}0===o(t[e],i)?swap(t,e,u):(++u,swap(t,u,r));u<=n&&(e=u+1);n<=u&&(r=u-1)}return t}function swap(t,n,e){const r=t[n];t[n]=t[e];t[e]=r}function greatest(t,n=ascending){let e;let r=false;if(1===n.length){let o;for(const i of t){const t=n(i);if(r?ascending(t,o)>0:0===ascending(t,t)){e=i;o=t;r=true}}}else for(const o of t)if(r?n(o,e)>0:0===n(o,o)){e=o;r=true}return e}function quantile(t,n,e){t=Float64Array.from(numbers(t,e));if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return min(t);if(n>=1)return max(t);var r,o=(r-1)*n,i=Math.floor(o),f=max(quickselect(t,i).subarray(0,i+1)),u=min(t.subarray(i+1));return f+(u-f)*(o-i)}}function quantileSorted(t,n,e=number){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,o=(r-1)*n,i=Math.floor(o),f=+e(t[i],i,t),u=+e(t[i+1],i+1,t);return f+(u-f)*(o-i)}}function quantileIndex(t,n,e=number){if(!isNaN(n=+n)){r=Float64Array.from(t,((n,r)=>number(e(t[r],r,t))));if(n<=0)return minIndex(r);if(n>=1)return maxIndex(r);var r,o=Uint32Array.from(t,((t,n)=>n)),i=r.length-1,f=Math.floor(i*n);quickselect(o,f,0,i,((t,n)=>ascendingDefined(r[t],r[n])));f=greatest(o.subarray(0,f+1),(t=>r[t]));return f>=0?f:-1}}function thresholdFreedmanDiaconis(t,n,e){const r=count(t),o=quantile(t,.75)-quantile(t,.25);return r&&o?Math.ceil((e-n)/(2*o*Math.pow(r,-1/3))):1}function thresholdScott(t,n,e){const r=count(t),o=deviation(t);return r&&o?Math.ceil((e-n)*Math.cbrt(r)/(3.49*o)):1}function mean(t,n){let e=0;let r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++e,r+=n);else{let o=-1;for(let i of t)null!=(i=n(i,++o,t))&&(i=+i)>=i&&(++e,r+=i)}if(e)return r/e}function median(t,n){return quantile(t,.5,n)}function medianIndex(t,n){return quantileIndex(t,.5,n)}function*flatten(t){for(const n of t)yield*n}function merge(t){return Array.from(flatten(t))}function mode(n,e){const r=new t;if(void 0===e)for(let t of n)null!=t&&t>=t&&r.set(t,(r.get(t)||0)+1);else{let t=-1;for(let o of n)null!=(o=e(o,++t,n))&&o>=o&&r.set(o,(r.get(o)||0)+1)}let o;let i=0;for(const[t,n]of r)if(n>i){i=n;o=t}return o}function pairs(t,n=pair){const e=[];let r;let o=false;for(const i of t){o&&e.push(n(r,i));r=i;o=true}return e}function pair(t,n){return[t,n]}function range(t,n,e){t=+t,n=+n,e=(o=arguments.length)<2?(n=t,t=0,1):o<3?1:+e;var r=-1,o=0|Math.max(0,Math.ceil((n-t)/e)),i=new Array(o);while(++rn(e[t],e[r]);let o,i;t=Uint32Array.from(e,((t,n)=>n));t.sort(n===ascending?(t,n)=>ascendingDefined(e[t],e[n]):compareDefined(compareIndex));t.forEach(((t,n)=>{const e=compareIndex(t,void 0===o?t:o);if(e>=0){(void 0===o||e>0)&&(o=t,i=n);r[t]=i}else r[t]=NaN}));return r}function least(t,n=ascending){let e;let r=false;if(1===n.length){let o;for(const i of t){const t=n(i);if(r?ascending(t,o)<0:0===ascending(t,t)){e=i;o=t;r=true}}}else for(const o of t)if(r?n(o,e)<0:0===n(o,o)){e=o;r=true}return e}function leastIndex(t,n=ascending){if(1===n.length)return minIndex(t,n);let e;let r=-1;let o=-1;for(const i of t){++o;if(r<0?0===n(i,i):n(i,e)<0){e=i;r=o}}return r}function greatestIndex(t,n=ascending){if(1===n.length)return maxIndex(t,n);let e;let r=-1;let o=-1;for(const i of t){++o;if(r<0?0===n(i,i):n(i,e)>0){e=i;r=o}}return r}function scan(t,n){const e=leastIndex(t,n);return e<0?void 0:e}var d=shuffler(Math.random);function shuffler(t){return function shuffle(n,e=0,r=n.length){let o=r-(e=+e);while(o){const r=t()*o--|0,i=n[o+e];n[o+e]=n[r+e];n[r+e]=i}return n}}function sum(t,n){let e=0;if(void 0===n)for(let n of t)(n=+n)&&(e+=n);else{let r=-1;for(let o of t)(o=+n(o,++r,t))&&(e+=o)}return e}function transpose(t){if(!(o=t.length))return[];for(var n=-1,e=min(t,length),r=new Array(e);++nn(e,r,t)))}function reduce(t,n,e){if("function"!==typeof n)throw new TypeError("reducer is not a function");const r=t[Symbol.iterator]();let o,i,f=-1;if(arguments.length<3){({done:o,value:e}=r.next());if(o)return;++f}while(({done:o,value:i}=r.next()),!o)e=n(e,i,++f,t);return e}function reverse(t){if("function"!==typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()}function difference(t,...e){t=new n(t);for(const n of e)for(const e of n)t.delete(e);return t}function disjoint(t,e){const r=e[Symbol.iterator](),o=new n;for(const n of t){if(o.has(n))return false;let t,e;while(({value:t,done:e}=r.next())){if(e)break;if(Object.is(n,t))return false;o.add(t)}}return true}function intersection(t,...e){t=new n(t);e=e.map(set);t:for(const n of t)for(const r of e)if(!r.has(n)){t.delete(n);continue t}return t}function set(t){return t instanceof n?t:new n(t)}function superset(t,n){const e=t[Symbol.iterator](),r=new Set;for(const t of n){const n=intern(t);if(r.has(n))continue;let o,i;while(({value:o,done:i}=e.next())){if(i)return false;const t=intern(o);r.add(t);if(Object.is(n,t))break}}return true}function intern(t){return null!==t&&"object"===typeof t?t.valueOf():t}function subset(t,n){return superset(n,t)}function union(...t){const e=new n;for(const n of t)for(const t of n)e.add(t);return e}export{Adder,ascending,bin,r as bisect,i as bisectCenter,o as bisectLeft,r as bisectRight,bisector,blur,f as blur2,u as blurImage,count,cross,cumsum,descending,deviation,difference,disjoint,every,extent,fcumsum,filter,flatGroup,flatRollup,fsum,greatest,greatestIndex,group,groupSort,groups,bin as histogram,index,indexes,intersection,least,leastIndex,map,max,maxIndex,mean,median,medianIndex,merge,min,minIndex,mode,nice,pairs,permute,quantile,quantileIndex,quantileSorted,quickselect,range,rank,reduce,reverse,rollup,rollups,scan,d as shuffle,shuffler,some,sort,subset,sum,superset,thresholdFreedmanDiaconis,thresholdScott,thresholdSturges,tickIncrement,tickStep,ticks,transpose,union,variance,zip}; + diff --git a/vendor/javascript/d3-axis.js b/vendor/javascript/d3-axis.js new file mode 100644 index 00000000..b8621a79 --- /dev/null +++ b/vendor/javascript/d3-axis.js @@ -0,0 +1,2 @@ +function identity(t){return t}var t=1,n=2,r=3,i=4,e=1e-6;function translateX(t){return"translate("+t+",0)"}function translateY(t){return"translate(0,"+t+")"}function number(t){return n=>+t(n)}function center(t,n){n=Math.max(0,t.bandwidth()-2*n)/2;t.round()&&(n=Math.round(n));return r=>+t(r)+n}function entering(){return!this.__axis}function axis(a,s){var o=[],u=null,c=null,l=6,x=6,f=3,d="undefined"!==typeof window&&window.devicePixelRatio>1?0:.5,m=a===t||a===i?-1:1,h=a===i||a===n?"x":"y",g=a===t||a===r?translateX:translateY;function axis(p){var k=null==u?s.ticks?s.ticks.apply(s,o):s.domain():u,y=null==c?s.tickFormat?s.tickFormat.apply(s,o):identity:c,A=Math.max(l,0)+f,M=s.range(),v=+M[0]+d,w=+M[M.length-1]+d,_=(s.bandwidth?center:number)(s.copy(),d),b=p.selection?p.selection():p,F=b.selectAll(".domain").data([null]),V=b.selectAll(".tick").data(k,s).order(),z=V.exit(),H=V.enter().append("g").attr("class","tick"),C=V.select("line"),R=V.select("text");F=F.merge(F.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor"));V=V.merge(H);C=C.merge(H.append("line").attr("stroke","currentColor").attr(h+"2",m*l));R=R.merge(H.append("text").attr("fill","currentColor").attr(h,m*A).attr("dy",a===t?"0em":a===r?"0.71em":"0.32em"));if(p!==b){F=F.transition(p);V=V.transition(p);C=C.transition(p);R=R.transition(p);z=z.transition(p).attr("opacity",e).attr("transform",(function(t){return isFinite(t=_(t))?g(t+d):this.getAttribute("transform")}));H.attr("opacity",e).attr("transform",(function(t){var n=this.parentNode.__axis;return g((n&&isFinite(n=n(t))?n:_(t))+d)}))}z.remove();F.attr("d",a===i||a===n?x?"M"+m*x+","+v+"H"+d+"V"+w+"H"+m*x:"M"+d+","+v+"V"+w:x?"M"+v+","+m*x+"V"+d+"H"+w+"V"+m*x:"M"+v+","+d+"H"+w);V.attr("opacity",1).attr("transform",(function(t){return g(_(t)+d)}));C.attr(h+"2",m*l);R.attr(h,m*A).text(y);b.filter(entering).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",a===n?"start":a===i?"end":"middle");b.each((function(){this.__axis=_}))}axis.scale=function(t){return arguments.length?(s=t,axis):s};axis.ticks=function(){return o=Array.from(arguments),axis};axis.tickArguments=function(t){return arguments.length?(o=null==t?[]:Array.from(t),axis):o.slice()};axis.tickValues=function(t){return arguments.length?(u=null==t?null:Array.from(t),axis):u&&u.slice()};axis.tickFormat=function(t){return arguments.length?(c=t,axis):c};axis.tickSize=function(t){return arguments.length?(l=x=+t,axis):l};axis.tickSizeInner=function(t){return arguments.length?(l=+t,axis):l};axis.tickSizeOuter=function(t){return arguments.length?(x=+t,axis):x};axis.tickPadding=function(t){return arguments.length?(f=+t,axis):f};axis.offset=function(t){return arguments.length?(d=+t,axis):d};return axis}function axisTop(n){return axis(t,n)}function axisRight(t){return axis(n,t)}function axisBottom(t){return axis(r,t)}function axisLeft(t){return axis(i,t)}export{axisBottom,axisLeft,axisRight,axisTop}; + diff --git a/vendor/javascript/d3-brush.js b/vendor/javascript/d3-brush.js new file mode 100644 index 00000000..53cbc53a --- /dev/null +++ b/vendor/javascript/d3-brush.js @@ -0,0 +1,2 @@ +import{dispatch as e}from"d3-dispatch";import{dragDisable as t,dragEnable as n}from"d3-drag";import{interpolate as r}from"d3-interpolate";import{select as u,pointer as i}from"d3-selection";import{interrupt as s}from"d3-transition";var constant=e=>()=>e;function BrushEvent(e,{sourceEvent:t,target:n,selection:r,mode:u,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:true,configurable:true},sourceEvent:{value:t,enumerable:true,configurable:true},target:{value:n,enumerable:true,configurable:true},selection:{value:r,enumerable:true,configurable:true},mode:{value:u,enumerable:true,configurable:true},_:{value:i}})}function nopropagation(e){e.stopImmediatePropagation()}function noevent(e){e.preventDefault();e.stopImmediatePropagation()}var o={name:"drag"},a={name:"space"},l={name:"handle"},c={name:"center"};const{abs:h,max:f,min:d}=Math;function number1(e){return[+e[0],+e[1]]}function number2(e){return[number1(e[0]),number1(e[1])]}var b={name:"x",handles:["w","e"].map(type),input:function(e,t){return null==e?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}};var p={name:"y",handles:["n","s"].map(type),input:function(e,t){return null==e?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}};var m={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(type),input:function(e){return null==e?null:number2(e)},output:function(e){return e}};var v={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};var y={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"};var w={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"};var g={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1};var _={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function type(e){return{type:e}}function defaultFilter(e){return!e.ctrlKey&&!e.button}function defaultExtent(){var e=this.ownerSVGElement||this;if(e.hasAttribute("viewBox")){e=e.viewBox.baseVal;return[[e.x,e.y],[e.x+e.width,e.y+e.height]]}return[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function local(e){while(!e.__brush)if(!(e=e.parentNode))return;return e.__brush}function empty(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function brushSelection(e){var t=e.__brush;return t?t.dim.output(t.selection):null}function brushX(){return brush$1(b)}function brushY(){return brush$1(p)}function brush(){return brush$1(m)}function brush$1(m){var k,x=defaultExtent,E=defaultFilter,z=defaultTouchable,A=true,T=e("start","brush","end"),K=6;function brush(e){var t=e.property("__brush",initialize).selectAll(".overlay").data([type("overlay")]);t.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",v.overlay).merge(t).each((function(){var e=local(this).extent;u(this).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1])}));e.selectAll(".selection").data([type("selection")]).enter().append("rect").attr("class","selection").attr("cursor",v.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var n=e.selectAll(".handle").data(m.handles,(function(e){return e.type}));n.exit().remove();n.enter().append("rect").attr("class",(function(e){return"handle handle--"+e.type})).attr("cursor",(function(e){return v[e.type]}));e.each(redraw).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",started).filter(z).on("touchstart.brush",started).on("touchmove.brush",touchmoved).on("touchend.brush touchcancel.brush",touchended).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}brush.move=function(e,t,n){e.tween?e.on("start.brush",(function(e){emitter(this,arguments).beforestart().start(e)})).on("interrupt.brush end.brush",(function(e){emitter(this,arguments).end(e)})).tween("brush",(function(){var e=this,n=e.__brush,u=emitter(e,arguments),i=n.selection,s=m.input("function"===typeof t?t.apply(this,arguments):t,n.extent),o=r(i,s);function tween(t){n.selection=1===t&&null===s?null:o(t);redraw.call(e);u.brush()}return null!==i&&null!==s?tween:tween(1)})):e.each((function(){var e=this,r=arguments,u=e.__brush,i=m.input("function"===typeof t?t.apply(e,r):t,u.extent),o=emitter(e,r).beforestart();s(e);u.selection=null===i?null:i;redraw.call(e);o.start(n).brush(n).end(n)}))};brush.clear=function(e,t){brush.move(e,null,t)};function redraw(){var e=u(this),t=local(this).selection;if(t){e.selectAll(".selection").style("display",null).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1]);e.selectAll(".handle").style("display",null).attr("x",(function(e){return"e"===e.type[e.type.length-1]?t[1][0]-K/2:t[0][0]-K/2})).attr("y",(function(e){return"s"===e.type[0]?t[1][1]-K/2:t[0][1]-K/2})).attr("width",(function(e){return"n"===e.type||"s"===e.type?t[1][0]-t[0][0]+K:K})).attr("height",(function(e){return"e"===e.type||"w"===e.type?t[1][1]-t[0][1]+K:K}))}else e.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function emitter(e,t,n){var r=e.__brush.emitter;return!r||n&&r.clean?new Emitter(e,t,n):r}function Emitter(e,t,n){this.that=e;this.args=t;this.state=e.__brush;this.active=0;this.clean=n}Emitter.prototype={beforestart:function(){1===++this.active&&(this.state.emitter=this,this.starting=true);return this},start:function(e,t){this.starting?(this.starting=false,this.emit("start",e,t)):this.emit("brush",e);return this},brush:function(e,t){this.emit("brush",e,t);return this},end:function(e,t){0===--this.active&&(delete this.state.emitter,this.emit("end",e,t));return this},emit:function(e,t,n){var r=u(this.that).datum();T.call(e,this.that,new BrushEvent(e,{sourceEvent:t,target:brush,selection:m.output(this.state.selection),mode:n,dispatch:T}),r)}};function started(e){if((!k||e.touches)&&E.apply(this,arguments)){var r,x,z,T,K,B,P,S,V,$,C,F=this,I=e.target.__data__.type,M="selection"===(A&&e.metaKey?I="overlay":I)?o:A&&e.altKey?c:l,X=m===p?null:g[I],Y=m===b?null:_[I],j=local(F),D=j.extent,G=j.selection,N=D[0][0],O=D[0][1],q=D[1][0],H=D[1][1],J=0,L=0,Q=X&&Y&&A&&e.shiftKey,R=Array.from(e.touches||[e],(e=>{const t=e.identifier;e=i(e,F);e.point0=e.slice();e.identifier=t;return e}));s(F);var U=emitter(F,arguments,true).beforestart();if("overlay"===I){G&&(V=true);const t=[R[0],R[1]||R[0]];j.selection=G=[[r=m===p?N:d(t[0][0],t[1][0]),z=m===b?O:d(t[0][1],t[1][1])],[K=m===p?q:f(t[0][0],t[1][0]),P=m===b?H:f(t[0][1],t[1][1])]];R.length>1&&move(e)}else{r=G[0][0];z=G[0][1];K=G[1][0];P=G[1][1]}x=r;T=z;B=K;S=P;var W=u(F).attr("pointer-events","none");var Z=W.selectAll(".overlay").attr("cursor",v[I]);if(e.touches){U.moved=moved;U.ended=ended}else{var ee=u(e.view).on("mousemove.brush",moved,true).on("mouseup.brush",ended,true);A&&ee.on("keydown.brush",keydowned,true).on("keyup.brush",keyupped,true);t(e.view)}redraw.call(F);U.start(e,M.name)}function moved(e){for(const t of e.changedTouches||[e])for(const e of R)e.identifier===t.identifier&&(e.cur=i(t,F));if(Q&&!$&&!C&&1===R.length){const e=R[0];h(e.cur[0]-e[0])>h(e.cur[1]-e[1])?C=true:$=true}for(const e of R)e.cur&&(e[0]=e.cur[0],e[1]=e.cur[1]);V=true;noevent(e);move(e)}function move(e){const t=R[0],n=t.point0;var u;J=t[0]-n[0];L=t[1]-n[1];switch(M){case a:case o:X&&(J=f(N-r,d(q-K,J)),x=r+J,B=K+J);Y&&(L=f(O-z,d(H-P,L)),T=z+L,S=P+L);break;case l:if(R[1]){X&&(x=f(N,d(q,R[0][0])),B=f(N,d(q,R[1][0])),X=1);Y&&(T=f(O,d(H,R[0][1])),S=f(O,d(H,R[1][1])),Y=1)}else{X<0?(J=f(N-r,d(q-r,J)),x=r+J,B=K):X>0&&(J=f(N-K,d(q-K,J)),x=r,B=K+J);Y<0?(L=f(O-z,d(H-z,L)),T=z+L,S=P):Y>0&&(L=f(O-P,d(H-P,L)),T=z,S=P+L)}break;case c:X&&(x=f(N,d(q,r-J*X)),B=f(N,d(q,K+J*X)));Y&&(T=f(O,d(H,z-L*Y)),S=f(O,d(H,P+L*Y)));break}if(B0&&(r=x-J);Y<0?P=S-L:Y>0&&(z=T-L);M=a;Z.attr("cursor",v.selection);move(e)}break;default:return}noevent(e)}function keyupped(e){switch(e.keyCode){case 16:if(Q){$=C=Q=false;move(e)}break;case 18:if(M===c){X<0?K=B:X>0&&(r=x);Y<0?P=S:Y>0&&(z=T);M=l;move(e)}break;case 32:if(M===a){if(e.altKey){X&&(K=B-J*X,r=x+J*X);Y&&(P=S-L*Y,z=T+L*Y);M=c}else{X<0?K=B:X>0&&(r=x);Y<0?P=S:Y>0&&(z=T);M=l}Z.attr("cursor",v[I]);move(e)}break;default:return}noevent(e)}}function touchmoved(e){emitter(this,arguments).moved(e)}function touchended(e){emitter(this,arguments).ended(e)}function initialize(){var e=this.__brush||{selection:null};e.extent=number2(x.apply(this,arguments));e.dim=m;return e}brush.extent=function(e){return arguments.length?(x="function"===typeof e?e:constant(number2(e)),brush):x};brush.filter=function(e){return arguments.length?(E="function"===typeof e?e:constant(!!e),brush):E};brush.touchable=function(e){return arguments.length?(z="function"===typeof e?e:constant(!!e),brush):z};brush.handleSize=function(e){return arguments.length?(K=+e,brush):K};brush.keyModifiers=function(e){return arguments.length?(A=!!e,brush):A};brush.on=function(){var e=T.on.apply(T,arguments);return e===T?brush:e};return brush}export{brush,brushSelection,brushX,brushY}; + diff --git a/vendor/javascript/d3-chord.js b/vendor/javascript/d3-chord.js new file mode 100644 index 00000000..ae586d74 --- /dev/null +++ b/vendor/javascript/d3-chord.js @@ -0,0 +1,2 @@ +import{path as n}from"d3-path";var r=Math.abs;var t=Math.cos;var e=Math.sin;var o=Math.PI;var u=o/2;var a=2*o;var l=Math.max;var i=1e-12;function range(n,r){return Array.from({length:r-n},((r,t)=>n+t))}function compareValue(n){return function(r,t){return n(r.source.value+r.target.value,t.source.value+t.target.value)}}function chord(){return chord$1(false,false)}function chordTranspose(){return chord$1(false,true)}function chordDirected(){return chord$1(true,false)}function chord$1(n,r){var t=0,e=null,o=null,u=null;function chord(i){var c,s=i.length,f=new Array(s),d=range(0,s),g=new Array(s*s),b=new Array(s),h=0;i=Float64Array.from({length:s*s},r?(n,r)=>i[r%s][r/s|0]:(n,r)=>i[r/s|0][r%s]);for(let r=0;re(f[n],f[r])));for(const t of d){const e=r;if(n){const n=range(1+~s,s).filter((n=>n<0?i[~n*s+t]:i[t*s+n]));o&&n.sort(((n,r)=>o(n<0?-i[~n*s+t]:i[t*s+n],r<0?-i[~r*s+t]:i[t*s+r])));for(const e of n)if(e<0){const n=g[~e*s+t]||(g[~e*s+t]={source:null,target:null});n.target={index:t,startAngle:r,endAngle:r+=i[~e*s+t]*h,value:i[~e*s+t]}}else{const n=g[t*s+e]||(g[t*s+e]={source:null,target:null});n.source={index:t,startAngle:r,endAngle:r+=i[t*s+e]*h,value:i[t*s+e]}}b[t]={index:t,startAngle:e,endAngle:r,value:f[t]}}else{const n=range(0,s).filter((n=>i[t*s+n]||i[n*s+t]));o&&n.sort(((n,r)=>o(i[t*s+n],i[t*s+r])));for(const e of n){let n;if(ti){r(R-m)>2*y+i?R>m?(m+=y,R-=y):(m-=y,R+=y):m=R=(m+R)/2;r(M-$)>2*y+i?M>$?($+=y,M-=y):($-=y,M+=y):$=M=($+M)/2}h.moveTo(x*t(m),x*e(m));h.arc(0,0,x,m,R);if(m!==$||R!==M)if(o){var S=+o.apply(this,arguments),C=w-S,P=($+M)/2;h.quadraticCurveTo(0,0,C*t($),C*e($));h.lineTo(w*t(P),w*e(P));h.lineTo(C*t(M),C*e(M))}else{h.quadraticCurveTo(0,0,w*t($),w*e($));h.arc(0,0,w,$,M)}h.quadraticCurveTo(0,0,x*t(m),x*e(m));h.closePath();if(p)return h=null,p+""||null}o&&(ribbon.headRadius=function(n){return arguments.length?(o="function"===typeof n?n:constant(+n),ribbon):o});ribbon.radius=function(n){return arguments.length?(s=f="function"===typeof n?n:constant(+n),ribbon):s};ribbon.sourceRadius=function(n){return arguments.length?(s="function"===typeof n?n:constant(+n),ribbon):s};ribbon.targetRadius=function(n){return arguments.length?(f="function"===typeof n?n:constant(+n),ribbon):f};ribbon.startAngle=function(n){return arguments.length?(d="function"===typeof n?n:constant(+n),ribbon):d};ribbon.endAngle=function(n){return arguments.length?(g="function"===typeof n?n:constant(+n),ribbon):g};ribbon.padAngle=function(n){return arguments.length?(b="function"===typeof n?n:constant(+n),ribbon):b};ribbon.source=function(n){return arguments.length?(a=n,ribbon):a};ribbon.target=function(n){return arguments.length?(l=n,ribbon):l};ribbon.context=function(n){return arguments.length?(h=null==n?null:n,ribbon):h};return ribbon}function ribbon$1(){return ribbon()}function ribbonArrow(){return ribbon(defaultArrowheadRadius)}export{chord,chordDirected,chordTranspose,ribbon$1 as ribbon,ribbonArrow}; + diff --git a/vendor/javascript/d3-color.js b/vendor/javascript/d3-color.js new file mode 100644 index 00000000..16068986 --- /dev/null +++ b/vendor/javascript/d3-color.js @@ -0,0 +1,2 @@ +function define(t,e,r){t.prototype=e.prototype=r;r.constructor=t}function extend(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Color(){}var t=.7;var e=1/t;var r="\\s*([+-]?\\d+)\\s*",n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",i="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",a=/^#([0-9a-f]{3,8})$/,l=new RegExp(`^rgb\\(${r},${r},${r}\\)$`),o=new RegExp(`^rgb\\(${i},${i},${i}\\)$`),h=new RegExp(`^rgba\\(${r},${r},${r},${n}\\)$`),s=new RegExp(`^rgba\\(${i},${i},${i},${n}\\)$`),c=new RegExp(`^hsl\\(${n},${i},${i}\\)$`),b=new RegExp(`^hsla\\(${n},${i},${i},${n}\\)$`);var u={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};define(Color,color,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:color_formatHex,formatHex:color_formatHex,formatHex8:color_formatHex8,formatHsl:color_formatHsl,formatRgb:color_formatRgb,toString:color_formatRgb});function color_formatHex(){return this.rgb().formatHex()}function color_formatHex8(){return this.rgb().formatHex8()}function color_formatHsl(){return hslConvert(this).formatHsl()}function color_formatRgb(){return this.rgb().formatRgb()}function color(t){var e,r;t=(t+"").trim().toLowerCase();return(e=a.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?rgbn(e):3===r?new Rgb(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?rgba(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?rgba(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=l.exec(t))?new Rgb(e[1],e[2],e[3],1):(e=o.exec(t))?new Rgb(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=h.exec(t))?rgba(e[1],e[2],e[3],e[4]):(e=s.exec(t))?rgba(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=c.exec(t))?hsla(e[1],e[2]/100,e[3]/100,1):(e=b.exec(t))?hsla(e[1],e[2]/100,e[3]/100,e[4]):u.hasOwnProperty(t)?rgbn(u[t]):"transparent"===t?new Rgb(NaN,NaN,NaN,0):null}function rgbn(t){return new Rgb(t>>16&255,t>>8&255,255&t,1)}function rgba(t,e,r,n){n<=0&&(t=e=r=NaN);return new Rgb(t,e,r,n)}function rgbConvert(t){t instanceof Color||(t=color(t));if(!t)return new Rgb;t=t.rgb();return new Rgb(t.r,t.g,t.b,t.opacity)}function rgb(t,e,r,n){return 1===arguments.length?rgbConvert(t):new Rgb(t,e,r,null==n?1:n)}function Rgb(t,e,r,n){this.r=+t;this.g=+e;this.b=+r;this.opacity=+n}define(Rgb,rgb,extend(Color,{brighter(t){t=null==t?e:Math.pow(e,t);return new Rgb(this.r*t,this.g*t,this.b*t,this.opacity)},darker(e){e=null==e?t:Math.pow(t,e);return new Rgb(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rgb(clampi(this.r),clampi(this.g),clampi(this.b),clampa(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:rgb_formatHex,formatHex:rgb_formatHex,formatHex8:rgb_formatHex8,formatRgb:rgb_formatRgb,toString:rgb_formatRgb}));function rgb_formatHex(){return`#${hex(this.r)}${hex(this.g)}${hex(this.b)}`}function rgb_formatHex8(){return`#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex(255*(isNaN(this.opacity)?1:this.opacity))}`}function rgb_formatRgb(){const t=clampa(this.opacity);return`${1===t?"rgb(":"rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${1===t?")":`, ${t})`}`}function clampa(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function clampi(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function hex(t){t=clampi(t);return(t<16?"0":"")+t.toString(16)}function hsla(t,e,r,n){n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN);return new Hsl(t,e,r,n)}function hslConvert(t){if(t instanceof Hsl)return new Hsl(t.h,t.s,t.l,t.opacity);t instanceof Color||(t=color(t));if(!t)return new Hsl;if(t instanceof Hsl)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),l=NaN,o=a-i,h=(a+i)/2;if(o){l=e===a?(r-n)/o+6*(r0&&h<1?0:l;return new Hsl(l,o,h,t.opacity)}function hsl(t,e,r,n){return 1===arguments.length?hslConvert(t):new Hsl(t,e,r,null==n?1:n)}function Hsl(t,e,r,n){this.h=+t;this.s=+e;this.l=+r;this.opacity=+n}define(Hsl,hsl,extend(Color,{brighter(t){t=null==t?e:Math.pow(e,t);return new Hsl(this.h,this.s,this.l*t,this.opacity)},darker(e){e=null==e?t:Math.pow(t,e);return new Hsl(this.h,this.s,this.l*e,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Rgb(hsl2rgb(t>=240?t-240:t+120,i,n),hsl2rgb(t,i,n),hsl2rgb(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Hsl(clamph(this.h),clampt(this.s),clampt(this.l),clampa(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(){const t=clampa(this.opacity);return`${1===t?"hsl(":"hsla("}${clamph(this.h)}, ${100*clampt(this.s)}%, ${100*clampt(this.l)}%${1===t?")":`, ${t})`}`}}));function clamph(t){t=(t||0)%360;return t<0?t+360:t}function clampt(t){return Math.max(0,Math.min(1,t||0))}function hsl2rgb(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}const g=Math.PI/180;const p=180/Math.PI;const f=18,m=.96422,d=1,y=.82521,w=4/29,x=6/29,$=3*x*x,v=x*x*x;function labConvert(t){if(t instanceof Lab)return new Lab(t.l,t.a,t.b,t.opacity);if(t instanceof Hcl)return hcl2lab(t);t instanceof Rgb||(t=rgbConvert(t));var e,r,n=rgb2lrgb(t.r),i=rgb2lrgb(t.g),a=rgb2lrgb(t.b),l=xyz2lab((.2225045*n+.7168786*i+.0606169*a)/d);if(n===i&&i===a)e=r=l;else{e=xyz2lab((.4360747*n+.3850649*i+.1430804*a)/m);r=xyz2lab((.0139322*n+.0971045*i+.7141733*a)/y)}return new Lab(116*l-16,500*(e-l),200*(l-r),t.opacity)}function gray(t,e){return new Lab(t,0,0,null==e?1:e)}function lab(t,e,r,n){return 1===arguments.length?labConvert(t):new Lab(t,e,r,null==n?1:n)}function Lab(t,e,r,n){this.l=+t;this.a=+e;this.b=+r;this.opacity=+n}define(Lab,lab,extend(Color,{brighter(t){return new Lab(this.l+f*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Lab(this.l-f*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;e=m*lab2xyz(e);t=d*lab2xyz(t);r=y*lab2xyz(r);return new Rgb(lrgb2rgb(3.1338561*e-1.6168667*t-.4906146*r),lrgb2rgb(-.9787684*e+1.9161415*t+.033454*r),lrgb2rgb(.0719453*e-.2289914*t+1.4052427*r),this.opacity)}}));function xyz2lab(t){return t>v?Math.pow(t,1/3):t/$+w}function lab2xyz(t){return t>x?t*t*t:$*(t-w)}function lrgb2rgb(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function rgb2lrgb(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function hclConvert(t){if(t instanceof Hcl)return new Hcl(t.h,t.c,t.l,t.opacity);t instanceof Lab||(t=labConvert(t));if(0===t.a&&0===t.b)return new Hcl(NaN,0()=>n;function contains(n,t){var r,o=-1,i=t.length;while(++oo!==d>o&&r<(l-f)*(o-c)/(d-c)+f&&(i=-i)}return i}function segmentContains(n,t,r){var o;return collinear(n,t,r)&&within(n[o=+(n[0]===t[0])],r[o],t[o])}function collinear(n,t,r){return(t[0]-n[0])*(r[1]-n[1])===(r[0]-n[0])*(t[1]-n[1])}function within(n,t,r){return n<=t&&t<=r||r<=t&&t<=n}function noop(){}var u=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Contours(){var i=1,e=1,a=n,f=smoothLinear;function contours(n){var i=a(n);if(Array.isArray(i))i=i.slice().sort(ascending);else{const e=t(n,finite);i=r(...o(e[0],e[1],i),i);while(i[i.length-1]>=e[1])i.pop();while(i[1]contour(n,t)))}function contour(n,t){const r=null==t?NaN:+t;if(isNaN(r))throw new Error(`invalid value: ${t}`);var o=[],i=[];isorings(n,r,(function(t){f(t,n,r);area(t)>0?o.push([t]):i.push(t)}));i.forEach((function(n){for(var t,r=0,i=o.length;r=t;u[c<<2].forEach(stitch);while(++o0&&o0&&a=0&&r>=0))throw new Error("invalid size");return i=t,e=r,contours};contours.thresholds=function(n){return arguments.length?(a="function"===typeof n?n:Array.isArray(n)?constant(s.call(n)):constant(n),contours):a};contours.smooth=function(n){return arguments.length?(f=n?smoothLinear:noop,contours):f===smoothLinear};return contours}function finite(n){return isFinite(n)?n:NaN}function above(n,t){return null!=n&&+n>=t}function valid(n){return null==n||isNaN(n=+n)?-Infinity:n}function smooth1(n,t,r,o){const i=o-t;const e=r-t;const a=isFinite(i)||isFinite(e)?i/e:Math.sign(i)/Math.sign(e);return isNaN(a)?n:n+a-.5}function defaultX(n){return n[0]}function defaultY(n){return n[1]}function defaultWeight(){return 1}function density(){var n=defaultX,t=defaultY,o=defaultWeight,a=960,u=500,f=20,c=2,h=3*f,l=a+2*h>>c,d=u+2*h>>c,g=constant(20);function grid(r){var e=new Float32Array(l*d),a=Math.pow(2,-c),s=-1;for(const i of r){var u=(n(i,++s,r)+h)*a,g=(t(i,s,r)+h)*a,v=+o(i,s,r);if(v&&u>=0&&u=0&&gn*i)))(t).map(((n,t)=>(n.value=+o[t],transform(n))))}density.contours=function(n){var t=grid(n),r=Contours().size([l,d]),o=Math.pow(2,2*c),contour=n=>{n=+n;var i=transform(r.contour(t,n*o));i.value=n;return i};Object.defineProperty(contour,"max",{get:()=>e(t)/o});return contour};function transform(n){n.coordinates.forEach(transformPolygon);return n}function transformPolygon(n){n.forEach(transformRing)}function transformRing(n){n.forEach(transformPoint)}function transformPoint(n){n[0]=n[0]*Math.pow(2,c)-h;n[1]=n[1]*Math.pow(2,c)-h}function resize(){h=3*f;l=a+2*h>>c;d=u+2*h>>c;return density}density.x=function(t){return arguments.length?(n="function"===typeof t?t:constant(+t),density):n};density.y=function(n){return arguments.length?(t="function"===typeof n?n:constant(+n),density):t};density.weight=function(n){return arguments.length?(o="function"===typeof n?n:constant(+n),density):o};density.size=function(n){if(!arguments.length)return[a,u];var t=+n[0],r=+n[1];if(!(t>=0&&r>=0))throw new Error("invalid size");return a=t,u=r,resize()};density.cellSize=function(n){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return c=Math.floor(Math.log(n)/Math.LN2),resize()};density.thresholds=function(n){return arguments.length?(g="function"===typeof n?n:Array.isArray(n)?constant(s.call(n)):constant(n),density):g};density.bandwidth=function(n){if(!arguments.length)return Math.sqrt(f*(f+1));if(!((n=+n)>=0))throw new Error("invalid bandwidth");return f=(Math.sqrt(4*n*n+1)-1)/2,resize()};return density}export{density as contourDensity,Contours as contours}; + diff --git a/vendor/javascript/d3-delaunay.js b/vendor/javascript/d3-delaunay.js new file mode 100644 index 00000000..a9568a9e --- /dev/null +++ b/vendor/javascript/d3-delaunay.js @@ -0,0 +1,2 @@ +import t from"delaunator";const n=1e-6;class Path{constructor(){this._x0=this._y0=this._x1=this._y1=null;this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){if(null!==this._x1){this._x1=this._x0,this._y1=this._y0;this._+="Z"}}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,e,i){t=+t,e=+e,i=+i;const s=t+i;const l=e;if(i<0)throw new Error("negative radius");null===this._x1?this._+=`M${s},${l}`:(Math.abs(this._x1-s)>n||Math.abs(this._y1-l)>n)&&(this._+="L"+s+","+l);i&&(this._+=`A${i},${i},0,1,1,${t-i},${e}A${i},${i},0,1,1,${this._x1=s},${this._y1=l}`)}rect(t,n,e,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+e}v${+i}h${-e}Z`}value(){return this._||null}}class Polygon{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class Voronoi{constructor(t,[n,e,i,s]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((s=+s)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t;this._circumcenters=new Float64Array(2*t.points.length);this.vectors=new Float64Array(2*t.points.length);this.xmax=i,this.xmin=n;this.ymax=s,this.ymin=e;this._init()}update(){this.delaunay.update();this._init();return this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:i}=this;let s,l;const h=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let i,o,r=0,c=0,a=e.length;r1)s-=2;for(let t=2;t0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)0){if(t>=this.xmax)return null;(s=(this.xmax-t)/e)this.xmax?2:0)|(nthis.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n1e-10)return false}return true}function jitter(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}class Delaunay{static from(t,n=pointX,e=pointY,i){return new Delaunay("length"in t?flatArray(t,n,e,i):Float64Array.from(flatIterable(t,n,e,i)))}constructor(n){this._delaunator=new t(n);this.inedges=new Int32Array(n.length/2);this._hullIndex=new Int32Array(n.length/2);this.points=this._delaunator.coords;this._init()}update(){this._delaunator.update();this._init();return this}_init(){const n=this._delaunator,e=this.points;if(n.hull&&n.hull.length>2&&collinear(n)){this.collinear=Int32Array.from({length:e.length/2},((t,n)=>n)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const n=this.collinear[0],i=this.collinear[this.collinear.length-1],s=[e[2*n],e[2*n+1],e[2*i],e[2*i+1]],l=1e-8*Math.hypot(s[3]-s[1],s[2]-s[0]);for(let t=0,n=e.length/2;t0){this.triangles=new Int32Array(3).fill(-1);this.halfedges=new Int32Array(3).fill(-1);this.triangles[0]=s[0];h[s[0]]=1;if(2===s.length){h[s[1]]=0;this.triangles[1]=s[1];this.triangles[2]=s[1]}}}voronoi(t){return new Voronoi(this,t)}*neighbors(t){const{inedges:n,hull:e,_hullIndex:i,halfedges:s,triangles:l,collinear:h}=this;if(h){const n=h.indexOf(t);n>0&&(yield h[n-1]);n=0&&s!==e&&s!==i)e=s;return s}_step(t,n,e){const{inedges:s,hull:l,_hullIndex:h,halfedges:o,triangles:r,points:c}=this;if(-1===s[t]||!c.length)return(t+1)%(c.length>>1);let a=t;let u=i(n-c[2*t],2)+i(e-c[2*t+1],2);const g=s[t];let f=g;do{let s=r[f];const g=i(n-c[2*s],2)+i(e-c[2*s+1],2);g{}};function dispatch(){for(var n,t=0,e=arguments.length,r={};t=0&&(e=n.slice(r+1),n=n.slice(0,r));if(n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:e}}))}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(n,t){var e,r=this._,i=parseTypenames(n+"",r),a=-1,o=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!==typeof t)throw new Error("invalid callback: "+t);while(++a0)for(var e,r,i=new Array(e),a=0;a()=>e;function DragEvent(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:o,x:u,y:i,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:true,configurable:true},sourceEvent:{value:t,enumerable:true,configurable:true},subject:{value:n,enumerable:true,configurable:true},target:{value:r,enumerable:true,configurable:true},identifier:{value:a,enumerable:true,configurable:true},active:{value:o,enumerable:true,configurable:true},x:{value:u,enumerable:true,configurable:true},y:{value:i,enumerable:true,configurable:true},dx:{value:c,enumerable:true,configurable:true},dy:{value:l,enumerable:true,configurable:true},_:{value:d}})}DragEvent.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function defaultFilter(e){return!e.ctrlKey&&!e.button}function defaultContainer(){return this.parentNode}function defaultSubject(e,t){return null==t?{x:e.x,y:e.y}:t}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function drag(){var o,u,i,c,l=defaultFilter,d=defaultContainer,s=defaultSubject,f=defaultTouchable,g={},v=e("start","drag","end"),h=0,m=0;function drag(e){e.on("mousedown.drag",mousedowned).filter(f).on("touchstart.drag",touchstarted).on("touchmove.drag",touchmoved,r).on("touchend.drag touchcancel.drag",touchended).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function mousedowned(e,n){if(!c&&l.call(this,e,n)){var r=beforestart(this,d.call(this,e,n),e,n,"mouse");if(r){t(e.view).on("mousemove.drag",mousemoved,a).on("mouseup.drag",mouseupped,a);nodrag(e.view);nopropagation(e);i=false;o=e.clientX;u=e.clientY;r("start",e)}}}function mousemoved(e){noevent(e);if(!i){var t=e.clientX-o,n=e.clientY-u;i=t*t+n*n>m}g.mouse("drag",e)}function mouseupped(e){t(e.view).on("mousemove.drag mouseup.drag",null);yesdrag(e.view,i);noevent(e);g.mouse("end",e)}function touchstarted(e,t){if(l.call(this,e,t)){var n,r,a=e.changedTouches,o=d.call(this,e,t),u=a.length;for(n=0;n9999?"+"+pad(r,6):pad(r,4)}function formatDate(r){var e=r.getUTCHours(),t=r.getUTCMinutes(),a=r.getUTCSeconds(),o=r.getUTCMilliseconds();return isNaN(r)?"Invalid Date":formatYear(r.getUTCFullYear(),4)+"-"+pad(r.getUTCMonth()+1,2)+"-"+pad(r.getUTCDate(),2)+(o?"T"+pad(e,2)+":"+pad(t,2)+":"+pad(a,2)+"."+pad(o,3)+"Z":a?"T"+pad(e,2)+":"+pad(t,2)+":"+pad(a,2)+"Z":t||e?"T"+pad(e,2)+":"+pad(t,2)+"Z":"")}function dsv(n){var u=new RegExp('["'+n+"\n\r]"),f=n.charCodeAt(0);function parse(r,e){var t,a,o=parseRows(r,(function(r,o){if(t)return t(r,o-1);a=r,t=e?customConverter(r,e):objectConverter(r)}));o.columns=a||[];return o}function parseRows(n,u){var i,s=[],c=n.length,l=0,d=0,m=c<=0,p=false;n.charCodeAt(c-1)===a&&--c;n.charCodeAt(c-1)===o&&--c;function token(){if(m)return e;if(p)return p=false,r;var u,i,s=l;if(n.charCodeAt(s)===t){while(l++=c)m=true;else if((i=n.charCodeAt(l++))===a)p=true;else if(i===o){p=true;n.charCodeAt(l)===a&&++l}return n.slice(s+1,u-1).replace(/""/g,'"')}while(l+t;function quadIn(t){return t*t}function quadOut(t){return t*(2-t)}function quadInOut(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function cubicIn(t){return t*t*t}function cubicOut(t){return--t*t*t+1}function cubicInOut(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var t=3;var n=function custom(t){t=+t;function polyIn(n){return Math.pow(n,t)}polyIn.exponent=custom;return polyIn}(t);var u=function custom(t){t=+t;function polyOut(n){return 1-Math.pow(1-n,t)}polyOut.exponent=custom;return polyOut}(t);var e=function custom(t){t=+t;function polyInOut(n){return((n*=2)<=1?Math.pow(n,t):2-Math.pow(2-n,t))/2}polyInOut.exponent=custom;return polyInOut}(t);var a=Math.PI,c=a/2;function sinIn(t){return 1===+t?1:1-Math.cos(t*c)}function sinOut(t){return Math.sin(t*c)}function sinInOut(t){return(1-Math.cos(a*t))/2}function tpmt(t){return 1.0009775171065494*(Math.pow(2,-10*t)-.0009765625)}function expIn(t){return tpmt(1-+t)}function expOut(t){return 1-tpmt(t)}function expInOut(t){return((t*=2)<=1?tpmt(1-t):2-tpmt(t-1))/2}function circleIn(t){return 1-Math.sqrt(1-t*t)}function circleOut(t){return Math.sqrt(1- --t*t)}function circleInOut(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var s=4/11,r=6/11,o=8/11,i=3/4,O=9/11,I=10/11,p=15/16,f=21/22,l=63/64,m=1/s/s;function bounceIn(t){return 1-bounceOut(1-t)}function bounceOut(t){return(t=+t)text(t,e).then((t=>(new DOMParser).parseFromString(t,r)))}var s=parser("application/xml");var u=parser("text/html");var f=parser("image/svg+xml");export{blob,buffer,n as csv,dsv,u as html,image,json,f as svg,text,o as tsv,s as xml}; + diff --git a/vendor/javascript/d3-force.js b/vendor/javascript/d3-force.js new file mode 100644 index 00000000..ece9edd8 --- /dev/null +++ b/vendor/javascript/d3-force.js @@ -0,0 +1,2 @@ +import{quadtree as n}from"d3-quadtree";import{dispatch as t}from"d3-dispatch";import{timer as e}from"d3-timer";function center(n,t){var e,i=1;null==n&&(n=0);null==t&&(t=0);function force(){var r,o,f=e.length,c=0,a=0;for(r=0;ru+v||il+v||fa.index){var d=u-c.x-c.vx,p=l-c.y-c.vy,z=d*d+p*p;if(zn.r&&(n.r=n[t].r)}function initialize(){if(e){var n,r,o=e.length;i=new Array(o);for(n=0;n[c(n,t,i),n])));for(f=0,r=new Array(u);f(n=(i*n+r)%o)/o}function x$1(n){return n.x}function y$1(n){return n.y}var f=10,c=Math.PI*(3-Math.sqrt(5));function simulation(n){var i,r=1,o=.001,a=1-Math.pow(o,1/300),u=0,l=.6,s=new Map,g=e(step),h=t("tick","end"),v=lcg();null==n&&(n=[]);function step(){tick();h.call("tick",i);if(r1?(null==t?s.delete(n):s.set(n,initializeForce(t)),i):s.get(n)},find:function(t,e,i){var r,o,f,c,a,u=0,l=n.length;null==i?i=Infinity:i*=i;for(u=0;u1?(h.on(n,t),i):h.on(n)}}}function manyBody(){var t,e,i,r,o,f=constant(-30),c=1,a=Infinity,u=.81;function force(i){var o,f=t.length,c=n(t,x$1,y$1).visitAfter(accumulate);for(r=i,o=0;o=a)){if(n.data!==e||n.next){0===s&&(s=jiggle(i),v+=s*s);0===g&&(g=jiggle(i),v+=g*g);v=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function formatDecimalParts(t,r){if((i=(t=r?t.toExponential(r-1):t.toExponential()).indexOf("e"))<0)return null;var i,e=t.slice(0,i);return[e.length>1?e[0]+e.slice(2):e,+t.slice(i+1)]}function exponent(t){return t=formatDecimalParts(Math.abs(t)),t?t[1]:NaN}function formatGroup(t,r){return function(i,e){var n=i.length,a=[],o=0,c=t[0],f=0;while(n>0&&c>0){f+c+1>e&&(c=Math.max(1,e-f));a.push(i.substring(n-=c,n+c));if((f+=c+1)>e)break;c=t[o=(o+1)%t.length]}return a.reverse().join(r)}}function formatNumerals(t){return function(r){return r.replace(/[0-9]/g,(function(r){return t[+r]}))}}var t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(r){if(!(i=t.exec(r)))throw new Error("invalid format: "+r);var i;return new FormatSpecifier({fill:i[1],align:i[2],sign:i[3],symbol:i[4],zero:i[5],width:i[6],comma:i[7],precision:i[8]&&i[8].slice(1),trim:i[9],type:i[10]})}formatSpecifier.prototype=FormatSpecifier.prototype;function FormatSpecifier(t){this.fill=void 0===t.fill?" ":t.fill+"";this.align=void 0===t.align?">":t.align+"";this.sign=void 0===t.sign?"-":t.sign+"";this.symbol=void 0===t.symbol?"":t.symbol+"";this.zero=!!t.zero;this.width=void 0===t.width?void 0:+t.width;this.comma=!!t.comma;this.precision=void 0===t.precision?void 0:+t.precision;this.trim=!!t.trim;this.type=void 0===t.type?"":t.type+""}FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};function formatTrim(t){t:for(var r,i=t.length,e=1,n=-1;e0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(r+1):t}var r;function formatPrefixAuto(t,i){var e=formatDecimalParts(t,i);if(!e)return t+"";var n=e[0],a=e[1],o=a-(r=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,c=n.length;return o===c?n:o>c?n+new Array(o-c+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+formatDecimalParts(t,Math.max(0,i+o-1))[0]}function formatRounded(t,r){var i=formatDecimalParts(t,r);if(!i)return t+"";var e=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+e:e.length>n+1?e.slice(0,n+1)+"."+e.slice(n+1):e+new Array(n-e.length+2).join("0")}var i={"%":(t,r)=>(100*t).toFixed(r),b:t=>Math.round(t).toString(2),c:t=>t+"",d:formatDecimal,e:(t,r)=>t.toExponential(r),f:(t,r)=>t.toFixed(r),g:(t,r)=>t.toPrecision(r),o:t=>Math.round(t).toString(8),p:(t,r)=>formatRounded(100*t,r),r:formatRounded,s:formatPrefixAuto,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function identity(t){return t}var e=Array.prototype.map,n=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function formatLocale(t){var a=void 0===t.grouping||void 0===t.thousands?identity:formatGroup(e.call(t.grouping,Number),t.thousands+""),o=void 0===t.currency?"":t.currency[0]+"",c=void 0===t.currency?"":t.currency[1]+"",f=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?identity:formatNumerals(e.call(t.numerals,String)),m=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function newFormat(t){t=formatSpecifier(t);var e=t.fill,h=t.align,p=t.sign,d=t.symbol,g=t.zero,v=t.width,x=t.comma,y=t.precision,M=t.trim,b=t.type;"n"===b?(x=true,b="g"):i[b]||(void 0===y&&(y=12),M=true,b="g");(g||"0"===e&&"="===h)&&(g=true,e="0",h="=");var w="$"===d?o:"#"===d&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",S="$"===d?c:/[%p]/.test(b)?m:"";var P=i[b],F=/[defgprs%]/.test(b);y=void 0===y?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function format(t){var i,o,c,m=w,d=S;if("c"===b){d=P(t)+d;t=""}else{t=+t;var k=t<0||1/t<0;t=isNaN(t)?u:P(Math.abs(t),y);M&&(t=formatTrim(t));k&&0===+t&&"+"!==p&&(k=false);m=(k?"("===p?p:l:"-"===p||"("===p?"":p)+m;d=("s"===b?n[8+r/3]:"")+d+(k&&"("===p?")":"");if(F){i=-1,o=t.length;while(++ic||c>57){d=(46===c?f+t.slice(i+1):t.slice(i))+d;t=t.slice(0,i);break}}}x&&!g&&(t=a(t,Infinity));var A=m.length+t.length+d.length,L=A>1)+m+t+d+L.slice(A);break;default:t=L+m+t+d;break}return s(t)}format.toString=function(){return t+""};return format}function formatPrefix(t,r){var i=newFormat((t=formatSpecifier(t),t.type="f",t)),e=3*Math.max(-8,Math.min(8,Math.floor(exponent(r)/3))),a=Math.pow(10,-e),o=n[8+e/3];return function(t){return i(a*t)+o}}return{format:newFormat,formatPrefix:formatPrefix}}var a;var o;var c;defaultLocale({thousands:",",grouping:[3],currency:["$",""]});function defaultLocale(t){a=formatLocale(t);o=a.format;c=a.formatPrefix;return a}function precisionFixed(t){return Math.max(0,-exponent(Math.abs(t)))}function precisionPrefix(t,r){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(exponent(r)/3)))-exponent(Math.abs(t)))}function precisionRound(t,r){t=Math.abs(t),r=Math.abs(r)-t;return Math.max(0,exponent(r)-exponent(t))+1}export{FormatSpecifier,o as format,defaultLocale as formatDefaultLocale,formatLocale,c as formatPrefix,formatSpecifier,precisionFixed,precisionPrefix,precisionRound}; + diff --git a/vendor/javascript/d3-geo.js b/vendor/javascript/d3-geo.js new file mode 100644 index 00000000..016b8564 --- /dev/null +++ b/vendor/javascript/d3-geo.js @@ -0,0 +1,2 @@ +import{Adder as n,merge as t,range as r}from"d3-array";var e=1e-6;var i=1e-12;var o=Math.PI;var a=o/2;var c=o/4;var u=2*o;var l=180/o;var s=o/180;var f=Math.abs;var p=Math.atan;var g=Math.atan2;var h=Math.cos;var d=Math.ceil;var v=Math.exp;Math.floor;var m=Math.hypot;var E=Math.log;var S=Math.pow;var y=Math.sin;var R=Math.sign||function(n){return n>0?1:n<0?-1:0};var w=Math.sqrt;var P=Math.tan;function acos(n){return n>1?0:n<-1?o:Math.acos(n)}function asin(n){return n>1?a:n<-1?-a:Math.asin(n)}function haversin(n){return(n=y(n/2))*n}function noop(){}function streamGeometry(n,t){n&&M.hasOwnProperty(n.type)&&M[n.type](n,t)}var j={Feature:function(n,t){streamGeometry(n.geometry,t)},FeatureCollection:function(n,t){var r=n.features,e=-1,i=r.length;while(++e=0?1:-1,i=e*r,o=h(t),a=y(t),u=$*a,l=q*o+u*h(i),f=u*e*y(i);b.add(g(f,l));C=n,q=o,$=a}function area(t){_=new n;geoStream(t,N);return 2*_}function spherical(n){return[g(n[1],n[0]),asin(n[2])]}function cartesian(n){var t=n[0],r=n[1],e=h(r);return[e*h(t),e*y(t),y(r)]}function cartesianDot(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function cartesianCross(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function cartesianAddInPlace(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function cartesianScale(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function cartesianNormalizeInPlace(n){var t=w(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var I,A,z,F,T,U,G,k,H,W,D;var O={point:boundsPoint$1,lineStart:boundsLineStart,lineEnd:boundsLineEnd,polygonStart:function(){O.point=boundsRingPoint;O.lineStart=boundsRingStart;O.lineEnd=boundsRingEnd;H=new n;N.polygonStart()},polygonEnd:function(){N.polygonEnd();O.point=boundsPoint$1;O.lineStart=boundsLineStart;O.lineEnd=boundsLineEnd;b<0?(I=-(z=180),A=-(F=90)):H>e?F=90:H<-e&&(A=-90);D[0]=I,D[1]=z},sphere:function(){I=-(z=180),A=-(F=90)}};function boundsPoint$1(n,t){W.push(D=[I=n,z=n]);tF&&(F=t)}function linePoint(n,t){var r=cartesian([n*s,t*s]);if(k){var e=cartesianCross(k,r),i=[e[1],-e[0],0],o=cartesianCross(i,e);cartesianNormalizeInPlace(o);o=spherical(o);var a,c=n-T,u=c>0?1:-1,p=o[0]*l*u,g=f(c)>180;if(g^(u*TF&&(F=a)}else if(p=(p+360)%360-180,g^(u*TF&&(F=t)}if(g)nangle(I,z)&&(z=n):angle(n,z)>angle(I,z)&&(I=n);else if(z>=I){nz&&(z=n)}else n>T?angle(I,n)>angle(I,z)&&(z=n):angle(n,z)>angle(I,z)&&(I=n)}else W.push(D=[I=n,z=n]);tF&&(F=t);k=r,T=n}function boundsLineStart(){O.point=linePoint}function boundsLineEnd(){D[0]=I,D[1]=z;O.point=boundsPoint$1;k=null}function boundsRingPoint(n,t){if(k){var r=n-T;H.add(f(r)>180?r+(r>0?360:-360):r)}else U=n,G=t;N.point(n,t);linePoint(n,t)}function boundsRingStart(){N.lineStart()}function boundsRingEnd(){boundsRingPoint(U,G);N.lineEnd();f(H)>e&&(I=-(z=180));D[0]=I,D[1]=z;k=null}function angle(n,t){return(t-=n)<0?t+360:t}function rangeCompare(n,t){return n[0]-t[0]}function rangeContains(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:tangle(e[0],e[1])&&(e[1]=i[1]);angle(i[0],e[1])>angle(e[0],e[1])&&(e[0]=i[0])}else o.push(e=i)}for(a=-Infinity,r=o.length-1,t=0,e=o[r];t<=r;e=i,++t){i=o[t];(c=angle(e[1],i[0]))>a&&(a=c,I=i[0],z=e[1])}}W=D=null;return Infinity===I||Infinity===A?[[NaN,NaN],[NaN,NaN]]:[[I,A],[z,F]]}var X,Y,B,Z,J,K,Q,V,nn,tn,rn,en,on,an,cn,un;var ln={sphere:noop,point:centroidPoint$1,lineStart:centroidLineStart$1,lineEnd:centroidLineEnd$1,polygonStart:function(){ln.lineStart=centroidRingStart$1;ln.lineEnd=centroidRingEnd$1},polygonEnd:function(){ln.lineStart=centroidLineStart$1;ln.lineEnd=centroidLineEnd$1}};function centroidPoint$1(n,t){n*=s,t*=s;var r=h(t);centroidPointCartesian(r*h(n),r*y(n),y(t))}function centroidPointCartesian(n,t,r){++X;B+=(n-B)/X;Z+=(t-Z)/X;J+=(r-J)/X}function centroidLineStart$1(){ln.point=centroidLinePointFirst}function centroidLinePointFirst(n,t){n*=s,t*=s;var r=h(t);an=r*h(n);cn=r*y(n);un=y(t);ln.point=centroidLinePoint;centroidPointCartesian(an,cn,un)}function centroidLinePoint(n,t){n*=s,t*=s;var r=h(t),e=r*h(n),i=r*y(n),o=y(t),a=g(w((a=cn*o-un*i)*a+(a=un*e-an*o)*a+(a=an*i-cn*e)*a),an*e+cn*i+un*o);Y+=a;K+=a*(an+(an=e));Q+=a*(cn+(cn=i));V+=a*(un+(un=o));centroidPointCartesian(an,cn,un)}function centroidLineEnd$1(){ln.point=centroidPoint$1}function centroidRingStart$1(){ln.point=centroidRingPointFirst}function centroidRingEnd$1(){centroidRingPoint(en,on);ln.point=centroidPoint$1}function centroidRingPointFirst(n,t){en=n,on=t;n*=s,t*=s;ln.point=centroidRingPoint;var r=h(t);an=r*h(n);cn=r*y(n);un=y(t);centroidPointCartesian(an,cn,un)}function centroidRingPoint(n,t){n*=s,t*=s;var r=h(t),e=r*h(n),i=r*y(n),o=y(t),a=cn*o-un*i,c=un*e-an*o,u=an*i-cn*e,l=m(a,c,u),f=asin(l),p=l&&-f/l;nn.add(p*a);tn.add(p*c);rn.add(p*u);Y+=f;K+=f*(an+(an=e));Q+=f*(cn+(cn=i));V+=f*(un+(un=o));centroidPointCartesian(an,cn,un)}function centroid(t){X=Y=B=Z=J=K=Q=V=0;nn=new n;tn=new n;rn=new n;geoStream(t,ln);var r=+nn,o=+tn,a=+rn,c=m(r,o,a);if(co&&(n-=Math.round(n/u)*u);return[n,t]}rotationIdentity.invert=rotationIdentity;function rotateRadians(n,t,r){return(n%=u)?t||r?compose(rotationLambda(n),rotationPhiGamma(t,r)):rotationLambda(n):t||r?rotationPhiGamma(t,r):rotationIdentity}function forwardRotationLambda(n){return function(t,r){t+=n;f(t)>o&&(t-=Math.round(t/u)*u);return[t,r]}}function rotationLambda(n){var t=forwardRotationLambda(n);t.invert=forwardRotationLambda(-n);return t}function rotationPhiGamma(n,t){var r=h(n),e=y(n),i=h(t),o=y(t);function rotation(n,t){var a=h(t),c=h(n)*a,u=y(n)*a,l=y(t),s=l*r+c*e;return[g(u*i-s*o,c*r-l*e),asin(s*i+u*o)]}rotation.invert=function(n,t){var a=h(t),c=h(n)*a,u=y(n)*a,l=y(t),s=l*i-u*o;return[g(u*i+l*o,c*r+s*e),asin(s*r-c*e)]};return rotation}function rotation(n){n=rotateRadians(n[0]*s,n[1]*s,n.length>2?n[2]*s:0);function forward(t){t=n(t[0]*s,t[1]*s);return t[0]*=l,t[1]*=l,t}forward.invert=function(t){t=n.invert(t[0]*s,t[1]*s);return t[0]*=l,t[1]*=l,t};return forward}function circleStream(n,t,r,e,i,o){if(r){var a=h(t),c=y(t),l=e*r;if(null==i){i=t+e*u;o=t-l/2}else{i=circleRadius(a,i);o=circleRadius(a,o);(e>0?io)&&(i+=e*u)}for(var s,f=i;e>0?f>o:f1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;t=[];n=null;return r}}}function pointEqual(n,t){return f(n[0]-t[0])=0;--a)o.point((f=s[a])[0],f[1])}else i(g.x,g.p.x,-1,o);g=g.p}g=g.o;s=g.z;h=!h}while(!g.v);o.lineEnd()}}}function link(n){if(t=n.length){var t,r,e=0,i=n[0];while(++e=0?1:-1,z=A*I,F=z>o,T=b*_;m.add(g(T*A*y(z),L*N+T*h(z)));d+=F?I+A*u:I;if(F^j>=l^q>=l){var U=cartesianCross(cartesian(P),cartesian(C));cartesianNormalizeInPlace(U);var G=cartesianCross(p,U);cartesianNormalizeInPlace(G);var k=(F^I>=0?-1:1)*asin(G[2]);(s>k||s===k&&(U[0]||U[1]))&&(v+=F^I>=0?1:-1)}}}return(d<-e||d0){p||(o.polygonStart(),p=true);o.lineStart();for(n=0;n1&&2&i&&l.push(l.pop().concat(l.shift()));c.push(l.filter(validSegment))}}return g}}function validSegment(n){return n.length>1}function compareIntersection(n,t){return((n=n.x)[0]<0?n[1]-a-e:a-n[1])-((t=t.x)[0]<0?t[1]-a-e:a-t[1])}var sn=clip((function(){return true}),clipAntimeridianLine,clipAntimeridianInterpolate,[-o,-a]);function clipAntimeridianLine(n){var t,r=NaN,i=NaN,c=NaN;return{lineStart:function(){n.lineStart();t=1},point:function(u,l){var s=u>0?o:-o,p=f(u-r);if(f(p-o)0?a:-a);n.point(c,i);n.lineEnd();n.lineStart();n.point(s,i);n.point(u,i);t=0}else if(c!==s&&p>=o){f(r-c)e?p((y(t)*(a=h(i))*y(r)-y(i)*(o=h(t))*y(n))/(o*a*c)):(t+i)/2}function clipAntimeridianInterpolate(n,t,r,i){var c;if(null==n){c=r*a;i.point(-o,c);i.point(0,c);i.point(o,c);i.point(o,0);i.point(o,-c);i.point(0,-c);i.point(-o,-c);i.point(-o,0);i.point(-o,c)}else if(f(n[0]-t[0])>e){var u=n[0]0,a=f(t)>e;function interpolate(t,e,i,o){circleStream(o,n,r,i,t,e)}function visible(n,r){return h(n)*h(r)>t}function clipLine(n){var t,r,e,c,u;return{lineStart:function(){c=e=false;u=1},point:function(l,s){var f,p=[l,s],g=visible(l,s),h=i?g?0:code(l,s):g?code(l+(l<0?o:-o),s):0;!t&&(c=e=g)&&n.lineStart();if(g!==e){f=intersect(t,p);(!f||pointEqual(t,f)||pointEqual(p,f))&&(p[2]=1)}if(g!==e){u=0;if(g){n.lineStart();f=intersect(p,t);n.point(f[0],f[1])}else{f=intersect(t,p);n.point(f[0],f[1],2);n.lineEnd()}t=f}else if(a&&t&&i^g){var d;if(!(h&r)&&(d=intersect(p,t,true))){u=0;if(i){n.lineStart();n.point(d[0][0],d[0][1]);n.point(d[1][0],d[1][1]);n.lineEnd()}else{n.point(d[1][0],d[1][1]);n.lineEnd();n.lineStart();n.point(d[0][0],d[0][1],3)}}}!g||t&&pointEqual(t,p)||n.point(p[0],p[1]);t=p,e=g,r=h},lineEnd:function(){e&&n.lineEnd();t=null},clean:function(){return u|(c&&e)<<1}}}function intersect(n,r,i){var a=cartesian(n),c=cartesian(r);var u=[1,0,0],l=cartesianCross(a,c),s=cartesianDot(l,l),p=l[0],g=s-p*p;if(!g)return!i&&n;var h=t*s/g,d=-t*p/g,v=cartesianCross(u,l),m=cartesianScale(u,h),E=cartesianScale(l,d);cartesianAddInPlace(m,E);var S=v,y=cartesianDot(m,S),R=cartesianDot(S,S),P=y*y-R*(cartesianDot(m,m)-1);if(!(P<0)){var j=w(P),M=cartesianScale(S,(-y-j)/R);cartesianAddInPlace(M,m);M=spherical(M);if(!i)return M;var b,L=n[0],x=r[0],C=n[1],q=r[1];x0^M[1]<(f(M[0]-L)o^(L<=M[0]&&M[0]<=x)){var I=cartesianScale(S,(-y+j)/R);cartesianAddInPlace(I,m);return[M,spherical(I)]}}}function code(t,r){var e=i?n:o-n,a=0;t<-e?a|=1:t>e&&(a|=2);r<-e?a|=4:r>e&&(a|=8);return a}return clip(visible,clipLine,interpolate,i?[0,-n]:[-o,n-o])}function clipLine(n,t,r,e,i,o){var a,c=n[0],u=n[1],l=t[0],s=t[1],f=0,p=1,g=l-c,h=s-u;a=r-c;if(g||!(a>0)){a/=g;if(g<0){if(a0){if(a>p)return;a>f&&(f=a)}a=i-c;if(g||!(a<0)){a/=g;if(g<0){if(a>p)return;a>f&&(f=a)}else if(g>0){if(a0)){a/=h;if(h<0){if(a0){if(a>p)return;a>f&&(f=a)}a=o-u;if(h||!(a<0)){a/=h;if(h<0){if(a>p)return;a>f&&(f=a)}else if(h>0){if(a0&&(n[0]=c+f*g,n[1]=u+f*h);p<1&&(t[0]=c+p*g,t[1]=u+p*h);return true}}}}}var fn=1e9,pn=-fn;function clipRectangle(n,r,i,o){function visible(t,e){return n<=t&&t<=i&&r<=e&&e<=o}function interpolate(t,e,a,c){var u=0,l=0;if(null==t||(u=corner(t,a))!==(l=corner(e,a))||comparePoint(t,e)<0^a>0)do{c.point(0===u||3===u?n:i,u>1?o:r)}while((u=(u+a+4)%4)!==l);else c.point(e[0],e[1])}function corner(t,o){return f(t[0]-n)0?0:3:f(t[0]-i)0?2:1:f(t[1]-r)0?1:0:o>0?3:2}function compareIntersection(n,t){return comparePoint(n.x,t.x)}function comparePoint(n,t){var r=corner(n,1),e=corner(t,1);return r!==e?r-e:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}return function(e){var a,c,u,l,s,f,p,g,h,d,v,m=e,E=clipBuffer();var S={point:point,lineStart:lineStart,lineEnd:lineEnd,polygonStart:polygonStart,polygonEnd:polygonEnd};function point(n,t){visible(n,t)&&m.point(n,t)}function polygonInside(){var t=0;for(var r=0,e=c.length;ro&&(p-i)*(o-a)>(g-a)*(n-i)&&++t:g<=o&&(p-i)*(o-a)<(g-a)*(n-i)&&--t}return t}function polygonStart(){m=E,a=[],c=[],v=true}function polygonEnd(){var n=polygonInside(),r=v&&n,i=(a=t(a)).length;if(r||i){e.polygonStart();if(r){e.lineStart();interpolate(null,null,1,e);e.lineEnd()}i&&clipRejoin(a,compareIntersection,n,interpolate,e);e.polygonEnd()}m=e,a=c=u=null}function lineStart(){S.point=linePoint;c&&c.push(u=[]);d=true;h=false;p=g=NaN}function lineEnd(){if(a){linePoint(l,s);f&&h&&E.rejoin();a.push(E.result())}S.point=point;h&&m.lineEnd()}function linePoint(t,e){var a=visible(t,e);c&&u.push([t,e]);if(d){l=t,s=e,f=a;d=false;if(a){m.lineStart();m.point(t,e)}}else if(a&&h)m.point(t,e);else{var E=[p=Math.max(pn,Math.min(fn,p)),g=Math.max(pn,Math.min(fn,g))],S=[t=Math.max(pn,Math.min(fn,t)),e=Math.max(pn,Math.min(fn,e))];if(clipLine(E,S,n,r,i,o)){if(!h){m.lineStart();m.point(E[0],E[1])}m.point(S[0],S[1]);a||m.lineEnd();v=false}else if(a){m.lineStart();m.point(t,e);v=false}}p=t,g=e,h=a}return S}}function extent(){var n,t,r,e=0,i=0,o=960,a=500;return r={stream:function(r){return n&&t===r?n:n=clipRectangle(e,i,o,a)(t=r)},extent:function(c){return arguments.length?(e=+c[0][0],i=+c[0][1],o=+c[1][0],a=+c[1][1],n=t=null,r):[[e,i],[o,a]]}}}var gn,hn,dn,vn;var mn={sphere:noop,point:noop,lineStart:lengthLineStart,lineEnd:noop,polygonStart:noop,polygonEnd:noop};function lengthLineStart(){mn.point=lengthPointFirst$1;mn.lineEnd=lengthLineEnd}function lengthLineEnd(){mn.point=mn.lineEnd=noop}function lengthPointFirst$1(n,t){n*=s,t*=s;hn=n,dn=y(t),vn=h(t);mn.point=lengthPoint$1}function lengthPoint$1(n,t){n*=s,t*=s;var r=y(t),e=h(t),i=f(n-hn),o=h(i),a=y(i),c=e*a,u=vn*r-dn*e*o,l=dn*r+vn*e*o;gn.add(g(w(c*c+u*u),l));hn=n,dn=r,vn=e}function length(t){gn=new n;geoStream(t,mn);return+gn}var En=[null,null],Sn={type:"LineString",coordinates:En};function distance(n,t){En[0]=n;En[1]=t;return length(Sn)}var yn={Feature:function(n,t){return containsGeometry(n.geometry,t)},FeatureCollection:function(n,t){var r=n.features,e=-1,i=r.length;while(++e0){o=distance(n[a],n[a-1]);if(o>0&&r<=o&&e<=o&&(r+e-o)*(1-Math.pow((r-e)/o,2))e})).map(s)).concat(r(d(c/m)*m,a,m).filter((function(n){return f(n%S)>e})).map(p))}graticule.lines=function(){return lines().map((function(n){return{type:"LineString",coordinates:n}}))};graticule.outline=function(){return{type:"Polygon",coordinates:[g(o).concat(h(u).slice(1),g(i).reverse().slice(1),h(l).reverse().slice(1))]}};graticule.extent=function(n){return arguments.length?graticule.extentMajor(n).extentMinor(n):graticule.extentMinor()};graticule.extentMajor=function(n){if(!arguments.length)return[[o,l],[i,u]];o=+n[0][0],i=+n[1][0];l=+n[0][1],u=+n[1][1];o>i&&(n=o,o=i,i=n);l>u&&(n=l,l=u,u=n);return graticule.precision(y)};graticule.extentMinor=function(r){if(!arguments.length)return[[t,c],[n,a]];t=+r[0][0],n=+r[1][0];c=+r[0][1],a=+r[1][1];t>n&&(r=t,t=n,n=r);c>a&&(r=c,c=a,a=r);return graticule.precision(y)};graticule.step=function(n){return arguments.length?graticule.stepMajor(n).stepMinor(n):graticule.stepMinor()};graticule.stepMajor=function(n){if(!arguments.length)return[E,S];E=+n[0],S=+n[1];return graticule};graticule.stepMinor=function(n){if(!arguments.length)return[v,m];v=+n[0],m=+n[1];return graticule};graticule.precision=function(r){if(!arguments.length)return y;y=+r;s=graticuleX(c,a,90);p=graticuleY(t,n,y);g=graticuleX(l,u,90);h=graticuleY(o,i,y);return graticule};return graticule.extentMajor([[-180,-90+e],[180,90-e]]).extentMinor([[-180,-80-e],[180,80+e]])}function graticule10(){return graticule()()}function interpolate(n,t){var r=n[0]*s,e=n[1]*s,i=t[0]*s,o=t[1]*s,a=h(e),c=y(e),u=h(o),f=y(o),p=a*h(r),d=a*y(r),v=u*h(i),m=u*y(i),E=2*asin(w(haversin(o-e)+a*u*haversin(i-r))),S=y(E);var R=E?function(n){var t=y(n*=E)/S,r=y(E-n)/S,e=r*p+t*v,i=r*d+t*m,o=r*c+t*f;return[g(i,e)*l,g(o,w(e*e+i*i))*l]}:function(){return[r*l,e*l]};R.distance=E;return R}var identity$1=n=>n;var wn,Pn,jn,Mn,bn=new n,Ln=new n;var xn={point:noop,lineStart:noop,lineEnd:noop,polygonStart:function(){xn.lineStart=areaRingStart;xn.lineEnd=areaRingEnd},polygonEnd:function(){xn.lineStart=xn.lineEnd=xn.point=noop;bn.add(f(Ln));Ln=new n},result:function(){var t=bn/2;bn=new n;return t}};function areaRingStart(){xn.point=areaPointFirst}function areaPointFirst(n,t){xn.point=areaPoint;wn=jn=n,Pn=Mn=t}function areaPoint(n,t){Ln.add(Mn*n-jn*t);jn=n,Mn=t}function areaRingEnd(){areaPoint(wn,Pn)}var Cn=Infinity,qn=Cn,$n=-Cn,_n=$n;var Nn={point:boundsPoint,lineStart:noop,lineEnd:noop,polygonStart:noop,polygonEnd:noop,result:function(){var n=[[Cn,qn],[$n,_n]];$n=_n=-(qn=Cn=Infinity);return n}};function boundsPoint(n,t){n$n&&($n=n);t_n&&(_n=t)}var In,An,zn,Fn,Tn=0,Un=0,Gn=0,kn=0,Hn=0,Wn=0,Dn=0,On=0,Xn=0;var Yn={point:centroidPoint,lineStart:centroidLineStart,lineEnd:centroidLineEnd,polygonStart:function(){Yn.lineStart=centroidRingStart;Yn.lineEnd=centroidRingEnd},polygonEnd:function(){Yn.point=centroidPoint;Yn.lineStart=centroidLineStart;Yn.lineEnd=centroidLineEnd},result:function(){var n=Xn?[Dn/Xn,On/Xn]:Wn?[kn/Wn,Hn/Wn]:Gn?[Tn/Gn,Un/Gn]:[NaN,NaN];Tn=Un=Gn=kn=Hn=Wn=Dn=On=Xn=0;return n}};function centroidPoint(n,t){Tn+=n;Un+=t;++Gn}function centroidLineStart(){Yn.point=centroidPointFirstLine}function centroidPointFirstLine(n,t){Yn.point=centroidPointLine;centroidPoint(zn=n,Fn=t)}function centroidPointLine(n,t){var r=n-zn,e=t-Fn,i=w(r*r+e*e);kn+=i*(zn+n)/2;Hn+=i*(Fn+t)/2;Wn+=i;centroidPoint(zn=n,Fn=t)}function centroidLineEnd(){Yn.point=centroidPoint}function centroidRingStart(){Yn.point=centroidPointFirstRing}function centroidRingEnd(){centroidPointRing(In,An)}function centroidPointFirstRing(n,t){Yn.point=centroidPointRing;centroidPoint(In=zn=n,An=Fn=t)}function centroidPointRing(n,t){var r=n-zn,e=t-Fn,i=w(r*r+e*e);kn+=i*(zn+n)/2;Hn+=i*(Fn+t)/2;Wn+=i;i=Fn*n-zn*t;Dn+=i*(zn+n);On+=i*(Fn+t);Xn+=3*i;centroidPoint(zn=n,Fn=t)}function PathContext(n){this._context=n}PathContext.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath();this._point=NaN},point:function(n,t){switch(this._point){case 0:this._context.moveTo(n,t);this._point=1;break;case 1:this._context.lineTo(n,t);break;default:this._context.moveTo(n+this._radius,t);this._context.arc(n,t,this._radius,0,u);break}},result:noop};var Bn,Zn,Jn,Kn,Qn,Vn=new n;var nt={point:noop,lineStart:function(){nt.point=lengthPointFirst},lineEnd:function(){Bn&&lengthPoint(Zn,Jn);nt.point=noop},polygonStart:function(){Bn=true},polygonEnd:function(){Bn=null},result:function(){var t=+Vn;Vn=new n;return t}};function lengthPointFirst(n,t){nt.point=lengthPoint;Zn=Kn=n,Jn=Qn=t}function lengthPoint(n,t){Kn-=n,Qn-=t;Vn.add(w(Kn*Kn+Qn*Qn));Kn=n,Qn=t}let tt,rt,et,it;class PathString{constructor(n){this._append=null==n?append:appendRound(n);this._radius=4.5;this._=""}pointRadius(n){this._radius=+n;return this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z");this._point=NaN}point(n,t){switch(this._point){case 0:this._append`M${n},${t}`;this._point=1;break;case 1:this._append`L${n},${t}`;break;default:this._append`M${n},${t}`;if(this._radius!==et||this._append!==rt){const n=this._radius;const t=this._;this._="";this._append`m0,${n}a${n},${n} 0 1,1 0,${-2*n}a${n},${n} 0 1,1 0,${2*n}z`;et=n;rt=this._append;it=this._;this._=t}this._+=it;break}}result(){const n=this._;this._="";return n.length?n:null}}function append(n){let t=1;this._+=n[0];for(const r=n.length;t=0))throw new RangeError(`invalid digits: ${n}`);if(t>15)return append;if(t!==tt){const n=10**t;tt=t;rt=function append(t){let r=1;this._+=t[0];for(const e=t.length;r=0))throw new RangeError(`invalid digits: ${n}`);i=t}null===t&&(e=new PathString(i));return path};return path.projection(n).digits(i).context(t)}function transform(n){return{stream:transformer(n)}}function transformer(n){return function(t){var r=new TransformStream;for(var e in n)r[e]=n[e];r.stream=t;return r}}function TransformStream(){}TransformStream.prototype={constructor:TransformStream,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function fit(n,t,r){var e=n.clipExtent&&n.clipExtent();n.scale(150).translate([0,0]);null!=e&&n.clipExtent(null);geoStream(r,n.stream(Nn));t(Nn.result());null!=e&&n.clipExtent(e);return n}function fitExtent(n,t,r){return fit(n,(function(r){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(e/(r[1][0]-r[0][0]),i/(r[1][1]-r[0][1])),a=+t[0][0]+(e-o*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(i-o*(r[1][1]+r[0][1]))/2;n.scale(150*o).translate([a,c])}),r)}function fitSize(n,t,r){return fitExtent(n,[[0,0],t],r)}function fitWidth(n,t,r){return fit(n,(function(r){var e=+t,i=e/(r[1][0]-r[0][0]),o=(e-i*(r[1][0]+r[0][0]))/2,a=-i*r[0][1];n.scale(150*i).translate([o,a])}),r)}function fitHeight(n,t,r){return fit(n,(function(r){var e=+t,i=e/(r[1][1]-r[0][1]),o=-i*r[0][0],a=(e-i*(r[1][1]+r[0][1]))/2;n.scale(150*i).translate([o,a])}),r)}var ot=16,at=h(30*s);function resample(n,t){return+t?resample$1(n,t):resampleNone(n)}function resampleNone(n){return transformer({point:function(t,r){t=n(t,r);this.stream.point(t[0],t[1])}})}function resample$1(n,t){function resampleLineTo(r,i,o,a,c,u,l,s,p,h,d,v,m,E){var S=l-r,y=s-i,R=S*S+y*y;if(R>4*t&&m--){var P=a+h,j=c+d,M=u+v,b=w(P*P+j*j+M*M),L=asin(M/=b),x=f(f(M)-1)t||f((S*_+y*N)/R-.5)>.3||a*h+c*d+u*v2?n[2]%360*s:0,recenter()):[E*l,S*l,y*l]};projection.angle=function(n){return arguments.length?(R=n%360*s,recenter()):R*l};projection.reflectX=function(n){return arguments.length?(P=n?-1:1,recenter()):P<0};projection.reflectY=function(n){return arguments.length?(j=n?-1:1,recenter()):j<0};projection.precision=function(n){return arguments.length?(a=resample(c,C=n*n),reset()):w(C)};projection.fitExtent=function(n,t){return fitExtent(projection,n,t)};projection.fitSize=function(n,t){return fitSize(projection,n,t)};projection.fitWidth=function(n,t){return fitWidth(projection,n,t)};projection.fitHeight=function(n,t){return fitHeight(projection,n,t)};function recenter(){var n=scaleTranslateRotate(g,0,0,P,j,R).apply(null,t(v,m)),e=scaleTranslateRotate(g,h-n[0],d-n[1],P,j,R);r=rotateRadians(E,S,y);c=compose(t,e);u=compose(r,c);a=resample(c,C);return reset()}function reset(){f=p=null;return projection}return function(){t=n.apply(this,arguments);projection.invert=t.invert&&invert;return recenter()}}function conicProjection(n){var t=0,r=o/3,e=projectionMutator(n),i=e(t,r);i.parallels=function(n){return arguments.length?e(t=n[0]*s,r=n[1]*s):[t*l,r*l]};return i}function cylindricalEqualAreaRaw(n){var t=h(n);function forward(n,r){return[n*t,y(r)/t]}forward.invert=function(n,r){return[n/t,asin(r*t)]};return forward}function conicEqualAreaRaw(n,t){var r=y(n),i=(r+y(t))/2;if(f(i)=.12&&i<.234&&e>=-.425&&e<-.214?u:i>=.166&&i<.234&&e>=-.214&&e<-.115?l:c).invert(n)};albersUsa.stream=function(r){return n&&t===r?n:n=multiplex([c.stream(t=r),u.stream(r),l.stream(r)])};albersUsa.precision=function(n){if(!arguments.length)return c.precision();c.precision(n),u.precision(n),l.precision(n);return reset()};albersUsa.scale=function(n){if(!arguments.length)return c.scale();c.scale(n),u.scale(.35*n),l.scale(n);return albersUsa.translate(c.translate())};albersUsa.translate=function(n){if(!arguments.length)return c.translate();var t=c.scale(),a=+n[0],f=+n[1];r=c.translate(n).clipExtent([[a-.455*t,f-.238*t],[a+.455*t,f+.238*t]]).stream(s);i=u.translate([a-.307*t,f+.201*t]).clipExtent([[a-.425*t+e,f+.12*t+e],[a-.214*t-e,f+.234*t-e]]).stream(s);o=l.translate([a-.205*t,f+.212*t]).clipExtent([[a-.214*t+e,f+.166*t+e],[a-.115*t-e,f+.234*t-e]]).stream(s);return reset()};albersUsa.fitExtent=function(n,t){return fitExtent(albersUsa,n,t)};albersUsa.fitSize=function(n,t){return fitSize(albersUsa,n,t)};albersUsa.fitWidth=function(n,t){return fitWidth(albersUsa,n,t)};albersUsa.fitHeight=function(n,t){return fitHeight(albersUsa,n,t)};function reset(){n=t=null;return albersUsa}return albersUsa.scale(1070)}function azimuthalRaw(n){return function(t,r){var e=h(t),i=h(r),o=n(e*i);return Infinity===o?[2,0]:[o*i*y(t),o*y(r)]}}function azimuthalInvert(n){return function(t,r){var e=w(t*t+r*r),i=n(e),o=y(i),a=h(i);return[g(t*o,e*a),asin(e&&r*o/e)]}}var ut=azimuthalRaw((function(n){return w(2/(1+n))}));ut.invert=azimuthalInvert((function(n){return 2*asin(n/2)}));function azimuthalEqualArea(){return projection(ut).scale(124.75).clipAngle(179.999)}var lt=azimuthalRaw((function(n){return(n=acos(n))&&n/y(n)}));lt.invert=azimuthalInvert((function(n){return n}));function azimuthalEquidistant(){return projection(lt).scale(79.4188).clipAngle(179.999)}function mercatorRaw(n,t){return[n,E(P((a+t)/2))]}mercatorRaw.invert=function(n,t){return[n,2*p(v(t))-a]};function mercator(){return mercatorProjection(mercatorRaw).scale(961/u)}function mercatorProjection(n){var t,r,e,i=projection(n),a=i.center,c=i.scale,u=i.translate,l=i.clipExtent,s=null;i.scale=function(n){return arguments.length?(c(n),reclip()):c()};i.translate=function(n){return arguments.length?(u(n),reclip()):u()};i.center=function(n){return arguments.length?(a(n),reclip()):a()};i.clipExtent=function(n){return arguments.length?(null==n?s=t=r=e=null:(s=+n[0][0],t=+n[0][1],r=+n[1][0],e=+n[1][1]),reclip()):null==s?null:[[s,t],[r,e]]};function reclip(){var a=o*c(),u=i(rotation(i.rotate()).invert([0,0]));return l(null==s?[[u[0]-a,u[1]-a],[u[0]+a,u[1]+a]]:n===mercatorRaw?[[Math.max(u[0]-a,s),t],[Math.min(u[0]+a,r),e]]:[[s,Math.max(u[1]-a,t)],[r,Math.min(u[1]+a,e)]])}return reclip()}function tany(n){return P((a+n)/2)}function conicConformalRaw(n,t){var r=h(n),i=n===t?y(n):E(r/h(t))/E(tany(t)/tany(n)),c=r*S(tany(n),i)/i;if(!i)return mercatorRaw;function project(n,t){c>0?t<-a+e&&(t=-a+e):t>a-e&&(t=a-e);var r=c/S(tany(t),i);return[r*y(i*n),c-r*h(i*n)]}project.invert=function(n,t){var r=c-t,e=R(i)*w(n*n+r*r),u=g(n,f(r))*R(r);r*i<0&&(u-=o*R(n)*R(r));return[u/i,2*p(S(c/e,1/i))-a]};return project}function conicConformal(){return conicProjection(conicConformalRaw).scale(109.5).parallels([30,30])}function equirectangularRaw(n,t){return[n,t]}equirectangularRaw.invert=equirectangularRaw;function equirectangular(){return projection(equirectangularRaw).scale(152.63)}function conicEquidistantRaw(n,t){var r=h(n),i=n===t?y(n):(r-h(t))/(t-n),a=r/i+n;if(f(i)e&&--o>0);return[n/(.8707+(a=i*i)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),i]};function naturalEarth1(){return projection(naturalEarth1Raw).scale(175.295)}function orthographicRaw(n,t){return[h(t)*y(n),y(t)]}orthographicRaw.invert=azimuthalInvert(asin);function orthographic(){return projection(orthographicRaw).scale(249.5).clipAngle(90+e)}function stereographicRaw(n,t){var r=h(t),e=1+h(n)*r;return[r*y(n)/e,y(t)/e]}stereographicRaw.invert=azimuthalInvert((function(n){return 2*p(n)}));function stereographic(){return projection(stereographicRaw).scale(250).clipAngle(142)}function transverseMercatorRaw(n,t){return[E(P((a+t)/2)),-n]}transverseMercatorRaw.invert=function(n,t){return[-t,2*p(v(n))-a]};function transverseMercator(){var n=mercatorProjection(transverseMercatorRaw),t=n.center,r=n.rotate;n.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])};n.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])};return r([0,0,90]).scale(159.155)}export{albers as geoAlbers,albersUsa as geoAlbersUsa,area as geoArea,azimuthalEqualArea as geoAzimuthalEqualArea,ut as geoAzimuthalEqualAreaRaw,azimuthalEquidistant as geoAzimuthalEquidistant,lt as geoAzimuthalEquidistantRaw,bounds as geoBounds,centroid as geoCentroid,circle as geoCircle,sn as geoClipAntimeridian,clipCircle as geoClipCircle,extent as geoClipExtent,clipRectangle as geoClipRectangle,conicConformal as geoConicConformal,conicConformalRaw as geoConicConformalRaw,conicEqualArea as geoConicEqualArea,conicEqualAreaRaw as geoConicEqualAreaRaw,conicEquidistant as geoConicEquidistant,conicEquidistantRaw as geoConicEquidistantRaw,contains as geoContains,distance as geoDistance,equalEarth as geoEqualEarth,equalEarthRaw as geoEqualEarthRaw,equirectangular as geoEquirectangular,equirectangularRaw as geoEquirectangularRaw,gnomonic as geoGnomonic,gnomonicRaw as geoGnomonicRaw,graticule as geoGraticule,graticule10 as geoGraticule10,identity as geoIdentity,interpolate as geoInterpolate,length as geoLength,mercator as geoMercator,mercatorRaw as geoMercatorRaw,naturalEarth1 as geoNaturalEarth1,naturalEarth1Raw as geoNaturalEarth1Raw,orthographic as geoOrthographic,orthographicRaw as geoOrthographicRaw,index as geoPath,projection as geoProjection,projectionMutator as geoProjectionMutator,rotation as geoRotation,stereographic as geoStereographic,stereographicRaw as geoStereographicRaw,geoStream,transform as geoTransform,transverseMercator as geoTransverseMercator,transverseMercatorRaw as geoTransverseMercatorRaw}; + diff --git a/vendor/javascript/d3-hierarchy.js b/vendor/javascript/d3-hierarchy.js new file mode 100644 index 00000000..1d69d374 --- /dev/null +++ b/vendor/javascript/d3-hierarchy.js @@ -0,0 +1,2 @@ +function defaultSeparation$1(e,n){return e.parent===n.parent?1:2}function meanX(e){return e.reduce(meanXReduce,0)/e.length}function meanXReduce(e,n){return e+n.x}function maxY(e){return 1+e.reduce(maxYReduce,0)}function maxYReduce(e,n){return Math.max(e,n.y)}function leafLeft(e){var n;while(n=e.children)e=n[0];return e}function leafRight(e){var n;while(n=e.children)e=n[n.length-1];return e}function cluster(){var e=defaultSeparation$1,n=1,t=1,r=false;function cluster(i){var a,o=0;i.eachAfter((function(n){var t=n.children;if(t){n.x=meanX(t);n.y=maxY(t)}else{n.x=a?o+=e(n,a):0;n.y=0;a=n}}));var u=leafLeft(i),c=leafRight(i),l=u.x-e(u,c)/2,s=c.x+e(c,u)/2;return i.eachAfter(r?function(e){e.x=(e.x-i.x)*n;e.y=(i.y-e.y)*t}:function(e){e.x=(e.x-l)/(s-l)*n;e.y=(1-(i.y?e.y/i.y:1))*t})}cluster.separation=function(n){return arguments.length?(e=n,cluster):e};cluster.size=function(e){return arguments.length?(r=false,n=+e[0],t=+e[1],cluster):r?null:[n,t]};cluster.nodeSize=function(e){return arguments.length?(r=true,n=+e[0],t=+e[1],cluster):r?[n,t]:null};return cluster}function count(e){var n=0,t=e.children,r=t&&t.length;if(r)while(--r>=0)n+=t[r].value;else n=1;e.value=n}function node_count(){return this.eachAfter(count)}function node_each(e,n){let t=-1;for(const r of this)e.call(n,r,++t,this);return this}function node_eachBefore(e,n){var t,r,i=this,a=[i],o=-1;while(i=a.pop()){e.call(n,i,++o,this);if(t=i.children)for(r=t.length-1;r>=0;--r)a.push(t[r])}return this}function node_eachAfter(e,n){var t,r,i,a=this,o=[a],u=[],c=-1;while(a=o.pop()){u.push(a);if(t=a.children)for(r=0,i=t.length;r=0)t+=r[i].value;n.value=t}))}function node_sort(e){return this.eachBefore((function(n){n.children&&n.children.sort(e)}))}function node_path(e){var n=this,t=leastCommonAncestor(n,e),r=[n];while(n!==t){n=n.parent;r.push(n)}var i=r.length;while(e!==t){r.splice(i,0,e);e=e.parent}return r}function leastCommonAncestor(e,n){if(e===n)return e;var t=e.ancestors(),r=n.ancestors(),i=null;e=t.pop();n=r.pop();while(e===n){i=e;e=t.pop();n=r.pop()}return i}function node_ancestors(){var e=this,n=[e];while(e=e.parent)n.push(e);return n}function node_descendants(){return Array.from(this)}function node_leaves(){var e=[];this.eachBefore((function(n){n.children||e.push(n)}));return e}function node_links(){var e=this,n=[];e.each((function(t){t!==e&&n.push({source:t.parent,target:t})}));return n}function*node_iterator(){var e,n,t,r,i=this,a=[i];do{e=a.reverse(),a=[];while(i=e.pop()){yield i;if(n=i.children)for(t=0,r=n.length;t=0;--a){c.push(r=i[a]=new Node$1(i[a]));r.parent=t;r.depth=t.depth+1}}return u.eachBefore(computeHeight)}function node_copy(){return hierarchy(this).eachBefore(copyData)}function objectChildren(e){return e.children}function mapChildren(e){return Array.isArray(e)?e[1]:null}function copyData(e){void 0!==e.data.value&&(e.value=e.data.value);e.data=e.data.data}function computeHeight(e){var n=0;do{e.height=n}while((e=e.parent)&&e.height<++n)}function Node$1(e){this.data=e;this.depth=this.height=0;this.parent=null}Node$1.prototype=hierarchy.prototype={constructor:Node$1,count:node_count,each:node_each,eachAfter:node_eachAfter,eachBefore:node_eachBefore,find:node_find,sum:node_sum,sort:node_sort,path:node_path,ancestors:node_ancestors,descendants:node_descendants,leaves:node_leaves,links:node_links,copy:node_copy,[Symbol.iterator]:node_iterator};function optional(e){return null==e?null:required(e)}function required(e){if("function"!==typeof e)throw new Error;return e}function constantZero(){return 0}function constant(e){return function(){return e}}const e=1664525;const n=1013904223;const t=4294967296;function lcg(){let r=1;return()=>(r=(e*r+n)%t)/t}function array(e){return"object"===typeof e&&"length"in e?e:Array.from(e)}function shuffle(e,n){let t,r,i=e.length;while(i){r=n()*i--|0;t=e[i];e[i]=e[r];e[r]=t}return e}function enclose(e){return packEncloseRandom(e,lcg())}function packEncloseRandom(e,n){var t,r,i=0,a=(e=shuffle(Array.from(e),n)).length,o=[];while(i0&&t*t>r*r+i*i}function enclosesWeakAll(e,n){for(var t=0;t1e-6?(z+Math.sqrt(z*z-4*R*M))/(2*R):M/z);return{x:r+B+k*S,y:i+N+A*S,r:S}}function place(e,n,t){var r,i,a,o,u=e.x-n.x,c=e.y-n.y,l=u*u+c*c;if(l){i=n.r+t.r,i*=i;o=e.r+t.r,o*=o;if(i>o){r=(l+o-i)/(2*l);a=Math.sqrt(Math.max(0,o/l-r*r));t.x=e.x-r*u-a*c;t.y=e.y-r*c+a*u}else{r=(l+i-o)/(2*l);a=Math.sqrt(Math.max(0,i/l-r*r));t.x=n.x+r*u-a*c;t.y=n.y+r*c+a*u}}else{t.x=n.x+t.r;t.y=n.y}}function intersects(e,n){var t=e.r+n.r-1e-6,r=n.x-e.x,i=n.y-e.y;return t>0&&t*t>r*r+i*i}function score(e){var n=e._,t=e.next._,r=n.r+t.r,i=(n.x*t.r+t.x*n.r)/r,a=(n.y*t.r+t.y*n.r)/r;return i*i+a*a}function Node(e){this._=e;this.next=null;this.previous=null}function packSiblingsRandom(e,n){if(!(a=(e=array(e)).length))return 0;var t,r,i,a,o,u,c,l,s,f,h;t=e[0],t.x=0,t.y=0;if(!(a>1))return t.r;r=e[1],t.x=-r.r,r.x=t.r,r.y=0;if(!(a>2))return t.r+r.r;place(r,t,i=e[2]);t=new Node(t),r=new Node(r),i=new Node(i);t.next=i.previous=r;r.next=t.previous=i;i.next=r.previous=t;e:for(c=3;cnormalize(e(n,t,o))));const t=n.map(parentof);const r=new Set(n).add("");for(const e of t)if(!r.has(e)){r.add(e);n.push(e);t.push(parentof(e));y.push(a)}x=(e,t)=>n[t];m=(e,n)=>t[n]}for(l=0,u=y.length;l=0;--e){h=y[e];if(h.data!==a)break;h.data=null}}s.parent=r;s.eachBefore((function(e){e.depth=e.parent.depth+1;--u})).eachBefore(computeHeight);s.parent=null;if(u>0)throw new Error("cycle");return s}stratify.id=function(e){return arguments.length?(n=optional(e),stratify):n};stratify.parentId=function(e){return arguments.length?(t=optional(e),stratify):t};stratify.path=function(n){return arguments.length?(e=optional(n),stratify):e};return stratify}function normalize(e){e=`${e}`;let n=e.length;slash(e,n-1)&&!slash(e,n-2)&&(e=e.slice(0,-1));return"/"===e[0]?e:`/${e}`}function parentof(e){let n=e.length;if(n<2)return"";while(--n>1)if(slash(e,n))break;return e.slice(0,n)}function slash(e,n){if("/"===e[n]){let t=0;while(n>0&&"\\"===e[--n])++t;if(0===(1&t))return true}return false}function defaultSeparation(e,n){return e.parent===n.parent?1:2}function nextLeft(e){var n=e.children;return n?n[0]:e.t}function nextRight(e){var n=e.children;return n?n[n.length-1]:e.t}function moveSubtree(e,n,t){var r=t/(n.i-e.i);n.c-=r;n.s+=t;e.c+=r;n.z+=t;n.m+=t}function executeShifts(e){var n,t=0,r=0,i=e.children,a=i.length;while(--a>=0){n=i[a];n.z+=t;n.m+=t;t+=n.s+(r+=n.c)}}function nextAncestor(e,n,t){return e.a.parent===n.parent?e.a:t}function TreeNode(e,n){this._=e;this.parent=null;this.children=null;this.A=null;this.a=this;this.z=0;this.m=0;this.c=0;this.s=0;this.t=null;this.i=n}TreeNode.prototype=Object.create(Node$1.prototype);function treeRoot(e){var n,t,r,i,a,o=new TreeNode(e,0),u=[o];while(n=u.pop())if(r=n._.children){n.children=new Array(a=r.length);for(i=a-1;i>=0;--i){u.push(t=n.children[i]=new TreeNode(r[i],i));t.parent=n}}(o.parent=new TreeNode(null,0)).children=[o];return o}function tree(){var e=defaultSeparation,n=1,t=1,r=null;function tree(i){var a=treeRoot(i);a.eachAfter(firstWalk),a.parent.m=-a.z;a.eachBefore(secondWalk);if(r)i.eachBefore(sizeNode);else{var o=i,u=i,c=i;i.eachBefore((function(e){e.xu.x&&(u=e);e.depth>c.depth&&(c=e)}));var l=o===u?1:e(o,u)/2,s=l-o.x,f=n/(u.x+l+s),h=t/(c.depth||1);i.eachBefore((function(e){e.x=(e.x+s)*f;e.y=e.depth*h}))}return i}function firstWalk(n){var t=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(t){executeShifts(n);var a=(t[0].z+t[t.length-1].z)/2;if(i){n.z=i.z+e(n._,i._);n.m=n.z-a}else n.z=a}else i&&(n.z=i.z+e(n._,i._));n.parent.A=apportion(n,i,n.parent.A||r[0])}function secondWalk(e){e._.x=e.z+e.parent.m;e.m+=e.parent.m}function apportion(n,t,r){if(t){var i,a=n,o=n,u=t,c=a.parent.children[0],l=a.m,s=o.m,f=u.m,h=c.m;while(u=nextRight(u),a=nextLeft(a),u&&a){c=nextLeft(c);o=nextRight(o);o.a=n;i=u.z+f-a.z-l+e(u._,a._);if(i>0){moveSubtree(nextAncestor(u,n,r),n,i);l+=i;s+=i}f+=u.m;l+=a.m;h+=c.m;s+=o.m}if(u&&!nextRight(o)){o.t=u;o.m+=f-s}if(a&&!nextLeft(c)){c.t=a;c.m+=l-h;r=n}}return r}function sizeNode(e){e.x*=n;e.y=e.depth*t}tree.separation=function(n){return arguments.length?(e=n,tree):e};tree.size=function(e){return arguments.length?(r=false,n=+e[0],t=+e[1],tree):r?null:[n,t]};tree.nodeSize=function(e){return arguments.length?(r=true,n=+e[0],t=+e[1],tree):r?[n,t]:null};return tree}function treemapSlice(e,n,t,r,i){var a,o=e.children,u=-1,c=o.length,l=e.value&&(i-t)/e.value;while(++uh&&(h=u);x=s*s*y;d=Math.max(h/x,x/f);if(d>p){s-=u;break}p=d}m.push(o={value:s,dice:c1?e:1)};return squarify}(o);function index(){var e=u,n=false,t=1,r=1,i=[0],a=constantZero,o=constantZero,c=constantZero,l=constantZero,s=constantZero;function treemap(e){e.x0=e.y0=0;e.x1=t;e.y1=r;e.eachBefore(positionNode);i=[0];n&&e.eachBefore(roundNode);return e}function positionNode(n){var t=i[n.depth],r=n.x0+t,u=n.y0+t,f=n.x1-t,h=n.y1-t;f=n-1){var c=u[e];c.x0=r,c.y0=i;c.x1=a,c.y1=o}else{var s=l[e],f=t/2+s,h=e+1,d=n-1;while(h>>1;l[p]o-i){var m=t?(r*x+a*y)/t:a;partition(e,h,y,r,i,m,o);partition(h,n,x,m,i,a,o)}else{var v=t?(i*x+o*y)/t:o;partition(e,h,y,r,i,a,v);partition(h,n,x,r,v,a,o)}}}}function sliceDice(e,n,t,r,i){(1&e.depth?treemapSlice:treemapDice)(e,n,t,r,i)}var c=function custom(e){function resquarify(n,t,r,i,a){if((o=n._squarify)&&o.ratio===e){var o,u,c,l,s,f=-1,h=o.length,d=n.value;while(++f1?e:1)};return resquarify}(o);export{Node$1 as Node,cluster,hierarchy,index$1 as pack,enclose as packEnclose,siblings as packSiblings,partition,stratify,tree,index as treemap,binary as treemapBinary,treemapDice,c as treemapResquarify,treemapSlice,sliceDice as treemapSliceDice,u as treemapSquarify}; + diff --git a/vendor/javascript/d3-interpolate.js b/vendor/javascript/d3-interpolate.js new file mode 100644 index 00000000..9822fa1f --- /dev/null +++ b/vendor/javascript/d3-interpolate.js @@ -0,0 +1,2 @@ +import{rgb as n,color as r,hsl as t,lab as e,hcl as a,cubehelix as o}from"d3-color";function basis(n,r,t,e,a){var o=n*n,u=o*n;return((1-3*n+3*o-u)*r+(4-6*o+3*u)*t+(1+3*n+3*o-3*u)*e+u*a)/6}function basis$1(n){var r=n.length-1;return function(t){var e=t<=0?t=0:t>=1?(t=1,r-1):Math.floor(t*r),a=n[e],o=n[e+1],u=e>0?n[e-1]:2*a-o,i=e()=>n;function linear(n,r){return function(t){return n+t*r}}function exponential(n,r,t){return n=Math.pow(n,t),r=Math.pow(r,t)-n,t=1/t,function(e){return Math.pow(n+e*r,t)}}function hue$1(n,r){var t=r-n;return t?linear(n,t>180||t<-180?t-360*Math.round(t/360):t):constant(isNaN(n)?r:n)}function gamma(n){return 1===(n=+n)?nogamma:function(r,t){return t-r?exponential(r,t,n):constant(isNaN(r)?t:r)}}function nogamma(n,r){var t=r-n;return t?linear(n,t):constant(isNaN(n)?r:n)}var u=function rgbGamma(r){var t=gamma(r);function rgb(r,e){var a=t((r=n(r)).r,(e=n(e)).r),o=t(r.g,e.g),u=t(r.b,e.b),i=nogamma(r.opacity,e.opacity);return function(n){r.r=a(n);r.g=o(n);r.b=u(n);r.opacity=i(n);return r+""}}rgb.gamma=rgbGamma;return rgb}(1);function rgbSpline(r){return function(t){var e,a,o=t.length,u=new Array(o),i=new Array(o),s=new Array(o);for(e=0;eo){a=r.slice(o,a);i[u]?i[u]+=a:i[++u]=a}if((t=t[0])===(e=e[0]))i[u]?i[u]+=e:i[++u]=e;else{i[++u]=null;s.push({i:u,x:number(t,e)})}o=c.lastIndex}if(o180?r+=360:r-n>180&&(n+=360);a.push({i:t.push(pop(t)+"rotate(",null,e)-2,x:number(n,r)})}else r&&t.push(pop(t)+"rotate("+r+e)}function skewX(n,r,t,a){n!==r?a.push({i:t.push(pop(t)+"skewX(",null,e)-2,x:number(n,r)}):r&&t.push(pop(t)+"skewX("+r+e)}function scale(n,r,t,e,a,o){if(n!==t||r!==e){var u=a.push(pop(a)+"scale(",null,",",null,")");o.push({i:u-4,x:number(n,t)},{i:u-2,x:number(r,e)})}else 1===t&&1===e||a.push(pop(a)+"scale("+t+","+e+")")}return function(r,t){var e=[],a=[];r=n(r),t=n(t);translate(r.translateX,r.translateY,t.translateX,t.translateY,e,a);rotate(r.rotate,t.rotate,e,a);skewX(r.skewX,t.skewX,e,a);scale(r.scaleX,r.scaleY,t.scaleX,t.scaleY,e,a);r=t=null;return function(n){var r,t=-1,o=a.length;while(++t=0))throw new Error(`invalid digits: ${t}`);if(h>15)return append;const i=10**h;return function(t){this._+=t[0];for(let h=1,s=t.length;hi)if(Math.abs(d*p-r*o)>i&&e){let u=n-_,x=a-$,y=p*p+r*r,M=u*u+x*x,c=Math.sqrt(y),f=Math.sqrt(l),w=e*Math.tan((t-Math.acos((y+l-M)/(2*c*f)))/2),v=w/f,P=w/c;Math.abs(v-1)>i&&this._append`L${h+v*o},${s+v*d}`;this._append`A${e},${e},0,0,${+(d*u>o*x)},${this._x1=h+P*p},${this._y1=s+P*r}`}else this._append`L${this._x1=h},${this._y1=s}`;else;}arc(n,a,e,_,$,p){n=+n,a=+a,e=+e,p=!!p;if(e<0)throw new Error(`negative radius: ${e}`);let r=e*Math.cos(_),o=e*Math.sin(_),d=n+r,l=a+o,u=1^p,x=p?_-$:$-_;null===this._x1?this._append`M${d},${l}`:(Math.abs(this._x1-d)>i||Math.abs(this._y1-l)>i)&&this._append`L${d},${l}`;if(e){x<0&&(x=x%h+h);x>s?this._append`A${e},${e},0,1,${u},${n-r},${a-o}A${e},${e},0,1,${u},${this._x1=d},${this._y1=l}`:x>i&&this._append`A${e},${e},0,${+(x>=t)},${u},${this._x1=n+e*Math.cos($)},${this._y1=a+e*Math.sin($)}`}}rect(t,h,i,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+h}h${i=+i}v${+s}h${-i}Z`}toString(){return this._}}function path(){return new Path}path.prototype=Path.prototype;function pathRound(t=3){return new Path(+t)}export{Path,path,pathRound}; + diff --git a/vendor/javascript/d3-polygon.js b/vendor/javascript/d3-polygon.js new file mode 100644 index 00000000..4ec6cc5c --- /dev/null +++ b/vendor/javascript/d3-polygon.js @@ -0,0 +1,2 @@ +function area(n){var r,e=-1,t=n.length,o=n[t-1],l=0;while(++e1&&cross(n[e[o-2]],n[e[o-1]],n[t])<=0)--o;e[o++]=t}return e.slice(0,o)}function hull(n){if((e=n.length)<3)return null;var r,e,t=new Array(e),o=new Array(e);for(r=0;r=0;--r)i.push(n[t[l[r]][2]]);for(r=+a;ra!==i>a&&u<(h-e)*(a-t)/(i-t)+e&&(c=!c);h=e,i=t}return c}function length(n){var r,e,t=-1,o=n.length,l=n[o-1],u=l[0],a=l[1],h=0;while(++t=(h=(x+v)/2))?x=h:v=h;(l=i>=(s=(c+w)/2))?c=s:w=s;if(n=f,!(f=f[_=l<<1|u]))return n[_]=y,t}a=+t._x.call(null,f.data);o=+t._y.call(null,f.data);if(e===a&&i===o)return y.next=f,n?n[_]=y:t._root=y,t;do{n=n?n[_]=new Array(4):t._root=new Array(4);(u=e>=(h=(x+v)/2))?x=h:v=h;(l=i>=(s=(c+w)/2))?c=s:w=s}while((_=l<<1|u)===(d=(o>=s)<<1|a>=h));return n[d]=f,n[_]=y,t}function addAll(t){var e,i,r,n,h=t.length,s=new Array(h),a=new Array(h),o=Infinity,u=Infinity,l=-Infinity,_=-Infinity;for(i=0;il&&(l=r);n_&&(_=n)}if(o>l||u>_)return this;this.cover(o,u).cover(l,_);for(i=0;it||t>=n||r>e||e>=h){a=(ed||(h=o.y0)>f||(s=o.x1)=v)<<1|t>=c){o=y[y.length-1];y[y.length-1]=y[y.length-1-u];y[y.length-1-u]=o}}else{var w=t-+this._x.call(null,x.data),p=e-+this._y.call(null,x.data),N=w*w+p*p;if(N=(a=(y+c)/2))?y=a:c=a;(l=s>=(o=(x+v)/2))?x=o:v=o;if(!(e=f,f=f[_=l<<1|u]))return this;if(!f.length)break;(e[_+1&3]||e[_+2&3]||e[_+3&3])&&(i=e,d=_)}while(f.data!==t)if(!(r=f,f=f.next))return this;(n=f.next)&&delete f.next;if(r)return n?r.next=n:delete r.next,this;if(!e)return this._root=n,this;n?e[_]=n:delete e[_];(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(i?i[d]=f:this._root=f);return this}function removeAll(t){for(var e=0,i=t.length;e1);return n+o*t*Math.sqrt(-2*Math.log(u)/u)}}randomNormal.source=sourceRandomNormal;return randomNormal}(r);var u=function sourceRandomLogNormal(r){var n=a.source(r);function randomLogNormal(){var r=n.apply(this,arguments);return function(){return Math.exp(r())}}randomLogNormal.source=sourceRandomLogNormal;return randomLogNormal}(r);var t=function sourceRandomIrwinHall(r){function randomIrwinHall(n){return(n=+n)<=0?()=>0:function(){for(var o=0,a=n;a>1;--a)o+=r();return o+a*r()}}randomIrwinHall.source=sourceRandomIrwinHall;return randomIrwinHall}(r);var e=function sourceRandomBates(r){var n=t.source(r);function randomBates(o){if(0===(o=+o))return r;var a=n(o);return function(){return a()/o}}randomBates.source=sourceRandomBates;return randomBates}(r);var i=function sourceRandomExponential(r){function randomExponential(n){return function(){return-Math.log1p(-r())/n}}randomExponential.source=sourceRandomExponential;return randomExponential}(r);var m=function sourceRandomPareto(r){function randomPareto(n){if((n=+n)<0)throw new RangeError("invalid alpha");n=1/-n;return function(){return Math.pow(1-r(),n)}}randomPareto.source=sourceRandomPareto;return randomPareto}(r);var c=function sourceRandomBernoulli(r){function randomBernoulli(n){if((n=+n)<0||n>1)throw new RangeError("invalid p");return function(){return Math.floor(r()+n)}}randomBernoulli.source=sourceRandomBernoulli;return randomBernoulli}(r);var l=function sourceRandomGeometric(r){function randomGeometric(n){if((n=+n)<0||n>1)throw new RangeError("invalid p");if(0===n)return()=>Infinity;if(1===n)return()=>1;n=Math.log1p(-n);return function(){return 1+Math.floor(Math.log1p(-r())/n)}}randomGeometric.source=sourceRandomGeometric;return randomGeometric}(r);var d=function sourceRandomGamma(r){var n=a.source(r)();function randomGamma(o,a){if((o=+o)<0)throw new RangeError("invalid k");if(0===o)return()=>0;a=null==a?1:+a;if(1===o)return()=>-Math.log1p(-r())*a;var u=(o<1?o+1:o)-1/3,t=1/(3*Math.sqrt(u)),e=o<1?()=>Math.pow(r(),1/o):()=>1;return function(){do{do{var o=n(),i=1+t*o}while(i<=0);i*=i*i;var m=1-r()}while(m>=1-.0331*o*o*o*o&&Math.log(m)>=.5*o*o+u*(1-i+Math.log(i)));return u*i*e()*a}}randomGamma.source=sourceRandomGamma;return randomGamma}(r);var s=function sourceRandomBeta(r){var n=d.source(r);function randomBeta(r,o){var a=n(r),u=n(o);return function(){var r=a();return 0===r?0:r/(r+u())}}randomBeta.source=sourceRandomBeta;return randomBeta}(r);var f=function sourceRandomBinomial(r){var n=l.source(r),o=s.source(r);function randomBinomial(r,a){r=+r;return(a=+a)>=1?()=>r:a<=0?()=>0:function(){var u=0,t=r,e=a;while(t*e>16&&t*(1-e)>16){var i=Math.floor((t+1)*e),m=o(i,t-i+1)();if(m<=e){u+=i;t-=i;e=(e-m)/(1-m)}else{t=i-1;e/=m}}var c=e<.5,l=c?e:1-e,d=n(l);for(var s=d(),f=0;s<=t;++f)s+=d();return u+(c?f:t-f)}}randomBinomial.source=sourceRandomBinomial;return randomBinomial}(r);var h=function sourceRandomWeibull(r){function randomWeibull(n,o,a){var u;if(0===(n=+n))u=r=>-Math.log(r);else{n=1/n;u=r=>Math.pow(r,n)}o=null==o?0:+o;a=null==a?1:+a;return function(){return o+a*u(-Math.log1p(-r()))}}randomWeibull.source=sourceRandomWeibull;return randomWeibull}(r);var v=function sourceRandomCauchy(r){function randomCauchy(n,o){n=null==n?0:+n;o=null==o?1:+o;return function(){return n+o*Math.tan(Math.PI*r())}}randomCauchy.source=sourceRandomCauchy;return randomCauchy}(r);var R=function sourceRandomLogistic(r){function randomLogistic(n,o){n=null==n?0:+n;o=null==o?1:+o;return function(){var a=r();return n+o*Math.log(a/(1-a))}}randomLogistic.source=sourceRandomLogistic;return randomLogistic}(r);var g=function sourceRandomPoisson(r){var n=d.source(r),o=f.source(r);function randomPoisson(a){return function(){var u=0,t=a;while(t>16){var e=Math.floor(.875*t),i=n(e)();if(i>t)return u+o(e-1,t/i)();u+=e;t-=i}for(var m=-Math.log1p(-r()),c=0;m<=t;++c)m-=Math.log1p(-r());return u+c}}randomPoisson.source=sourceRandomPoisson;return randomPoisson}(r);const M=1664525;const B=1013904223;const p=1/4294967296;function lcg(r=Math.random()){let n=0|(0<=r&&r<1?r/p:Math.abs(r));return()=>(n=M*n+B|0,p*(n>>>0))}export{e as randomBates,c as randomBernoulli,s as randomBeta,f as randomBinomial,v as randomCauchy,i as randomExponential,d as randomGamma,l as randomGeometric,o as randomInt,t as randomIrwinHall,lcg as randomLcg,u as randomLogNormal,R as randomLogistic,a as randomNormal,m as randomPareto,g as randomPoisson,n as randomUniform,h as randomWeibull}; + diff --git a/vendor/javascript/d3-scale-chromatic.js b/vendor/javascript/d3-scale-chromatic.js new file mode 100644 index 00000000..6f6d4230 --- /dev/null +++ b/vendor/javascript/d3-scale-chromatic.js @@ -0,0 +1,2 @@ +import{interpolateRgbBasis as f,interpolateCubehelixLong as e}from"d3-interpolate";import{cubehelix as a,rgb as d}from"d3-color";function colors(f){var e=f.length/6|0,a=new Array(e),d=0;while(df(e[e.length-1]);var v=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(colors);var p=ramp$1(v);var h=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(colors);var u=ramp$1(h);var w=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(colors);var M=ramp$1(w);var y=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(colors);var A=ramp$1(y);var P=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(colors);var B=ramp$1(P);var G=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(colors);var R=ramp$1(G);var Y=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(colors);var x=ramp$1(Y);var g=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(colors);var O=ramp$1(g);var S=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(colors);var C=ramp$1(S);var I=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(colors);var D=ramp$1(I);var T=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(colors);var k=ramp$1(T);var V=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(colors);var W=ramp$1(V);var j=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(colors);var q=ramp$1(j);var z=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(colors);var E=ramp$1(z);var F=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(colors);var H=ramp$1(F);var J=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(colors);var K=ramp$1(J);var L=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(colors);var N=ramp$1(L);var Q=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(colors);var U=ramp$1(Q);var X=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(colors);var Z=ramp$1(X);var $=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(colors);var _=ramp$1($);var ff=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(colors);var ef=ramp$1(ff);var af=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(colors);var df=ramp$1(af);var cf=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(colors);var bf=ramp$1(cf);var rf=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(colors);var of=ramp$1(rf);var sf=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(colors);var tf=ramp$1(sf);var nf=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(colors);var lf=ramp$1(nf);var mf=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(colors);var vf=ramp$1(mf);function cividis(f){f=Math.max(0,Math.min(1,f));return"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-f*(35.34-f*(2381.73-f*(6402.7-f*(7024.72-2710.57*f)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+f*(170.73+f*(52.82-f*(131.46-f*(176.58-67.37*f)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+f*(442.36-f*(2482.43-f*(6167.24-f*(6614.94-2475.67*f)))))))+")"}var pf=e(a(300,.5,0),a(-240,.5,1));var hf=e(a(-100,.75,.35),a(80,1.5,.8));var uf=e(a(260,.75,.35),a(80,1.5,.8));var wf=a();function rainbow(f){(f<0||f>1)&&(f-=Math.floor(f));var e=Math.abs(f-.5);wf.h=360*f-100;wf.s=1.5-1.5*e;wf.l=.8-.9*e;return wf+""}var Mf=d(),yf=Math.PI/3,Af=2*Math.PI/3;function sinebow(f){var e;f=(.5-f)*Math.PI;Mf.r=255*(e=Math.sin(f))*e;Mf.g=255*(e=Math.sin(f+yf))*e;Mf.b=255*(e=Math.sin(f+Af))*e;return Mf+""}function turbo(f){f=Math.max(0,Math.min(1,f));return"rgb("+Math.max(0,Math.min(255,Math.round(34.61+f*(1172.33-f*(10793.56-f*(33300.12-f*(38394.49-14825.05*f)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+f*(557.33+f*(1225.33-f*(3574.96-f*(1073.77+707.56*f)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+f*(3211.1-f*(15327.97-f*(27814-f*(22569.18-6838.66*f)))))))+")"}function ramp(f){var e=f.length;return function(a){return f[Math.max(0,Math.min(e-1,Math.floor(a*e)))]}}var Pf=ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var Bf=ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));var Gf=ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));var Rf=ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));export{df as interpolateBlues,p as interpolateBrBG,D as interpolateBuGn,k as interpolateBuPu,cividis as interpolateCividis,uf as interpolateCool,pf as interpolateCubehelixDefault,W as interpolateGnBu,bf as interpolateGreens,of as interpolateGreys,Gf as interpolateInferno,Bf as interpolateMagma,q as interpolateOrRd,vf as interpolateOranges,u as interpolatePRGn,M as interpolatePiYG,Rf as interpolatePlasma,H as interpolatePuBu,E as interpolatePuBuGn,A as interpolatePuOr,K as interpolatePuRd,tf as interpolatePurples,rainbow as interpolateRainbow,B as interpolateRdBu,R as interpolateRdGy,N as interpolateRdPu,x as interpolateRdYlBu,O as interpolateRdYlGn,lf as interpolateReds,sinebow as interpolateSinebow,C as interpolateSpectral,turbo as interpolateTurbo,Pf as interpolateViridis,hf as interpolateWarm,Z as interpolateYlGn,U as interpolateYlGnBu,_ as interpolateYlOrBr,ef as interpolateYlOrRd,b as schemeAccent,af as schemeBlues,v as schemeBrBG,I as schemeBuGn,T as schemeBuPu,c as schemeCategory10,r as schemeDark2,V as schemeGnBu,cf as schemeGreens,rf as schemeGreys,j as schemeOrRd,mf as schemeOranges,h as schemePRGn,o as schemePaired,s as schemePastel1,t as schemePastel2,w as schemePiYG,F as schemePuBu,z as schemePuBuGn,y as schemePuOr,J as schemePuRd,sf as schemePurples,P as schemeRdBu,G as schemeRdGy,L as schemeRdPu,Y as schemeRdYlBu,g as schemeRdYlGn,nf as schemeReds,n as schemeSet1,l as schemeSet2,m as schemeSet3,S as schemeSpectral,i as schemeTableau10,X as schemeYlGn,Q as schemeYlGnBu,$ as schemeYlOrBr,ff as schemeYlOrRd}; + diff --git a/vendor/javascript/d3-scale.js b/vendor/javascript/d3-scale.js new file mode 100644 index 00000000..2cdc5594 --- /dev/null +++ b/vendor/javascript/d3-scale.js @@ -0,0 +1,2 @@ +import{InternMap as n,range as e,bisect as t,tickStep as r,ticks as a,tickIncrement as i,quantileSorted as o,ascending as l,quantile as u}from"d3-array";import{interpolate as c,interpolateNumber as s,interpolateRound as f,piecewise as g}from"d3-interpolate";import{formatSpecifier as p,precisionFixed as h,precisionRound as m,precisionPrefix as d,formatPrefix as y,format as v}from"d3-format";import{timeTicks as w,timeTickInterval as M,timeYear as q,timeMonth as k,timeWeek as b,timeDay as x,timeHour as $,timeMinute as N,timeSecond as S,utcTicks as I,utcTickInterval as R,utcYear as A,utcMonth as L,utcWeek as P,utcDay as D,utcHour as E,utcMinute as F,utcSecond as z}from"d3-time";import{timeFormat as O,utcFormat as Q}from"d3-time-format";function initRange(n,e){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(e).domain(n);break}return this}function initInterpolator(n,e){switch(arguments.length){case 0:break;case 1:"function"===typeof n?this.interpolator(n):this.range(n);break;default:this.domain(n);"function"===typeof e?this.interpolator(e):this.range(e);break}return this}const T=Symbol("implicit");function ordinal(){var e=new n,t=[],r=[],a=T;function scale(n){let i=e.get(n);if(void 0===i){if(a!==T)return a;e.set(n,i=t.push(n)-1)}return r[i%r.length]}scale.domain=function(r){if(!arguments.length)return t.slice();t=[],e=new n;for(const n of r)e.has(n)||e.set(n,t.push(n)-1);return scale};scale.range=function(n){return arguments.length?(r=Array.from(n),scale):r.slice()};scale.unknown=function(n){return arguments.length?(a=n,scale):a};scale.copy=function(){return ordinal(t,r).unknown(a)};initRange.apply(scale,arguments);return scale}function band(){var n,t,r=ordinal().unknown(void 0),a=r.domain,i=r.range,o=0,l=1,u=false,c=0,s=0,f=.5;delete r.unknown;function rescale(){var r=a().length,g=le&&(t=n,n=e,e=t);return function(t){return Math.max(n,Math.min(e,t))}}function bimap(n,e,t){var r=n[0],a=n[1],i=e[0],o=e[1];a2?polymap:bimap;a=i=null;return scale}function scale(e){return null==e||isNaN(e=+e)?t:(a||(a=r(o.map(n),l,u)))(n(g(e)))}scale.invert=function(t){return g(e((i||(i=r(l,o.map(n),s)))(t)))};scale.domain=function(n){return arguments.length?(o=Array.from(n,number$1),rescale()):o.slice()};scale.range=function(n){return arguments.length?(l=Array.from(n),rescale()):l.slice()};scale.rangeRound=function(n){return l=Array.from(n),u=f,rescale()};scale.clamp=function(n){return arguments.length?(g=!!n||identity$1,rescale()):g!==identity$1};scale.interpolate=function(n){return arguments.length?(u=n,rescale()):u};scale.unknown=function(n){return arguments.length?(t=n,scale):t};return function(t,r){n=t,e=r;return rescale()}}function continuous(){return transformer$2()(identity$1,identity$1)}function tickFormat(n,e,t,a){var i,o=r(n,e,t);a=p(null==a?",f":a);switch(a.type){case"s":var l=Math.max(Math.abs(n),Math.abs(e));null!=a.precision||isNaN(i=d(o,l))||(a.precision=i);return y(a,l);case"":case"e":case"g":case"p":case"r":null!=a.precision||isNaN(i=m(o,Math.max(Math.abs(n),Math.abs(e))))||(a.precision=i-("e"===a.type));break;case"f":case"%":null!=a.precision||isNaN(i=h(o))||(a.precision=i-2*("%"===a.type));break}return v(a)}function linearish(n){var e=n.domain;n.ticks=function(n){var t=e();return a(t[0],t[t.length-1],null==n?10:n)};n.tickFormat=function(n,t){var r=e();return tickFormat(r[0],r[r.length-1],null==n?10:n,t)};n.nice=function(t){null==t&&(t=10);var r=e();var a=0;var o=r.length-1;var l=r[a];var u=r[o];var c;var s;var f=10;if(u0){s=i(l,u,t);if(s===c){r[a]=l;r[o]=u;return e(r)}if(s>0){l=Math.floor(l/s)*s;u=Math.ceil(u/s)*s}else{if(!(s<0))break;l=Math.ceil(l*s)/s;u=Math.floor(u*s)/s}c=s}return n};return n}function linear(){var n=continuous();n.copy=function(){return copy$1(n,linear())};initRange.apply(n,arguments);return linearish(n)}function identity(n){var e;function scale(n){return null==n||isNaN(n=+n)?e:n}scale.invert=scale;scale.domain=scale.range=function(e){return arguments.length?(n=Array.from(e,number$1),scale):n.slice()};scale.unknown=function(n){return arguments.length?(e=n,scale):e};scale.copy=function(){return identity(n).unknown(e)};n=arguments.length?Array.from(n,number$1):[0,1];return linearish(scale)}function nice(n,e){n=n.slice();var t,r=0,a=n.length-1,i=n[r],o=n[a];if(oMath.pow(n,e)}function logp(n){return n===Math.E?Math.log:10===n&&Math.log10||2===n&&Math.log2||(n=Math.log(n),e=>Math.log(e)/n)}function reflect(n){return(e,t)=>-n(-e,t)}function loggish(n){const e=n(transformLog,transformExp);const t=e.domain;let r=10;let i;let o;function rescale(){i=logp(r),o=powp(r);if(t()[0]<0){i=reflect(i),o=reflect(o);n(transformLogn,transformExpn)}else n(transformLog,transformExp);return e}e.base=function(n){return arguments.length?(r=+n,rescale()):r};e.domain=function(n){return arguments.length?(t(n),rescale()):t()};e.ticks=n=>{const e=t();let l=e[0];let u=e[e.length-1];const c=u0)for(;s<=f;++s)for(g=1;gu)break;m.push(p)}}else for(;s<=f;++s)for(g=r-1;g>=1;--g){p=s>0?g/o(-s):g*o(s);if(!(pu)break;m.push(p)}}2*m.length{null==n&&(n=10);null==t&&(t=10===r?"s":",");if("function"!==typeof t){r%1||null!=(t=p(t)).precision||(t.trim=true);t=v(t)}if(Infinity===n)return t;const a=Math.max(1,r*n/e.ticks().length);return n=>{let e=n/o(Math.round(i(n)));e*rt(nice(t(),{floor:n=>o(Math.floor(i(n))),ceil:n=>o(Math.ceil(i(n)))}));return e}function log(){const n=loggish(transformer$2()).domain([1,10]);n.copy=()=>copy$1(n,log()).base(n.base());initRange.apply(n,arguments);return n}function transformSymlog(n){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/n))}}function transformSymexp(n){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*n}}function symlogish(n){var e=1,t=n(transformSymlog(e),transformSymexp(e));t.constant=function(t){return arguments.length?n(transformSymlog(e=+t),transformSymexp(e)):e};return linearish(t)}function symlog(){var n=symlogish(transformer$2());n.copy=function(){return copy$1(n,symlog()).constant(n.constant())};return initRange.apply(n,arguments)}function transformPow(n){return function(e){return e<0?-Math.pow(-e,n):Math.pow(e,n)}}function transformSqrt(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)}function transformSquare(n){return n<0?-n*n:n*n}function powish(n){var e=n(identity$1,identity$1),t=1;function rescale(){return 1===t?n(identity$1,identity$1):.5===t?n(transformSqrt,transformSquare):n(transformPow(t),transformPow(1/t))}e.exponent=function(n){return arguments.length?(t=+n,rescale()):t};return linearish(e)}function pow(){var n=powish(transformer$2());n.copy=function(){return copy$1(n,pow()).exponent(n.exponent())};initRange.apply(n,arguments);return n}function sqrt(){return pow.apply(null,arguments).exponent(.5)}function square(n){return Math.sign(n)*n*n}function unsquare(n){return Math.sign(n)*Math.sqrt(Math.abs(n))}function radial(){var n,e=continuous(),t=[0,1],r=false;function scale(t){var a=unsquare(e(t));return isNaN(a)?n:r?Math.round(a):a}scale.invert=function(n){return e.invert(square(n))};scale.domain=function(n){return arguments.length?(e.domain(n),scale):e.domain()};scale.range=function(n){return arguments.length?(e.range((t=Array.from(n,number$1)).map(square)),scale):t.slice()};scale.rangeRound=function(n){return scale.range(n).round(true)};scale.round=function(n){return arguments.length?(r=!!n,scale):r};scale.clamp=function(n){return arguments.length?(e.clamp(n),scale):e.clamp()};scale.unknown=function(e){return arguments.length?(n=e,scale):n};scale.copy=function(){return radial(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)};initRange.apply(scale,arguments);return linearish(scale)}function quantile(){var n,e=[],r=[],a=[];function rescale(){var n=0,t=Math.max(1,r.length);a=new Array(t-1);while(++n0?a[t-1]:e[0],t=a?[i[a-1],r]:[i[t-1],i[t]]};scale.unknown=function(e){return arguments.length?(n=e,scale):scale};scale.thresholds=function(){return i.slice()};scale.copy=function(){return quantize().domain([e,r]).range(o).unknown(n)};return initRange.apply(linearish(scale),arguments)}function threshold(){var n,e=[.5],r=[0,1],a=1;function scale(i){return null!=i&&i<=i?r[t(e,i,0,a)]:n}scale.domain=function(n){return arguments.length?(e=Array.from(n),a=Math.min(e.length,r.length-1),scale):e.slice()};scale.range=function(n){return arguments.length?(r=Array.from(n),a=Math.min(e.length,r.length-1),scale):r.slice()};scale.invertExtent=function(n){var t=r.indexOf(n);return[e[t-1],e[t]]};scale.unknown=function(e){return arguments.length?(n=e,scale):n};scale.copy=function(){return threshold().domain(e).range(r).unknown(n)};return initRange.apply(scale,arguments)}function date(n){return new Date(n)}function number(n){return n instanceof Date?+n:+new Date(+n)}function calendar(n,e,t,r,a,i,o,l,u,c){var s=continuous(),f=s.invert,g=s.domain;var p=c(".%L"),h=c(":%S"),m=c("%I:%M"),d=c("%I %p"),y=c("%a %d"),v=c("%b %d"),w=c("%B"),M=c("%Y");function tickFormat(n){return(u(n)e(r/(n.length-1))))};scale.quantiles=function(e){return Array.from({length:e+1},((t,r)=>u(n,r/e)))};scale.copy=function(){return sequentialQuantile(e).domain(n)};return initInterpolator.apply(scale,arguments)}function transformer(){var n,e,t,r,a,i,o,l=0,u=.5,s=1,p=1,h=identity$1,m=false;function scale(n){return isNaN(n=+n)?o:(n=.5+((n=+i(n))-e)*(p*n=0&&"xmlns"!==(n=t.slice(0,r))&&(t=t.slice(r+1));return e.hasOwnProperty(n)?{space:e[n],local:t}:t}function creatorInherit(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===t&&n.documentElement.namespaceURI===t?n.createElement(e):n.createElementNS(r,e)}}function creatorFixed(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function creator(t){var e=namespace(t);return(e.local?creatorFixed:creatorInherit)(e)}function none(){}function selector(t){return null==t?none:function(){return this.querySelector(t)}}function selection_select(t){"function"!==typeof t&&(t=selector(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=A&&(A=w+1);while(!(g=y[A])&&++A<_);v._next=g||null}}s=new Selection(s,r);s._enter=c;s._exit=l;return s}function arraylike(t){return"object"===typeof t&&"length"in t?t:Array.from(t)}function selection_exit(){return new Selection(this._exit||this._groups.map(sparse),this._parents)}function selection_join(t,e,n){var r=this.enter(),i=this,o=this.exit();if("function"===typeof t){r=t(r);r&&(r=r.selection())}else r=r.append(t+"");if(null!=e){i=e(i);i&&(i=i.selection())}null==n?o.remove():n(o);return r&&i?r.merge(i).order():i}function selection_merge(t){var e=t.selection?t.selection():t;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),c=new Array(i),l=0;l=0;)if(r=i[o]){s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s);s=r}return this}function selection_sort(t){t||(t=ascending);function compareNode(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}for(var e=this._groups,n=e.length,r=new Array(n),i=0;ie?1:t>=e?0:NaN}function selection_call(){var t=arguments[0];arguments[0]=this;t.apply(null,arguments);return this}function selection_nodes(){return Array.from(this)}function selection_node(){for(var t=this._groups,e=0,n=t.length;e1?this.each((null==e?styleRemove:"function"===typeof e?styleFunction:styleConstant)(t,e,null==n?"":n)):styleValue(this.node(),t)}function styleValue(t,e){return t.style.getPropertyValue(e)||defaultView(t).getComputedStyle(t,null).getPropertyValue(e)}function propertyRemove(t){return function(){delete this[t]}}function propertyConstant(t,e){return function(){this[t]=e}}function propertyFunction(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function selection_property(t,e){return arguments.length>1?this.each((null==e?propertyRemove:"function"===typeof e?propertyFunction:propertyConstant)(t,e)):this.node()[t]}function classArray(t){return t.trim().split(/^|\s+/)}function classList(t){return t.classList||new ClassList(t)}function ClassList(t){this._node=t;this._names=classArray(t.getAttribute("class")||"")}ClassList.prototype={add:function(t){var e=this._names.indexOf(t);if(e<0){this._names.push(t);this._node.setAttribute("class",this._names.join(" "))}},remove:function(t){var e=this._names.indexOf(t);if(e>=0){this._names.splice(e,1);this._node.setAttribute("class",this._names.join(" "))}},contains:function(t){return this._names.indexOf(t)>=0}};function classedAdd(t,e){var n=classList(t),r=-1,i=e.length;while(++r=0&&(e=t.slice(n+1),t=t.slice(0,n));return{type:t,name:e}}))}function onRemove(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;rpointer(t,e)))}function selectAll(t){return"string"===typeof t?new Selection([document.querySelectorAll(t)],[document.documentElement]):new Selection([array(t)],i)}export{create,creator,local,matcher,namespace,e as namespaces,pointer,pointers,select,selectAll,selection,selector,selectorAll,styleValue as style,defaultView as window}; + diff --git a/vendor/javascript/d3-shape.js b/vendor/javascript/d3-shape.js new file mode 100644 index 00000000..a4307180 --- /dev/null +++ b/vendor/javascript/d3-shape.js @@ -0,0 +1,2 @@ +import{Path as t}from"d3-path";function constant(t){return function constant(){return t}}const n=Math.abs;const i=Math.atan2;const e=Math.cos;const s=Math.max;const o=Math.min;const a=Math.sin;const r=Math.sqrt;const h=1e-12;const l=Math.PI;const c=l/2;const _=2*l;function acos(t){return t>1?0:t<-1?l:Math.acos(t)}function asin(t){return t>=1?c:t<=-1?-c:Math.asin(t)}function withPath(n){let i=3;n.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);i=n}return n};return()=>new t(i)}function arcInnerRadius(t){return t.innerRadius}function arcOuterRadius(t){return t.outerRadius}function arcStartAngle(t){return t.startAngle}function arcEndAngle(t){return t.endAngle}function arcPadAngle(t){return t&&t.padAngle}function intersect(t,n,i,e,s,o,a,r){var l=i-t,c=e-n,_=a-s,u=r-o,f=u*l-_*c;if(!(f*f$*$+B*B&&(N=P,E=A);return{cx:N,cy:E,x01:-u,y01:-f,x11:N*(o/R-1),y11:E*(o/R-1)}}function arc(){var t=arcInnerRadius,s=arcOuterRadius,u=constant(0),f=null,p=arcStartAngle,d=arcEndAngle,v=arcPadAngle,m=null,T=withPath(arc);function arc(){var b,g,k=+t.apply(this,arguments),w=+s.apply(this,arguments),R=p.apply(this,arguments)-c,C=d.apply(this,arguments)-c,S=n(C-R),N=C>R;m||(m=b=T());wh)if(S>_-h){m.moveTo(w*e(R),w*a(R));m.arc(0,0,w,R,C,!N);if(k>h){m.moveTo(k*e(C),k*a(C));m.arc(0,0,k,C,R,N)}}else{var E,P,A=R,M=C,O=R,$=C,B=S,X=S,Y=v.apply(this,arguments)/2,z=Y>h&&(f?+f.apply(this,arguments):r(k*k+w*w)),L=o(n(w-k)/2,+u.apply(this,arguments)),I=L,q=L;if(z>h){var V=asin(z/k*a(Y)),D=asin(z/w*a(Y));(B-=2*V)>h?(V*=N?1:-1,O+=V,$-=V):(B=0,O=$=(R+C)/2);(X-=2*D)>h?(D*=N?1:-1,A+=D,M-=D):(X=0,A=M=(R+C)/2)}var j=w*e(A),H=w*a(A),W=k*e($),F=k*a($);if(L>h){var G,J=w*e(M),K=w*a(M),Q=k*e(O),U=k*a(O);if(Sh)if(q>h){E=cornerTangents(Q,U,j,H,w,q,N);P=cornerTangents(J,K,W,F,w,q,N);m.moveTo(E.cx+E.x01,E.cy+E.y01);if(qh&&B>h)if(I>h){E=cornerTangents(W,F,J,K,k,-I,N);P=cornerTangents(j,H,Q,U,k,-I,N);m.lineTo(E.cx+E.x01,E.cy+E.y01);if(I=_;--u)r.point(m[u],T[u]);r.lineEnd();r.areaEnd()}if(v){m[c]=+t(f,c,l),T[c]=+n(f,c,l);r.point(e?+e(f,c,l):m[c],i?+i(f,c,l):T[c])}}if(p)return r=null,p+""||null}function arealine(){return line().defined(s).curve(a).context(o)}area.x=function(n){return arguments.length?(t="function"===typeof n?n:constant(+n),e=null,area):t};area.x0=function(n){return arguments.length?(t="function"===typeof n?n:constant(+n),area):t};area.x1=function(t){return arguments.length?(e=null==t?null:"function"===typeof t?t:constant(+t),area):e};area.y=function(t){return arguments.length?(n="function"===typeof t?t:constant(+t),i=null,area):n};area.y0=function(t){return arguments.length?(n="function"===typeof t?t:constant(+t),area):n};area.y1=function(t){return arguments.length?(i=null==t?null:"function"===typeof t?t:constant(+t),area):i};area.lineX0=area.lineY0=function(){return arealine().x(t).y(n)};area.lineY1=function(){return arealine().x(t).y(i)};area.lineX1=function(){return arealine().x(e).y(n)};area.defined=function(t){return arguments.length?(s="function"===typeof t?t:constant(!!t),area):s};area.curve=function(t){return arguments.length?(a=t,null!=o&&(r=a(o)),area):a};area.context=function(t){return arguments.length?(null==t?o=r=null:r=a(o=t),area):o};return area}function descending$1(t,n){return nt?1:n>=t?0:NaN}function identity(t){return t}function pie(){var t=identity,n=descending$1,i=null,e=constant(0),s=constant(_),o=constant(0);function pie(a){var r,h,l,c,u,f=(a=array(a)).length,p=0,d=new Array(f),v=new Array(f),m=+e.apply(this,arguments),T=Math.min(_,Math.max(-_,s.apply(this,arguments)-m)),b=Math.min(Math.abs(T)/f,o.apply(this,arguments)),g=b*(T<0?-1:1);for(r=0;r0&&(p+=u);null!=n?d.sort((function(t,i){return n(v[t],v[i])})):null!=i&&d.sort((function(t,n){return i(a[t],a[n])}));for(r=0,l=p?(T-f*g)/p:0;r0?u*l:0)+g,v[h]={data:a[h],index:r,value:u,startAngle:m,endAngle:c,padAngle:b};return v}pie.value=function(n){return arguments.length?(t="function"===typeof n?n:constant(+n),pie):t};pie.sortValues=function(t){return arguments.length?(n=t,i=null,pie):n};pie.sort=function(t){return arguments.length?(i=t,n=null,pie):i};pie.startAngle=function(t){return arguments.length?(e="function"===typeof t?t:constant(+t),pie):e};pie.endAngle=function(t){return arguments.length?(s="function"===typeof t?t:constant(+t),pie):s};pie.padAngle=function(t){return arguments.length?(o="function"===typeof t?t:constant(+t),pie):o};return pie}var f=curveRadial(curveLinear);function Radial(t){this._curve=t}Radial.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};function curveRadial(t){function radial(n){return new Radial(t(n))}radial._curve=t;return radial}function lineRadial(t){var n=t.curve;t.angle=t.x,delete t.x;t.radius=t.y,delete t.y;t.curve=function(t){return arguments.length?n(curveRadial(t)):n()._curve};return t}function lineRadial$1(){return lineRadial(line().curve(f))}function areaRadial(){var t=area().curve(f),n=t.curve,i=t.lineX0,e=t.lineX1,s=t.lineY0,o=t.lineY1;t.angle=t.x,delete t.x;t.startAngle=t.x0,delete t.x0;t.endAngle=t.x1,delete t.x1;t.radius=t.y,delete t.y;t.innerRadius=t.y0,delete t.y0;t.outerRadius=t.y1,delete t.y1;t.lineStartAngle=function(){return lineRadial(i())},delete t.lineX0;t.lineEndAngle=function(){return lineRadial(e())},delete t.lineX1;t.lineInnerRadius=function(){return lineRadial(s())},delete t.lineY0;t.lineOuterRadius=function(){return lineRadial(o())},delete t.lineY1;t.curve=function(t){return arguments.length?n(curveRadial(t)):n()._curve};return t}function pointRadial(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}class Bump{constructor(t,n){this._context=t;this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line}point(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}this._x0=t,this._y0=n}}class BumpRadial{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,n){t=+t,n=+n;if(0===this._point)this._point=1;else{const i=pointRadial(this._x0,this._y0);const e=pointRadial(this._x0,this._y0=(this._y0+n)/2);const s=pointRadial(t,this._y0);const o=pointRadial(t,n);this._context.moveTo(...i);this._context.bezierCurveTo(...e,...s,...o)}this._x0=t,this._y0=n}}function bumpX(t){return new Bump(t,true)}function bumpY(t){return new Bump(t,false)}function bumpRadial(t){return new BumpRadial(t)}function linkSource(t){return t.source}function linkTarget(t){return t.target}function link(t){let n=linkSource,i=linkTarget,e=x,s=y,o=null,a=null,r=withPath(link);function link(){let h;const l=u.call(arguments);const c=n.apply(this,l);const _=i.apply(this,l);null==o&&(a=t(h=r()));a.lineStart();l[0]=c,a.point(+e.apply(this,l),+s.apply(this,l));l[0]=_,a.point(+e.apply(this,l),+s.apply(this,l));a.lineEnd();if(h)return a=null,h+""||null}link.source=function(t){return arguments.length?(n=t,link):n};link.target=function(t){return arguments.length?(i=t,link):i};link.x=function(t){return arguments.length?(e="function"===typeof t?t:constant(+t),link):e};link.y=function(t){return arguments.length?(s="function"===typeof t?t:constant(+t),link):s};link.context=function(n){return arguments.length?(null==n?o=a=null:a=t(o=n),link):o};return link}function linkHorizontal(){return link(bumpX)}function linkVertical(){return link(bumpY)}function linkRadial(){const t=link(bumpRadial);t.angle=t.x,delete t.x;t.radius=t.y,delete t.y;return t}const p=r(3);var d={draw(t,n){const i=.59436*r(n+o(n/28,.75));const e=i/2;const s=e*p;t.moveTo(0,i);t.lineTo(0,-i);t.moveTo(-s,-e);t.lineTo(s,e);t.moveTo(-s,e);t.lineTo(s,-e)}};var v={draw(t,n){const i=r(n/l);t.moveTo(i,0);t.arc(0,0,i,0,_)}};var m={draw(t,n){const i=r(n/5)/2;t.moveTo(-3*i,-i);t.lineTo(-i,-i);t.lineTo(-i,-3*i);t.lineTo(i,-3*i);t.lineTo(i,-i);t.lineTo(3*i,-i);t.lineTo(3*i,i);t.lineTo(i,i);t.lineTo(i,3*i);t.lineTo(-i,3*i);t.lineTo(-i,i);t.lineTo(-3*i,i);t.closePath()}};const T=r(1/3);const b=2*T;var g={draw(t,n){const i=r(n/b);const e=i*T;t.moveTo(0,-i);t.lineTo(e,0);t.lineTo(0,i);t.lineTo(-e,0);t.closePath()}};var k={draw(t,n){const i=.62625*r(n);t.moveTo(0,-i);t.lineTo(i,0);t.lineTo(0,i);t.lineTo(-i,0);t.closePath()}};var w={draw(t,n){const i=.87559*r(n-o(n/7,2));t.moveTo(-i,0);t.lineTo(i,0);t.moveTo(0,i);t.lineTo(0,-i)}};var R={draw(t,n){const i=r(n);const e=-i/2;t.rect(e,e,i,i)}};var C={draw(t,n){const i=.4431*r(n);t.moveTo(i,i);t.lineTo(i,-i);t.lineTo(-i,-i);t.lineTo(-i,i);t.closePath()}};const S=.8908130915292852;const N=a(l/10)/a(7*l/10);const E=a(_/10)*N;const P=-e(_/10)*N;var A={draw(t,n){const i=r(n*S);const s=E*i;const o=P*i;t.moveTo(0,-i);t.lineTo(s,o);for(let n=1;n<5;++n){const r=_*n/5;const h=e(r);const l=a(r);t.lineTo(l*i,-h*i);t.lineTo(h*s-l*o,l*s+h*o)}t.closePath()}};const M=r(3);var O={draw(t,n){const i=-r(n/(3*M));t.moveTo(0,2*i);t.lineTo(-M*i,-i);t.lineTo(M*i,-i);t.closePath()}};const $=r(3);var B={draw(t,n){const i=.6824*r(n);const e=i/2;const s=i*$/2;t.moveTo(0,-i);t.lineTo(s,e);t.lineTo(-s,e);t.closePath()}};const X=-.5;const Y=r(3)/2;const z=1/r(12);const L=3*(z/2+1);var I={draw(t,n){const i=r(n/L);const e=i/2,s=i*z;const o=e,a=i*z+i;const h=-o,l=a;t.moveTo(e,s);t.lineTo(o,a);t.lineTo(h,l);t.lineTo(X*e-Y*s,Y*e+X*s);t.lineTo(X*o-Y*a,Y*o+X*a);t.lineTo(X*h-Y*l,Y*h+X*l);t.lineTo(X*e+Y*s,X*s-Y*e);t.lineTo(X*o+Y*a,X*a-Y*o);t.lineTo(X*h+Y*l,X*l-Y*h);t.closePath()}};var q={draw(t,n){const i=.6189*r(n-o(n/6,1.7));t.moveTo(-i,-i);t.lineTo(i,i);t.moveTo(-i,i);t.lineTo(i,-i)}};const V=[v,m,g,R,A,O,I];const D=[v,w,q,B,d,C,k];function Symbol$1(t,n){let i=null,e=withPath(symbol);t="function"===typeof t?t:constant(t||v);n="function"===typeof n?n:constant(void 0===n?64:+n);function symbol(){let s;i||(i=s=e());t.apply(this,arguments).draw(i,+n.apply(this,arguments));if(s)return i=null,s+""||null}symbol.type=function(n){return arguments.length?(t="function"===typeof n?n:constant(n),symbol):t};symbol.size=function(t){return arguments.length?(n="function"===typeof t?t:constant(+t),symbol):n};symbol.context=function(t){return arguments.length?(i=null==t?null:t,symbol):i};return symbol}function noop(){}function point$3(t,n,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+i)/6)}function Basis(t){this._context=t}Basis.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN;this._point=0},lineEnd:function(){switch(this._point){case 3:point$3(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:point$3(this,t,n);break}this._x0=this._x1,this._x1=t;this._y0=this._y1,this._y1=n}};function basis(t){return new Basis(t)}function BasisClosed(t){this._context=t}BasisClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN;this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2);this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3);this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3);this._context.closePath();break;case 3:this.point(this._x2,this._y2);this.point(this._x3,this._y3);this.point(this._x4,this._y4);break}},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._x2=t,this._y2=n;break;case 1:this._point=2;this._x3=t,this._y3=n;break;case 2:this._point=3;this._x4=t,this._y4=n;this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:point$3(this,t,n);break}this._x0=this._x1,this._x1=t;this._y0=this._y1,this._y1=n}};function basisClosed(t){return new BasisClosed(t)}function BasisOpen(t){this._context=t}BasisOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN;this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var i=(this._x0+4*this._x1+t)/6,e=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 3:this._point=4;default:point$3(this,t,n);break}this._x0=this._x1,this._x1=t;this._y0=this._y1,this._y1=n}};function basisOpen(t){return new BasisOpen(t)}function Bundle(t,n){this._basis=new Basis(t);this._beta=n}Bundle.prototype={lineStart:function(){this._x=[];this._y=[];this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,i=t.length-1;if(i>0){var e,s=t[0],o=n[0],a=t[i]-s,r=n[i]-o,h=-1;while(++h<=i){e=h/i;this._basis.point(this._beta*t[h]+(1-this._beta)*(s+e*a),this._beta*n[h]+(1-this._beta)*(o+e*r))}}this._x=this._y=null;this._basis.lineEnd()},point:function(t,n){this._x.push(+t);this._y.push(+n)}};var j=function custom(t){function bundle(n){return 1===t?new Basis(n):new Bundle(n,t)}bundle.beta=function(t){return custom(+t)};return bundle}(.85);function point$2(t,n,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function Cardinal(t,n){this._context=t;this._k=(1-n)/6}Cardinal.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:point$2(this,this._x1,this._y1);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;this._x1=t,this._y1=n;break;case 2:this._point=3;default:point$2(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var H=function custom(t){function cardinal(n){return new Cardinal(n,t)}cardinal.tension=function(t){return custom(+t)};return cardinal}(0);function CardinalClosed(t,n){this._context=t;this._k=(1-n)/6}CardinalClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN;this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3);this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3);this._context.closePath();break;case 3:this.point(this._x3,this._y3);this.point(this._x4,this._y4);this.point(this._x5,this._y5);break}},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._x3=t,this._y3=n;break;case 1:this._point=2;this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3;this._x5=t,this._y5=n;break;default:point$2(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var W=function custom(t){function cardinal(n){return new CardinalClosed(n,t)}cardinal.tension=function(t){return custom(+t)};return cardinal}(0);function CardinalOpen(t,n){this._context=t;this._k=(1-n)/6}CardinalOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:point$2(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var F=function custom(t){function cardinal(n){return new CardinalOpen(n,t)}cardinal.tension=function(t){return custom(+t)};return cardinal}(0);function point$1(t,n,i){var e=t._x1,s=t._y1,o=t._x2,a=t._y2;if(t._l01_a>h){var r=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);e=(e*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/l;s=(s*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>h){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,_=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-n*t._l12_2a)/_;a=(a*c+t._y1*t._l23_2a-i*t._l12_2a)/_}t._context.bezierCurveTo(e,s,o,a,t._x2,t._y2)}function CatmullRom(t,n){this._context=t;this._alpha=n}CatmullRom.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;if(this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:point$1(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var G=function custom(t){function catmullRom(n){return t?new CatmullRom(n,t):new Cardinal(n,0)}catmullRom.alpha=function(t){return custom(+t)};return catmullRom}(.5);function CatmullRomClosed(t,n){this._context=t;this._alpha=n}CatmullRomClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3);this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3);this._context.closePath();break;case 3:this.point(this._x3,this._y3);this.point(this._x4,this._y4);this.point(this._x5,this._y5);break}},point:function(t,n){t=+t,n=+n;if(this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1;this._x3=t,this._y3=n;break;case 1:this._point=2;this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3;this._x5=t,this._y5=n;break;default:point$1(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var J=function custom(t){function catmullRom(n){return t?new CatmullRomClosed(n,t):new CardinalClosed(n,0)}catmullRom.alpha=function(t){return custom(+t)};return catmullRom}(.5);function CatmullRomOpen(t,n){this._context=t;this._alpha=n}CatmullRomOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;if(this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:point$1(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var K=function custom(t){function catmullRom(n){return t?new CatmullRomOpen(n,t):new CardinalOpen(n,0)}catmullRom.alpha=function(t){return custom(+t)};return catmullRom}(.5);function LinearClosed(t){this._context=t}LinearClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n;this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}};function linearClosed(t){return new LinearClosed(t)}function sign(t){return t<0?-1:1}function slope3(t,n,i){var e=t._x1-t._x0,s=n-t._x1,o=(t._y1-t._y0)/(e||s<0&&-0),a=(i-t._y1)/(s||e<0&&-0),r=(o*s+a*e)/(e+s);return(sign(o)+sign(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(r))||0}function slope2(t,n){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-n)/2:n}function point(t,n,i){var e=t._x0,s=t._y0,o=t._x1,a=t._y1,r=(o-e)/3;t._context.bezierCurveTo(e+r,s+r*n,o-r,a-r*i,o,a)}function MonotoneX(t){this._context=t}MonotoneX.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:point(this,this._t0,slope2(this,this._t0));break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){var i=NaN;t=+t,n=+n;if(t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;point(this,slope2(this,i=slope3(this,t,n)),i);break;default:point(this,this._t0,i=slope3(this,t,n));break}this._x0=this._x1,this._x1=t;this._y0=this._y1,this._y1=n;this._t0=i}}};function MonotoneY(t){this._context=new ReflectContext(t)}(MonotoneY.prototype=Object.create(MonotoneX.prototype)).point=function(t,n){MonotoneX.prototype.point.call(this,n,t)};function ReflectContext(t){this._context=t}ReflectContext.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,i,e,s,o){this._context.bezierCurveTo(n,t,e,i,o,s)}};function monotoneX(t){return new MonotoneX(t)}function monotoneY(t){return new MonotoneY(t)}function Natural(t){this._context=t}Natural.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[];this._y=[]},lineEnd:function(){var t=this._x,n=this._y,i=t.length;if(i){this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]);if(2===i)this._context.lineTo(t[1],n[1]);else{var e=controlPoints(t),s=controlPoints(n);for(var o=0,a=1;a=0;--n)s[n]=(a[n]-s[n+1])/o[n];o[e-1]=(t[e]+s[e-1])/2;for(n=0;n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0){this._context.lineTo(this._x,n);this._context.lineTo(t,n)}else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y);this._context.lineTo(i,n)}break}this._x=t,this._y=n}};function step(t){return new Step(t,.5)}function stepBefore(t){return new Step(t,0)}function stepAfter(t){return new Step(t,1)}function none$1(t,n){if((s=t.length)>1)for(var i,e,s,o=1,a=t[n[0]],r=a.length;o=0)i[n]=n;return i}function stackValue(t,n){return t[n]}function stackSeries(t){const n=[];n.key=t;return n}function stack(){var t=constant([]),n=none,i=none$1,e=stackValue;function stack(s){var o,a,r=Array.from(t.apply(this,arguments),stackSeries),h=r.length,l=-1;for(const t of s)for(o=0,++l;o0){for(var i,e,s,o=0,a=t[0].length;o0)for(var i,e,s,o,a,r,h=0,l=t[n[0]].length;h0?(e[0]=o,e[1]=o+=s):s<0?(e[1]=a,e[0]=a+=s):(e[0]=0,e[1]=s)}function silhouette(t,n){if((i=t.length)>0){for(var i,e=0,s=t[n[0]],o=s.length;e0&&(e=(i=t[n[0]]).length)>0){for(var i,e,s,o=0,a=1;ao&&(o=n,e=i);return e}function ascending(t){var n=t.map(sum);return none(t).sort((function(t,i){return n[t]-n[i]}))}function sum(t){var n,i=0,e=-1,s=t.length;while(++e53)return null;"w"in c||(c.w=1);if("Z"in c){f=utcDate(newDate(c.y,0,1)),i=f.getUTCDay();f=i>4||0===i?e.ceil(f):e(f);f=r.offset(f,7*(c.V-1));c.y=f.getUTCFullYear();c.m=f.getUTCMonth();c.d=f.getUTCDate()+(c.w+6)%7}else{f=localDate(newDate(c.y,0,1)),i=f.getDay();f=i>4||0===i?t.ceil(f):t(f);f=n.offset(f,7*(c.V-1));c.y=f.getFullYear();c.m=f.getMonth();c.d=f.getDate()+(c.w+6)%7}}else if("W"in c||"U"in c){"w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0);i="Z"in c?utcDate(newDate(c.y,0,1)).getUTCDay():localDate(newDate(c.y,0,1)).getDay();c.m=0;c.d="W"in c?(c.w+6)%7+7*c.W-(i+5)%7:c.w+7*c.U-(i+6)%7}if("Z"in c){c.H+=c.Z/100|0;c.M+=c.Z%100;return utcDate(c)}return localDate(c)}}function parseSpecifier(e,r,t,n){var a,o,u=0,f=r.length,i=t.length;while(u=i)return-1;a=r.charCodeAt(u++);if(37===a){a=r.charAt(u++);o=W[a in m?r.charAt(u++):a];if(!o||(n=o(e,t,n))<0)return-1}else if(a!=t.charCodeAt(n++))return-1}return n}function parsePeriod(e,r,t){var n=p.exec(r.slice(t));return n?(e.p=y.get(n[0].toLowerCase()),t+n[0].length):-1}function parseShortWeekday(e,r,t){var n=g.exec(r.slice(t));return n?(e.w=U.get(n[0].toLowerCase()),t+n[0].length):-1}function parseWeekday(e,r,t){var n=T.exec(r.slice(t));return n?(e.w=h.get(n[0].toLowerCase()),t+n[0].length):-1}function parseShortMonth(e,r,t){var n=S.exec(r.slice(t));return n?(e.m=D.get(n[0].toLowerCase()),t+n[0].length):-1}function parseMonth(e,r,t){var n=M.exec(r.slice(t));return n?(e.m=C.get(n[0].toLowerCase()),t+n[0].length):-1}function parseLocaleDateTime(e,r,t){return parseSpecifier(e,o,r,t)}function parseLocaleDate(e,r,t){return parseSpecifier(e,u,r,t)}function parseLocaleTime(e,r,t){return parseSpecifier(e,f,r,t)}function formatShortWeekday(e){return s[e.getDay()]}function formatWeekday(e){return c[e.getDay()]}function formatShortMonth(e){return d[e.getMonth()]}function formatMonth(e){return l[e.getMonth()]}function formatPeriod(e){return i[+(e.getHours()>=12)]}function formatQuarter(e){return 1+~~(e.getMonth()/3)}function formatUTCShortWeekday(e){return s[e.getUTCDay()]}function formatUTCWeekday(e){return c[e.getUTCDay()]}function formatUTCShortMonth(e){return d[e.getUTCMonth()]}function formatUTCMonth(e){return l[e.getUTCMonth()]}function formatUTCPeriod(e){return i[+(e.getUTCHours()>=12)]}function formatUTCQuarter(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var r=newFormat(e+="",v);r.toString=function(){return e};return r},parse:function(e){var r=newParse(e+="",false);r.toString=function(){return e};return r},utcFormat:function(e){var r=newFormat(e+="",w);r.toString=function(){return e};return r},utcParse:function(e){var r=newParse(e+="",true);r.toString=function(){return e};return r}}}var m={"-":"",_:" ",0:"0"},s=/^\s*\d+/,l=/^%/,d=/[\\^$*+?|[\]().{}]/g;function pad(e,r,t){var n=e<0?"-":"",a=(n?-e:e)+"",o=a.length;return n+(o[e.toLowerCase(),r])))}function parseWeekdayNumberSunday(e,r,t){var n=s.exec(r.slice(t,t+1));return n?(e.w=+n[0],t+n[0].length):-1}function parseWeekdayNumberMonday(e,r,t){var n=s.exec(r.slice(t,t+1));return n?(e.u=+n[0],t+n[0].length):-1}function parseWeekNumberSunday(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.U=+n[0],t+n[0].length):-1}function parseWeekNumberISO(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.V=+n[0],t+n[0].length):-1}function parseWeekNumberMonday(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.W=+n[0],t+n[0].length):-1}function parseFullYear(e,r,t){var n=s.exec(r.slice(t,t+4));return n?(e.y=+n[0],t+n[0].length):-1}function parseYear(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),t+n[0].length):-1}function parseZone(e,r,t){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(r.slice(t,t+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),t+n[0].length):-1}function parseQuarter(e,r,t){var n=s.exec(r.slice(t,t+1));return n?(e.q=3*n[0]-3,t+n[0].length):-1}function parseMonthNumber(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.m=n[0]-1,t+n[0].length):-1}function parseDayOfMonth(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.d=+n[0],t+n[0].length):-1}function parseDayOfYear(e,r,t){var n=s.exec(r.slice(t,t+3));return n?(e.m=0,e.d=+n[0],t+n[0].length):-1}function parseHour24(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.H=+n[0],t+n[0].length):-1}function parseMinutes(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.M=+n[0],t+n[0].length):-1}function parseSeconds(e,r,t){var n=s.exec(r.slice(t,t+2));return n?(e.S=+n[0],t+n[0].length):-1}function parseMilliseconds(e,r,t){var n=s.exec(r.slice(t,t+3));return n?(e.L=+n[0],t+n[0].length):-1}function parseMicroseconds(e,r,t){var n=s.exec(r.slice(t,t+6));return n?(e.L=Math.floor(n[0]/1e3),t+n[0].length):-1}function parseLiteralPercent(e,r,t){var n=l.exec(r.slice(t,t+1));return n?t+n[0].length:-1}function parseUnixTimestamp(e,r,t){var n=s.exec(r.slice(t));return n?(e.Q=+n[0],t+n[0].length):-1}function parseUnixTimestampSeconds(e,r,t){var n=s.exec(r.slice(t));return n?(e.s=+n[0],t+n[0].length):-1}function formatDayOfMonth(e,r){return pad(e.getDate(),r,2)}function formatHour24(e,r){return pad(e.getHours(),r,2)}function formatHour12(e,r){return pad(e.getHours()%12||12,r,2)}function formatDayOfYear(e,r){return pad(1+n.count(a(e),e),r,3)}function formatMilliseconds(e,r){return pad(e.getMilliseconds(),r,3)}function formatMicroseconds(e,r){return formatMilliseconds(e,r)+"000"}function formatMonthNumber(e,r){return pad(e.getMonth()+1,r,2)}function formatMinutes(e,r){return pad(e.getMinutes(),r,2)}function formatSeconds(e,r){return pad(e.getSeconds(),r,2)}function formatWeekdayNumberMonday(e){var r=e.getDay();return 0===r?7:r}function formatWeekNumberSunday(e,r){return pad(o.count(a(e)-1,e),r,2)}function dISO(e){var r=e.getDay();return r>=4||0===r?u(e):u.ceil(e)}function formatWeekNumberISO(e,r){e=dISO(e);return pad(u.count(a(e),e)+(4===a(e).getDay()),r,2)}function formatWeekdayNumberSunday(e){return e.getDay()}function formatWeekNumberMonday(e,r){return pad(t.count(a(e)-1,e),r,2)}function formatYear(e,r){return pad(e.getFullYear()%100,r,2)}function formatYearISO(e,r){e=dISO(e);return pad(e.getFullYear()%100,r,2)}function formatFullYear(e,r){return pad(e.getFullYear()%1e4,r,4)}function formatFullYearISO(e,r){var t=e.getDay();e=t>=4||0===t?u(e):u.ceil(e);return pad(e.getFullYear()%1e4,r,4)}function formatZone(e){var r=e.getTimezoneOffset();return(r>0?"-":(r*=-1,"+"))+pad(r/60|0,"0",2)+pad(r%60,"0",2)}function formatUTCDayOfMonth(e,r){return pad(e.getUTCDate(),r,2)}function formatUTCHour24(e,r){return pad(e.getUTCHours(),r,2)}function formatUTCHour12(e,r){return pad(e.getUTCHours()%12||12,r,2)}function formatUTCDayOfYear(e,t){return pad(1+r.count(f(e),e),t,3)}function formatUTCMilliseconds(e,r){return pad(e.getUTCMilliseconds(),r,3)}function formatUTCMicroseconds(e,r){return formatUTCMilliseconds(e,r)+"000"}function formatUTCMonthNumber(e,r){return pad(e.getUTCMonth()+1,r,2)}function formatUTCMinutes(e,r){return pad(e.getUTCMinutes(),r,2)}function formatUTCSeconds(e,r){return pad(e.getUTCSeconds(),r,2)}function formatUTCWeekdayNumberMonday(e){var r=e.getUTCDay();return 0===r?7:r}function formatUTCWeekNumberSunday(e,r){return pad(i.count(f(e)-1,e),r,2)}function UTCdISO(e){var r=e.getUTCDay();return r>=4||0===r?c(e):c.ceil(e)}function formatUTCWeekNumberISO(e,r){e=UTCdISO(e);return pad(c.count(f(e),e)+(4===f(e).getUTCDay()),r,2)}function formatUTCWeekdayNumberSunday(e){return e.getUTCDay()}function formatUTCWeekNumberMonday(r,t){return pad(e.count(f(r)-1,r),t,2)}function formatUTCYear(e,r){return pad(e.getUTCFullYear()%100,r,2)}function formatUTCYearISO(e,r){e=UTCdISO(e);return pad(e.getUTCFullYear()%100,r,2)}function formatUTCFullYear(e,r){return pad(e.getUTCFullYear()%1e4,r,4)}function formatUTCFullYearISO(e,r){var t=e.getUTCDay();e=t>=4||0===t?c(e):c.ceil(e);return pad(e.getUTCFullYear()%1e4,r,4)}function formatUTCZone(){return"+0000"}function formatLiteralPercent(){return"%"}function formatUnixTimestamp(e){return+e}function formatUnixTimestampSeconds(e){return Math.floor(+e/1e3)}var p;var y;var T;var h;var g;defaultLocale({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 defaultLocale(e){p=formatLocale(e);y=p.format;T=p.parse;h=p.utcFormat;g=p.utcParse;return p}var U="%Y-%m-%dT%H:%M:%S.%LZ";function formatIsoNative(e){return e.toISOString()}var M=Date.prototype.toISOString?formatIsoNative:h(U);function parseIsoNative(e){var r=new Date(e);return isNaN(r)?null:r}var C=+new Date("2000-01-01T00:00:00.000Z")?parseIsoNative:g(U);export{M as isoFormat,C as isoParse,y as timeFormat,defaultLocale as timeFormatDefaultLocale,formatLocale as timeFormatLocale,T as timeParse,h as utcFormat,g as utcParse}; + diff --git a/vendor/javascript/d3-time.js b/vendor/javascript/d3-time.js new file mode 100644 index 00000000..7f5538e3 --- /dev/null +++ b/vendor/javascript/d3-time.js @@ -0,0 +1,2 @@ +import{bisector as e,tickStep as t}from"d3-array";const n=new Date,s=new Date;function timeInterval(e,t,r,a){function interval(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}interval.floor=t=>(e(t=new Date(+t)),t);interval.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n);interval.round=e=>{const t=interval(e),n=interval.ceil(e);return e-t(t(e=new Date(+e),null==n?1:Math.floor(n)),e);interval.range=(n,s,r)=>{const a=[];n=interval.ceil(n);r=null==r?1:Math.floor(r);if(!(n0))return a;let o;do{a.push(o=new Date(+n)),t(n,r),e(n)}while(otimeInterval((t=>{if(t>=t)while(e(t),!n(t))t.setTime(t-1)}),((e,s)=>{if(e>=e)if(s<0)while(++s<=0)while(t(e,-1),!n(e));else while(--s>=0)while(t(e,1),!n(e));}));if(r){interval.count=(t,a)=>{n.setTime(+t),s.setTime(+a);e(n),e(s);return Math.floor(r(n,s))};interval.every=e=>{e=Math.floor(e);return isFinite(e)&&e>0?e>1?interval.filter(a?t=>a(t)%e===0:t=>interval.count(0,t)%e===0):interval:null}}return interval}const r=timeInterval((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e));r.every=e=>{e=Math.floor(e);return isFinite(e)&&e>0?e>1?timeInterval((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):r:null};const a=r.range;const o=1e3;const l=60*o;const i=60*l;const c=24*i;const u=7*c;const g=30*c;const T=365*c;const m=timeInterval((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*o)}),((e,t)=>(t-e)/o),(e=>e.getUTCSeconds()));const v=m.range;const f=timeInterval((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*o)}),((e,t)=>{e.setTime(+e+t*l)}),((e,t)=>(t-e)/l),(e=>e.getMinutes()));const C=f.range;const U=timeInterval((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*l)}),((e,t)=>(t-e)/l),(e=>e.getUTCMinutes()));const M=U.range;const h=timeInterval((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*o-e.getMinutes()*l)}),((e,t)=>{e.setTime(+e+t*i)}),((e,t)=>(t-e)/i),(e=>e.getHours()));const d=h.range;const k=timeInterval((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*i)}),((e,t)=>(t-e)/i),(e=>e.getUTCHours()));const D=k.range;const y=timeInterval((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*l)/c),(e=>e.getDate()-1));const F=y.range;const I=timeInterval((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/c),(e=>e.getUTCDate()-1));const Y=I.range;const W=timeInterval((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/c),(e=>Math.floor(e/c)));const w=W.range;function timeWeekday(e){return timeInterval((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7);t.setHours(0,0,0,0)}),((e,t)=>{e.setDate(e.getDate()+7*t)}),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*l)/u))}const H=timeWeekday(0);const S=timeWeekday(1);const p=timeWeekday(2);const z=timeWeekday(3);const O=timeWeekday(4);const x=timeWeekday(5);const b=timeWeekday(6);const j=H.range;const q=S.range;const A=p.range;const B=z.range;const E=O.range;const G=x.range;const J=b.range;function utcWeekday(e){return timeInterval((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7);t.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)}),((e,t)=>(t-e)/u))}const K=utcWeekday(0);const L=utcWeekday(1);const N=utcWeekday(2);const P=utcWeekday(3);const Q=utcWeekday(4);const R=utcWeekday(5);const V=utcWeekday(6);const X=K.range;const Z=L.range;const $=N.range;const _=P.range;const ee=Q.range;const te=R.range;const ne=V.range;const se=timeInterval((e=>{e.setDate(1);e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth()));const re=se.range;const ae=timeInterval((e=>{e.setUTCDate(1);e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth()));const oe=ae.range;const le=timeInterval((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?timeInterval((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e);t.setMonth(0,1);t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null;const ie=le.range;const ce=timeInterval((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()));ce.every=e=>isFinite(e=Math.floor(e))&&e>0?timeInterval((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e);t.setUTCMonth(0,1);t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null;const ue=ce.range;function ticker(n,s,a,v,f,C){const U=[[m,1,o],[m,5,5*o],[m,15,15*o],[m,30,30*o],[C,1,l],[C,5,5*l],[C,15,15*l],[C,30,30*l],[f,1,i],[f,3,3*i],[f,6,6*i],[f,12,12*i],[v,1,c],[v,2,2*c],[a,1,u],[s,1,g],[s,3,3*g],[n,1,T]];function ticks(e,t,n){const s=te)).right(U,l);if(i===U.length)return n.every(t(s/T,a/T,o));if(0===i)return r.every(Math.max(t(s,a,o),1));const[c,u]=U[l/U[i-1][2]=0&&i._call.call(void 0,e);i=i._next}--n}function wake(){a=(l=s.now())+u;n=i=0;try{timerFlush()}finally{n=0;nap();a=0}}function poke(){var t=s.now(),e=t-l;e>o&&(u-=e,l=t)}function nap(){var n,i,r=t,o=Infinity;while(r)if(r._call){o>r._time&&(o=r._time);n=r,r=r._next}else{i=r._next,r._next=null;r=n?n._next=i:t=i}e=n;sleep(o)}function sleep(t){if(!n){i&&(i=clearTimeout(i));var e=t-a;if(e>24){t{i.stop();t(n+e)}),e,n);return i}function interval(t,e,n){var i=new Timer,r=e;if(null==e)return i.restart(t,e,n),i;i._restart=i.restart;i.restart=function(t,e,n){e=+e,n=null==n?now():+n;i._restart((function tick(o){o+=r;i._restart(tick,r+=e,n);t(o)}),e,n)};i.restart(t,e,n);return i}export{interval,now,timeout,timer,timerFlush}; + diff --git a/vendor/javascript/d3-transition.js b/vendor/javascript/d3-transition.js new file mode 100644 index 00000000..f47dc858 --- /dev/null +++ b/vendor/javascript/d3-transition.js @@ -0,0 +1,2 @@ +import{namespace as t,matcher as n,selector as e,selectorAll as r,selection as i,style as o}from"d3-selection";import{dispatch as a}from"d3-dispatch";import{timer as s,timeout as u,now as l}from"d3-timer";import{interpolateNumber as c,interpolateRgb as f,interpolateString as h,interpolateTransformSvg as _,interpolateTransformCss as v}from"d3-interpolate";import{color as d}from"d3-color";import{easeCubicInOut as p}from"d3-ease";var y=a("start","end","cancel","interrupt");var w=[];var m=0;var g=1;var T=2;var x=3;var C=4;var A=5;var N=6;function schedule(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};create(t,e,{name:n,index:r,group:i,on:y,tween:w,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:m})}function init(t,n){var e=get(t,n);if(e.state>m)throw new Error("too late; already scheduled");return e}function set(t,n){var e=get(t,n);if(e.state>x)throw new Error("too late; already running");return e}function get(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function create(t,n,e){var r,i=t.__transition;i[n]=e;e.timer=s(schedule,0,e.time);function schedule(t){e.state=g;e.timer.restart(start,e.delay,e.time);e.delay<=t&&start(t-e.delay)}function start(o){var a,s,l,c;if(e.state!==g)return stop();for(a in i){c=i[a];if(c.name===e.name){if(c.state===x)return u(start);if(c.state===C){c.state=N;c.timer.stop();c.on.call("interrupt",t,t.__data__,c.index,c.group);delete i[a]}else if(+aT&&e.state=0&&(t=t.slice(0,n));return!t||"start"===t}))}function onFunction(t,n,e){var r,i,o=start(n)?init:set;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(n,e);a.on=i}}function transition_on(t,n){var e=this._id;return arguments.length<2?get(this.node(),e).on.on(t):this.each(onFunction(e,t,n))}function removeFunction(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function transition_remove(){return this.on("end.remove",removeFunction(this._id))}function transition_select(t){var n=this._name,r=this._id;"function"!==typeof t&&(t=e(t));for(var i=this._groups,o=i.length,a=new Array(o),s=0;sg&&e.name===n)return new Transition([[t]],I,n,+r)}return null}export{active,interrupt,transition}; + diff --git a/vendor/javascript/d3-zoom.js b/vendor/javascript/d3-zoom.js new file mode 100644 index 00000000..f155a61d --- /dev/null +++ b/vendor/javascript/d3-zoom.js @@ -0,0 +1,2 @@ +import{dispatch as t}from"d3-dispatch";import{dragDisable as o,dragEnable as e}from"d3-drag";import{interpolateZoom as n}from"d3-interpolate";import{select as i,pointer as r}from"d3-selection";import{interrupt as u}from"d3-transition";var constant=t=>()=>t;function ZoomEvent(t,{sourceEvent:o,target:e,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:true,configurable:true},sourceEvent:{value:o,enumerable:true,configurable:true},target:{value:e,enumerable:true,configurable:true},transform:{value:n,enumerable:true,configurable:true},_:{value:i}})}function Transform(t,o,e){this.k=t;this.x=o;this.y=e}Transform.prototype={constructor:Transform,scale:function(t){return 1===t?this:new Transform(this.k*t,this.x,this.y)},translate:function(t,o){return 0===t&0===o?this:new Transform(this.k,this.x+this.k*t,this.y+this.k*o)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var s=new Transform(1,0,0);transform.prototype=Transform.prototype;function transform(t){while(!t.__zoom)if(!(t=t.parentNode))return s;return t.__zoom}function nopropagation(t){t.stopImmediatePropagation()}function noevent(t){t.preventDefault();t.stopImmediatePropagation()}function defaultFilter(t){return(!t.ctrlKey||"wheel"===t.type)&&!t.button}function defaultExtent(){var t=this;if(t instanceof SVGElement){t=t.ownerSVGElement||t;if(t.hasAttribute("viewBox")){t=t.viewBox.baseVal;return[[t.x,t.y],[t.x+t.width,t.y+t.height]]}return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}return[[0,0],[t.clientWidth,t.clientHeight]]}function defaultTransform(){return this.__zoom||s}function defaultWheelDelta(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function defaultConstrain(t,o,e){var n=t.invertX(o[0][0])-e[0][0],i=t.invertX(o[1][0])-e[1][0],r=t.invertY(o[0][1])-e[0][1],u=t.invertY(o[1][1])-e[1][1];return t.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),u>r?(r+u)/2:Math.min(0,r)||Math.max(0,u))}function zoom(){var a,h,c,l=defaultFilter,m=defaultExtent,f=defaultConstrain,p=defaultWheelDelta,d=defaultTouchable,v=[0,Infinity],z=[[-Infinity,-Infinity],[Infinity,Infinity]],y=250,g=n,_=t("start","zoom","end"),w=500,T=150,k=0,x=10;function zoom(t){t.property("__zoom",defaultTransform).on("wheel.zoom",wheeled,{passive:false}).on("mousedown.zoom",mousedowned).on("dblclick.zoom",dblclicked).filter(d).on("touchstart.zoom",touchstarted).on("touchmove.zoom",touchmoved).on("touchend.zoom touchcancel.zoom",touchended).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}zoom.transform=function(t,o,e,n){var i=t.selection?t.selection():t;i.property("__zoom",defaultTransform);t!==i?schedule(t,o,e,n):i.interrupt().each((function(){gesture(this,arguments).event(n).start().zoom(null,"function"===typeof o?o.apply(this,arguments):o).end()}))};zoom.scaleBy=function(t,o,e,n){zoom.scaleTo(t,(function(){var t=this.__zoom.k,e="function"===typeof o?o.apply(this,arguments):o;return t*e}),e,n)};zoom.scaleTo=function(t,o,e,n){zoom.transform(t,(function(){var t=m.apply(this,arguments),n=this.__zoom,i=null==e?centroid(t):"function"===typeof e?e.apply(this,arguments):e,r=n.invert(i),u="function"===typeof o?o.apply(this,arguments):o;return f(translate(scale(n,u),i,r),t,z)}),e,n)};zoom.translateBy=function(t,o,e,n){zoom.transform(t,(function(){return f(this.__zoom.translate("function"===typeof o?o.apply(this,arguments):o,"function"===typeof e?e.apply(this,arguments):e),m.apply(this,arguments),z)}),null,n)};zoom.translateTo=function(t,o,e,n,i){zoom.transform(t,(function(){var t=m.apply(this,arguments),i=this.__zoom,r=null==n?centroid(t):"function"===typeof n?n.apply(this,arguments):n;return f(s.translate(r[0],r[1]).scale(i.k).translate("function"===typeof o?-o.apply(this,arguments):-o,"function"===typeof e?-e.apply(this,arguments):-e),t,z)}),n,i)};function scale(t,o){o=Math.max(v[0],Math.min(v[1],o));return o===t.k?t:new Transform(o,t.x,t.y)}function translate(t,o,e){var n=o[0]-e[0]*t.k,i=o[1]-e[1]*t.k;return n===t.x&&i===t.y?t:new Transform(t.k,n,i)}function centroid(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function schedule(t,o,e,n){t.on("start.zoom",(function(){gesture(this,arguments).event(n).start()})).on("interrupt.zoom end.zoom",(function(){gesture(this,arguments).event(n).end()})).tween("zoom",(function(){var t=this,i=arguments,r=gesture(t,i).event(n),u=m.apply(t,i),s=null==e?centroid(u):"function"===typeof e?e.apply(t,i):e,a=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),h=t.__zoom,c="function"===typeof o?o.apply(t,i):o,l=g(h.invert(s).concat(a/h.k),c.invert(s).concat(a/c.k));return function(t){if(1===t)t=c;else{var o=l(t),e=a/o[2];t=new Transform(e,s[0]-o[0]*e,s[1]-o[1]*e)}r.zoom(null,t)}}))}function gesture(t,o,e){return!e&&t.__zooming||new Gesture(t,o)}function Gesture(t,o){this.that=t;this.args=o;this.active=0;this.sourceEvent=null;this.extent=m.apply(t,o);this.taps=0}Gesture.prototype={event:function(t){t&&(this.sourceEvent=t);return this},start:function(){if(1===++this.active){this.that.__zooming=this;this.emit("start")}return this},zoom:function(t,o){this.mouse&&"mouse"!==t&&(this.mouse[1]=o.invert(this.mouse[0]));this.touch0&&"touch"!==t&&(this.touch0[1]=o.invert(this.touch0[0]));this.touch1&&"touch"!==t&&(this.touch1[1]=o.invert(this.touch1[0]));this.that.__zoom=o;this.emit("zoom");return this},end:function(){if(0===--this.active){delete this.that.__zooming;this.emit("end")}return this},emit:function(t){var o=i(this.that).datum();_.call(t,this.that,new ZoomEvent(t,{sourceEvent:this.sourceEvent,target:zoom,type:t,transform:this.that.__zoom,dispatch:_}),o)}};function wheeled(t,...o){if(l.apply(this,arguments)){var e=gesture(this,o).event(t),n=this.__zoom,i=Math.max(v[0],Math.min(v[1],n.k*Math.pow(2,p.apply(this,arguments)))),s=r(t);if(e.wheel){e.mouse[0][0]===s[0]&&e.mouse[0][1]===s[1]||(e.mouse[1]=n.invert(e.mouse[0]=s));clearTimeout(e.wheel)}else{if(n.k===i)return;e.mouse=[s,n.invert(s)];u(this);e.start()}noevent(t);e.wheel=setTimeout(wheelidled,T);e.zoom("mouse",f(translate(scale(n,i),e.mouse[0],e.mouse[1]),e.extent,z))}function wheelidled(){e.wheel=null;e.end()}}function mousedowned(t,...n){if(!c&&l.apply(this,arguments)){var s=t.currentTarget,a=gesture(this,n,true).event(t),h=i(t.view).on("mousemove.zoom",mousemoved,true).on("mouseup.zoom",mouseupped,true),m=r(t,s),p=t.clientX,d=t.clientY;o(t.view);nopropagation(t);a.mouse=[m,this.__zoom.invert(m)];u(this);a.start()}function mousemoved(t){noevent(t);if(!a.moved){var o=t.clientX-p,e=t.clientY-d;a.moved=o*o+e*e>k}a.event(t).zoom("mouse",f(translate(a.that.__zoom,a.mouse[0]=r(t,s),a.mouse[1]),a.extent,z))}function mouseupped(t){h.on("mousemove.zoom mouseup.zoom",null);e(t.view,a.moved);noevent(t);a.event(t).end()}}function dblclicked(t,...o){if(l.apply(this,arguments)){var e=this.__zoom,n=r(t.changedTouches?t.changedTouches[0]:t,this),u=e.invert(n),s=e.k*(t.shiftKey?.5:2),a=f(translate(scale(e,s),n,u),m.apply(this,o),z);noevent(t);y>0?i(this).transition().duration(y).call(schedule,a,n,t):i(this).call(zoom.transform,a,n,t)}}function touchstarted(t,...o){if(l.apply(this,arguments)){var e,n,i,s,c=t.touches,m=c.length,f=gesture(this,o,t.changedTouches.length===m).event(t);nopropagation(t);for(n=0;n>1;if(s>0&&typeof t[0]!=="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*s-5,0);this._triangles=new Uint32Array(i*3);this._halfedges=new Int32Array(i*3);this._hashSize=Math.ceil(Math.sqrt(s));this._hullPrev=new Uint32Array(s);this._hullNext=new Uint32Array(s);this._hullTri=new Uint32Array(s);this._hullHash=new Int32Array(this._hashSize);this._ids=new Uint32Array(s);this._dists=new Float64Array(s);this.update()}update(){const{coords:i,_hullPrev:n,_hullNext:e,_hullTri:h,_hullHash:l}=this;const r=i.length>>1;let o=Infinity;let c=Infinity;let a=-Infinity;let u=-Infinity;for(let t=0;ta&&(a=s);n>u&&(u=n);this._ids[t]=t}const _=(o+a)/2;const f=(c+u)/2;let d,y,g;for(let t=0,s=Infinity;t0){y=t;s=n}}let b=i[2*y];let p=i[2*y+1];let A=Infinity;for(let t=0;tn){t[s++]=e;n=h}}this.hull=t.subarray(0,s);this.triangles=new Uint32Array(0);this.halfedges=new Uint32Array(0);return}if(t(w,k,b,p,I,S)<0){const t=y;const s=b;const i=p;y=g;b=I;p=S;g=t;I=s;S=i}const m=circumcenter(w,k,b,p,I,S);this._cx=m.x;this._cy=m.y;for(let t=0;t0&&Math.abs(u-r)<=s&&Math.abs(_-o)<=s)continue;r=u;o=_;if(a===d||a===y||a===g)continue;let f=0;for(let t=0,s=this._hashKey(u,_);t=0){k=w;if(k===f){k=-1;break}}if(k===-1)continue;let b=this._addTriangle(k,a,e[k],-1,-1,h[k]);h[a]=this._legalize(b+2);h[k]=b;x++;let p=e[k];while(w=e[p],t(u,_,i[2*p],i[2*p+1],i[2*w],i[2*w+1])<0){b=this._addTriangle(p,a,w,h[a],-1,h[p]);h[a]=this._legalize(b+2);e[p]=p;x--;p=w}if(k===f)while(w=n[k],t(u,_,i[2*w],i[2*w+1],i[2*k],i[2*k+1])<0){b=this._addTriangle(w,a,k,-1,h[k],h[w]);this._legalize(b+2);h[w]=b;e[k]=k;x--;k=w}this._hullStart=n[a]=k;e[k]=n[p]=a;e[a]=p;l[this._hashKey(u,_)]=a;l[this._hashKey(i[2*k],i[2*k+1])]=k}this.hull=new Uint32Array(x);for(let t=0,s=this._hullStart;t0?3-i:1+i)/4}function dist(t,s,i,n){const e=t-i;const h=s-n;return e*e+h*h}function inCircle(t,s,i,n,e,h,l,r){const o=t-l;const c=s-r;const a=i-l;const u=n-r;const _=e-l;const f=h-r;const d=o*o+c*c;const y=a*a+u*u;const g=_*_+f*f;return o*(u*g-y*f)-c*(a*g-y*_)+d*(a*f-u*_)<0}function circumradius(t,s,i,n,e,h){const l=i-t;const r=n-s;const o=e-t;const c=h-s;const a=l*l+r*r;const u=o*o+c*c;const _=.5/(l*c-r*o);const f=(c*a-r*u)*_;const d=(l*u-o*a)*_;return f*f+d*d}function circumcenter(t,s,i,n,e,h){const l=i-t;const r=n-s;const o=e-t;const c=h-s;const a=l*l+r*r;const u=o*o+c*c;const _=.5/(l*c-r*o);const f=t+(c*a-r*u)*_;const d=s+(l*u-o*a)*_;return{x:f,y:d}}function quicksort(t,s,i,n){if(n-i<=20)for(let e=i+1;e<=n;e++){const n=t[e];const h=s[n];let l=e-1;while(l>=i&&s[t[l]]>h)t[l+1]=t[l--];t[l+1]=n}else{const e=i+n>>1;let h=i+1;let l=n;swap(t,e,h);s[t[i]]>s[t[n]]&&swap(t,i,n);s[t[h]]>s[t[n]]&&swap(t,h,n);s[t[i]]>s[t[h]]&&swap(t,i,h);const r=t[h];const o=s[r];while(true){do{h++}while(s[t[h]]o);if(l=l-i){quicksort(t,s,h,n);quicksort(t,s,i,l-1)}else{quicksort(t,s,i,l-1);quicksort(t,s,h,n)}}}function swap(t,s,i){const n=t[s];t[s]=t[i];t[i]=n}function defaultGetX(t){return t[0]}function defaultGetY(t){return t[1]}export{Delaunator as default}; + diff --git a/vendor/javascript/internmap.js b/vendor/javascript/internmap.js new file mode 100644 index 00000000..8f8ace93 --- /dev/null +++ b/vendor/javascript/internmap.js @@ -0,0 +1,2 @@ +class InternMap extends Map{constructor(e,t=keyof){super();Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}});if(null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(intern_get(this,e))}has(e){return super.has(intern_get(this,e))}set(e,t){return super.set(intern_set(this,e),t)}delete(e){return super.delete(intern_delete(this,e))}}class InternSet extends Set{constructor(e,t=keyof){super();Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}});if(null!=e)for(const t of e)this.add(t)}has(e){return super.has(intern_get(this,e))}add(e){return super.add(intern_set(this,e))}delete(e){return super.delete(intern_delete(this,e))}}function intern_get({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function intern_set({_intern:e,_key:t},n){const r=t(n);if(e.has(r))return e.get(r);e.set(r,n);return n}function intern_delete({_intern:e,_key:t},n){const r=t(n);if(e.has(r)){n=e.get(r);e.delete(r)}return n}function keyof(e){return null!==e&&"object"===typeof e?e.valueOf():e}export{InternMap,InternSet}; + diff --git a/vendor/javascript/robust-predicates.js b/vendor/javascript/robust-predicates.js new file mode 100644 index 00000000..d82a84a8 --- /dev/null +++ b/vendor/javascript/robust-predicates.js @@ -0,0 +1,2 @@ +const c=11102230246251565e-32;const s=134217729;const t=(3+8*c)*c;function sum(c,s,t,n,e){let o,a,l,i;let r=s[0];let f=n[0];let u=0;let d=0;if(f>r===f>-r){o=r;r=s[++u]}else{o=f;f=n[++d]}let v=0;if(ur===f>-r){a=r+o;l=o-(a-r);r=s[++u]}else{a=f+o;l=o-(a-f);f=n[++d]}o=a;0!==l&&(e[v++]=l);while(ur===f>-r){a=o+r;i=a-o;l=o-(a-i)+(r-i);r=s[++u]}else{a=o+f;i=a-o;l=o-(a-i)+(f-i);f=n[++d]}o=a;0!==l&&(e[v++]=l)}}while(u=K||-J>=K)return J;$=c-E;_=c-(E+$)+($-v);$=u-G;M=u-(G+$)+($-v);$=n-H;b=n-(H+$)+($-h);$=d-I;p=d-(I+$)+($-h);if(0===_&&0===b&&0===M&&0===p)return J;K=o*m+t*Math.abs(J);J+=E*p+I*_-(H*M+G*b);if(J>=K||-J>=K)return J;q=_*I;x=s*_;g=x-(x-_);w=_-g;x=s*I;y=x-(x-I);A=I-y;z=w*A-(q-g*y-w*y-g*A);B=b*G;x=s*b;g=x-(x-b);w=b-g;x=s*G;y=x-(x-G);A=G-y;C=w*A-(B-g*y-w*y-g*A);F=z-C;$=z-F;f[0]=z-(F+$)+($-C);j=q+F;$=j-q;k=q-(j-$)+(F-$);F=k-B;$=k-F;f[1]=k-(F+$)+($-B);D=j+F;$=D-j;f[2]=j-(D-$)+(F-$);f[3]=D;const L=sum(4,a,4,f,l);q=E*p;x=s*E;g=x-(x-E);w=E-g;x=s*p;y=x-(x-p);A=p-y;z=w*A-(q-g*y-w*y-g*A);B=H*M;x=s*H;g=x-(x-H);w=H-g;x=s*M;y=x-(x-M);A=M-y;C=w*A-(B-g*y-w*y-g*A);F=z-C;$=z-F;f[0]=z-(F+$)+($-C);j=q+F;$=j-q;k=q-(j-$)+(F-$);F=k-B;$=k-F;f[1]=k-(F+$)+($-B);D=j+F;$=D-j;f[2]=j-(D-$)+(F-$);f[3]=D;const N=sum(L,l,4,f,i);q=_*p;x=s*_;g=x-(x-_);w=_-g;x=s*p;y=x-(x-p);A=p-y;z=w*A-(q-g*y-w*y-g*A);B=b*M;x=s*b;g=x-(x-b);w=b-g;x=s*M;y=x-(x-M);A=M-y;C=w*A-(B-g*y-w*y-g*A);F=z-C;$=z-F;f[0]=z-(F+$)+($-C);j=q+F;$=j-q;k=q-(j-$)+(F-$);F=k-B;$=k-F;f[1]=k-(F+$)+($-B);D=j+F;$=D-j;f[2]=j-(D-$)+(F-$);f[3]=D;const O=sum(N,i,4,f,r);return r[O-1]}function orient2d(c,s,t,e,o,a){const l=(s-a)*(t-o);const i=(c-o)*(e-a);const r=l-i;const f=Math.abs(l+i);return Math.abs(r)>=n*f?r:-orient2dadapt(c,s,t,e,o,a,f)}function orient2dfast(c,s,t,n,e,o){return(s-o)*(t-e)-(c-e)*(n-o)}const u=(7+56*c)*c;const d=(3+28*c)*c;const v=(26+288*c)*c*c;const h=vec(4);const m=vec(4);const _=vec(4);const b=vec(4);const M=vec(4);const p=vec(4);const $=vec(4);const x=vec(4);const g=vec(4);const w=vec(8);const y=vec(8);const A=vec(8);const F=vec(4);const j=vec(8);const k=vec(8);const q=vec(8);const z=vec(12);let B=vec(192);let C=vec(192);function finadd$1(c,s,t){c=sum(c,B,s,t,C);const n=B;B=C;C=n;return c}function tailinit(c,t,n,e,o,a,l,i){let r,f,u,d,v,h,m,_,b,M,p,$,x,g,w;if(0===c){if(0===t){l[0]=0;i[0]=0;return 1}w=-t;M=w*n;f=s*w;u=f-(f-w);d=w-u;f=s*n;v=f-(f-n);h=n-v;l[0]=d*h-(M-u*v-d*v-u*h);l[1]=M;M=t*o;f=s*t;u=f-(f-t);d=t-u;f=s*o;v=f-(f-o);h=o-v;i[0]=d*h-(M-u*v-d*v-u*h);i[1]=M;return 2}if(0===t){M=c*e;f=s*c;u=f-(f-c);d=c-u;f=s*e;v=f-(f-e);h=e-v;l[0]=d*h-(M-u*v-d*v-u*h);l[1]=M;w=-c;M=w*a;f=s*w;u=f-(f-w);d=w-u;f=s*a;v=f-(f-a);h=a-v;i[0]=d*h-(M-u*v-d*v-u*h);i[1]=M;return 2}M=c*e;f=s*c;u=f-(f-c);d=c-u;f=s*e;v=f-(f-e);h=e-v;p=d*h-(M-u*v-d*v-u*h);$=t*n;f=s*t;u=f-(f-t);d=t-u;f=s*n;v=f-(f-n);h=n-v;x=d*h-($-u*v-d*v-u*h);m=p-x;r=p-m;l[0]=p-(m+r)+(r-x);_=M+m;r=_-M;b=M-(_-r)+(m-r);m=b-$;r=b-m;l[1]=b-(m+r)+(r-$);g=_+m;r=g-_;l[2]=_-(g-r)+(m-r);l[3]=g;M=t*o;f=s*t;u=f-(f-t);d=t-u;f=s*o;v=f-(f-o);h=o-v;p=d*h-(M-u*v-d*v-u*h);$=c*a;f=s*c;u=f-(f-c);d=c-u;f=s*a;v=f-(f-a);h=a-v;x=d*h-($-u*v-d*v-u*h);m=p-x;r=p-m;i[0]=p-(m+r)+(r-x);_=M+m;r=_-M;b=M-(_-r)+(m-r);m=b-$;r=b-m;i[1]=b-(m+r)+(r-$);g=_+m;r=g-_;i[2]=_-(g-r)+(m-r);i[3]=g;return 4}function tailadd(c,t,n,e,o){let a,l,i,r,f,u,d,v,h,m,_,b,M;_=t*n;l=s*t;i=l-(l-t);r=t-i;l=s*n;f=l-(l-n);u=n-f;b=r*u-(_-i*f-r*f-i*u);l=s*e;f=l-(l-e);u=e-f;d=b*e;l=s*b;i=l-(l-b);r=b-i;F[0]=r*u-(d-i*f-r*f-i*u);v=_*e;l=s*_;i=l-(l-_);r=_-i;m=r*u-(v-i*f-r*f-i*u);h=d+m;a=h-d;F[1]=d-(h-a)+(m-a);M=v+h;F[2]=h-(M-v);F[3]=M;c=finadd$1(c,4,F);if(0!==o){l=s*o;f=l-(l-o);u=o-f;d=b*o;l=s*b;i=l-(l-b);r=b-i;F[0]=r*u-(d-i*f-r*f-i*u);v=_*o;l=s*_;i=l-(l-_);r=_-i;m=r*u-(v-i*f-r*f-i*u);h=d+m;a=h-d;F[1]=d-(h-a)+(m-a);M=v+h;F[2]=h-(M-v);F[3]=M;c=finadd$1(c,4,F)}return c}function orient3dadapt(c,n,e,o,a,l,i,r,f,u,F,C,D){let E;let G,H,I;let J,K,L;let N,O,P;let Q,R,S,T,U,V,W,X,Y,Z,cc,sc,tc,nc;const ec=c-u;const oc=o-u;const ac=i-u;const lc=n-F;const ic=a-F;const rc=r-F;const fc=e-C;const uc=l-C;const dc=f-C;Z=oc*rc;R=s*oc;S=R-(R-oc);T=oc-S;R=s*rc;U=R-(R-rc);V=rc-U;cc=T*V-(Z-S*U-T*U-S*V);sc=ac*ic;R=s*ac;S=R-(R-ac);T=ac-S;R=s*ic;U=R-(R-ic);V=ic-U;tc=T*V-(sc-S*U-T*U-S*V);W=cc-tc;Q=cc-W;h[0]=cc-(W+Q)+(Q-tc);X=Z+W;Q=X-Z;Y=Z-(X-Q)+(W-Q);W=Y-sc;Q=Y-W;h[1]=Y-(W+Q)+(Q-sc);nc=X+W;Q=nc-X;h[2]=X-(nc-Q)+(W-Q);h[3]=nc;Z=ac*lc;R=s*ac;S=R-(R-ac);T=ac-S;R=s*lc;U=R-(R-lc);V=lc-U;cc=T*V-(Z-S*U-T*U-S*V);sc=ec*rc;R=s*ec;S=R-(R-ec);T=ec-S;R=s*rc;U=R-(R-rc);V=rc-U;tc=T*V-(sc-S*U-T*U-S*V);W=cc-tc;Q=cc-W;m[0]=cc-(W+Q)+(Q-tc);X=Z+W;Q=X-Z;Y=Z-(X-Q)+(W-Q);W=Y-sc;Q=Y-W;m[1]=Y-(W+Q)+(Q-sc);nc=X+W;Q=nc-X;m[2]=X-(nc-Q)+(W-Q);m[3]=nc;Z=ec*ic;R=s*ec;S=R-(R-ec);T=ec-S;R=s*ic;U=R-(R-ic);V=ic-U;cc=T*V-(Z-S*U-T*U-S*V);sc=oc*lc;R=s*oc;S=R-(R-oc);T=oc-S;R=s*lc;U=R-(R-lc);V=lc-U;tc=T*V-(sc-S*U-T*U-S*V);W=cc-tc;Q=cc-W;_[0]=cc-(W+Q)+(Q-tc);X=Z+W;Q=X-Z;Y=Z-(X-Q)+(W-Q);W=Y-sc;Q=Y-W;_[1]=Y-(W+Q)+(Q-sc);nc=X+W;Q=nc-X;_[2]=X-(nc-Q)+(W-Q);_[3]=nc;E=sum(sum(scale(4,h,fc,j),j,scale(4,m,uc,k),k,q),q,scale(4,_,dc,j),j,B);let vc=estimate(E,B);let hc=d*D;if(vc>=hc||-vc>=hc)return vc;Q=c-ec;G=c-(ec+Q)+(Q-u);Q=o-oc;H=o-(oc+Q)+(Q-u);Q=i-ac;I=i-(ac+Q)+(Q-u);Q=n-lc;J=n-(lc+Q)+(Q-F);Q=a-ic;K=a-(ic+Q)+(Q-F);Q=r-rc;L=r-(rc+Q)+(Q-F);Q=e-fc;N=e-(fc+Q)+(Q-C);Q=l-uc;O=l-(uc+Q)+(Q-C);Q=f-dc;P=f-(dc+Q)+(Q-C);if(0===G&&0===H&&0===I&&0===J&&0===K&&0===L&&0===N&&0===O&&0===P)return vc;hc=v*D+t*Math.abs(vc);vc+=fc*(oc*L+rc*H-(ic*I+ac*K))+N*(oc*rc-ic*ac)+uc*(ac*J+lc*I-(rc*G+ec*L))+O*(ac*lc-rc*ec)+dc*(ec*K+ic*G-(lc*H+oc*J))+P*(ec*ic-lc*oc);if(vc>=hc||-vc>=hc)return vc;const mc=tailinit(G,J,oc,ic,ac,rc,b,M);const _c=tailinit(H,K,ac,rc,ec,lc,p,$);const bc=tailinit(I,L,ec,lc,oc,ic,x,g);const Mc=sum(_c,p,bc,g,w);E=finadd$1(E,scale(Mc,w,fc,q),q);const pc=sum(bc,x,mc,M,y);E=finadd$1(E,scale(pc,y,uc,q),q);const $c=sum(mc,b,_c,$,A);E=finadd$1(E,scale($c,A,dc,q),q);if(0!==N){E=finadd$1(E,scale(4,h,N,z),z);E=finadd$1(E,scale(Mc,w,N,q),q)}if(0!==O){E=finadd$1(E,scale(4,m,O,z),z);E=finadd$1(E,scale(pc,y,O,q),q)}if(0!==P){E=finadd$1(E,scale(4,_,P,z),z);E=finadd$1(E,scale($c,A,P,q),q)}if(0!==G){0!==K&&(E=tailadd(E,G,K,dc,P));0!==L&&(E=tailadd(E,-G,L,uc,O))}if(0!==H){0!==L&&(E=tailadd(E,H,L,fc,N));0!==J&&(E=tailadd(E,-H,J,dc,P))}if(0!==I){0!==J&&(E=tailadd(E,I,J,uc,O));0!==K&&(E=tailadd(E,-I,K,fc,N))}return B[E-1]}function orient3d(c,s,t,n,e,o,a,l,i,r,f,d){const v=c-r;const h=n-r;const m=a-r;const _=s-f;const b=e-f;const M=l-f;const p=t-d;const $=o-d;const x=i-d;const g=h*M;const w=m*b;const y=m*_;const A=v*M;const F=v*b;const j=h*_;const k=p*(g-w)+$*(y-A)+x*(F-j);const q=(Math.abs(g)+Math.abs(w))*Math.abs(p)+(Math.abs(y)+Math.abs(A))*Math.abs($)+(Math.abs(F)+Math.abs(j))*Math.abs(x);const z=u*q;return k>z||-k>z?k:orient3dadapt(c,s,t,n,e,o,a,l,i,r,f,d,q)}function orient3dfast(c,s,t,n,e,o,a,l,i,r,f,u){const d=c-r;const v=n-r;const h=a-r;const m=s-f;const _=e-f;const b=l-f;const M=t-u;const p=o-u;const $=i-u;return d*(_*$-p*b)+v*(b*M-$*m)+h*(m*p-M*_)}const D=(10+96*c)*c;const E=(4+48*c)*c;const G=(44+576*c)*c*c;const H=vec(4);const I=vec(4);const J=vec(4);const K=vec(4);const L=vec(4);const N=vec(4);const O=vec(4);const P=vec(4);const Q=vec(8);const R=vec(8);const S=vec(8);const T=vec(8);const U=vec(8);const V=vec(8);const W=vec(8);const X=vec(8);const Y=vec(8);const Z=vec(4);const cc=vec(4);const sc=vec(4);const tc=vec(8);const nc=vec(16);const ec=vec(16);const oc=vec(16);const ac=vec(32);const lc=vec(32);const ic=vec(48);const rc=vec(64);let fc=vec(1152);let uc=vec(1152);function finadd(c,s,t){c=sum(c,fc,s,t,uc);const n=fc;fc=uc;uc=n;return c}function incircleadapt(c,n,e,o,a,l,i,r,f){let u;let d,v,h,m,_,b;let M,p,$,x,g,w;let y,A,F;let j,k,q;let z,B;let C,D,uc,dc,vc,hc,mc,_c,bc,Mc,pc,$c,xc,gc;const wc=c-i;const yc=e-i;const Ac=a-i;const Fc=n-r;const jc=o-r;const kc=l-r;Mc=yc*kc;D=s*yc;uc=D-(D-yc);dc=yc-uc;D=s*kc;vc=D-(D-kc);hc=kc-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=Ac*jc;D=s*Ac;uc=D-(D-Ac);dc=Ac-uc;D=s*jc;vc=D-(D-jc);hc=jc-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc-xc;C=pc-mc;H[0]=pc-(mc+C)+(C-xc);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc-$c;C=bc-mc;H[1]=bc-(mc+C)+(C-$c);gc=_c+mc;C=gc-_c;H[2]=_c-(gc-C)+(mc-C);H[3]=gc;Mc=Ac*Fc;D=s*Ac;uc=D-(D-Ac);dc=Ac-uc;D=s*Fc;vc=D-(D-Fc);hc=Fc-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=wc*kc;D=s*wc;uc=D-(D-wc);dc=wc-uc;D=s*kc;vc=D-(D-kc);hc=kc-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc-xc;C=pc-mc;I[0]=pc-(mc+C)+(C-xc);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc-$c;C=bc-mc;I[1]=bc-(mc+C)+(C-$c);gc=_c+mc;C=gc-_c;I[2]=_c-(gc-C)+(mc-C);I[3]=gc;Mc=wc*jc;D=s*wc;uc=D-(D-wc);dc=wc-uc;D=s*jc;vc=D-(D-jc);hc=jc-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=yc*Fc;D=s*yc;uc=D-(D-yc);dc=yc-uc;D=s*Fc;vc=D-(D-Fc);hc=Fc-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc-xc;C=pc-mc;J[0]=pc-(mc+C)+(C-xc);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc-$c;C=bc-mc;J[1]=bc-(mc+C)+(C-$c);gc=_c+mc;C=gc-_c;J[2]=_c-(gc-C)+(mc-C);J[3]=gc;u=sum(sum(sum(scale(scale(4,H,wc,tc),tc,wc,nc),nc,scale(scale(4,H,Fc,tc),tc,Fc,ec),ec,ac),ac,sum(scale(scale(4,I,yc,tc),tc,yc,nc),nc,scale(scale(4,I,jc,tc),tc,jc,ec),ec,lc),lc,rc),rc,sum(scale(scale(4,J,Ac,tc),tc,Ac,nc),nc,scale(scale(4,J,kc,tc),tc,kc,ec),ec,ac),ac,fc);let qc=estimate(u,fc);let zc=E*f;if(qc>=zc||-qc>=zc)return qc;C=c-wc;d=c-(wc+C)+(C-i);C=n-Fc;m=n-(Fc+C)+(C-r);C=e-yc;v=e-(yc+C)+(C-i);C=o-jc;_=o-(jc+C)+(C-r);C=a-Ac;h=a-(Ac+C)+(C-i);C=l-kc;b=l-(kc+C)+(C-r);if(0===d&&0===v&&0===h&&0===m&&0===_&&0===b)return qc;zc=G*f+t*Math.abs(qc);qc+=(wc*wc+Fc*Fc)*(yc*b+kc*v-(jc*h+Ac*_))+2*(wc*d+Fc*m)*(yc*kc-jc*Ac)+((yc*yc+jc*jc)*(Ac*m+Fc*h-(kc*d+wc*b))+2*(yc*v+jc*_)*(Ac*Fc-kc*wc))+((Ac*Ac+kc*kc)*(wc*_+jc*d-(Fc*v+yc*m))+2*(Ac*h+kc*b)*(wc*jc-Fc*yc));if(qc>=zc||-qc>=zc)return qc;if(0!==v||0!==_||0!==h||0!==b){Mc=wc*wc;D=s*wc;uc=D-(D-wc);dc=wc-uc;pc=dc*dc-(Mc-uc*uc-(uc+uc)*dc);$c=Fc*Fc;D=s*Fc;uc=D-(D-Fc);dc=Fc-uc;xc=dc*dc-($c-uc*uc-(uc+uc)*dc);mc=pc+xc;C=mc-pc;K[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;K[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;K[2]=_c-(gc-C)+(mc-C);K[3]=gc}if(0!==h||0!==b||0!==d||0!==m){Mc=yc*yc;D=s*yc;uc=D-(D-yc);dc=yc-uc;pc=dc*dc-(Mc-uc*uc-(uc+uc)*dc);$c=jc*jc;D=s*jc;uc=D-(D-jc);dc=jc-uc;xc=dc*dc-($c-uc*uc-(uc+uc)*dc);mc=pc+xc;C=mc-pc;L[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;L[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;L[2]=_c-(gc-C)+(mc-C);L[3]=gc}if(0!==d||0!==m||0!==v||0!==_){Mc=Ac*Ac;D=s*Ac;uc=D-(D-Ac);dc=Ac-uc;pc=dc*dc-(Mc-uc*uc-(uc+uc)*dc);$c=kc*kc;D=s*kc;uc=D-(D-kc);dc=kc-uc;xc=dc*dc-($c-uc*uc-(uc+uc)*dc);mc=pc+xc;C=mc-pc;N[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;N[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;N[2]=_c-(gc-C)+(mc-C);N[3]=gc}if(0!==d){M=scale(4,H,d,Q);u=finadd(u,sum_three(scale(M,Q,2*wc,nc),nc,scale(scale(4,N,d,tc),tc,jc,ec),ec,scale(scale(4,L,d,tc),tc,-kc,oc),oc,ac,ic),ic)}if(0!==m){p=scale(4,H,m,R);u=finadd(u,sum_three(scale(p,R,2*Fc,nc),nc,scale(scale(4,L,m,tc),tc,Ac,ec),ec,scale(scale(4,N,m,tc),tc,-yc,oc),oc,ac,ic),ic)}if(0!==v){$=scale(4,I,v,S);u=finadd(u,sum_three(scale($,S,2*yc,nc),nc,scale(scale(4,K,v,tc),tc,kc,ec),ec,scale(scale(4,N,v,tc),tc,-Fc,oc),oc,ac,ic),ic)}if(0!==_){x=scale(4,I,_,T);u=finadd(u,sum_three(scale(x,T,2*jc,nc),nc,scale(scale(4,N,_,tc),tc,wc,ec),ec,scale(scale(4,K,_,tc),tc,-Ac,oc),oc,ac,ic),ic)}if(0!==h){g=scale(4,J,h,U);u=finadd(u,sum_three(scale(g,U,2*Ac,nc),nc,scale(scale(4,L,h,tc),tc,Fc,ec),ec,scale(scale(4,K,h,tc),tc,-jc,oc),oc,ac,ic),ic)}if(0!==b){w=scale(4,J,b,V);u=finadd(u,sum_three(scale(w,V,2*kc,nc),nc,scale(scale(4,K,b,tc),tc,yc,ec),ec,scale(scale(4,L,b,tc),tc,-wc,oc),oc,ac,ic),ic)}if(0!==d||0!==m){if(0!==v||0!==_||0!==h||0!==b){Mc=v*kc;D=s*v;uc=D-(D-v);dc=v-uc;D=s*kc;vc=D-(D-kc);hc=kc-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=yc*b;D=s*yc;uc=D-(D-yc);dc=yc-uc;D=s*b;vc=D-(D-b);hc=b-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc+xc;C=mc-pc;O[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;O[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;O[2]=_c-(gc-C)+(mc-C);O[3]=gc;Mc=h*-jc;D=s*h;uc=D-(D-h);dc=h-uc;D=s*-jc;vc=D-(D- -jc);hc=-jc-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=Ac*-_;D=s*Ac;uc=D-(D-Ac);dc=Ac-uc;D=s*-_;vc=D-(D- -_);hc=-_-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc+xc;C=mc-pc;P[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;P[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;P[2]=_c-(gc-C)+(mc-C);P[3]=gc;A=sum(4,O,4,P,X);Mc=v*b;D=s*v;uc=D-(D-v);dc=v-uc;D=s*b;vc=D-(D-b);hc=b-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=h*_;D=s*h;uc=D-(D-h);dc=h-uc;D=s*_;vc=D-(D-_);hc=_-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc-xc;C=pc-mc;cc[0]=pc-(mc+C)+(C-xc);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc-$c;C=bc-mc;cc[1]=bc-(mc+C)+(C-$c);gc=_c+mc;C=gc-_c;cc[2]=_c-(gc-C)+(mc-C);cc[3]=gc;k=4}else{X[0]=0;A=1;cc[0]=0;k=1}if(0!==d){const c=scale(A,X,d,oc);u=finadd(u,sum(scale(M,Q,d,nc),nc,scale(c,oc,2*wc,ac),ac,ic),ic);const s=scale(k,cc,d,tc);u=finadd(u,sum_three(scale(s,tc,2*wc,nc),nc,scale(s,tc,d,ec),ec,scale(c,oc,d,ac),ac,lc,rc),rc);0!==_&&(u=finadd(u,scale(scale(4,N,d,tc),tc,_,nc),nc));0!==b&&(u=finadd(u,scale(scale(4,L,-d,tc),tc,b,nc),nc))}if(0!==m){const c=scale(A,X,m,oc);u=finadd(u,sum(scale(p,R,m,nc),nc,scale(c,oc,2*Fc,ac),ac,ic),ic);const s=scale(k,cc,m,tc);u=finadd(u,sum_three(scale(s,tc,2*Fc,nc),nc,scale(s,tc,m,ec),ec,scale(c,oc,m,ac),ac,lc,rc),rc)}}if(0!==v||0!==_){if(0!==h||0!==b||0!==d||0!==m){Mc=h*Fc;D=s*h;uc=D-(D-h);dc=h-uc;D=s*Fc;vc=D-(D-Fc);hc=Fc-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=Ac*m;D=s*Ac;uc=D-(D-Ac);dc=Ac-uc;D=s*m;vc=D-(D-m);hc=m-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc+xc;C=mc-pc;O[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;O[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;O[2]=_c-(gc-C)+(mc-C);O[3]=gc;z=-kc;B=-b;Mc=d*z;D=s*d;uc=D-(D-d);dc=d-uc;D=s*z;vc=D-(D-z);hc=z-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=wc*B;D=s*wc;uc=D-(D-wc);dc=wc-uc;D=s*B;vc=D-(D-B);hc=B-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc+xc;C=mc-pc;P[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;P[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;P[2]=_c-(gc-C)+(mc-C);P[3]=gc;F=sum(4,O,4,P,Y);Mc=h*m;D=s*h;uc=D-(D-h);dc=h-uc;D=s*m;vc=D-(D-m);hc=m-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=d*b;D=s*d;uc=D-(D-d);dc=d-uc;D=s*b;vc=D-(D-b);hc=b-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc-xc;C=pc-mc;sc[0]=pc-(mc+C)+(C-xc);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc-$c;C=bc-mc;sc[1]=bc-(mc+C)+(C-$c);gc=_c+mc;C=gc-_c;sc[2]=_c-(gc-C)+(mc-C);sc[3]=gc;q=4}else{Y[0]=0;F=1;sc[0]=0;q=1}if(0!==v){const c=scale(F,Y,v,oc);u=finadd(u,sum(scale($,S,v,nc),nc,scale(c,oc,2*yc,ac),ac,ic),ic);const s=scale(q,sc,v,tc);u=finadd(u,sum_three(scale(s,tc,2*yc,nc),nc,scale(s,tc,v,ec),ec,scale(c,oc,v,ac),ac,lc,rc),rc);0!==b&&(u=finadd(u,scale(scale(4,K,v,tc),tc,b,nc),nc));0!==m&&(u=finadd(u,scale(scale(4,N,-v,tc),tc,m,nc),nc))}if(0!==_){const c=scale(F,Y,_,oc);u=finadd(u,sum(scale(x,T,_,nc),nc,scale(c,oc,2*jc,ac),ac,ic),ic);const s=scale(q,sc,_,tc);u=finadd(u,sum_three(scale(s,tc,2*jc,nc),nc,scale(s,tc,_,ec),ec,scale(c,oc,_,ac),ac,lc,rc),rc)}}if(0!==h||0!==b){if(0!==d||0!==m||0!==v||0!==_){Mc=d*jc;D=s*d;uc=D-(D-d);dc=d-uc;D=s*jc;vc=D-(D-jc);hc=jc-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=wc*_;D=s*wc;uc=D-(D-wc);dc=wc-uc;D=s*_;vc=D-(D-_);hc=_-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc+xc;C=mc-pc;O[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;O[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;O[2]=_c-(gc-C)+(mc-C);O[3]=gc;z=-Fc;B=-m;Mc=v*z;D=s*v;uc=D-(D-v);dc=v-uc;D=s*z;vc=D-(D-z);hc=z-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=yc*B;D=s*yc;uc=D-(D-yc);dc=yc-uc;D=s*B;vc=D-(D-B);hc=B-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc+xc;C=mc-pc;P[0]=pc-(mc-C)+(xc-C);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc+$c;C=mc-bc;P[1]=bc-(mc-C)+($c-C);gc=_c+mc;C=gc-_c;P[2]=_c-(gc-C)+(mc-C);P[3]=gc;y=sum(4,O,4,P,W);Mc=d*_;D=s*d;uc=D-(D-d);dc=d-uc;D=s*_;vc=D-(D-_);hc=_-vc;pc=dc*hc-(Mc-uc*vc-dc*vc-uc*hc);$c=v*m;D=s*v;uc=D-(D-v);dc=v-uc;D=s*m;vc=D-(D-m);hc=m-vc;xc=dc*hc-($c-uc*vc-dc*vc-uc*hc);mc=pc-xc;C=pc-mc;Z[0]=pc-(mc+C)+(C-xc);_c=Mc+mc;C=_c-Mc;bc=Mc-(_c-C)+(mc-C);mc=bc-$c;C=bc-mc;Z[1]=bc-(mc+C)+(C-$c);gc=_c+mc;C=gc-_c;Z[2]=_c-(gc-C)+(mc-C);Z[3]=gc;j=4}else{W[0]=0;y=1;Z[0]=0;j=1}if(0!==h){const c=scale(y,W,h,oc);u=finadd(u,sum(scale(g,U,h,nc),nc,scale(c,oc,2*Ac,ac),ac,ic),ic);const s=scale(j,Z,h,tc);u=finadd(u,sum_three(scale(s,tc,2*Ac,nc),nc,scale(s,tc,h,ec),ec,scale(c,oc,h,ac),ac,lc,rc),rc);0!==m&&(u=finadd(u,scale(scale(4,L,h,tc),tc,m,nc),nc));0!==_&&(u=finadd(u,scale(scale(4,K,-h,tc),tc,_,nc),nc))}if(0!==b){const c=scale(y,W,b,oc);u=finadd(u,sum(scale(w,V,b,nc),nc,scale(c,oc,2*kc,ac),ac,ic),ic);const s=scale(j,Z,b,tc);u=finadd(u,sum_three(scale(s,tc,2*kc,nc),nc,scale(s,tc,b,ec),ec,scale(c,oc,b,ac),ac,lc,rc),rc)}}return fc[u-1]}function incircle(c,s,t,n,e,o,a,l){const i=c-a;const r=t-a;const f=e-a;const u=s-l;const d=n-l;const v=o-l;const h=r*v;const m=f*d;const _=i*i+u*u;const b=f*u;const M=i*v;const p=r*r+d*d;const $=i*d;const x=r*u;const g=f*f+v*v;const w=_*(h-m)+p*(b-M)+g*($-x);const y=(Math.abs(h)+Math.abs(m))*_+(Math.abs(b)+Math.abs(M))*p+(Math.abs($)+Math.abs(x))*g;const A=D*y;return w>A||-w>A?w:incircleadapt(c,s,t,n,e,o,a,l,y)}function incirclefast(c,s,t,n,e,o,a,l){const i=c-a;const r=s-l;const f=t-a;const u=n-l;const d=e-a;const v=o-l;const h=i*u-f*r;const m=f*v-d*u;const _=d*r-i*v;const b=i*i+r*r;const M=f*f+u*u;const p=d*d+v*v;return b*m+M*_+p*h}const dc=(16+224*c)*c;const vc=(5+72*c)*c;const hc=(71+1408*c)*c*c;const mc=vec(4);const _c=vec(4);const bc=vec(4);const Mc=vec(4);const pc=vec(4);const $c=vec(4);const xc=vec(4);const gc=vec(4);const wc=vec(4);const yc=vec(4);const Ac=vec(24);const Fc=vec(24);const jc=vec(24);const kc=vec(24);const qc=vec(24);const zc=vec(24);const Bc=vec(24);const Cc=vec(24);const Dc=vec(24);const Ec=vec(24);const Gc=vec(1152);const Hc=vec(1152);const Ic=vec(1152);const Jc=vec(1152);const Kc=vec(1152);const Lc=vec(2304);const Nc=vec(2304);const Oc=vec(3456);const Pc=vec(5760);const Qc=vec(8);const Rc=vec(8);const Sc=vec(8);const Tc=vec(16);const Uc=vec(24);const Vc=vec(48);const Wc=vec(48);const Xc=vec(96);const Yc=vec(192);const Zc=vec(384);const cs=vec(384);const ss=vec(384);const ts=vec(768);function sum_three_scale(c,s,t,n,e,o,a){return sum_three(scale(4,c,n,Qc),Qc,scale(4,s,e,Rc),Rc,scale(4,t,o,Sc),Sc,Tc,a)}function liftexact(c,s,t,n,e,o,a,l,i,r,f,u){const d=sum(sum(c,s,t,n,Vc),Vc,negate(sum(e,o,a,l,Wc),Wc),Wc,Xc);return sum_three(scale(scale(d,Xc,i,Yc),Yc,i,Zc),Zc,scale(scale(d,Xc,r,Yc),Yc,r,cs),cs,scale(scale(d,Xc,f,Yc),Yc,f,ss),ss,ts,u)}function insphereexact(c,t,n,e,o,a,l,i,r,f,u,d,v,h,m){let _,b,M,p,$,x,g,w,y,A,F,j,k,q;A=c*o;b=s*c;M=b-(b-c);p=c-M;b=s*o;$=b-(b-o);x=o-$;F=p*x-(A-M*$-p*$-M*x);j=e*t;b=s*e;M=b-(b-e);p=e-M;b=s*t;$=b-(b-t);x=t-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;mc[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;mc[1]=y-(g+_)+(_-j);q=w+g;_=q-w;mc[2]=w-(q-_)+(g-_);mc[3]=q;A=e*i;b=s*e;M=b-(b-e);p=e-M;b=s*i;$=b-(b-i);x=i-$;F=p*x-(A-M*$-p*$-M*x);j=l*o;b=s*l;M=b-(b-l);p=l-M;b=s*o;$=b-(b-o);x=o-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;_c[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;_c[1]=y-(g+_)+(_-j);q=w+g;_=q-w;_c[2]=w-(q-_)+(g-_);_c[3]=q;A=l*u;b=s*l;M=b-(b-l);p=l-M;b=s*u;$=b-(b-u);x=u-$;F=p*x-(A-M*$-p*$-M*x);j=f*i;b=s*f;M=b-(b-f);p=f-M;b=s*i;$=b-(b-i);x=i-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;bc[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;bc[1]=y-(g+_)+(_-j);q=w+g;_=q-w;bc[2]=w-(q-_)+(g-_);bc[3]=q;A=f*h;b=s*f;M=b-(b-f);p=f-M;b=s*h;$=b-(b-h);x=h-$;F=p*x-(A-M*$-p*$-M*x);j=v*u;b=s*v;M=b-(b-v);p=v-M;b=s*u;$=b-(b-u);x=u-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;Mc[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;Mc[1]=y-(g+_)+(_-j);q=w+g;_=q-w;Mc[2]=w-(q-_)+(g-_);Mc[3]=q;A=v*t;b=s*v;M=b-(b-v);p=v-M;b=s*t;$=b-(b-t);x=t-$;F=p*x-(A-M*$-p*$-M*x);j=c*h;b=s*c;M=b-(b-c);p=c-M;b=s*h;$=b-(b-h);x=h-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;pc[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;pc[1]=y-(g+_)+(_-j);q=w+g;_=q-w;pc[2]=w-(q-_)+(g-_);pc[3]=q;A=c*i;b=s*c;M=b-(b-c);p=c-M;b=s*i;$=b-(b-i);x=i-$;F=p*x-(A-M*$-p*$-M*x);j=l*t;b=s*l;M=b-(b-l);p=l-M;b=s*t;$=b-(b-t);x=t-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;$c[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;$c[1]=y-(g+_)+(_-j);q=w+g;_=q-w;$c[2]=w-(q-_)+(g-_);$c[3]=q;A=e*u;b=s*e;M=b-(b-e);p=e-M;b=s*u;$=b-(b-u);x=u-$;F=p*x-(A-M*$-p*$-M*x);j=f*o;b=s*f;M=b-(b-f);p=f-M;b=s*o;$=b-(b-o);x=o-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;xc[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;xc[1]=y-(g+_)+(_-j);q=w+g;_=q-w;xc[2]=w-(q-_)+(g-_);xc[3]=q;A=l*h;b=s*l;M=b-(b-l);p=l-M;b=s*h;$=b-(b-h);x=h-$;F=p*x-(A-M*$-p*$-M*x);j=v*i;b=s*v;M=b-(b-v);p=v-M;b=s*i;$=b-(b-i);x=i-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;gc[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;gc[1]=y-(g+_)+(_-j);q=w+g;_=q-w;gc[2]=w-(q-_)+(g-_);gc[3]=q;A=f*t;b=s*f;M=b-(b-f);p=f-M;b=s*t;$=b-(b-t);x=t-$;F=p*x-(A-M*$-p*$-M*x);j=c*u;b=s*c;M=b-(b-c);p=c-M;b=s*u;$=b-(b-u);x=u-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;wc[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;wc[1]=y-(g+_)+(_-j);q=w+g;_=q-w;wc[2]=w-(q-_)+(g-_);wc[3]=q;A=v*o;b=s*v;M=b-(b-v);p=v-M;b=s*o;$=b-(b-o);x=o-$;F=p*x-(A-M*$-p*$-M*x);j=e*h;b=s*e;M=b-(b-e);p=e-M;b=s*h;$=b-(b-h);x=h-$;k=p*x-(j-M*$-p*$-M*x);g=F-k;_=F-g;yc[0]=F-(g+_)+(_-k);w=A+g;_=w-A;y=A-(w-_)+(g-_);g=y-j;_=y-g;yc[1]=y-(g+_)+(_-j);q=w+g;_=q-w;yc[2]=w-(q-_)+(g-_);yc[3]=q;const z=sum_three_scale(mc,_c,$c,r,n,-a,Ac);const B=sum_three_scale(_c,bc,xc,d,a,-r,Fc);const C=sum_three_scale(bc,Mc,gc,m,r,-d,jc);const D=sum_three_scale(Mc,pc,wc,n,d,-m,kc);const E=sum_three_scale(pc,mc,yc,a,m,-n,qc);const G=sum_three_scale(mc,xc,wc,d,n,a,zc);const H=sum_three_scale(_c,gc,yc,m,a,r,Bc);const I=sum_three_scale(bc,wc,$c,n,r,d,Cc);const J=sum_three_scale(Mc,yc,xc,a,d,m,Dc);const K=sum_three_scale(pc,$c,gc,r,m,n,Ec);const L=sum_three(liftexact(C,jc,H,Bc,J,Dc,B,Fc,c,t,n,Gc),Gc,liftexact(D,kc,I,Cc,K,Ec,C,jc,e,o,a,Hc),Hc,sum_three(liftexact(E,qc,J,Dc,G,zc,D,kc,l,i,r,Ic),Ic,liftexact(z,Ac,K,Ec,H,Bc,E,qc,f,u,d,Jc),Jc,liftexact(B,Fc,G,zc,I,Cc,z,Ac,v,h,m,Kc),Kc,Nc,Oc),Oc,Lc,Pc);return Pc[L-1]}const ns=vec(96);const es=vec(96);const os=vec(96);const as=vec(1152);function liftadapt(c,s,t,n,e,o,a,l,i,r){const f=sum_three_scale(c,s,t,n,e,o,Uc);return sum_three(scale(scale(f,Uc,a,Vc),Vc,a,ns),ns,scale(scale(f,Uc,l,Vc),Vc,l,es),es,scale(scale(f,Uc,i,Vc),Vc,i,os),os,Yc,r)}function insphereadapt(c,n,e,o,a,l,i,r,f,u,d,v,h,m,_,b){let M,p,$,x,g,w;let y,A,F,j;let k,q,z,B;let C,D,E,G;let H,I,J,K,L,N,O,P,Q,R,S,T,U;const V=c-h;const W=o-h;const X=i-h;const Y=u-h;const Z=n-m;const cc=a-m;const sc=r-m;const tc=d-m;const nc=e-_;const ec=l-_;const oc=f-_;const ac=v-_;R=V*cc;I=s*V;J=I-(I-V);K=V-J;I=s*cc;L=I-(I-cc);N=cc-L;S=K*N-(R-J*L-K*L-J*N);T=W*Z;I=s*W;J=I-(I-W);K=W-J;I=s*Z;L=I-(I-Z);N=Z-L;U=K*N-(T-J*L-K*L-J*N);O=S-U;H=S-O;mc[0]=S-(O+H)+(H-U);P=R+O;H=P-R;Q=R-(P-H)+(O-H);O=Q-T;H=Q-O;mc[1]=Q-(O+H)+(H-T);M=P+O;H=M-P;mc[2]=P-(M-H)+(O-H);mc[3]=M;R=W*sc;I=s*W;J=I-(I-W);K=W-J;I=s*sc;L=I-(I-sc);N=sc-L;S=K*N-(R-J*L-K*L-J*N);T=X*cc;I=s*X;J=I-(I-X);K=X-J;I=s*cc;L=I-(I-cc);N=cc-L;U=K*N-(T-J*L-K*L-J*N);O=S-U;H=S-O;_c[0]=S-(O+H)+(H-U);P=R+O;H=P-R;Q=R-(P-H)+(O-H);O=Q-T;H=Q-O;_c[1]=Q-(O+H)+(H-T);p=P+O;H=p-P;_c[2]=P-(p-H)+(O-H);_c[3]=p;R=X*tc;I=s*X;J=I-(I-X);K=X-J;I=s*tc;L=I-(I-tc);N=tc-L;S=K*N-(R-J*L-K*L-J*N);T=Y*sc;I=s*Y;J=I-(I-Y);K=Y-J;I=s*sc;L=I-(I-sc);N=sc-L;U=K*N-(T-J*L-K*L-J*N);O=S-U;H=S-O;bc[0]=S-(O+H)+(H-U);P=R+O;H=P-R;Q=R-(P-H)+(O-H);O=Q-T;H=Q-O;bc[1]=Q-(O+H)+(H-T);$=P+O;H=$-P;bc[2]=P-($-H)+(O-H);bc[3]=$;R=Y*Z;I=s*Y;J=I-(I-Y);K=Y-J;I=s*Z;L=I-(I-Z);N=Z-L;S=K*N-(R-J*L-K*L-J*N);T=V*tc;I=s*V;J=I-(I-V);K=V-J;I=s*tc;L=I-(I-tc);N=tc-L;U=K*N-(T-J*L-K*L-J*N);O=S-U;H=S-O;wc[0]=S-(O+H)+(H-U);P=R+O;H=P-R;Q=R-(P-H)+(O-H);O=Q-T;H=Q-O;wc[1]=Q-(O+H)+(H-T);x=P+O;H=x-P;wc[2]=P-(x-H)+(O-H);wc[3]=x;R=V*sc;I=s*V;J=I-(I-V);K=V-J;I=s*sc;L=I-(I-sc);N=sc-L;S=K*N-(R-J*L-K*L-J*N);T=X*Z;I=s*X;J=I-(I-X);K=X-J;I=s*Z;L=I-(I-Z);N=Z-L;U=K*N-(T-J*L-K*L-J*N);O=S-U;H=S-O;$c[0]=S-(O+H)+(H-U);P=R+O;H=P-R;Q=R-(P-H)+(O-H);O=Q-T;H=Q-O;$c[1]=Q-(O+H)+(H-T);g=P+O;H=g-P;$c[2]=P-(g-H)+(O-H);$c[3]=g;R=W*tc;I=s*W;J=I-(I-W);K=W-J;I=s*tc;L=I-(I-tc);N=tc-L;S=K*N-(R-J*L-K*L-J*N);T=Y*cc;I=s*Y;J=I-(I-Y);K=Y-J;I=s*cc;L=I-(I-cc);N=cc-L;U=K*N-(T-J*L-K*L-J*N);O=S-U;H=S-O;xc[0]=S-(O+H)+(H-U);P=R+O;H=P-R;Q=R-(P-H)+(O-H);O=Q-T;H=Q-O;xc[1]=Q-(O+H)+(H-T);w=P+O;H=w-P;xc[2]=P-(w-H)+(O-H);xc[3]=w;const lc=sum(sum(negate(liftadapt(_c,bc,xc,ac,ec,-oc,V,Z,nc,Gc),Gc),Gc,liftadapt(bc,wc,$c,nc,oc,ac,W,cc,ec,Hc),Hc,Lc),Lc,sum(negate(liftadapt(wc,mc,xc,ec,ac,nc,X,sc,oc,Ic),Ic),Ic,liftadapt(mc,_c,$c,oc,nc,-ec,Y,tc,ac,Jc),Jc,Nc),Nc,as);let ic=estimate(lc,as);let rc=vc*b;if(ic>=rc||-ic>=rc)return ic;H=c-V;y=c-(V+H)+(H-h);H=n-Z;k=n-(Z+H)+(H-m);H=e-nc;C=e-(nc+H)+(H-_);H=o-W;A=o-(W+H)+(H-h);H=a-cc;q=a-(cc+H)+(H-m);H=l-ec;D=l-(ec+H)+(H-_);H=i-X;F=i-(X+H)+(H-h);H=r-sc;z=r-(sc+H)+(H-m);H=f-oc;E=f-(oc+H)+(H-_);H=u-Y;j=u-(Y+H)+(H-h);H=d-tc;B=d-(tc+H)+(H-m);H=v-ac;G=v-(ac+H)+(H-_);if(0===y&&0===k&&0===C&&0===A&&0===q&&0===D&&0===F&&0===z&&0===E&&0===j&&0===B&&0===G)return ic;rc=hc*b+t*Math.abs(ic);const fc=V*q+cc*y-(Z*A+W*k);const uc=W*z+sc*A-(cc*F+X*q);const dc=X*B+tc*F-(sc*j+Y*z);const Mc=Y*k+Z*j-(tc*y+V*B);const pc=V*z+sc*y-(Z*F+X*k);const gc=W*B+tc*A-(cc*j+Y*q);ic+=(W*W+cc*cc+ec*ec)*(oc*Mc+ac*pc+nc*dc+(E*x+G*g+C*$))+(Y*Y+tc*tc+ac*ac)*(nc*uc-ec*pc+oc*fc+(C*p-D*g+E*M))-((V*V+Z*Z+nc*nc)*(ec*dc-oc*gc+ac*uc+(D*$-E*w+G*p))+(X*X+sc*sc+oc*oc)*(ac*fc+nc*gc+ec*Mc+(G*M+C*w+D*x)))+2*((W*A+cc*q+ec*D)*(oc*x+ac*g+nc*$)+(Y*j+tc*B+ac*G)*(nc*p-ec*g+oc*M)-((V*y+Z*k+nc*C)*(ec*$-oc*w+ac*p)+(X*F+sc*z+oc*E)*(ac*M+nc*w+ec*x)));return ic>=rc||-ic>=rc?ic:insphereexact(c,n,e,o,a,l,i,r,f,u,d,v,h,m,_)}function insphere(c,s,t,n,e,o,a,l,i,r,f,u,d,v,h){const m=c-d;const _=n-d;const b=a-d;const M=r-d;const p=s-v;const $=e-v;const x=l-v;const g=f-v;const w=t-h;const y=o-h;const A=i-h;const F=u-h;const j=m*$;const k=_*p;const q=j-k;const z=_*x;const B=b*$;const C=z-B;const D=b*g;const E=M*x;const G=D-E;const H=M*p;const I=m*g;const J=H-I;const K=m*x;const L=b*p;const N=K-L;const O=_*g;const P=M*$;const Q=O-P;const R=m*m+p*p+w*w;const S=_*_+$*$+y*y;const T=b*b+x*x+A*A;const U=M*M+g*g+F*F;const V=T*(F*q+w*Q+y*J)-U*(w*C-y*N+A*q)+(R*(y*G-A*Q+F*C)-S*(A*J+F*N+w*G));const W=Math.abs(w);const X=Math.abs(y);const Y=Math.abs(A);const Z=Math.abs(F);const cc=Math.abs(j)+Math.abs(k);const sc=Math.abs(z)+Math.abs(B);const tc=Math.abs(D)+Math.abs(E);const nc=Math.abs(H)+Math.abs(I);const ec=Math.abs(K)+Math.abs(L);const oc=Math.abs(O)+Math.abs(P);const ac=(tc*X+oc*Y+sc*Z)*R+(nc*Y+ec*Z+tc*W)*S+(cc*Z+oc*W+nc*X)*T+(sc*W+ec*X+cc*Y)*U;const lc=dc*ac;return V>lc||-V>lc?V:-insphereadapt(c,s,t,n,e,o,a,l,i,r,f,u,d,v,h,ac)}function inspherefast(c,s,t,n,e,o,a,l,i,r,f,u,d,v,h){const m=c-d;const _=n-d;const b=a-d;const M=r-d;const p=s-v;const $=e-v;const x=l-v;const g=f-v;const w=t-h;const y=o-h;const A=i-h;const F=u-h;const j=m*$-_*p;const k=_*x-b*$;const q=b*g-M*x;const z=M*p-m*g;const B=m*x-b*p;const C=_*g-M*$;const D=w*k-y*B+A*j;const E=y*q-A*C+F*k;const G=A*z+F*B+w*q;const H=F*j+w*C+y*z;const I=m*m+p*p+w*w;const J=_*_+$*$+y*y;const K=b*b+x*x+A*A;const L=M*M+g*g+F*F;return K*H-L*D+(I*E-J*G)}export{incircle,incirclefast,insphere,inspherefast,orient2d,orient2dfast,orient3d,orient3dfast}; +