main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

13
node_modules/d3-format/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,13 @@
Copyright 2010-2021 Mike Bostock
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

350
node_modules/d3-format/README.md generated vendored Normal file
View File

@@ -0,0 +1,350 @@
# d3-format
Ever noticed how sometimes JavaScript doesnt display numbers the way you expect? Like, you tried to print tenths with a simple loop:
```js
for (let i = 0; i < 10; ++i) {
console.log(0.1 * i);
}
```
And you got this:
```js
0
0.1
0.2
0.30000000000000004
0.4
0.5
0.6000000000000001
0.7000000000000001
0.8
0.9
```
Welcome to [binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)! ಠ_ಠ
Yet rounding error is not the only reason to customize number formatting. A table of numbers should be formatted consistently for comparison; above, 0.0 would be better than 0. Large numbers should have grouped digits (e.g., 42,000) or be in scientific or metric notation (4.2e+4, 42k). Currencies should have fixed precision ($3.50). Reported numerical results should be rounded to significant digits (4021 becomes 4000). Number formats should appropriate to the readers locale (42.000,00 or 42,000.00). The list goes on.
Formatting numbers for human consumption is the purpose of d3-format, which is modeled after Python 3s [format specification mini-language](https://docs.python.org/3/library/string.html#format-specification-mini-language) ([PEP 3101](https://www.python.org/dev/peps/pep-3101/)). Revisiting the example above:
```js
const f = d3.format(".1f");
for (let i = 0; i < 10; ++i) {
console.log(f(0.1 * i));
}
```
Now you get this:
```js
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
```
But d3-format is much more than an alias for [number.toFixed](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed)! A few more examples:
```js
d3.format(".0%")(0.123); // rounded percentage, "12%"
d3.format("($.2f")(-3.5); // localized fixed-point currency, "(£3.50)"
d3.format("+20")(42); // space-filled and signed, " +42"
d3.format(".^20")(42); // dot-filled and centered, ".........42........."
d3.format(".2s")(42e6); // SI-prefix with two significant digits, "42M"
d3.format("#x")(48879); // prefixed lowercase hexadecimal, "0xbeef"
d3.format(",.2r")(4223); // grouped thousands with two significant digits, "4,200"
```
See [*locale*.format](#locale_format) for a detailed specification, and try running [d3.formatSpecifier](#formatSpecifier) on the above formats to decode their meaning.
## Installing
If you use npm, `npm install d3-format`. You can also download the [latest release on GitHub](https://github.com/d3/d3-format/releases/latest). In modern browsers, you can import d3-format from Skypack:
```html
<script type="module">
import {format} from "https://cdn.skypack.dev/d3-format@3";
const f = format(".2s");
</script>
```
For legacy environments, you can load d3-formats UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported:
```html
<script src="https://cdn.jsdelivr.net/npm/d3-format@3"></script>
<script>
var f = d3.format(".2s");
</script>
```
Locale files are published to npm and can be loaded using [d3.json](https://github.com/d3/d3-fetch/blob/master/README.md#json). For example, to set Russian as the default locale:
```js
const locale = await d3.json("https://cdn.jsdelivr.net/npm/d3-format@3/locale/ru-RU.json");
d3.formatDefaultLocale(locale);
const f = d3.format("$,");
console.log(f(1234.56)); // 1 234,56 руб.
```
[Try d3-format in your browser.](https://observablehq.com/@d3/d3-format)
## API Reference
<a name="format" href="#format">#</a> d3.<b>format</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-format/blob/main/src/defaultLocale.js#L4 "Source")
An alias for [*locale*.format](#locale_format) on the [default locale](#formatDefaultLocale).
<a name="formatPrefix" href="#formatPrefix">#</a> d3.<b>formatPrefix</b>(<i>specifier</i>, <i>value</i>) [<>](https://github.com/d3/d3-format/blob/main/src/defaultLocale.js#L5 "Source")
An alias for [*locale*.formatPrefix](#locale_formatPrefix) on the [default locale](#formatDefaultLocale).
<a name="locale_format" href="#locale_format">#</a> <i>locale</i>.<b>format</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-format/blob/main/src/locale.js#L18 "Source")
Returns a new format function for the given string *specifier*. The returned function takes a number as the only argument, and returns a string representing the formatted number. The general form of a specifier is:
```
[[fill]align][sign][symbol][0][width][,][.precision][~][type]
```
The *fill* can be any character. The presence of a fill character is signaled by the *align* character following it, which must be one of the following:
* `>` - Forces the field to be right-aligned within the available space. (Default behavior).
* `<` - Forces the field to be left-aligned within the available space.
* `^` - Forces the field to be centered within the available space.
* `=` - like `>`, but with any sign and symbol to the left of any padding.
The *sign* can be:
* `-` - nothing for zero or positive and a minus sign for negative. (Default behavior.)
* `+` - a plus sign for zero or positive and a minus sign for negative.
* `(` - nothing for zero or positive and parentheses for negative.
* ` ` (space) - a space for zero or positive and a minus sign for negative.
The *symbol* can be:
* `$` - apply currency symbols per the locale definition.
* `#` - for binary, octal, or hexadecimal notation, prefix by `0b`, `0o`, or `0x`, respectively.
The *zero* (`0`) option enables zero-padding; this implicitly sets *fill* to `0` and *align* to `=`. The *width* defines the minimum field width; if not specified, then the width will be determined by the content. The *comma* (`,`) option enables the use of a group separator, such as a comma for thousands.
Depending on the *type*, the *precision* either indicates the number of digits that follow the decimal point (types `f` and `%`), or the number of significant digits (types ``, `e`, `g`, `r`, `s` and `p`). If the precision is not specified, it defaults to 6 for all types except `` (none), which defaults to 12. Precision is ignored for integer formats (types `b`, `o`, `d`, `x`, and `X`) and character data (type `c`). See [precisionFixed](#precisionFixed) and [precisionRound](#precisionRound) for help picking an appropriate precision.
The `~` option trims insignificant trailing zeros across all format types. This is most commonly used in conjunction with types `r`, `e`, `s` and `%`. For example:
```js
d3.format("s")(1500); // "1.50000k"
d3.format("~s")(1500); // "1.5k"
```
The available *type* values are:
* `e` - exponent notation.
* `f` - fixed point notation.
* `g` - either decimal or exponent notation, rounded to significant digits.
* `r` - decimal notation, rounded to significant digits.
* `s` - decimal notation with an [SI prefix](#locale_formatPrefix), rounded to significant digits.
* `%` - multiply by 100, and then decimal notation with a percent sign.
* `p` - multiply by 100, round to significant digits, and then decimal notation with a percent sign.
* `b` - binary notation, rounded to integer.
* `o` - octal notation, rounded to integer.
* `d` - decimal notation, rounded to integer.
* `x` - hexadecimal notation, using lower-case letters, rounded to integer.
* `X` - hexadecimal notation, using upper-case letters, rounded to integer.
* `c` - character data, for a string of text.
The type `` (none) is also supported as shorthand for `~g` (with a default precision of 12 instead of 6), and the type `n` is shorthand for `,g`. For the `g`, `n` and `` (none) types, decimal notation is used if the resulting string would have *precision* or fewer digits; otherwise, exponent notation is used. For example:
```js
d3.format(".2")(42); // "42"
d3.format(".2")(4.2); // "4.2"
d3.format(".1")(42); // "4e+1"
d3.format(".1")(4.2); // "4"
```
<a name="locale_formatPrefix" href="#locale_formatPrefix">#</a> <i>locale</i>.<b>formatPrefix</b>(<i>specifier</i>, <i>value</i>) [<>](https://github.com/d3/d3-format/blob/main/src/locale.js#L127 "Source")
Equivalent to [*locale*.format](#locale_format), except the returned function will convert values to the units of the appropriate [SI prefix](https://en.wikipedia.org/wiki/Metric_prefix#List_of_SI_prefixes) for the specified numeric reference *value* before formatting in fixed point notation. The following prefixes are supported:
* `y` - yocto, 10⁻²⁴
* `z` - zepto, 10⁻²¹
* `a` - atto, 10⁻¹⁸
* `f` - femto, 10⁻¹⁵
* `p` - pico, 10⁻¹²
* `n` - nano, 10⁻⁹
* `µ` - micro, 10⁻⁶
* `m` - milli, 10⁻³
* `` (none) - 10⁰
* `k` - kilo, 10³
* `M` - mega, 10⁶
* `G` - giga, 10⁹
* `T` - tera, 10¹²
* `P` - peta, 10¹⁵
* `E` - exa, 10¹⁸
* `Z` - zetta, 10²¹
* `Y` - yotta, 10²⁴
Unlike [*locale*.format](#locale_format) with the `s` format type, this method returns a formatter with a consistent SI prefix, rather than computing the prefix dynamically for each number. In addition, the *precision* for the given *specifier* represents the number of digits past the decimal point (as with `f` fixed point notation), not the number of significant digits. For example:
```js
const f = d3.formatPrefix(",.0", 1e-6);
f(0.00042); // "420µ"
f(0.0042); // "4,200µ"
```
This method is useful when formatting multiple numbers in the same units for easy comparison. See [precisionPrefix](#precisionPrefix) for help picking an appropriate precision, and [bl.ocks.org/9764126](http://bl.ocks.org/mbostock/9764126) for an example.
<a name="formatSpecifier" href="#formatSpecifier">#</a> d3.<b>formatSpecifier</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-format/blob/main/src/formatSpecifier.js "Source")
Parses the specified *specifier*, returning an object with exposed fields that correspond to the [format specification mini-language](#locale_format) and a toString method that reconstructs the specifier. For example, `formatSpecifier("s")` returns:
```js
FormatSpecifier {
"fill": " ",
"align": ">",
"sign": "-",
"symbol": "",
"zero": false,
"width": undefined,
"comma": false,
"precision": undefined,
"trim": false,
"type": "s"
}
```
This method is useful for understanding how format specifiers are parsed and for deriving new specifiers. For example, you might compute an appropriate precision based on the numbers you want to format using [precisionFixed](#precisionFixed) and then create a new format:
```js
const s = d3.formatSpecifier("f");
s.precision = d3.precisionFixed(0.01);
const f = d3.format(s);
f(42); // "42.00";
```
<a name="FormatSpecifier" href="#FormatSpecifier">#</a> new d3.<b>FormatSpecifier</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-format/blob/main/src/formatSpecifier.js "Source")
Given the specified *specifier* object, returning an object with exposed fields that correspond to the [format specification mini-language](#locale_format) and a toString method that reconstructs the specifier. For example, `new FormatSpecifier({type: "s"})` returns:
```js
FormatSpecifier {
"fill": " ",
"align": ">",
"sign": "-",
"symbol": "",
"zero": false,
"width": undefined,
"comma": false,
"precision": undefined,
"trim": false,
"type": "s"
}
```
<a name="precisionFixed" href="#precisionFixed">#</a> d3.<b>precisionFixed</b>(<i>step</i>) [<>](https://github.com/d3/d3-format/blob/main/src/precisionFixed.js "Source")
Returns a suggested decimal precision for fixed point notation given the specified numeric *step* value. The *step* represents the minimum absolute difference between values that will be formatted. (This assumes that the values to be formatted are also multiples of *step*.) For example, given the numbers 1, 1.5, and 2, the *step* should be 0.5 and the suggested precision is 1:
```js
const p = d3.precisionFixed(0.5);
const f = d3.format("." + p + "f");
f(1); // "1.0"
f(1.5); // "1.5"
f(2); // "2.0"
```
Whereas for the numbers 1, 2 and 3, the *step* should be 1 and the suggested precision is 0:
```js
const p = d3.precisionFixed(1);
const f = d3.format("." + p + "f");
f(1); // "1"
f(2); // "2"
f(3); // "3"
```
Note: for the `%` format type, subtract two:
```js
const p = Math.max(0, d3.precisionFixed(0.05) - 2);
const f = d3.format("." + p + "%");
f(0.45); // "45%"
f(0.50); // "50%"
f(0.55); // "55%"
```
<a name="precisionPrefix" href="#precisionPrefix">#</a> d3.<b>precisionPrefix</b>(<i>step</i>, <i>value</i>) [<>](https://github.com/d3/d3-format/blob/main/src/precisionPrefix.js "Source")
Returns a suggested decimal precision for use with [*locale*.formatPrefix](#locale_formatPrefix) given the specified numeric *step* and reference *value*. The *step* represents the minimum absolute difference between values that will be formatted, and *value* determines which SI prefix will be used. (This assumes that the values to be formatted are also multiples of *step*.) For example, given the numbers 1.1e6, 1.2e6, and 1.3e6, the *step* should be 1e5, the *value* could be 1.3e6, and the suggested precision is 1:
```js
const p = d3.precisionPrefix(1e5, 1.3e6);
const f = d3.formatPrefix("." + p, 1.3e6);
f(1.1e6); // "1.1M"
f(1.2e6); // "1.2M"
f(1.3e6); // "1.3M"
```
<a name="precisionRound" href="#precisionRound">#</a> d3.<b>precisionRound</b>(<i>step</i>, <i>max</i>) [<>](https://github.com/d3/d3-format/blob/main/src/precisionRound.js "Source")
Returns a suggested decimal precision for format types that round to significant digits given the specified numeric *step* and *max* values. The *step* represents the minimum absolute difference between values that will be formatted, and the *max* represents the largest absolute value that will be formatted. (This assumes that the values to be formatted are also multiples of *step*.) For example, given the numbers 0.99, 1.0, and 1.01, the *step* should be 0.01, the *max* should be 1.01, and the suggested precision is 3:
```js
const p = d3.precisionRound(0.01, 1.01);
const f = d3.format("." + p + "r");
f(0.99); // "0.990"
f(1.0); // "1.00"
f(1.01); // "1.01"
```
Whereas for the numbers 0.9, 1.0, and 1.1, the *step* should be 0.1, the *max* should be 1.1, and the suggested precision is 2:
```js
const p = d3.precisionRound(0.1, 1.1);
const f = d3.format("." + p + "r");
f(0.9); // "0.90"
f(1.0); // "1.0"
f(1.1); // "1.1"
```
Note: for the `e` format type, subtract one:
```js
const p = Math.max(0, d3.precisionRound(0.01, 1.01) - 1);
const f = d3.format("." + p + "e");
f(0.01); // "1.00e-2"
f(1.01); // "1.01e+0"
```
### Locales
<a name="formatLocale" href="#formatLocale">#</a> d3.<b>formatLocale</b>(<i>definition</i>) [<>](https://github.com/d3/d3-format/blob/main/src/locale.js "Source")
Returns a *locale* object for the specified *definition* with [*locale*.format](#locale_format) and [*locale*.formatPrefix](#locale_formatPrefix) methods. The *definition* must include the following properties:
* `decimal` - the decimal point (e.g., `"."`).
* `thousands` - the group separator (e.g., `","`).
* `grouping` - the array of group sizes (e.g., `[3]`), cycled as needed.
* `currency` - the currency prefix and suffix (e.g., `["$", ""]`).
* `numerals` - optional; an array of ten strings to replace the numerals 0-9.
* `percent` - optional; the percent sign (defaults to `"%"`).
* `minus` - optional; the minus sign (defaults to `""`).
* `nan` - optional; the not-a-number value (defaults `"NaN"`).
Note that the *thousands* property is a misnomer, as the grouping definition allows groups other than thousands.
<a name="formatDefaultLocale" href="#formatDefaultLocale">#</a> d3.<b>formatDefaultLocale</b>(<i>definition</i>) [<>](https://github.com/d3/d3-format/blob/main/src/defaultLocale.js "Source")
Equivalent to [d3.formatLocale](#formatLocale), except it also redefines [d3.format](#format) and [d3.formatPrefix](#formatPrefix) to the new locales [*locale*.format](#locale_format) and [*locale*.formatPrefix](#locale_formatPrefix). If you do not set a default locale, it defaults to [U.S. English](https://github.com/d3/d3-format/blob/main/locale/en-US.json).

345
node_modules/d3-format/dist/d3-format.js generated vendored Normal file
View File

@@ -0,0 +1,345 @@
// https://d3js.org/d3-format/ v3.1.0 Copyright 2010-2021 Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}));
})(this, (function (exports) { 'use strict';
function formatDecimal(x) {
return Math.abs(x = Math.round(x)) >= 1e21
? x.toLocaleString("en").replace(/,/g, "")
: x.toString(10);
}
// Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimalParts(1.23) returns ["123", 0].
function formatDecimalParts(x, p) {
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
var i, coefficient = x.slice(0, i);
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
return [
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+x.slice(i + 1)
];
}
function exponent(x) {
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
}
function formatGroup(grouping, thousands) {
return function(value, width) {
var i = value.length,
t = [],
j = 0,
g = grouping[0],
length = 0;
while (i > 0 && g > 0) {
if (length + g + 1 > width) g = Math.max(1, width - length);
t.push(value.substring(i -= g, i + g));
if ((length += g + 1) > width) break;
g = grouping[j = (j + 1) % grouping.length];
}
return t.reverse().join(thousands);
};
}
function formatNumerals(numerals) {
return function(value) {
return value.replace(/[0-9]/g, function(i) {
return numerals[+i];
});
};
}
// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function formatSpecifier(specifier) {
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
var match;
return new FormatSpecifier({
fill: match[1],
align: match[2],
sign: match[3],
symbol: match[4],
zero: match[5],
width: match[6],
comma: match[7],
precision: match[8] && match[8].slice(1),
trim: match[9],
type: match[10]
});
}
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
function FormatSpecifier(specifier) {
this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
this.align = specifier.align === undefined ? ">" : specifier.align + "";
this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
this.zero = !!specifier.zero;
this.width = specifier.width === undefined ? undefined : +specifier.width;
this.comma = !!specifier.comma;
this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
this.trim = !!specifier.trim;
this.type = specifier.type === undefined ? "" : specifier.type + "";
}
FormatSpecifier.prototype.toString = function() {
return this.fill
+ this.align
+ this.sign
+ this.symbol
+ (this.zero ? "0" : "")
+ (this.width === undefined ? "" : Math.max(1, this.width | 0))
+ (this.comma ? "," : "")
+ (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
+ (this.trim ? "~" : "")
+ this.type;
};
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
function formatTrim(s) {
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
switch (s[i]) {
case ".": i0 = i1 = i; break;
case "0": if (i0 === 0) i0 = i; i1 = i; break;
default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
}
}
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
}
var prefixExponent;
function formatPrefixAuto(x, p) {
var d = formatDecimalParts(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1],
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
n = coefficient.length;
return i === n ? coefficient
: i > n ? coefficient + new Array(i - n + 1).join("0")
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
: "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
}
function formatRounded(x, p) {
var d = formatDecimalParts(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1];
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
}
var formatTypes = {
"%": (x, p) => (x * 100).toFixed(p),
"b": (x) => Math.round(x).toString(2),
"c": (x) => x + "",
"d": formatDecimal,
"e": (x, p) => x.toExponential(p),
"f": (x, p) => x.toFixed(p),
"g": (x, p) => x.toPrecision(p),
"o": (x) => Math.round(x).toString(8),
"p": (x, p) => formatRounded(x * 100, p),
"r": formatRounded,
"s": formatPrefixAuto,
"X": (x) => Math.round(x).toString(16).toUpperCase(),
"x": (x) => Math.round(x).toString(16)
};
function identity(x) {
return x;
}
var map = Array.prototype.map,
prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
function formatLocale(locale) {
var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
decimal = locale.decimal === undefined ? "." : locale.decimal + "",
numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
percent = locale.percent === undefined ? "%" : locale.percent + "",
minus = locale.minus === undefined ? "" : locale.minus + "",
nan = locale.nan === undefined ? "NaN" : locale.nan + "";
function newFormat(specifier) {
specifier = formatSpecifier(specifier);
var fill = specifier.fill,
align = specifier.align,
sign = specifier.sign,
symbol = specifier.symbol,
zero = specifier.zero,
width = specifier.width,
comma = specifier.comma,
precision = specifier.precision,
trim = specifier.trim,
type = specifier.type;
// The "n" type is an alias for ",g".
if (type === "n") comma = true, type = "g";
// The "" type, and any invalid type, is an alias for ".12~g".
else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
// If zero fill is specified, padding goes after sign and before digits.
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
// Compute the prefix and suffix.
// For SI-prefix, the suffix is lazily computed.
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
// What format function should we use?
// Is this an integer type?
// Can this type generate exponential notation?
var formatType = formatTypes[type],
maybeSuffix = /[defgprs%]/.test(type);
// Set the default precision if not specified,
// or clamp the specified precision to the supported range.
// For significant precision, it must be in [1, 21].
// For fixed precision, it must be in [0, 20].
precision = precision === undefined ? 6
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
: Math.max(0, Math.min(20, precision));
function format(value) {
var valuePrefix = prefix,
valueSuffix = suffix,
i, n, c;
if (type === "c") {
valueSuffix = formatType(value) + valueSuffix;
value = "";
} else {
value = +value;
// Determine the sign. -0 is not less than 0, but 1 / -0 is!
var valueNegative = value < 0 || 1 / value < 0;
// Perform the initial formatting.
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
// Trim insignificant zeros.
if (trim) value = formatTrim(value);
// If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
// Compute the prefix and suffix.
valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
// Break the formatted value into the integer “value” part that can be
// grouped, and fractional or exponential “suffix” part that is not.
if (maybeSuffix) {
i = -1, n = value.length;
while (++i < n) {
if (c = value.charCodeAt(i), 48 > c || c > 57) {
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
value = value.slice(0, i);
break;
}
}
}
}
// If the fill character is not "0", grouping is applied before padding.
if (comma && !zero) value = group(value, Infinity);
// Compute the padding.
var length = valuePrefix.length + value.length + valueSuffix.length,
padding = length < width ? new Array(width - length + 1).join(fill) : "";
// If the fill character is "0", grouping is applied after padding.
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
// Reconstruct the final output based on the desired alignment.
switch (align) {
case "<": value = valuePrefix + value + valueSuffix + padding; break;
case "=": value = valuePrefix + padding + value + valueSuffix; break;
case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
default: value = padding + valuePrefix + value + valueSuffix; break;
}
return numerals(value);
}
format.toString = function() {
return specifier + "";
};
return format;
}
function formatPrefix(specifier, value) {
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
k = Math.pow(10, -e),
prefix = prefixes[8 + e / 3];
return function(value) {
return f(k * value) + prefix;
};
}
return {
format: newFormat,
formatPrefix: formatPrefix
};
}
var locale;
exports.format = void 0;
exports.formatPrefix = void 0;
defaultLocale({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function defaultLocale(definition) {
locale = formatLocale(definition);
exports.format = locale.format;
exports.formatPrefix = locale.formatPrefix;
return locale;
}
function precisionFixed(step) {
return Math.max(0, -exponent(Math.abs(step)));
}
function precisionPrefix(step, value) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
}
function precisionRound(step, max) {
step = Math.abs(step), max = Math.abs(max) - step;
return Math.max(0, exponent(max) - exponent(step)) + 1;
}
exports.FormatSpecifier = FormatSpecifier;
exports.formatDefaultLocale = defaultLocale;
exports.formatLocale = formatLocale;
exports.formatSpecifier = formatSpecifier;
exports.precisionFixed = precisionFixed;
exports.precisionPrefix = precisionPrefix;
exports.precisionRound = precisionRound;
Object.defineProperty(exports, '__esModule', { value: true });
}));

2
node_modules/d3-format/dist/d3-format.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

7
node_modules/d3-format/locale/ar-001.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", ""],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-AE.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u062f\u002e\u0625\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-BH.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u062f\u002e\u0628\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-DJ.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["\u200f\u0046\u0064\u006a ", ""],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

6
node_modules/d3-format/locale/ar-DZ.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": "\u002c",
"thousands": "\u002e",
"grouping": [3],
"currency": ["\u062f\u002e\u062c\u002e ", ""]
}

7
node_modules/d3-format/locale/ar-EG.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u062c\u002e\u0645\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

6
node_modules/d3-format/locale/ar-EH.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": "\u002e",
"thousands": "\u002c",
"grouping": [3],
"currency": ["\u062f\u002e\u0645\u002e ", ""]
}

7
node_modules/d3-format/locale/ar-ER.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["\u004e\u0066\u006b ", ""],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-IL.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["\u20aa ", ""],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-IQ.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u062f\u002e\u0639\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-JO.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u062f\u002e\u0623\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-KM.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u0641\u002e\u062c\u002e\u0642\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-KW.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u062f\u002e\u0643\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-LB.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u0644\u002e\u0644\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

6
node_modules/d3-format/locale/ar-LY.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": "\u002c",
"thousands": "\u002e",
"grouping": [3],
"currency": ["\u062f\u002e\u0644\u002e ", ""]
}

6
node_modules/d3-format/locale/ar-MA.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": "\u002c",
"thousands": "\u002e",
"grouping": [3],
"currency": ["\u062f\u002e\u0645\u002e ", ""]
}

7
node_modules/d3-format/locale/ar-MR.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u0623\u002e\u0645\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-OM.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u0631\u002e\u0639\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-PS.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["\u20aa ", ""],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-QA.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u0631\u002e\u0642\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-SA.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u0631\u002e\u0633\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-SD.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u062c\u002e\u0633\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-SO.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["\u200f\u0053 ", ""],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-SS.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["\u00a3 ", ""],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-SY.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u0644\u002e\u0633\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

7
node_modules/d3-format/locale/ar-TD.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["\u200f\u0046\u0043\u0046\u0041 ", ""],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

6
node_modules/d3-format/locale/ar-TN.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": "\u002c",
"thousands": "\u002e",
"grouping": [3],
"currency": ["\u062f\u002e\u062a\u002e ", ""]
}

7
node_modules/d3-format/locale/ar-YE.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": "\u066b",
"thousands": "\u066c",
"grouping": [3],
"currency": ["", " \u0631\u002e\u0649\u002e"],
"numerals" : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
}

6
node_modules/d3-format/locale/ca-ES.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", "\u00a0€"]
}

6
node_modules/d3-format/locale/cs-CZ.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", "\u00a0Kč"]
}

6
node_modules/d3-format/locale/da-DK.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", " kr"]
}

6
node_modules/d3-format/locale/de-CH.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "'",
"grouping": [3],
"currency": ["", "\u00a0CHF"]
}

6
node_modules/d3-format/locale/de-DE.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", "\u00a0€"]
}

6
node_modules/d3-format/locale/en-CA.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["$", ""]
}

6
node_modules/d3-format/locale/en-GB.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["£", ""]
}

6
node_modules/d3-format/locale/en-IE.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["€", ""]
}

6
node_modules/d3-format/locale/en-IN.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3, 2, 2, 2, 2, 2, 2, 2, 2, 2],
"currency": ["₹", ""]
}

