@iyulab/u-numflow 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -11
- package/node/u_numflow.cjs +405 -1
- package/node/u_numflow.d.cts +103 -0
- package/node/u_numflow_bg.wasm +0 -0
- package/package.json +1 -1
- package/u_numflow.d.ts +103 -0
- package/u_numflow.js +1 -1
- package/u_numflow_bg.js +396 -1
- package/u_numflow_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -16,13 +16,14 @@ u-numflow provides foundational mathematical, statistical, and probabilistic bui
|
|
|
16
16
|
| Module | Description |
|
|
17
17
|
|--------|-------------|
|
|
18
18
|
| `stats` | Descriptive statistics (mean, variance, skewness, kurtosis) with Welford's online algorithm and Neumaier summation |
|
|
19
|
-
| `distributions` | Probability distributions: Uniform, Triangular, PERT, Normal, LogNormal |
|
|
19
|
+
| `distributions` | Probability distributions: Uniform, Triangular, PERT, Normal, LogNormal, Weibull, Exponential, Gamma, Beta, χ² |
|
|
20
20
|
| `special` | Special functions: normal CDF and tail-precise survival function (and their inverses), t/F/chi² CDF and quantiles, the noncentral t CDF (Lenth AS 243 — the distribution power is computed from), regularized incomplete beta/gamma, erf |
|
|
21
21
|
| `transforms` | Data transformations: Box-Cox (λ via MLE golden-section search), inverse Box-Cox |
|
|
22
22
|
| `fourier` | Discrete Fourier transform of any length (radix-2 for powers of two, Bluestein otherwise): `fft`, `ifft`, `rfft`, `Complex` |
|
|
23
23
|
| `matrix` | Dense matrix operations: determinant, inverse, Cholesky decomposition, Jacobi eigenvalue decomposition |
|
|
24
24
|
| `random` | Seeded RNG, Fisher-Yates shuffle, weighted sampling, random subset selection |
|
|
25
|
-
| `
|
|
25
|
+
| `distributions::Sample` | Random variates from every continuous distribution — `sample(&mut rng)` and reproducible `sample_n(n, seed)`; inversion where the quantile is direct, Marsaglia–Tsang for the gamma family (Gamma, χ², Beta, PERT); uniforms from the open interval (0, 1), so no variate is infinite |
|
|
26
|
+
| `collections` | Specialized data structures: Union-Find with path compression and union-by-rank; `IntervalSet` — unions of half-open intervals with union, intersection, difference, clip and a measure that counts overlapping input once |
|
|
26
27
|
|
|
27
28
|
## Design Philosophy
|
|
28
29
|
|
|
@@ -34,7 +35,7 @@ u-numflow provides foundational mathematical, statistical, and probabilistic bui
|
|
|
34
35
|
|
|
35
36
|
```toml
|
|
36
37
|
[dependencies]
|
|
37
|
-
u-numflow = "0.
|
|
38
|
+
u-numflow = "0.10"
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
```rust
|
|
@@ -49,11 +50,14 @@ for x in [1.0, 2.0, 3.0, 4.0, 5.0] {
|
|
|
49
50
|
}
|
|
50
51
|
assert_eq!(stats.mean(), Some(3.0));
|
|
51
52
|
|
|
52
|
-
// PERT distribution: moments
|
|
53
|
+
// PERT distribution: moments, quantiles and reproducible samples
|
|
54
|
+
use u_numflow::distributions::Sample;
|
|
53
55
|
let pert = Pert::new(1.0, 4.0, 7.0).unwrap();
|
|
54
56
|
assert_eq!(pert.mean(), 4.0);
|
|
55
57
|
let p90 = pert.quantile(0.9).unwrap();
|
|
56
58
|
assert!(p90 > 4.0 && p90 < 7.0);
|
|
59
|
+
let draws = pert.sample_n(1000, 7); // same (n, seed), same draws
|
|
60
|
+
assert!(draws.iter().all(|&x| (1.0..=7.0).contains(&x)));
|
|
57
61
|
|
|
58
62
|
// Seeded shuffling for reproducibility
|
|
59
63
|
let mut rng = create_rng(42);
|
|
@@ -72,8 +76,22 @@ use u_numflow::fourier::rfft;
|
|
|
72
76
|
let signal: Vec<f64> = (0..30).map(|j| (2.0 * std::f64::consts::PI * 3.0 * j as f64 / 30.0).sin()).collect();
|
|
73
77
|
let spectrum = rfft(&signal); // 30 complex bins; bin 3 carries the energy
|
|
74
78
|
assert!(spectrum[3].norm() > 14.0);
|
|
79
|
+
|
|
80
|
+
// Interval sets: overlapping stops are down-time once, not twice
|
|
81
|
+
use u_numflow::collections::IntervalSet;
|
|
82
|
+
let planned = IntervalSet::from_intervals([(0.0, 24.0)]).unwrap();
|
|
83
|
+
let unplanned = IntervalSet::from_intervals([(10.0, 30.0)]).unwrap();
|
|
84
|
+
let week = IntervalSet::from_intervals([(0.0, 168.0)]).unwrap();
|
|
85
|
+
let up = week.difference(&planned.union(&unplanned));
|
|
86
|
+
assert_eq!(up.measure(), 138.0);
|
|
75
87
|
```
|
|
76
88
|
|
|
89
|
+
`IntervalSet<T>` works over `f32`, `f64` and every primitive integer type. Its
|
|
90
|
+
measure has the type of a distance — the unsigned type of the same width for
|
|
91
|
+
integers (as `i64::abs_diff` returns `u64`), so it cannot overflow. A reversed
|
|
92
|
+
interval (`start > end`) or a NaN/infinite bound is refused with its position,
|
|
93
|
+
never swapped or dropped.
|
|
94
|
+
|
|
77
95
|
## Build & Test
|
|
78
96
|
|
|
79
97
|
```bash
|
|
@@ -83,13 +101,24 @@ cargo test
|
|
|
83
101
|
|
|
84
102
|
## Dependencies
|
|
85
103
|
|
|
86
|
-
- `rand` 0.
|
|
104
|
+
- `rand` 0.10 — Random number generation
|
|
87
105
|
- `proptest` 1.4 — Property-based testing (dev only)
|
|
88
106
|
|
|
89
107
|
## License
|
|
90
108
|
|
|
91
109
|
MIT License — see [LICENSE](LICENSE).
|
|
92
110
|
|
|
111
|
+
## .NET (NuGet)
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
dotnet add package UNumflow
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The distributions (CDF, quantile, moments, seeded sampling) and interval sets,
|
|
118
|
+
backed by this crate through its C ABI (the `ffi` feature) — see
|
|
119
|
+
[bindings/csharp/README.md](bindings/csharp/README.md). Refusals carry the same
|
|
120
|
+
`code` and fields as the WebAssembly binding's.
|
|
121
|
+
|
|
93
122
|
## npm (WebAssembly)
|
|
94
123
|
|
|
95
124
|
```bash
|
|
@@ -137,6 +166,50 @@ const { t_distribution_quantile } = require("@iyulab/u-numflow");
|
|
|
137
166
|
t_distribution_quantile(0.975, 10); // 2.2281…
|
|
138
167
|
```
|
|
139
168
|
|
|
169
|
+
Any of the crate's distributions by specification — `distribution` is an object
|
|
170
|
+
`{ kind, ...parameters }`, declared as the union type `DistributionSpec`:
|
|
171
|
+
|
|
172
|
+
| `kind` | Parameters |
|
|
173
|
+
|---|---|
|
|
174
|
+
| `uniform` | `min`, `max` |
|
|
175
|
+
| `triangular` | `min`, `mode`, `max` |
|
|
176
|
+
| `pert` | `min`, `mode`, `max`, `lambda?` (default 4) |
|
|
177
|
+
| `normal` / `lognormal` | `mu`, `sigma` |
|
|
178
|
+
| `weibull` | `shape`, `scale` |
|
|
179
|
+
| `exponential` | `rate` |
|
|
180
|
+
| `gamma` | `shape`, `rate` |
|
|
181
|
+
| `beta` | `alpha`, `beta` |
|
|
182
|
+
| `chi_squared` | `k` |
|
|
183
|
+
|
|
184
|
+
| Function | Returns |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `distribution_cdf(distribution, x)` | `P(X ≤ x)` |
|
|
187
|
+
| `distribution_quantile(distribution, p)` | `x` with `P(X ≤ x) = p`, `p` strictly inside (0, 1) |
|
|
188
|
+
| `distribution_sample(distribution, n, seed)` | `Float64Array` of `n` variates — the same `(distribution, n, seed)` always gives the same values |
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
const { distribution_quantile, distribution_sample } = require("@iyulab/u-numflow");
|
|
192
|
+
distribution_quantile({ kind: "chi_squared", k: 4 }, 0.95); // 9.4877…
|
|
193
|
+
const lives = distribution_sample({ kind: "weibull", shape: 2, scale: 100 }, 1000, 42);
|
|
194
|
+
console.log(lives.length); // 1000
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Interval sets — each argument is a `[start, end][]` of half-open intervals, and every
|
|
198
|
+
result is in normal form (sorted, disjoint, touching pieces merged, empty ones dropped):
|
|
199
|
+
|
|
200
|
+
| Function | Returns |
|
|
201
|
+
|---|---|
|
|
202
|
+
| `interval_normalize(intervals)` | The union of `intervals`, as `[number, number][]` |
|
|
203
|
+
| `interval_measure(intervals)` | Its total length — each point counted once, however many rows cover it |
|
|
204
|
+
| `interval_union(a, b)` / `interval_intersection(a, b)` / `interval_difference(a, b)` | Set operations, as `[number, number][]`; clip to a window with `interval_intersection(a, [[from, to]])` |
|
|
205
|
+
|
|
206
|
+
```js
|
|
207
|
+
const { interval_union, interval_difference, interval_measure } = require("@iyulab/u-numflow");
|
|
208
|
+
const down = interval_union([[0, 24]], [[10, 30]]); // [[0, 30]] — the overlap counts once
|
|
209
|
+
const up = interval_difference([[0, 168]], down); // [[30, 168]]
|
|
210
|
+
console.log(interval_measure(up)); // 138
|
|
211
|
+
```
|
|
212
|
+
|
|
140
213
|
**Errors.** A refusal throws an `Error` whose `message` is readable text and which
|
|
141
214
|
carries a `code` naming the reason, next to the values behind it:
|
|
142
215
|
|
|
@@ -151,14 +224,17 @@ try {
|
|
|
151
224
|
|
|
152
225
|
| `code` | Fields | Meaning |
|
|
153
226
|
|---|---|---|
|
|
154
|
-
| `parameter_out_of_range` | `parameter`, `min`, `max` (or `null`), `got` | `p` not strictly inside (0, 1), or a degrees of freedom that is not a finite number `> 0` (both bounds excluded) |
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
227
|
+
| `parameter_out_of_range` | `parameter`, `min`, `max` (or `null`), `got` | `p` not strictly inside (0, 1), or a degrees of freedom that is not a finite number `> 0` (both bounds excluded); a distribution parameter that must be `> 0` (`parameter` is its path, e.g. `distribution.sigma`); `n` or `seed` not a whole number in range |
|
|
228
|
+
| `unknown_option` | `parameter`, `got`, `expected` | A `distribution.kind` the crate does not have |
|
|
229
|
+
| `invalid_option` | `parameter` | Distribution parameters out of order: `min < max`, `min ≤ mode ≤ max` |
|
|
230
|
+
| `malformed_input` | `parameter`, `index` (or absent) | A `data` argument that is not an array or `Float64Array`, or an element that is not a number; a `distribution` that is not an object with a string `kind`, lacks a parameter or has one its kind does not take; an interval row that is not two numbers (`parameter` is its path, e.g. `a[2]`) |
|
|
231
|
+
| `reversed_interval` | `parameter`, `index` | An interval row with start > end — refused, not swapped |
|
|
232
|
+
| `value_not_finite` | `parameter`, `index` for an array element | A NaN argument, or a NaN or infinity in any `data` array or interval row (`parameter` is the row's path) |
|
|
157
233
|
| `empty_input` | `parameter` | `mean` of no values |
|
|
158
|
-
| `non_positive_data` |
|
|
159
|
-
| `insufficient_data` | `parameter`, `min`, `got`
|
|
234
|
+
| `non_positive_data` | `parameter`, `index`, `got` | Box-Cox data with a value `≤ 0` — `index` is the first such value |
|
|
235
|
+
| `insufficient_data` | `parameter`, `min`, `got` | Fewer values than the function needs (`std_dev`/`variance` 2, Box-Cox 2) |
|
|
160
236
|
| `invalid_transform` | — | A Box-Cox result that is not finite |
|
|
161
|
-
| `invalid_lambda_range` |
|
|
237
|
+
| `invalid_lambda_range` | `parameter`, `min`, `max` | `estimate_lambda` bounds that are not finite with `lambda_min < lambda_max` (`min`/`max` are the bounds given) |
|
|
162
238
|
|
|
163
239
|
### TypeScript
|
|
164
240
|
|
package/node/u_numflow.cjs
CHANGED
|
@@ -61,6 +61,91 @@ function chi_squared_quantile(p, k) {
|
|
|
61
61
|
}
|
|
62
62
|
exports.chi_squared_quantile = chi_squared_quantile;
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* `P(X ≤ x)` for the distribution `{ kind, ...parameters }`.
|
|
66
|
+
*
|
|
67
|
+
* # Errors
|
|
68
|
+
* As every `distribution` argument: `malformed_input` for a value that is
|
|
69
|
+
* not such an object, `unknown_option` for an unknown `kind` (with
|
|
70
|
+
* `expected`), `value_not_finite` for a NaN or infinite parameter,
|
|
71
|
+
* `parameter_out_of_range` for a parameter that must be `> 0`, and
|
|
72
|
+
* `invalid_option` for parameters out of order (`min < max`,
|
|
73
|
+
* `min ≤ mode ≤ max`). `x` NaN throws `value_not_finite`.
|
|
74
|
+
* @param {DistributionSpec} distribution
|
|
75
|
+
* @param {number} x
|
|
76
|
+
* @returns {number}
|
|
77
|
+
*/
|
|
78
|
+
function distribution_cdf(distribution, x) {
|
|
79
|
+
const ret = wasm.distribution_cdf(distribution, x);
|
|
80
|
+
if (ret[2]) {
|
|
81
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
82
|
+
}
|
|
83
|
+
return ret[0];
|
|
84
|
+
}
|
|
85
|
+
exports.distribution_cdf = distribution_cdf;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Mean and variance of `distribution` — also the way to check a
|
|
89
|
+
* specification before using it.
|
|
90
|
+
*
|
|
91
|
+
* # Errors
|
|
92
|
+
* As [`distribution_cdf`] for `distribution`.
|
|
93
|
+
* @param {DistributionSpec} distribution
|
|
94
|
+
* @returns {MomentsDto}
|
|
95
|
+
*/
|
|
96
|
+
function distribution_moments(distribution) {
|
|
97
|
+
const ret = wasm.distribution_moments(distribution);
|
|
98
|
+
if (ret[2]) {
|
|
99
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
100
|
+
}
|
|
101
|
+
return takeFromExternrefTable0(ret[0]);
|
|
102
|
+
}
|
|
103
|
+
exports.distribution_moments = distribution_moments;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The `x` with `P(X ≤ x) = p`.
|
|
107
|
+
*
|
|
108
|
+
* # Errors
|
|
109
|
+
* As [`distribution_cdf`] for `distribution`; `p` outside `(0, 1)` throws
|
|
110
|
+
* `parameter_out_of_range`.
|
|
111
|
+
* @param {DistributionSpec} distribution
|
|
112
|
+
* @param {number} p
|
|
113
|
+
* @returns {number}
|
|
114
|
+
*/
|
|
115
|
+
function distribution_quantile(distribution, p) {
|
|
116
|
+
const ret = wasm.distribution_quantile(distribution, p);
|
|
117
|
+
if (ret[2]) {
|
|
118
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
119
|
+
}
|
|
120
|
+
return ret[0];
|
|
121
|
+
}
|
|
122
|
+
exports.distribution_quantile = distribution_quantile;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* `n` random variates, reproducible from `seed`: the same `(distribution, n,
|
|
126
|
+
* seed)` always returns the same values. Uniforms are drawn from the open
|
|
127
|
+
* interval (0, 1), so no variate is infinite.
|
|
128
|
+
*
|
|
129
|
+
* # Errors
|
|
130
|
+
* As [`distribution_cdf`] for `distribution`; `n` not a whole number in
|
|
131
|
+
* `[0, 2³² − 1]` or `seed` not a whole number in `[0, 2⁵³]` throws
|
|
132
|
+
* `parameter_out_of_range`.
|
|
133
|
+
* @param {DistributionSpec} distribution
|
|
134
|
+
* @param {number} n
|
|
135
|
+
* @param {number} seed
|
|
136
|
+
* @returns {Float64Array}
|
|
137
|
+
*/
|
|
138
|
+
function distribution_sample(distribution, n, seed) {
|
|
139
|
+
const ret = wasm.distribution_sample(distribution, n, seed);
|
|
140
|
+
if (ret[3]) {
|
|
141
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
142
|
+
}
|
|
143
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
144
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
145
|
+
return v1;
|
|
146
|
+
}
|
|
147
|
+
exports.distribution_sample = distribution_sample;
|
|
148
|
+
|
|
64
149
|
/**
|
|
65
150
|
* Estimate the optimal Box-Cox lambda via profile maximum likelihood.
|
|
66
151
|
*
|
|
@@ -126,6 +211,101 @@ function f_distribution_quantile(p, df1, df2) {
|
|
|
126
211
|
}
|
|
127
212
|
exports.f_distribution_quantile = f_distribution_quantile;
|
|
128
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Points in `a` but not in `b`, in normal form — e.g. a reporting window
|
|
216
|
+
* minus down-time is up-time.
|
|
217
|
+
*
|
|
218
|
+
* # Errors
|
|
219
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
220
|
+
* @param {[number, number][]} a
|
|
221
|
+
* @param {[number, number][]} b
|
|
222
|
+
* @returns {[number, number][]}
|
|
223
|
+
*/
|
|
224
|
+
function interval_difference(a, b) {
|
|
225
|
+
const ret = wasm.interval_difference(a, b);
|
|
226
|
+
if (ret[2]) {
|
|
227
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
228
|
+
}
|
|
229
|
+
return takeFromExternrefTable0(ret[0]);
|
|
230
|
+
}
|
|
231
|
+
exports.interval_difference = interval_difference;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Points in both `a` and `b`, in normal form. Clipping to a window is
|
|
235
|
+
* `interval_intersection(a, [[from, to]])`.
|
|
236
|
+
*
|
|
237
|
+
* # Errors
|
|
238
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
239
|
+
* @param {[number, number][]} a
|
|
240
|
+
* @param {[number, number][]} b
|
|
241
|
+
* @returns {[number, number][]}
|
|
242
|
+
*/
|
|
243
|
+
function interval_intersection(a, b) {
|
|
244
|
+
const ret = wasm.interval_intersection(a, b);
|
|
245
|
+
if (ret[2]) {
|
|
246
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
247
|
+
}
|
|
248
|
+
return takeFromExternrefTable0(ret[0]);
|
|
249
|
+
}
|
|
250
|
+
exports.interval_intersection = interval_intersection;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Total length of the union of `intervals`: each point counts once, however
|
|
254
|
+
* many rows cover it.
|
|
255
|
+
*
|
|
256
|
+
* # Errors
|
|
257
|
+
* As [`interval_normalize`].
|
|
258
|
+
* @param {[number, number][]} intervals
|
|
259
|
+
* @returns {number}
|
|
260
|
+
*/
|
|
261
|
+
function interval_measure(intervals) {
|
|
262
|
+
const ret = wasm.interval_measure(intervals);
|
|
263
|
+
if (ret[2]) {
|
|
264
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
265
|
+
}
|
|
266
|
+
return ret[0];
|
|
267
|
+
}
|
|
268
|
+
exports.interval_measure = interval_measure;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* The union of `intervals` (each `[start, end]`, half-open) in normal form:
|
|
272
|
+
* sorted, disjoint, touching pieces merged, empty ones dropped.
|
|
273
|
+
*
|
|
274
|
+
* # Errors
|
|
275
|
+
* Throws `malformed_input` for a row that is not two numbers (`parameter` is
|
|
276
|
+
* the row's path, e.g. `intervals[2]`), `value_not_finite` for a NaN or
|
|
277
|
+
* ±Infinity bound, and `reversed_interval` (`parameter`, `index`) for a row
|
|
278
|
+
* with start > end — reversed rows are refused, not swapped.
|
|
279
|
+
* @param {[number, number][]} intervals
|
|
280
|
+
* @returns {[number, number][]}
|
|
281
|
+
*/
|
|
282
|
+
function interval_normalize(intervals) {
|
|
283
|
+
const ret = wasm.interval_normalize(intervals);
|
|
284
|
+
if (ret[2]) {
|
|
285
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
286
|
+
}
|
|
287
|
+
return takeFromExternrefTable0(ret[0]);
|
|
288
|
+
}
|
|
289
|
+
exports.interval_normalize = interval_normalize;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Points in `a` or `b`, in normal form.
|
|
293
|
+
*
|
|
294
|
+
* # Errors
|
|
295
|
+
* As [`interval_normalize`], naming `a` or `b`.
|
|
296
|
+
* @param {[number, number][]} a
|
|
297
|
+
* @param {[number, number][]} b
|
|
298
|
+
* @returns {[number, number][]}
|
|
299
|
+
*/
|
|
300
|
+
function interval_union(a, b) {
|
|
301
|
+
const ret = wasm.interval_union(a, b);
|
|
302
|
+
if (ret[2]) {
|
|
303
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
304
|
+
}
|
|
305
|
+
return takeFromExternrefTable0(ret[0]);
|
|
306
|
+
}
|
|
307
|
+
exports.interval_union = interval_union;
|
|
308
|
+
|
|
129
309
|
/**
|
|
130
310
|
* Standard normal quantile Φ⁻¹(p): the `z` with `P(Z ≤ z) = p`.
|
|
131
311
|
*
|
|
@@ -290,6 +470,10 @@ exports.variance = variance;
|
|
|
290
470
|
function __wbg_get_imports() {
|
|
291
471
|
const import0 = {
|
|
292
472
|
__proto__: null,
|
|
473
|
+
__wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
|
|
474
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
475
|
+
return ret;
|
|
476
|
+
},
|
|
293
477
|
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
294
478
|
const ret = String(arg1);
|
|
295
479
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -297,10 +481,53 @@ function __wbg_get_imports() {
|
|
|
297
481
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
298
482
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
299
483
|
},
|
|
484
|
+
__wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c: function(arg0, arg1) {
|
|
485
|
+
const v = arg1;
|
|
486
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
487
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
488
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
489
|
+
},
|
|
490
|
+
__wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
|
|
491
|
+
const v = arg0;
|
|
492
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
493
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
494
|
+
},
|
|
495
|
+
__wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
|
|
496
|
+
const ret = debugString(arg1);
|
|
497
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
498
|
+
const len1 = WASM_VECTOR_LEN;
|
|
499
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
500
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
501
|
+
},
|
|
502
|
+
__wbg___wbindgen_in_92f62ee1427d9e49: function(arg0, arg1) {
|
|
503
|
+
const ret = arg0 in arg1;
|
|
504
|
+
return ret;
|
|
505
|
+
},
|
|
506
|
+
__wbg___wbindgen_is_bigint_b123553bed3bb382: function(arg0) {
|
|
507
|
+
const ret = typeof(arg0) === 'bigint';
|
|
508
|
+
return ret;
|
|
509
|
+
},
|
|
510
|
+
__wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
|
|
511
|
+
const ret = typeof(arg0) === 'function';
|
|
512
|
+
return ret;
|
|
513
|
+
},
|
|
300
514
|
__wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
|
|
301
515
|
const ret = arg0 === null;
|
|
302
516
|
return ret;
|
|
303
517
|
},
|
|
518
|
+
__wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
|
|
519
|
+
const val = arg0;
|
|
520
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
521
|
+
return ret;
|
|
522
|
+
},
|
|
523
|
+
__wbg___wbindgen_jsval_eq_02babf21faa37971: function(arg0, arg1) {
|
|
524
|
+
const ret = arg0 === arg1;
|
|
525
|
+
return ret;
|
|
526
|
+
},
|
|
527
|
+
__wbg___wbindgen_jsval_loose_eq_677f21e468d6b461: function(arg0, arg1) {
|
|
528
|
+
const ret = arg0 == arg1;
|
|
529
|
+
return ret;
|
|
530
|
+
},
|
|
304
531
|
__wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
|
|
305
532
|
const obj = arg1;
|
|
306
533
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
@@ -322,10 +549,44 @@ function __wbg_get_imports() {
|
|
|
322
549
|
const ret = typeof arg0;
|
|
323
550
|
return ret;
|
|
324
551
|
},
|
|
552
|
+
__wbg_call_6137034ef55c9d0f: function() { return handleError(function (arg0, arg1) {
|
|
553
|
+
const ret = arg0.call(arg1);
|
|
554
|
+
return ret;
|
|
555
|
+
}, arguments); },
|
|
556
|
+
__wbg_done_b41a1d26cdb37fb6: function(arg0) {
|
|
557
|
+
const ret = arg0.done;
|
|
558
|
+
return ret;
|
|
559
|
+
},
|
|
560
|
+
__wbg_entries_fb6397112b1de25f: function(arg0) {
|
|
561
|
+
const ret = Object.entries(arg0);
|
|
562
|
+
return ret;
|
|
563
|
+
},
|
|
564
|
+
__wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
|
|
565
|
+
const ret = Reflect.get(arg0, arg1);
|
|
566
|
+
return ret;
|
|
567
|
+
}, arguments); },
|
|
568
|
+
__wbg_get_658f6698067d9515: function() { return handleError(function (arg0, arg1) {
|
|
569
|
+
const ret = Reflect.get(arg0, arg1);
|
|
570
|
+
return ret;
|
|
571
|
+
}, arguments); },
|
|
572
|
+
__wbg_get_6c896e0571ddae51: function(arg0, arg1) {
|
|
573
|
+
const ret = arg0[arg1 >>> 0];
|
|
574
|
+
return ret;
|
|
575
|
+
},
|
|
325
576
|
__wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
|
|
326
577
|
const ret = arg0[arg1 >>> 0];
|
|
327
578
|
return ret;
|
|
328
579
|
},
|
|
580
|
+
__wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
|
|
581
|
+
let result;
|
|
582
|
+
try {
|
|
583
|
+
result = arg0 instanceof ArrayBuffer;
|
|
584
|
+
} catch (_) {
|
|
585
|
+
result = false;
|
|
586
|
+
}
|
|
587
|
+
const ret = result;
|
|
588
|
+
return ret;
|
|
589
|
+
},
|
|
329
590
|
__wbg_instanceof_Float64Array_8a59377f9eec1b8b: function(arg0) {
|
|
330
591
|
let result;
|
|
331
592
|
try {
|
|
@@ -336,10 +597,42 @@ function __wbg_get_imports() {
|
|
|
336
597
|
const ret = result;
|
|
337
598
|
return ret;
|
|
338
599
|
},
|
|
600
|
+
__wbg_instanceof_Map_b2611749102d7ba3: function(arg0) {
|
|
601
|
+
let result;
|
|
602
|
+
try {
|
|
603
|
+
result = arg0 instanceof Map;
|
|
604
|
+
} catch (_) {
|
|
605
|
+
result = false;
|
|
606
|
+
}
|
|
607
|
+
const ret = result;
|
|
608
|
+
return ret;
|
|
609
|
+
},
|
|
610
|
+
__wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
|
|
611
|
+
let result;
|
|
612
|
+
try {
|
|
613
|
+
result = arg0 instanceof Uint8Array;
|
|
614
|
+
} catch (_) {
|
|
615
|
+
result = false;
|
|
616
|
+
}
|
|
617
|
+
const ret = result;
|
|
618
|
+
return ret;
|
|
619
|
+
},
|
|
339
620
|
__wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
|
|
340
621
|
const ret = Array.isArray(arg0);
|
|
341
622
|
return ret;
|
|
342
623
|
},
|
|
624
|
+
__wbg_isSafeInteger_717808ad6a54bd9e: function(arg0) {
|
|
625
|
+
const ret = Number.isSafeInteger(arg0);
|
|
626
|
+
return ret;
|
|
627
|
+
},
|
|
628
|
+
__wbg_iterator_e3c31c892080e444: function() {
|
|
629
|
+
const ret = Symbol.iterator;
|
|
630
|
+
return ret;
|
|
631
|
+
},
|
|
632
|
+
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
633
|
+
const ret = arg0.length;
|
|
634
|
+
return ret;
|
|
635
|
+
},
|
|
343
636
|
__wbg_length_b5f0008bbf60cf59: function(arg0) {
|
|
344
637
|
const ret = arg0.length;
|
|
345
638
|
return ret;
|
|
@@ -348,6 +641,10 @@ function __wbg_get_imports() {
|
|
|
348
641
|
const ret = arg0.length;
|
|
349
642
|
return ret;
|
|
350
643
|
},
|
|
644
|
+
__wbg_new_1dbf7428bba60a42: function(arg0) {
|
|
645
|
+
const ret = new Uint8Array(arg0);
|
|
646
|
+
return ret;
|
|
647
|
+
},
|
|
351
648
|
__wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
|
|
352
649
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
353
650
|
return ret;
|
|
@@ -356,9 +653,32 @@ function __wbg_get_imports() {
|
|
|
356
653
|
const ret = new Object();
|
|
357
654
|
return ret;
|
|
358
655
|
},
|
|
656
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
657
|
+
const ret = new Array();
|
|
658
|
+
return ret;
|
|
659
|
+
},
|
|
660
|
+
__wbg_next_33784799010f1bbe: function(arg0) {
|
|
661
|
+
const ret = arg0.next;
|
|
662
|
+
return ret;
|
|
663
|
+
},
|
|
664
|
+
__wbg_next_f4aac29c42af995c: function() { return handleError(function (arg0) {
|
|
665
|
+
const ret = arg0.next();
|
|
666
|
+
return ret;
|
|
667
|
+
}, arguments); },
|
|
668
|
+
__wbg_of_20798cb14708764f: function(arg0, arg1) {
|
|
669
|
+
const ret = Array.of(arg0, arg1);
|
|
670
|
+
return ret;
|
|
671
|
+
},
|
|
672
|
+
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
673
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
674
|
+
},
|
|
359
675
|
__wbg_prototypesetcall_d49a4fab5ca427bc: function(arg0, arg1, arg2) {
|
|
360
676
|
Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
|
|
361
677
|
},
|
|
678
|
+
__wbg_push_2baf45db356cf468: function(arg0, arg1) {
|
|
679
|
+
const ret = arg0.push(arg1);
|
|
680
|
+
return ret;
|
|
681
|
+
},
|
|
362
682
|
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
363
683
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
364
684
|
return ret;
|
|
@@ -366,16 +686,30 @@ function __wbg_get_imports() {
|
|
|
366
686
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
367
687
|
arg0[arg1] = arg2;
|
|
368
688
|
},
|
|
689
|
+
__wbg_value_f3c585ee8f5ba40c: function(arg0) {
|
|
690
|
+
const ret = arg0.value;
|
|
691
|
+
return ret;
|
|
692
|
+
},
|
|
369
693
|
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
370
694
|
// Cast intrinsic for `F64 -> Externref`.
|
|
371
695
|
const ret = arg0;
|
|
372
696
|
return ret;
|
|
373
697
|
},
|
|
374
|
-
__wbindgen_generic_0000000000000002: function(arg0
|
|
698
|
+
__wbindgen_generic_0000000000000002: function(arg0) {
|
|
699
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
700
|
+
const ret = arg0;
|
|
701
|
+
return ret;
|
|
702
|
+
},
|
|
703
|
+
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
375
704
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
376
705
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
377
706
|
return ret;
|
|
378
707
|
},
|
|
708
|
+
__wbindgen_generic_0000000000000004: function(arg0) {
|
|
709
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
710
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
711
|
+
return ret;
|
|
712
|
+
},
|
|
379
713
|
__wbindgen_init_externref_table: function() {
|
|
380
714
|
const table = wasm.__wbindgen_externrefs;
|
|
381
715
|
const offset = table.grow(4);
|
|
@@ -398,11 +732,81 @@ function addToExternrefTable0(obj) {
|
|
|
398
732
|
return idx;
|
|
399
733
|
}
|
|
400
734
|
|
|
735
|
+
function debugString(val) {
|
|
736
|
+
// primitive types
|
|
737
|
+
const type = typeof val;
|
|
738
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
739
|
+
return `${val}`;
|
|
740
|
+
}
|
|
741
|
+
if (type == 'string') {
|
|
742
|
+
return `"${val}"`;
|
|
743
|
+
}
|
|
744
|
+
if (type == 'symbol') {
|
|
745
|
+
const description = val.description;
|
|
746
|
+
if (description == null) {
|
|
747
|
+
return 'Symbol';
|
|
748
|
+
} else {
|
|
749
|
+
return `Symbol(${description})`;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
if (type == 'function') {
|
|
753
|
+
const name = val.name;
|
|
754
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
755
|
+
return `Function(${name})`;
|
|
756
|
+
} else {
|
|
757
|
+
return 'Function';
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
// objects
|
|
761
|
+
if (Array.isArray(val)) {
|
|
762
|
+
const length = val.length;
|
|
763
|
+
let debug = '[';
|
|
764
|
+
if (length > 0) {
|
|
765
|
+
debug += debugString(val[0]);
|
|
766
|
+
}
|
|
767
|
+
for(let i = 1; i < length; i++) {
|
|
768
|
+
debug += ', ' + debugString(val[i]);
|
|
769
|
+
}
|
|
770
|
+
debug += ']';
|
|
771
|
+
return debug;
|
|
772
|
+
}
|
|
773
|
+
// Test for built-in
|
|
774
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
775
|
+
let className;
|
|
776
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
777
|
+
className = builtInMatches[1];
|
|
778
|
+
} else {
|
|
779
|
+
// Failed to match the standard '[object ClassName]'
|
|
780
|
+
return toString.call(val);
|
|
781
|
+
}
|
|
782
|
+
if (className == 'Object') {
|
|
783
|
+
// we're a user defined class or Object
|
|
784
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
785
|
+
// easier than looping through ownProperties of `val`.
|
|
786
|
+
try {
|
|
787
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
788
|
+
} catch (_) {
|
|
789
|
+
return 'Object';
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
// errors
|
|
793
|
+
if (val instanceof Error) {
|
|
794
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
795
|
+
}
|
|
796
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
797
|
+
return className;
|
|
798
|
+
}
|
|
799
|
+
|
|
401
800
|
function getArrayF64FromWasm0(ptr, len) {
|
|
402
801
|
ptr = ptr >>> 0;
|
|
403
802
|
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
404
803
|
}
|
|
405
804
|
|
|
805
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
806
|
+
ptr = ptr >>> 0;
|
|
807
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
808
|
+
}
|
|
809
|
+
|
|
406
810
|
let cachedDataViewMemory0 = null;
|
|
407
811
|
function getDataViewMemory0() {
|
|
408
812
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|