@iyulab/u-doe 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 iyulab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # u-doe
2
+
3
+ Design of Experiments (DOE) library for Rust — classical design generation, effect estimation, RSM, and multi-response optimization.
4
+
5
+ ## Features
6
+
7
+ - **Design Generation**: Full factorial (2^k), fractional factorial (2^(k-p)), Plackett-Burman screening, Central Composite Design (CCD), Box-Behnken, Taguchi orthogonal arrays, Definitive Screening Design (DSD)
8
+ - **Analysis**: Effect estimation (main effects + 2FI), half-normal plot data, DOE ANOVA with F-statistics and p-values, Taguchi S/N ratio analysis
9
+ - **Response Surface Methodology**: Second-order OLS model fitting, steepest ascent path
10
+ - **Power & Sample Size**: Two-level factorial power, required replicates, power curves
11
+ - **Multi-response Optimization**: Derringer-Suich desirability functions
12
+ - **Coding**: Actual ↔ coded value transformation (Encoder)
13
+
14
+ ## Quick Start
15
+
16
+ ```toml
17
+ [dependencies]
18
+ u-doe = "0.2"
19
+ ```
20
+
21
+ ## Examples
22
+
23
+ ### 2^4 Full Factorial Design
24
+
25
+ ```rust
26
+ use u_doe::design::factorial::full_factorial;
27
+ use u_doe::analysis::effects::estimate_effects;
28
+
29
+ let design = full_factorial(4).unwrap(); // 16 runs, Yates order
30
+ let responses = vec![
31
+ 45.0, 71.0, 48.0, 65.0, 68.0, 60.0, 80.0, 65.0,
32
+ 43.0, 100.0, 45.0, 104.0, 75.0, 86.0, 70.0, 96.0,
33
+ ];
34
+
35
+ let effects = estimate_effects(&design, &responses, 2).unwrap();
36
+ // Prints A = 21.625, AC = -18.125, ...
37
+ for e in &effects {
38
+ println!("{}: {:.3}", e.name, e.estimate);
39
+ }
40
+ ```
41
+
42
+ ### Response Surface Methodology
43
+
44
+ ```rust
45
+ use u_doe::design::ccd::{ccd, AlphaType};
46
+ use u_doe::analysis::rsm::{fit_rsm, steepest_ascent};
47
+
48
+ let design = ccd(2, AlphaType::Rotatable, 3).unwrap();
49
+ let responses = vec![/* measured values */];
50
+ // let model = fit_rsm(&design, &responses).unwrap();
51
+ // let path = steepest_ascent(&model, 5, 0.5);
52
+ ```
53
+
54
+ ### Multi-response Desirability
55
+
56
+ ```rust
57
+ use u_doe::optimization::desirability::{ResponseSpec, overall_desirability};
58
+
59
+ let specs = vec![
60
+ ResponseSpec::maximize(50.0, 100.0, 100.0, 1.0),
61
+ ResponseSpec::minimize(0.0, 0.0, 30.0, 1.0),
62
+ ];
63
+ let d = overall_desirability(&specs, &[80.0, 10.0]);
64
+ println!("Overall desirability: {d:.3}");
65
+ ```
66
+
67
+ ### Taguchi S/N Ratio
68
+
69
+ ```rust
70
+ use u_doe::analysis::taguchi_sn::{signal_to_noise, sn_factor_effects, SnGoal};
71
+ use u_doe::design::factorial::full_factorial;
72
+
73
+ // Replicated responses per run (e.g., 3 replicates each)
74
+ let responses = vec![
75
+ vec![10.0, 11.0, 10.5], // run 1
76
+ vec![20.0, 21.0, 19.5], // run 2
77
+ vec![15.0, 14.5, 15.5], // run 3
78
+ vec![25.0, 26.0, 24.5], // run 4
79
+ ];
80
+ let sn_values = signal_to_noise(&responses, SnGoal::LargerIsBetter).unwrap();
81
+
82
+ let design = full_factorial(2).unwrap();
83
+ let effects = sn_factor_effects(&design, &sn_values).unwrap();
84
+ for e in &effects {
85
+ println!("Factor {}: optimal level {}, Δ = {:.2} dB",
86
+ e.factor_index, e.optimal_level, e.delta);
87
+ }
88
+ ```
89
+
90
+ ### Power & Sample Size
91
+
92
+ ```rust
93
+ use u_doe::power::{two_level_factorial_power, required_replicates};
94
+
95
+ // Power for a 2^3 full factorial, detecting effect of 2σ with α=0.05
96
+ let power = two_level_factorial_power(3, 0, 2, 2.0, 1.0, 0.05);
97
+ println!("Power = {power:.3}"); // ~0.95 at n=2 replicates
98
+
99
+ // Minimum replicates to achieve 80% power
100
+ let n = required_replicates(3, 0, 2.0, 1.0, 0.05, 0.80, 10);
101
+ println!("Required replicates: {n}");
102
+ ```
103
+
104
+ ## Design Types
105
+
106
+ | Design | Function | Use Case |
107
+ |--------|----------|----------|
108
+ | Full Factorial | `full_factorial(k)` | k = 2..7, all factor combinations |
109
+ | Fractional Factorial | `fractional_factorial(k, p)` | Screening, k=3..7, p=1..3 |
110
+ | Plackett-Burman | `plackett_burman(k)` | Screening, k ≤ 19, N = 8/12/16/20 |
111
+ | CCD | `ccd(k, alpha, n_center)` | RSM, k = 2..6 |
112
+ | Box-Behnken | `box_behnken(k, n_center)` | RSM, k = 3/4/5 |
113
+ | Taguchi | `taguchi_array(name, k)` | Robust design, L4–L27 |
114
+ | DSD | `definitive_screening(k)` | Screening + quadratic, k = 2..12, 2k+1 runs |
115
+
116
+ ## References
117
+
118
+ - Montgomery, D.C. (2019). *Introduction to Statistical Quality Control*, 8th ed. Wiley.
119
+ - Derringer, G. & Suich, R. (1980). Simultaneous Optimization of Several Response Variables. *Journal of Quality Technology* 12(4), 214–219.
120
+ - Plackett, R.L. & Burman, J.P. (1946). The Design of Optimum Multifactorial Experiments. *Biometrika* 33(4), 305–325.
121
+ - Jones, B. & Nachtsheim, C.J. (2011). A Class of Three-Level Designs for Definitive Screening in the Presence of Second-Order Effects. *Journal of Quality Technology* 43(1), 1–15.
122
+ - Taguchi, G. (1986). *Introduction to Quality Engineering*. Asian Productivity Organization.
123
+
124
+ ## Related
125
+
126
+ - [`u-analytics`](https://crates.io/crates/u-analytics) — SPC, process capability, statistical analysis
127
+ - [`u-numflow`](https://crates.io/crates/u-numflow) — Math primitives (used internally)
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@iyulab/u-doe",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "iyulab"
6
+ ],
7
+ "description": "Design of Experiments (DOE) framework: factorial, Plackett-Burman, CCD, Box-Behnken, Taguchi, effects analysis, RSM, and desirability optimization.",
8
+ "version": "0.2.0",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/iyulab/u-doe"
13
+ },
14
+ "files": [
15
+ "u_doe_bg.wasm",
16
+ "u_doe.js",
17
+ "u_doe_bg.js",
18
+ "u_doe.d.ts"
19
+ ],
20
+ "main": "u_doe.js",
21
+ "types": "u_doe.d.ts",
22
+ "sideEffects": [
23
+ "./u_doe.js",
24
+ "./snippets/*"
25
+ ],
26
+ "keywords": [
27
+ "doe",
28
+ "design-of-experiments",
29
+ "rsm",
30
+ "factorial",
31
+ "statistics"
32
+ ]
33
+ }
package/u_doe.d.ts ADDED
@@ -0,0 +1,110 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Generate a Box-Behnken Design (BBD).
6
+ *
7
+ * Supported: k = 3, 4, or 5.
8
+ *
9
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
10
+ *
11
+ * # Errors
12
+ * Returns an error string if `k` is not 3, 4, or 5, or `n_center == 0`.
13
+ */
14
+ export function box_behnken(k: number, n_center: number): any;
15
+
16
+ /**
17
+ * Generate a Central Composite Design (CCD).
18
+ *
19
+ * `design_type`: `"FaceCentered"` | `"Rotatable"` | `"Inscribed"`
20
+ *
21
+ * `n_center`: number of center point replicates (≥ 1, default 3 if 0 is passed is rejected).
22
+ *
23
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
24
+ *
25
+ * # Errors
26
+ * Returns an error string if `k` is out of range (2..=6), `n_center == 0`,
27
+ * or `design_type` is unrecognised.
28
+ */
29
+ export function ccd(k: number, design_type: string, n_center: number): any;
30
+
31
+ /**
32
+ * Generate a Definitive Screening Design (DSD).
33
+ *
34
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
35
+ *
36
+ * # Errors
37
+ * Returns an error string if `k` is out of the supported range.
38
+ */
39
+ export function definitive_screening(k: number): any;
40
+
41
+ /**
42
+ * Perform DOE ANOVA.
43
+ *
44
+ * `design_json`: JSON array-of-arrays `[[f64]]` — the coded design matrix (rows = runs).
45
+ * `responses`: flat array of response values, one per run.
46
+ * `factor_names_json`: JSON array of factor name strings used as column labels.
47
+ * `effect_names_json`: JSON array of effect names to include (e.g. `["A","B","AB"]`).
48
+ *
49
+ * Returns an ANOVA result object with `effects`, `residual_ss`, `residual_df`,
50
+ * `total_ss`, `r_squared`, `r_squared_adj`.
51
+ *
52
+ * # Errors
53
+ * Returns an error string if dimensions do not match or JSON is malformed.
54
+ */
55
+ export function doe_anova(design_json: any, responses: Float64Array, factor_names_json: any, effect_names_json: any): any;
56
+
57
+ /**
58
+ * Generate a 2^k full factorial design.
59
+ *
60
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
61
+ *
62
+ * # Errors
63
+ * Returns an error string if `k` is out of range (1..=7).
64
+ */
65
+ export function full_factorial(k: number): any;
66
+
67
+ /**
68
+ * Compute Taguchi Signal-to-Noise ratios.
69
+ *
70
+ * `responses_json`: JSON array-of-arrays `[[f64]]` — one inner array per run,
71
+ * containing the replicate measurements for that run.
72
+ * `goal`: `"LargerIsBetter"` | `"SmallerIsBetter"` | `"NominalIsBest"`
73
+ *
74
+ * Returns a flat `[f64]` of SN values in dB, one per run.
75
+ *
76
+ * # Errors
77
+ * Returns an error string if the goal string is unrecognised, or if the
78
+ * response data violates the requirements for the chosen goal.
79
+ */
80
+ export function signal_to_noise(responses_json: any, goal: string): any;
81
+
82
+ /**
83
+ * Get a Taguchi orthogonal array.
84
+ *
85
+ * `name`: `"L4"` | `"L8"` | `"L9"` | `"L12"` | `"L16"` | `"L18"` | `"L27"`
86
+ *
87
+ * `k`: number of factors to use (must be ≤ max columns for the array).
88
+ *
89
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
90
+ *
91
+ * # Errors
92
+ * Returns an error string if the array name is unknown or `k` exceeds capacity.
93
+ */
94
+ export function taguchi_array(name: string, k: number): any;
95
+
96
+ /**
97
+ * Compute the statistical power of a 2^(k-p) factorial design.
98
+ *
99
+ * Uses the normal approximation. Returns power in [0, 1], or 0.0 for invalid
100
+ * inputs (k=0, p≥k, n_replicates=0, effect_size≤0, sigma≤0).
101
+ *
102
+ * # Arguments
103
+ * * `k` — total number of factors
104
+ * * `p` — number of generators (p=0 = full factorial)
105
+ * * `n_replicates` — number of replicates
106
+ * * `effect_size` — detectable effect δ (in response units)
107
+ * * `sigma` — process standard deviation σ
108
+ * * `alpha` — type-I error rate (e.g. 0.05)
109
+ */
110
+ export function two_level_factorial_power(k: number, p: number, n_replicates: number, effect_size: number, sigma: number, alpha: number): number;
package/u_doe.js ADDED
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./u_doe.d.ts" */
2
+
3
+ import * as wasm from "./u_doe_bg.wasm";
4
+ import { __wbg_set_wasm } from "./u_doe_bg.js";
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ box_behnken, ccd, definitive_screening, doe_anova, full_factorial, signal_to_noise, taguchi_array, two_level_factorial_power
9
+ } from "./u_doe_bg.js";
package/u_doe_bg.js ADDED
@@ -0,0 +1,553 @@
1
+ /**
2
+ * Generate a Box-Behnken Design (BBD).
3
+ *
4
+ * Supported: k = 3, 4, or 5.
5
+ *
6
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
7
+ *
8
+ * # Errors
9
+ * Returns an error string if `k` is not 3, 4, or 5, or `n_center == 0`.
10
+ * @param {number} k
11
+ * @param {number} n_center
12
+ * @returns {any}
13
+ */
14
+ export function box_behnken(k, n_center) {
15
+ const ret = wasm.box_behnken(k, n_center);
16
+ if (ret[2]) {
17
+ throw takeFromExternrefTable0(ret[1]);
18
+ }
19
+ return takeFromExternrefTable0(ret[0]);
20
+ }
21
+
22
+ /**
23
+ * Generate a Central Composite Design (CCD).
24
+ *
25
+ * `design_type`: `"FaceCentered"` | `"Rotatable"` | `"Inscribed"`
26
+ *
27
+ * `n_center`: number of center point replicates (≥ 1, default 3 if 0 is passed is rejected).
28
+ *
29
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
30
+ *
31
+ * # Errors
32
+ * Returns an error string if `k` is out of range (2..=6), `n_center == 0`,
33
+ * or `design_type` is unrecognised.
34
+ * @param {number} k
35
+ * @param {string} design_type
36
+ * @param {number} n_center
37
+ * @returns {any}
38
+ */
39
+ export function ccd(k, design_type, n_center) {
40
+ const ptr0 = passStringToWasm0(design_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
41
+ const len0 = WASM_VECTOR_LEN;
42
+ const ret = wasm.ccd(k, ptr0, len0, n_center);
43
+ if (ret[2]) {
44
+ throw takeFromExternrefTable0(ret[1]);
45
+ }
46
+ return takeFromExternrefTable0(ret[0]);
47
+ }
48
+
49
+ /**
50
+ * Generate a Definitive Screening Design (DSD).
51
+ *
52
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
53
+ *
54
+ * # Errors
55
+ * Returns an error string if `k` is out of the supported range.
56
+ * @param {number} k
57
+ * @returns {any}
58
+ */
59
+ export function definitive_screening(k) {
60
+ const ret = wasm.definitive_screening(k);
61
+ if (ret[2]) {
62
+ throw takeFromExternrefTable0(ret[1]);
63
+ }
64
+ return takeFromExternrefTable0(ret[0]);
65
+ }
66
+
67
+ /**
68
+ * Perform DOE ANOVA.
69
+ *
70
+ * `design_json`: JSON array-of-arrays `[[f64]]` — the coded design matrix (rows = runs).
71
+ * `responses`: flat array of response values, one per run.
72
+ * `factor_names_json`: JSON array of factor name strings used as column labels.
73
+ * `effect_names_json`: JSON array of effect names to include (e.g. `["A","B","AB"]`).
74
+ *
75
+ * Returns an ANOVA result object with `effects`, `residual_ss`, `residual_df`,
76
+ * `total_ss`, `r_squared`, `r_squared_adj`.
77
+ *
78
+ * # Errors
79
+ * Returns an error string if dimensions do not match or JSON is malformed.
80
+ * @param {any} design_json
81
+ * @param {Float64Array} responses
82
+ * @param {any} factor_names_json
83
+ * @param {any} effect_names_json
84
+ * @returns {any}
85
+ */
86
+ export function doe_anova(design_json, responses, factor_names_json, effect_names_json) {
87
+ const ptr0 = passArrayF64ToWasm0(responses, wasm.__wbindgen_malloc);
88
+ const len0 = WASM_VECTOR_LEN;
89
+ const ret = wasm.doe_anova(design_json, ptr0, len0, factor_names_json, effect_names_json);
90
+ if (ret[2]) {
91
+ throw takeFromExternrefTable0(ret[1]);
92
+ }
93
+ return takeFromExternrefTable0(ret[0]);
94
+ }
95
+
96
+ /**
97
+ * Generate a 2^k full factorial design.
98
+ *
99
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
100
+ *
101
+ * # Errors
102
+ * Returns an error string if `k` is out of range (1..=7).
103
+ * @param {number} k
104
+ * @returns {any}
105
+ */
106
+ export function full_factorial(k) {
107
+ const ret = wasm.full_factorial(k);
108
+ if (ret[2]) {
109
+ throw takeFromExternrefTable0(ret[1]);
110
+ }
111
+ return takeFromExternrefTable0(ret[0]);
112
+ }
113
+
114
+ /**
115
+ * Compute Taguchi Signal-to-Noise ratios.
116
+ *
117
+ * `responses_json`: JSON array-of-arrays `[[f64]]` — one inner array per run,
118
+ * containing the replicate measurements for that run.
119
+ * `goal`: `"LargerIsBetter"` | `"SmallerIsBetter"` | `"NominalIsBest"`
120
+ *
121
+ * Returns a flat `[f64]` of SN values in dB, one per run.
122
+ *
123
+ * # Errors
124
+ * Returns an error string if the goal string is unrecognised, or if the
125
+ * response data violates the requirements for the chosen goal.
126
+ * @param {any} responses_json
127
+ * @param {string} goal
128
+ * @returns {any}
129
+ */
130
+ export function signal_to_noise(responses_json, goal) {
131
+ const ptr0 = passStringToWasm0(goal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
132
+ const len0 = WASM_VECTOR_LEN;
133
+ const ret = wasm.signal_to_noise(responses_json, ptr0, len0);
134
+ if (ret[2]) {
135
+ throw takeFromExternrefTable0(ret[1]);
136
+ }
137
+ return takeFromExternrefTable0(ret[0]);
138
+ }
139
+
140
+ /**
141
+ * Get a Taguchi orthogonal array.
142
+ *
143
+ * `name`: `"L4"` | `"L8"` | `"L9"` | `"L12"` | `"L16"` | `"L18"` | `"L27"`
144
+ *
145
+ * `k`: number of factors to use (must be ≤ max columns for the array).
146
+ *
147
+ * Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
148
+ *
149
+ * # Errors
150
+ * Returns an error string if the array name is unknown or `k` exceeds capacity.
151
+ * @param {string} name
152
+ * @param {number} k
153
+ * @returns {any}
154
+ */
155
+ export function taguchi_array(name, k) {
156
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
157
+ const len0 = WASM_VECTOR_LEN;
158
+ const ret = wasm.taguchi_array(ptr0, len0, k);
159
+ if (ret[2]) {
160
+ throw takeFromExternrefTable0(ret[1]);
161
+ }
162
+ return takeFromExternrefTable0(ret[0]);
163
+ }
164
+
165
+ /**
166
+ * Compute the statistical power of a 2^(k-p) factorial design.
167
+ *
168
+ * Uses the normal approximation. Returns power in [0, 1], or 0.0 for invalid
169
+ * inputs (k=0, p≥k, n_replicates=0, effect_size≤0, sigma≤0).
170
+ *
171
+ * # Arguments
172
+ * * `k` — total number of factors
173
+ * * `p` — number of generators (p=0 = full factorial)
174
+ * * `n_replicates` — number of replicates
175
+ * * `effect_size` — detectable effect δ (in response units)
176
+ * * `sigma` — process standard deviation σ
177
+ * * `alpha` — type-I error rate (e.g. 0.05)
178
+ * @param {number} k
179
+ * @param {number} p
180
+ * @param {number} n_replicates
181
+ * @param {number} effect_size
182
+ * @param {number} sigma
183
+ * @param {number} alpha
184
+ * @returns {number}
185
+ */
186
+ export function two_level_factorial_power(k, p, n_replicates, effect_size, sigma, alpha) {
187
+ const ret = wasm.two_level_factorial_power(k, p, n_replicates, effect_size, sigma, alpha);
188
+ return ret;
189
+ }
190
+ export function __wbg_Error_83742b46f01ce22d(arg0, arg1) {
191
+ const ret = Error(getStringFromWasm0(arg0, arg1));
192
+ return ret;
193
+ }
194
+ export function __wbg_String_8564e559799eccda(arg0, arg1) {
195
+ const ret = String(arg1);
196
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
+ const len1 = WASM_VECTOR_LEN;
198
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
199
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
200
+ }
201
+ export function __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1(arg0) {
202
+ const v = arg0;
203
+ const ret = typeof(v) === 'boolean' ? v : undefined;
204
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
205
+ }
206
+ export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
207
+ const ret = debugString(arg1);
208
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ const len1 = WASM_VECTOR_LEN;
210
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
211
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
212
+ }
213
+ export function __wbg___wbindgen_is_function_3c846841762788c1(arg0) {
214
+ const ret = typeof(arg0) === 'function';
215
+ return ret;
216
+ }
217
+ export function __wbg___wbindgen_is_object_781bc9f159099513(arg0) {
218
+ const val = arg0;
219
+ const ret = typeof(val) === 'object' && val !== null;
220
+ return ret;
221
+ }
222
+ export function __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b(arg0, arg1) {
223
+ const ret = arg0 == arg1;
224
+ return ret;
225
+ }
226
+ export function __wbg___wbindgen_number_get_34bb9d9dcfa21373(arg0, arg1) {
227
+ const obj = arg1;
228
+ const ret = typeof(obj) === 'number' ? obj : undefined;
229
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
230
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
231
+ }
232
+ export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
233
+ const obj = arg1;
234
+ const ret = typeof(obj) === 'string' ? obj : undefined;
235
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
+ var len1 = WASM_VECTOR_LEN;
237
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
238
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
239
+ }
240
+ export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
241
+ throw new Error(getStringFromWasm0(arg0, arg1));
242
+ }
243
+ export function __wbg_call_e133b57c9155d22c() { return handleError(function (arg0, arg1) {
244
+ const ret = arg0.call(arg1);
245
+ return ret;
246
+ }, arguments); }
247
+ export function __wbg_done_08ce71ee07e3bd17(arg0) {
248
+ const ret = arg0.done;
249
+ return ret;
250
+ }
251
+ export function __wbg_get_326e41e095fb2575() { return handleError(function (arg0, arg1) {
252
+ const ret = Reflect.get(arg0, arg1);
253
+ return ret;
254
+ }, arguments); }
255
+ export function __wbg_get_unchecked_329cfe50afab7352(arg0, arg1) {
256
+ const ret = arg0[arg1 >>> 0];
257
+ return ret;
258
+ }
259
+ export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
260
+ let result;
261
+ try {
262
+ result = arg0 instanceof ArrayBuffer;
263
+ } catch (_) {
264
+ result = false;
265
+ }
266
+ const ret = result;
267
+ return ret;
268
+ }
269
+ export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
270
+ let result;
271
+ try {
272
+ result = arg0 instanceof Uint8Array;
273
+ } catch (_) {
274
+ result = false;
275
+ }
276
+ const ret = result;
277
+ return ret;
278
+ }
279
+ export function __wbg_isArray_33b91feb269ff46e(arg0) {
280
+ const ret = Array.isArray(arg0);
281
+ return ret;
282
+ }
283
+ export function __wbg_iterator_d8f549ec8fb061b1() {
284
+ const ret = Symbol.iterator;
285
+ return ret;
286
+ }
287
+ export function __wbg_length_b3416cf66a5452c8(arg0) {
288
+ const ret = arg0.length;
289
+ return ret;
290
+ }
291
+ export function __wbg_length_ea16607d7b61445b(arg0) {
292
+ const ret = arg0.length;
293
+ return ret;
294
+ }
295
+ export function __wbg_new_5f486cdf45a04d78(arg0) {
296
+ const ret = new Uint8Array(arg0);
297
+ return ret;
298
+ }
299
+ export function __wbg_new_a70fbab9066b301f() {
300
+ const ret = new Array();
301
+ return ret;
302
+ }
303
+ export function __wbg_new_ab79df5bd7c26067() {
304
+ const ret = new Object();
305
+ return ret;
306
+ }
307
+ export function __wbg_next_11b99ee6237339e3() { return handleError(function (arg0) {
308
+ const ret = arg0.next();
309
+ return ret;
310
+ }, arguments); }
311
+ export function __wbg_next_e01a967809d1aa68(arg0) {
312
+ const ret = arg0.next;
313
+ return ret;
314
+ }
315
+ export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
316
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
317
+ }
318
+ export function __wbg_set_282384002438957f(arg0, arg1, arg2) {
319
+ arg0[arg1 >>> 0] = arg2;
320
+ }
321
+ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
322
+ arg0[arg1] = arg2;
323
+ }
324
+ export function __wbg_value_21fc78aab0322612(arg0) {
325
+ const ret = arg0.value;
326
+ return ret;
327
+ }
328
+ export function __wbindgen_cast_0000000000000001(arg0) {
329
+ // Cast intrinsic for `F64 -> Externref`.
330
+ const ret = arg0;
331
+ return ret;
332
+ }
333
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
334
+ // Cast intrinsic for `Ref(String) -> Externref`.
335
+ const ret = getStringFromWasm0(arg0, arg1);
336
+ return ret;
337
+ }
338
+ export function __wbindgen_cast_0000000000000003(arg0) {
339
+ // Cast intrinsic for `U64 -> Externref`.
340
+ const ret = BigInt.asUintN(64, arg0);
341
+ return ret;
342
+ }
343
+ export function __wbindgen_init_externref_table() {
344
+ const table = wasm.__wbindgen_externrefs;
345
+ const offset = table.grow(4);
346
+ table.set(0, undefined);
347
+ table.set(offset + 0, undefined);
348
+ table.set(offset + 1, null);
349
+ table.set(offset + 2, true);
350
+ table.set(offset + 3, false);
351
+ }
352
+ function addToExternrefTable0(obj) {
353
+ const idx = wasm.__externref_table_alloc();
354
+ wasm.__wbindgen_externrefs.set(idx, obj);
355
+ return idx;
356
+ }
357
+
358
+ function debugString(val) {
359
+ // primitive types
360
+ const type = typeof val;
361
+ if (type == 'number' || type == 'boolean' || val == null) {
362
+ return `${val}`;
363
+ }
364
+ if (type == 'string') {
365
+ return `"${val}"`;
366
+ }
367
+ if (type == 'symbol') {
368
+ const description = val.description;
369
+ if (description == null) {
370
+ return 'Symbol';
371
+ } else {
372
+ return `Symbol(${description})`;
373
+ }
374
+ }
375
+ if (type == 'function') {
376
+ const name = val.name;
377
+ if (typeof name == 'string' && name.length > 0) {
378
+ return `Function(${name})`;
379
+ } else {
380
+ return 'Function';
381
+ }
382
+ }
383
+ // objects
384
+ if (Array.isArray(val)) {
385
+ const length = val.length;
386
+ let debug = '[';
387
+ if (length > 0) {
388
+ debug += debugString(val[0]);
389
+ }
390
+ for(let i = 1; i < length; i++) {
391
+ debug += ', ' + debugString(val[i]);
392
+ }
393
+ debug += ']';
394
+ return debug;
395
+ }
396
+ // Test for built-in
397
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
398
+ let className;
399
+ if (builtInMatches && builtInMatches.length > 1) {
400
+ className = builtInMatches[1];
401
+ } else {
402
+ // Failed to match the standard '[object ClassName]'
403
+ return toString.call(val);
404
+ }
405
+ if (className == 'Object') {
406
+ // we're a user defined class or Object
407
+ // JSON.stringify avoids problems with cycles, and is generally much
408
+ // easier than looping through ownProperties of `val`.
409
+ try {
410
+ return 'Object(' + JSON.stringify(val) + ')';
411
+ } catch (_) {
412
+ return 'Object';
413
+ }
414
+ }
415
+ // errors
416
+ if (val instanceof Error) {
417
+ return `${val.name}: ${val.message}\n${val.stack}`;
418
+ }
419
+ // TODO we could test for more things here, like `Set`s and `Map`s.
420
+ return className;
421
+ }
422
+
423
+ function getArrayU8FromWasm0(ptr, len) {
424
+ ptr = ptr >>> 0;
425
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
426
+ }
427
+
428
+ let cachedDataViewMemory0 = null;
429
+ function getDataViewMemory0() {
430
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
431
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
432
+ }
433
+ return cachedDataViewMemory0;
434
+ }
435
+
436
+ let cachedFloat64ArrayMemory0 = null;
437
+ function getFloat64ArrayMemory0() {
438
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
439
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
440
+ }
441
+ return cachedFloat64ArrayMemory0;
442
+ }
443
+
444
+ function getStringFromWasm0(ptr, len) {
445
+ ptr = ptr >>> 0;
446
+ return decodeText(ptr, len);
447
+ }
448
+
449
+ let cachedUint8ArrayMemory0 = null;
450
+ function getUint8ArrayMemory0() {
451
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
452
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
453
+ }
454
+ return cachedUint8ArrayMemory0;
455
+ }
456
+
457
+ function handleError(f, args) {
458
+ try {
459
+ return f.apply(this, args);
460
+ } catch (e) {
461
+ const idx = addToExternrefTable0(e);
462
+ wasm.__wbindgen_exn_store(idx);
463
+ }
464
+ }
465
+
466
+ function isLikeNone(x) {
467
+ return x === undefined || x === null;
468
+ }
469
+
470
+ function passArrayF64ToWasm0(arg, malloc) {
471
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
472
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
473
+ WASM_VECTOR_LEN = arg.length;
474
+ return ptr;
475
+ }
476
+
477
+ function passStringToWasm0(arg, malloc, realloc) {
478
+ if (realloc === undefined) {
479
+ const buf = cachedTextEncoder.encode(arg);
480
+ const ptr = malloc(buf.length, 1) >>> 0;
481
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
482
+ WASM_VECTOR_LEN = buf.length;
483
+ return ptr;
484
+ }
485
+
486
+ let len = arg.length;
487
+ let ptr = malloc(len, 1) >>> 0;
488
+
489
+ const mem = getUint8ArrayMemory0();
490
+
491
+ let offset = 0;
492
+
493
+ for (; offset < len; offset++) {
494
+ const code = arg.charCodeAt(offset);
495
+ if (code > 0x7F) break;
496
+ mem[ptr + offset] = code;
497
+ }
498
+ if (offset !== len) {
499
+ if (offset !== 0) {
500
+ arg = arg.slice(offset);
501
+ }
502
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
503
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
504
+ const ret = cachedTextEncoder.encodeInto(arg, view);
505
+
506
+ offset += ret.written;
507
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
508
+ }
509
+
510
+ WASM_VECTOR_LEN = offset;
511
+ return ptr;
512
+ }
513
+
514
+ function takeFromExternrefTable0(idx) {
515
+ const value = wasm.__wbindgen_externrefs.get(idx);
516
+ wasm.__externref_table_dealloc(idx);
517
+ return value;
518
+ }
519
+
520
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
521
+ cachedTextDecoder.decode();
522
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
523
+ let numBytesDecoded = 0;
524
+ function decodeText(ptr, len) {
525
+ numBytesDecoded += len;
526
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
527
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
528
+ cachedTextDecoder.decode();
529
+ numBytesDecoded = len;
530
+ }
531
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
532
+ }
533
+
534
+ const cachedTextEncoder = new TextEncoder();
535
+
536
+ if (!('encodeInto' in cachedTextEncoder)) {
537
+ cachedTextEncoder.encodeInto = function (arg, view) {
538
+ const buf = cachedTextEncoder.encode(arg);
539
+ view.set(buf);
540
+ return {
541
+ read: arg.length,
542
+ written: buf.length
543
+ };
544
+ };
545
+ }
546
+
547
+ let WASM_VECTOR_LEN = 0;
548
+
549
+
550
+ let wasm;
551
+ export function __wbg_set_wasm(val) {
552
+ wasm = val;
553
+ }
package/u_doe_bg.wasm ADDED
Binary file