6
node_modules/d3-format/locale/en-US.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["$", ""]
}

7
node_modules/d3-format/locale/es-BO.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["Bs\u00a0", ""],
"percent": "\u202f%"
}

6
node_modules/d3-format/locale/es-ES.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", "\u00a0€"]
}

6
node_modules/d3-format/locale/es-MX.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["$", ""]
}

6
node_modules/d3-format/locale/fi-FI.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", "\u00a0€"]
}

6
node_modules/d3-format/locale/fr-CA.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", "$"]
}

7
node_modules/d3-format/locale/fr-FR.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", "\u00a0€"],
"percent": "\u202f%"
}

6
node_modules/d3-format/locale/he-IL.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["₪", ""]
}

6
node_modules/d3-format/locale/hu-HU.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", "\u00a0Ft"]
}

6
node_modules/d3-format/locale/it-IT.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["€", ""]
}

6
node_modules/d3-format/locale/ja-JP.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["", "円"]
}

6
node_modules/d3-format/locale/ko-KR.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["₩", ""]
}

6
node_modules/d3-format/locale/mk-MK.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", "\u00a0ден."]
}

6
node_modules/d3-format/locale/nl-NL.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["€\u00a0", ""]
}

6
node_modules/d3-format/locale/pl-PL.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", "zł"]
}

6
node_modules/d3-format/locale/pt-BR.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["R$", ""]
}

6
node_modules/d3-format/locale/pt-PT.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", "\u00a0€"]
}

6
node_modules/d3-format/locale/ru-RU.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", "\u00a0\u20bd"]
}

6
node_modules/d3-format/locale/sl-SI.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", "\u00a0€"]
}

6
node_modules/d3-format/locale/sv-SE.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", " kr"]
}

6
node_modules/d3-format/locale/uk-UA.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ",",
"thousands": "\u00a0",
"grouping": [3],
"currency": ["", "\u00a0₴."]
}

6
node_modules/d3-format/locale/zh-CN.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"decimal": ".",
"thousands": ",",
"grouping": [3],
"currency": ["¥", ""]
}

55
node_modules/d3-format/package.json generated vendored Normal file
View File

@@ -0,0 +1,55 @@
{
"name": "d3-format",
"version": "3.1.0",
"description": "Format numbers for human consumption.",
"homepage": "https://d3js.org/d3-format/",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-format.git"
},
"keywords": [
"d3",
"d3-module",
"format",
"localization"
],
"license": "ISC",
"author": {
"name": "Mike Bostock",
"url": "http://bost.ocks.org/mike"
},
"type": "module",
"files": [
"dist/**/*.js",
"src/**/*.js",
"locale/*.json"
],
"module": "src/index.js",
"main": "src/index.js",
"jsdelivr": "dist/d3-format.min.js",
"unpkg": "dist/d3-format.min.js",
"exports": {
".": {
"umd": "./dist/d3-format.min.js",
"default": "./src/index.js"
},
"./locale/*": "./locale/*.json"
},
"sideEffects": [
"./src/defaultLocale.js"
],
"devDependencies": {
"eslint": "8",
"mocha": "9",
"rollup": "2",
"rollup-plugin-terser": "7"
},
"scripts": {
"test": "mocha 'test/**/*-test.js' && eslint src test",
"prepublishOnly": "rm -rf dist && yarn test && rollup -c",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd -"
},
"engines": {
"node": ">=12"
}
}

18
node_modules/d3-format/src/defaultLocale.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import formatLocale from "./locale.js";
var locale;
export var format;
export var formatPrefix;
defaultLocale({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
export default function defaultLocale(definition) {
locale = formatLocale(definition);
format = locale.format;
formatPrefix = locale.formatPrefix;
return locale;
}

5
node_modules/d3-format/src/exponent.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import {formatDecimalParts} from "./formatDecimal.js";
export default function(x) {
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
}

20
node_modules/d3-format/src/formatDecimal.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
export default function(x) {
return Math.abs(x = Math.round(x)) >= 1e21
? x.toLocaleString("en").replace(/,/g, "")
: x.toString(10);
}
// Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimalParts(1.23) returns ["123", 0].
export function formatDecimalParts(x, p) {
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
var i, coefficient = x.slice(0, i);
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
return [
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+x.slice(i + 1)
];
}

18
node_modules/d3-format/src/formatGroup.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
export default function(grouping, thousands) {
return function(value, width) {
var i = value.length,
t = [],
j = 0,
g = grouping[0],
length = 0;
while (i > 0 && g > 0) {
if (length + g + 1 > width) g = Math.max(1, width - length);
t.push(value.substring(i -= g, i + g));
if ((length += g + 1) > width) break;
g = grouping[j = (j + 1) % grouping.length];
}
return t.reverse().join(thousands);
};
}

7
node_modules/d3-format/src/formatNumerals.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export default function(numerals) {
return function(value) {
return value.replace(/[0-9]/g, function(i) {
return numerals[+i];
});
};
}

16
node_modules/d3-format/src/formatPrefixAuto.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import {formatDecimalParts} from "./formatDecimal.js";
export var prefixExponent;
export default function(x, p) {
var d = formatDecimalParts(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1],
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
n = coefficient.length;
return i === n ? coefficient
: i > n ? coefficient + new Array(i - n + 1).join("0")
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
: "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
}

11
node_modules/d3-format/src/formatRounded.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import {formatDecimalParts} from "./formatDecimal.js";
export default function(x, p) {
var d = formatDecimalParts(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1];
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
}

47
node_modules/d3-format/src/formatSpecifier.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
export default function formatSpecifier(specifier) {
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
var match;
return new FormatSpecifier({
fill: match[1],
align: match[2],
sign: match[3],
symbol: match[4],
zero: match[5],
width: match[6],
comma: match[7],
precision: match[8] && match[8].slice(1),
trim: match[9],
type: match[10]
});
}
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
export function FormatSpecifier(specifier) {
this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
this.align = specifier.align === undefined ? ">" : specifier.align + "";
this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
this.zero = !!specifier.zero;
this.width = specifier.width === undefined ? undefined : +specifier.width;
this.comma = !!specifier.comma;
this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
this.trim = !!specifier.trim;
this.type = specifier.type === undefined ? "" : specifier.type + "";
}
FormatSpecifier.prototype.toString = function() {
return this.fill
+ this.align
+ this.sign
+ this.symbol
+ (this.zero ? "0" : "")
+ (this.width === undefined ? "" : Math.max(1, this.width | 0))
+ (this.comma ? "," : "")
+ (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
+ (this.trim ? "~" : "")
+ this.type;
};

11
node_modules/d3-format/src/formatTrim.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
export default function(s) {
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
switch (s[i]) {
case ".": i0 = i1 = i; break;
case "0": if (i0 === 0) i0 = i; i1 = i; break;
default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
}
}
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
}

19
node_modules/d3-format/src/formatTypes.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import formatDecimal from "./formatDecimal.js";
import formatPrefixAuto from "./formatPrefixAuto.js";
import formatRounded from "./formatRounded.js";
export default {
"%": (x, p) => (x * 100).toFixed(p),
"b": (x) => Math.round(x).toString(2),
"c": (x) => x + "",
"d": formatDecimal,
"e": (x, p) => x.toExponential(p),
"f": (x, p) => x.toFixed(p),
"g": (x, p) => x.toPrecision(p),
"o": (x) => Math.round(x).toString(8),
"p": (x, p) => formatRounded(x * 100, p),
"r": formatRounded,
"s": formatPrefixAuto,
"X": (x) => Math.round(x).toString(16).toUpperCase(),
"x": (x) => Math.round(x).toString(16)
};

3
node_modules/d3-format/src/identity.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export default function(x) {
return x;
}

6
node_modules/d3-format/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export {default as formatDefaultLocale, format, formatPrefix} from "./defaultLocale.js";
export {default as formatLocale} from "./locale.js";
export {default as formatSpecifier, FormatSpecifier} from "./formatSpecifier.js";
export {default as precisionFixed} from "./precisionFixed.js";
export {default as precisionPrefix} from "./precisionPrefix.js";
export {default as precisionRound} from "./precisionRound.js";

148
node_modules/d3-format/src/locale.js generated vendored Normal file
View File

@@ -0,0 +1,148 @@
import exponent from "./exponent.js";
import formatGroup from "./formatGroup.js";
import formatNumerals from "./formatNumerals.js";
import formatSpecifier from "./formatSpecifier.js";
import formatTrim from "./formatTrim.js";
import formatTypes from "./formatTypes.js";
import {prefixExponent} from "./formatPrefixAuto.js";
import identity from "./identity.js";
var map = Array.prototype.map,
prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
export default function(locale) {
var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
decimal = locale.decimal === undefined ? "." : locale.decimal + "",
numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
percent = locale.percent === undefined ? "%" : locale.percent + "",
minus = locale.minus === undefined ? "" : locale.minus + "",
nan = locale.nan === undefined ? "NaN" : locale.nan + "";
function newFormat(specifier) {
specifier = formatSpecifier(specifier);
var fill = specifier.fill,
align = specifier.align,
sign = specifier.sign,
symbol = specifier.symbol,
zero = specifier.zero,
width = specifier.width,
comma = specifier.comma,
precision = specifier.precision,
trim = specifier.trim,
type = specifier.type;
// The "n" type is an alias for ",g".
if (type === "n") comma = true, type = "g";
// The "" type, and any invalid type, is an alias for ".12~g".
else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
// If zero fill is specified, padding goes after sign and before digits.
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
// Compute the prefix and suffix.
// For SI-prefix, the suffix is lazily computed.
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
// What format function should we use?
// Is this an integer type?
// Can this type generate exponential notation?
var formatType = formatTypes[type],
maybeSuffix = /[defgprs%]/.test(type);
// Set the default precision if not specified,
// or clamp the specified precision to the supported range.
// For significant precision, it must be in [1, 21].
// For fixed precision, it must be in [0, 20].
precision = precision === undefined ? 6
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
: Math.max(0, Math.min(20, precision));
function format(value) {
var valuePrefix = prefix,
valueSuffix = suffix,
i, n, c;
if (type === "c") {
valueSuffix = formatType(value) + valueSuffix;
value = "";
} else {
value = +value;
// Determine the sign. -0 is not less than 0, but 1 / -0 is!
var valueNegative = value < 0 || 1 / value < 0;
// Perform the initial formatting.
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
// Trim insignificant zeros.
if (trim) value = formatTrim(value);
// If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
// Compute the prefix and suffix.
valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
// Break the formatted value into the integer “value” part that can be
// grouped, and fractional or exponential “suffix” part that is not.
if (maybeSuffix) {
i = -1, n = value.length;
while (++i < n) {
if (c = value.charCodeAt(i), 48 > c || c > 57) {
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
value = value.slice(0, i);
break;
}
}
}
}
// If the fill character is not "0", grouping is applied before padding.
if (comma && !zero) value = group(value, Infinity);
// Compute the padding.
var length = valuePrefix.length + value.length + valueSuffix.length,
padding = length < width ? new Array(width - length + 1).join(fill) : "";
// If the fill character is "0", grouping is applied after padding.
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
// Reconstruct the final output based on the desired alignment.
switch (align) {
case "<": value = valuePrefix + value + valueSuffix + padding; break;
case "=": value = valuePrefix + padding + value + valueSuffix; break;
case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
default: value = padding + valuePrefix + value + valueSuffix; break;
}
return numerals(value);
}
format.toString = function() {
return specifier + "";
};
return format;
}
function formatPrefix(specifier, value) {
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
k = Math.pow(10, -e),
prefix = prefixes[8 + e / 3];
return function(value) {
return f(k * value) + prefix;
};
}
return {
format: newFormat,
formatPrefix: formatPrefix
};
}

5
node_modules/d3-format/src/precisionFixed.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import exponent from "./exponent.js";
export default function(step) {
return Math.max(0, -exponent(Math.abs(step)));
}

5
node_modules/d3-format/src/precisionPrefix.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import exponent from "./exponent.js";
export default function(step, value) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
}

6
node_modules/d3-format/src/precisionRound.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import exponent from "./exponent.js";
export default function(step, max) {
step = Math.abs(step), max = Math.abs(max) - step;
return Math.max(0, exponent(max) - exponent(step)) + 1;
}