@eveshipfit/dogma-engine 11.2.0 → 12.0.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 +6 -5
- package/esf_dogma_engine.d.ts +46 -2
- package/esf_dogma_engine.js +666 -8
- package/esf_dogma_engine_bg.wasm +0 -0
- package/package.json +1 -3
- package/esf_dogma_engine_bg.js +0 -563
package/README.md
CHANGED
|
@@ -199,15 +199,16 @@ The WebAssembly variant is published on npm as
|
|
|
199
199
|
[`@eveshipfit/dogma-engine`](https://www.npmjs.com/package/@eveshipfit/dogma-engine).
|
|
200
200
|
[`@eveshipfit/sde`](https://www.npmjs.com/package/@eveshipfit/sde) ships `sde.dat` in its `dist` folder; serve or bundle that file.
|
|
201
201
|
|
|
202
|
-
The package is
|
|
202
|
+
The package is an ES module with TypeScript types included, and it runs anywhere: under a bundler
|
|
203
|
+
(Vite, webpack, ...), from a CDN, or in a plain `<script type="module">`.
|
|
204
|
+
Its default export loads the WebAssembly and has to be awaited once before any other function is called.
|
|
203
205
|
|
|
204
206
|
```bash
|
|
205
207
|
npm install @eveshipfit/dogma-engine @eveshipfit/sde
|
|
206
208
|
```
|
|
207
209
|
|
|
208
210
|
```js
|
|
209
|
-
import {
|
|
210
|
-
init,
|
|
211
|
+
import wasmInit, {
|
|
211
212
|
load_sde,
|
|
212
213
|
load_eft,
|
|
213
214
|
save_eft,
|
|
@@ -216,7 +217,7 @@ import {
|
|
|
216
217
|
beacon,
|
|
217
218
|
} from "@eveshipfit/dogma-engine";
|
|
218
219
|
|
|
219
|
-
|
|
220
|
+
await wasmInit();
|
|
220
221
|
|
|
221
222
|
const sde = await fetch("/sde.dat").then((response) => response.arrayBuffer());
|
|
222
223
|
const buildNumber = load_sde(new Uint8Array(sde));
|
|
@@ -366,7 +367,7 @@ This is done with [wasm-pack](https://rustwasm.github.io/wasm-pack/):
|
|
|
366
367
|
|
|
367
368
|
```bash
|
|
368
369
|
cargo install wasm-pack
|
|
369
|
-
wasm-pack build crates/esf-wasm --release --out-dir ../../pkg
|
|
370
|
+
wasm-pack build crates/esf-wasm --release --target web --out-dir ../../pkg
|
|
370
371
|
```
|
|
371
372
|
|
|
372
373
|
In the `pkg` folder is now a NPM module to use.
|
package/esf_dogma_engine.d.ts
CHANGED
|
@@ -437,8 +437,6 @@ export function beacon(type_id: number): Projection;
|
|
|
437
437
|
*/
|
|
438
438
|
export function calculate(fit: Fit, options?: Options | null): Calculation;
|
|
439
439
|
|
|
440
|
-
export function init(): void;
|
|
441
|
-
|
|
442
440
|
/**
|
|
443
441
|
* Load a fit from EFT, the text format EVE copies a fit to the clipboard in.
|
|
444
442
|
*/
|
|
@@ -462,8 +460,54 @@ export function load_sde(bytes: Uint8Array): number;
|
|
|
462
460
|
*/
|
|
463
461
|
export function save_eft(fit: Fit): string;
|
|
464
462
|
|
|
463
|
+
export function set_panic_hook(): void;
|
|
464
|
+
|
|
465
465
|
/**
|
|
466
466
|
* Report the fitting rules the fit breaks. Calculates the fit itself, as
|
|
467
467
|
* every rule reads the values after skills and modules changed them.
|
|
468
468
|
*/
|
|
469
469
|
export function validate(fit: Fit): Violation[];
|
|
470
|
+
|
|
471
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
472
|
+
|
|
473
|
+
export interface InitOutput {
|
|
474
|
+
readonly memory: WebAssembly.Memory;
|
|
475
|
+
readonly beacon: (a: number) => [number, number, number];
|
|
476
|
+
readonly calculate: (a: any, b: number) => [number, number, number];
|
|
477
|
+
readonly load_eft: (a: number, b: number) => [number, number, number];
|
|
478
|
+
readonly load_names: (a: number, b: number) => [number, number, number];
|
|
479
|
+
readonly load_sde: (a: number, b: number) => [number, number, number];
|
|
480
|
+
readonly save_eft: (a: any) => [number, number, number, number];
|
|
481
|
+
readonly set_panic_hook: () => void;
|
|
482
|
+
readonly validate: (a: any) => [number, number, number];
|
|
483
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
484
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
485
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
486
|
+
readonly __externref_table_alloc: () => number;
|
|
487
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
488
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
489
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
490
|
+
readonly __wbindgen_start: () => void;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
497
|
+
* a precompiled `WebAssembly.Module`.
|
|
498
|
+
*
|
|
499
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
500
|
+
*
|
|
501
|
+
* @returns {InitOutput}
|
|
502
|
+
*/
|
|
503
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
507
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
508
|
+
*
|
|
509
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
510
|
+
*
|
|
511
|
+
* @returns {Promise<InitOutput>}
|
|
512
|
+
*/
|
|
513
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/esf_dogma_engine.js
CHANGED
|
@@ -1,9 +1,667 @@
|
|
|
1
1
|
/* @ts-self-types="./esf_dogma_engine.d.ts" */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What a beacon in space hands to every fit in there with it. Put the result
|
|
5
|
+
* in `incoming` of a fit to have it applied.
|
|
6
|
+
* @param {number} type_id
|
|
7
|
+
* @returns {Projection}
|
|
8
|
+
*/
|
|
9
|
+
export function beacon(type_id) {
|
|
10
|
+
const ret = wasm.beacon(type_id);
|
|
11
|
+
if (ret[2]) {
|
|
12
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
13
|
+
}
|
|
14
|
+
return takeFromExternrefTable0(ret[0]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `options` may be left out; it then uses the defaults.
|
|
19
|
+
* @param {Fit} fit
|
|
20
|
+
* @param {Options | null} [options]
|
|
21
|
+
* @returns {Calculation}
|
|
22
|
+
*/
|
|
23
|
+
export function calculate(fit, options) {
|
|
24
|
+
const ret = wasm.calculate(fit, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
25
|
+
if (ret[2]) {
|
|
26
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
27
|
+
}
|
|
28
|
+
return takeFromExternrefTable0(ret[0]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Load a fit from EFT, the text format EVE copies a fit to the clipboard in.
|
|
33
|
+
* @param {string} eft
|
|
34
|
+
* @returns {Fit}
|
|
35
|
+
*/
|
|
36
|
+
export function load_eft(eft) {
|
|
37
|
+
const ptr0 = passStringToWasm0(eft, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
38
|
+
const len0 = WASM_VECTOR_LEN;
|
|
39
|
+
const ret = wasm.load_eft(ptr0, len0);
|
|
40
|
+
if (ret[2]) {
|
|
41
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
42
|
+
}
|
|
43
|
+
return takeFromExternrefTable0(ret[0]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Load `names.dat`, so an EFT written in another language than English also
|
|
48
|
+
* imports. Optional; without it only English names match. Has to be called
|
|
49
|
+
* after `load_sde`, and calling it twice is an error.
|
|
50
|
+
* @param {Uint8Array} bytes
|
|
51
|
+
* @returns {number}
|
|
52
|
+
*/
|
|
53
|
+
export function load_names(bytes) {
|
|
54
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
55
|
+
const len0 = WASM_VECTOR_LEN;
|
|
56
|
+
const ret = wasm.load_names(ptr0, len0);
|
|
57
|
+
if (ret[2]) {
|
|
58
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
59
|
+
}
|
|
60
|
+
return ret[0];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Load `sde.dat`. Has to be called before `calculate`; calling it twice is an
|
|
65
|
+
* error, as the first buffer is borrowed for the rest of the session.
|
|
66
|
+
* @param {Uint8Array} bytes
|
|
67
|
+
* @returns {number}
|
|
68
|
+
*/
|
|
69
|
+
export function load_sde(bytes) {
|
|
70
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
71
|
+
const len0 = WASM_VECTOR_LEN;
|
|
72
|
+
const ret = wasm.load_sde(ptr0, len0);
|
|
73
|
+
if (ret[2]) {
|
|
74
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
75
|
+
}
|
|
76
|
+
return ret[0];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Write a fit as EFT, the text format EVE copies a fit to the clipboard in.
|
|
81
|
+
* @param {Fit} fit
|
|
82
|
+
* @returns {string}
|
|
83
|
+
*/
|
|
84
|
+
export function save_eft(fit) {
|
|
85
|
+
let deferred2_0;
|
|
86
|
+
let deferred2_1;
|
|
87
|
+
try {
|
|
88
|
+
const ret = wasm.save_eft(fit);
|
|
89
|
+
var ptr1 = ret[0];
|
|
90
|
+
var len1 = ret[1];
|
|
91
|
+
if (ret[3]) {
|
|
92
|
+
ptr1 = 0; len1 = 0;
|
|
93
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
94
|
+
}
|
|
95
|
+
deferred2_0 = ptr1;
|
|
96
|
+
deferred2_1 = len1;
|
|
97
|
+
return getStringFromWasm0(ptr1, len1);
|
|
98
|
+
} finally {
|
|
99
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function set_panic_hook() {
|
|
104
|
+
wasm.set_panic_hook();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Report the fitting rules the fit breaks. Calculates the fit itself, as
|
|
109
|
+
* every rule reads the values after skills and modules changed them.
|
|
110
|
+
* @param {Fit} fit
|
|
111
|
+
* @returns {Violation[]}
|
|
112
|
+
*/
|
|
113
|
+
export function validate(fit) {
|
|
114
|
+
const ret = wasm.validate(fit);
|
|
115
|
+
if (ret[2]) {
|
|
116
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
117
|
+
}
|
|
118
|
+
return takeFromExternrefTable0(ret[0]);
|
|
119
|
+
}
|
|
120
|
+
function __wbg_get_imports() {
|
|
121
|
+
const import0 = {
|
|
122
|
+
__proto__: null,
|
|
123
|
+
__wbg_Error_67e7344beaa85059: function(arg0, arg1) {
|
|
124
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
125
|
+
return ret;
|
|
126
|
+
},
|
|
127
|
+
__wbg_Number_c54e7112a3fa7e3e: function(arg0) {
|
|
128
|
+
const ret = Number(arg0);
|
|
129
|
+
return ret;
|
|
130
|
+
},
|
|
131
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
132
|
+
const ret = String(arg1);
|
|
133
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
134
|
+
const len1 = WASM_VECTOR_LEN;
|
|
135
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
136
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
137
|
+
},
|
|
138
|
+
__wbg___wbindgen_bigint_get_as_i64_b482365c149396c8: function(arg0, arg1) {
|
|
139
|
+
const v = arg1;
|
|
140
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
141
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
142
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
143
|
+
},
|
|
144
|
+
__wbg___wbindgen_boolean_get_7a12af2b3f899c5a: function(arg0) {
|
|
145
|
+
const v = arg0;
|
|
146
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
147
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
148
|
+
},
|
|
149
|
+
__wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
|
|
150
|
+
const ret = debugString(arg1);
|
|
151
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
152
|
+
const len1 = WASM_VECTOR_LEN;
|
|
153
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
154
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
155
|
+
},
|
|
156
|
+
__wbg___wbindgen_in_50072d4d6e45c193: function(arg0, arg1) {
|
|
157
|
+
const ret = arg0 in arg1;
|
|
158
|
+
return ret;
|
|
159
|
+
},
|
|
160
|
+
__wbg___wbindgen_is_bigint_60fc0336cb14f5d7: function(arg0) {
|
|
161
|
+
const ret = typeof(arg0) === 'bigint';
|
|
162
|
+
return ret;
|
|
163
|
+
},
|
|
164
|
+
__wbg___wbindgen_is_function_fcda5e3902d732fe: function(arg0) {
|
|
165
|
+
const ret = typeof(arg0) === 'function';
|
|
166
|
+
return ret;
|
|
167
|
+
},
|
|
168
|
+
__wbg___wbindgen_is_object_edb6b15aa3afe12e: function(arg0) {
|
|
169
|
+
const val = arg0;
|
|
170
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
171
|
+
return ret;
|
|
172
|
+
},
|
|
173
|
+
__wbg___wbindgen_is_string_c4f7cb494a2a21f1: function(arg0) {
|
|
174
|
+
const ret = typeof(arg0) === 'string';
|
|
175
|
+
return ret;
|
|
176
|
+
},
|
|
177
|
+
__wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
|
|
178
|
+
const ret = arg0 === undefined;
|
|
179
|
+
return ret;
|
|
180
|
+
},
|
|
181
|
+
__wbg___wbindgen_jsval_eq_9fdcd3c0a860dd3b: function(arg0, arg1) {
|
|
182
|
+
const ret = arg0 === arg1;
|
|
183
|
+
return ret;
|
|
184
|
+
},
|
|
185
|
+
__wbg___wbindgen_jsval_loose_eq_3c30021c243b64cd: function(arg0, arg1) {
|
|
186
|
+
const ret = arg0 == arg1;
|
|
187
|
+
return ret;
|
|
188
|
+
},
|
|
189
|
+
__wbg___wbindgen_number_get_1dc732b810cb937c: function(arg0, arg1) {
|
|
190
|
+
const obj = arg1;
|
|
191
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
192
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
193
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
194
|
+
},
|
|
195
|
+
__wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
|
|
196
|
+
const obj = arg1;
|
|
197
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
198
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
199
|
+
var len1 = WASM_VECTOR_LEN;
|
|
200
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
201
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
202
|
+
},
|
|
203
|
+
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
204
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
205
|
+
},
|
|
206
|
+
__wbg_call_269c5566fbede3eb: function() { return handleError(function (arg0, arg1) {
|
|
207
|
+
const ret = arg0.call(arg1);
|
|
208
|
+
return ret;
|
|
209
|
+
}, arguments); },
|
|
210
|
+
__wbg_done_cffed884d87aa22e: function(arg0) {
|
|
211
|
+
const ret = arg0.done;
|
|
212
|
+
return ret;
|
|
213
|
+
},
|
|
214
|
+
__wbg_entries_972a87586902cf87: function(arg0) {
|
|
215
|
+
const ret = Object.entries(arg0);
|
|
216
|
+
return ret;
|
|
217
|
+
},
|
|
218
|
+
__wbg_error_757e9472f8410341: function(arg0, arg1) {
|
|
219
|
+
let deferred0_0;
|
|
220
|
+
let deferred0_1;
|
|
221
|
+
try {
|
|
222
|
+
deferred0_0 = arg0;
|
|
223
|
+
deferred0_1 = arg1;
|
|
224
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
225
|
+
} finally {
|
|
226
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
__wbg_get_6cf5a4d4d8ad3c5a: function() { return handleError(function (arg0, arg1) {
|
|
230
|
+
const ret = Reflect.get(arg0, arg1);
|
|
231
|
+
return ret;
|
|
232
|
+
}, arguments); },
|
|
233
|
+
__wbg_get_b1f0ab13c737f856: function(arg0, arg1) {
|
|
234
|
+
const ret = arg0[arg1 >>> 0];
|
|
235
|
+
return ret;
|
|
236
|
+
},
|
|
237
|
+
__wbg_get_unchecked_363572bdd397d473: function(arg0, arg1) {
|
|
238
|
+
const ret = arg0[arg1 >>> 0];
|
|
239
|
+
return ret;
|
|
240
|
+
},
|
|
241
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
242
|
+
const ret = arg0[arg1];
|
|
243
|
+
return ret;
|
|
244
|
+
},
|
|
245
|
+
__wbg_instanceof_ArrayBuffer_d4ff01f8247925ae: function(arg0) {
|
|
246
|
+
let result;
|
|
247
|
+
try {
|
|
248
|
+
result = arg0 instanceof ArrayBuffer;
|
|
249
|
+
} catch (_) {
|
|
250
|
+
result = false;
|
|
251
|
+
}
|
|
252
|
+
const ret = result;
|
|
253
|
+
return ret;
|
|
254
|
+
},
|
|
255
|
+
__wbg_instanceof_Map_1ff6a2b54c899f0d: function(arg0) {
|
|
256
|
+
let result;
|
|
257
|
+
try {
|
|
258
|
+
result = arg0 instanceof Map;
|
|
259
|
+
} catch (_) {
|
|
260
|
+
result = false;
|
|
261
|
+
}
|
|
262
|
+
const ret = result;
|
|
263
|
+
return ret;
|
|
264
|
+
},
|
|
265
|
+
__wbg_instanceof_Uint8Array_598adc0fef426aa8: function(arg0) {
|
|
266
|
+
let result;
|
|
267
|
+
try {
|
|
268
|
+
result = arg0 instanceof Uint8Array;
|
|
269
|
+
} catch (_) {
|
|
270
|
+
result = false;
|
|
271
|
+
}
|
|
272
|
+
const ret = result;
|
|
273
|
+
return ret;
|
|
274
|
+
},
|
|
275
|
+
__wbg_isArray_5674713bb7b79043: function(arg0) {
|
|
276
|
+
const ret = Array.isArray(arg0);
|
|
277
|
+
return ret;
|
|
278
|
+
},
|
|
279
|
+
__wbg_isSafeInteger_8f51c743827d1ec5: function(arg0) {
|
|
280
|
+
const ret = Number.isSafeInteger(arg0);
|
|
281
|
+
return ret;
|
|
282
|
+
},
|
|
283
|
+
__wbg_iterator_22ddeb808cf55a6f: function() {
|
|
284
|
+
const ret = Symbol.iterator;
|
|
285
|
+
return ret;
|
|
286
|
+
},
|
|
287
|
+
__wbg_length_31bdaf014f5fbde2: function(arg0) {
|
|
288
|
+
const ret = arg0.length;
|
|
289
|
+
return ret;
|
|
290
|
+
},
|
|
291
|
+
__wbg_length_4e1adc0d42e23620: function(arg0) {
|
|
292
|
+
const ret = arg0.length;
|
|
293
|
+
return ret;
|
|
294
|
+
},
|
|
295
|
+
__wbg_new_1da3429bc3c4541c: function(arg0) {
|
|
296
|
+
const ret = new Uint8Array(arg0);
|
|
297
|
+
return ret;
|
|
298
|
+
},
|
|
299
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
300
|
+
const ret = new Error();
|
|
301
|
+
return ret;
|
|
302
|
+
},
|
|
303
|
+
__wbg_new_8d36e20aa758e411: function() {
|
|
304
|
+
const ret = new Map();
|
|
305
|
+
return ret;
|
|
306
|
+
},
|
|
307
|
+
__wbg_new_bebc3f4757acf305: function() {
|
|
308
|
+
const ret = new Object();
|
|
309
|
+
return ret;
|
|
310
|
+
},
|
|
311
|
+
__wbg_new_ffa92086ea89f79c: function() {
|
|
312
|
+
const ret = new Array();
|
|
313
|
+
return ret;
|
|
314
|
+
},
|
|
315
|
+
__wbg_next_95053e306b1c3aed: function(arg0) {
|
|
316
|
+
const ret = arg0.next;
|
|
317
|
+
return ret;
|
|
318
|
+
},
|
|
319
|
+
__wbg_next_f31ecb8646d2c605: function() { return handleError(function (arg0) {
|
|
320
|
+
const ret = arg0.next();
|
|
321
|
+
return ret;
|
|
322
|
+
}, arguments); },
|
|
323
|
+
__wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
|
|
324
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
325
|
+
},
|
|
326
|
+
__wbg_set_13d25b81ab403f5e: function(arg0, arg1, arg2) {
|
|
327
|
+
arg0[arg1 >>> 0] = arg2;
|
|
328
|
+
},
|
|
329
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
330
|
+
arg0[arg1] = arg2;
|
|
331
|
+
},
|
|
332
|
+
__wbg_set_bf6dde4923b9b059: function(arg0, arg1, arg2) {
|
|
333
|
+
const ret = arg0.set(arg1, arg2);
|
|
334
|
+
return ret;
|
|
335
|
+
},
|
|
336
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
337
|
+
const ret = arg1.stack;
|
|
338
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
339
|
+
const len1 = WASM_VECTOR_LEN;
|
|
340
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
341
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
342
|
+
},
|
|
343
|
+
__wbg_value_c227f843d21da141: function(arg0) {
|
|
344
|
+
const ret = arg0.value;
|
|
345
|
+
return ret;
|
|
346
|
+
},
|
|
347
|
+
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
348
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
349
|
+
const ret = arg0;
|
|
350
|
+
return ret;
|
|
351
|
+
},
|
|
352
|
+
__wbindgen_generic_0000000000000002: function(arg0) {
|
|
353
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
354
|
+
const ret = arg0;
|
|
355
|
+
return ret;
|
|
356
|
+
},
|
|
357
|
+
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
358
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
359
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
360
|
+
return ret;
|
|
361
|
+
},
|
|
362
|
+
__wbindgen_generic_0000000000000004: function(arg0) {
|
|
363
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
364
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
365
|
+
return ret;
|
|
366
|
+
},
|
|
367
|
+
__wbindgen_init_externref_table: function() {
|
|
368
|
+
const table = wasm.__wbindgen_externrefs;
|
|
369
|
+
const offset = table.grow(4);
|
|
370
|
+
table.set(0, undefined);
|
|
371
|
+
table.set(offset + 0, undefined);
|
|
372
|
+
table.set(offset + 1, null);
|
|
373
|
+
table.set(offset + 2, true);
|
|
374
|
+
table.set(offset + 3, false);
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
return {
|
|
378
|
+
__proto__: null,
|
|
379
|
+
"./esf_dogma_engine_bg.js": import0,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function addToExternrefTable0(obj) {
|
|
384
|
+
const idx = wasm.__externref_table_alloc();
|
|
385
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
386
|
+
return idx;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function debugString(val) {
|
|
390
|
+
// primitive types
|
|
391
|
+
const type = typeof val;
|
|
392
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
393
|
+
return `${val}`;
|
|
394
|
+
}
|
|
395
|
+
if (type == 'string') {
|
|
396
|
+
return `"${val}"`;
|
|
397
|
+
}
|
|
398
|
+
if (type == 'symbol') {
|
|
399
|
+
const description = val.description;
|
|
400
|
+
if (description == null) {
|
|
401
|
+
return 'Symbol';
|
|
402
|
+
} else {
|
|
403
|
+
return `Symbol(${description})`;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (type == 'function') {
|
|
407
|
+
const name = val.name;
|
|
408
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
409
|
+
return `Function(${name})`;
|
|
410
|
+
} else {
|
|
411
|
+
return 'Function';
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// objects
|
|
415
|
+
if (Array.isArray(val)) {
|
|
416
|
+
const length = val.length;
|
|
417
|
+
let debug = '[';
|
|
418
|
+
if (length > 0) {
|
|
419
|
+
debug += debugString(val[0]);
|
|
420
|
+
}
|
|
421
|
+
for(let i = 1; i < length; i++) {
|
|
422
|
+
debug += ', ' + debugString(val[i]);
|
|
423
|
+
}
|
|
424
|
+
debug += ']';
|
|
425
|
+
return debug;
|
|
426
|
+
}
|
|
427
|
+
// Test for built-in
|
|
428
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
429
|
+
let className;
|
|
430
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
431
|
+
className = builtInMatches[1];
|
|
432
|
+
} else {
|
|
433
|
+
// Failed to match the standard '[object ClassName]'
|
|
434
|
+
return toString.call(val);
|
|
435
|
+
}
|
|
436
|
+
if (className == 'Object') {
|
|
437
|
+
// we're a user defined class or Object
|
|
438
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
439
|
+
// easier than looping through ownProperties of `val`.
|
|
440
|
+
try {
|
|
441
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
442
|
+
} catch (_) {
|
|
443
|
+
return 'Object';
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
// errors
|
|
447
|
+
if (val instanceof Error) {
|
|
448
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
449
|
+
}
|
|
450
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
451
|
+
return className;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
455
|
+
ptr = ptr >>> 0;
|
|
456
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
let cachedDataViewMemory0 = null;
|
|
460
|
+
function getDataViewMemory0() {
|
|
461
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
462
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
463
|
+
}
|
|
464
|
+
return cachedDataViewMemory0;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function getStringFromWasm0(ptr, len) {
|
|
468
|
+
return decodeText(ptr >>> 0, len);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
let cachedUint8ArrayMemory0 = null;
|
|
472
|
+
function getUint8ArrayMemory0() {
|
|
473
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
474
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
475
|
+
}
|
|
476
|
+
return cachedUint8ArrayMemory0;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function handleError(f, args) {
|
|
480
|
+
try {
|
|
481
|
+
return f.apply(this, args);
|
|
482
|
+
} catch (e) {
|
|
483
|
+
const idx = addToExternrefTable0(e);
|
|
484
|
+
wasm.__wbindgen_exn_store(idx);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function isLikeNone(x) {
|
|
489
|
+
return x === undefined || x === null;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
493
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
494
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
495
|
+
WASM_VECTOR_LEN = arg.length;
|
|
496
|
+
return ptr;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
500
|
+
if (realloc === undefined) {
|
|
501
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
502
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
503
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
504
|
+
WASM_VECTOR_LEN = buf.length;
|
|
505
|
+
return ptr;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
let len = arg.length;
|
|
509
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
510
|
+
|
|
511
|
+
const mem = getUint8ArrayMemory0();
|
|
512
|
+
|
|
513
|
+
let offset = 0;
|
|
514
|
+
|
|
515
|
+
for (; offset < len; offset++) {
|
|
516
|
+
const code = arg.charCodeAt(offset);
|
|
517
|
+
if (code > 0x7F) break;
|
|
518
|
+
mem[ptr + offset] = code;
|
|
519
|
+
}
|
|
520
|
+
if (offset !== len) {
|
|
521
|
+
if (offset !== 0) {
|
|
522
|
+
arg = arg.slice(offset);
|
|
523
|
+
}
|
|
524
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
525
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
526
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
527
|
+
|
|
528
|
+
offset += ret.written;
|
|
529
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
WASM_VECTOR_LEN = offset;
|
|
533
|
+
return ptr;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function takeFromExternrefTable0(idx) {
|
|
537
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
538
|
+
wasm.__externref_table_dealloc(idx);
|
|
539
|
+
return value;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
543
|
+
cachedTextDecoder.decode();
|
|
544
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
545
|
+
let numBytesDecoded = 0;
|
|
546
|
+
function decodeText(ptr, len) {
|
|
547
|
+
numBytesDecoded += len;
|
|
548
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
549
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
550
|
+
cachedTextDecoder.decode();
|
|
551
|
+
numBytesDecoded = len;
|
|
552
|
+
}
|
|
553
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const cachedTextEncoder = new TextEncoder();
|
|
557
|
+
|
|
558
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
559
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
560
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
561
|
+
view.set(buf);
|
|
562
|
+
return {
|
|
563
|
+
read: arg.length,
|
|
564
|
+
written: buf.length
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
let WASM_VECTOR_LEN = 0;
|
|
570
|
+
|
|
571
|
+
let wasmModule, wasmInstance, wasm;
|
|
572
|
+
function __wbg_finalize_init(instance, module) {
|
|
573
|
+
wasmInstance = instance;
|
|
574
|
+
wasm = instance.exports;
|
|
575
|
+
wasmModule = module;
|
|
576
|
+
cachedDataViewMemory0 = null;
|
|
577
|
+
cachedUint8ArrayMemory0 = null;
|
|
578
|
+
wasm.__wbindgen_start();
|
|
579
|
+
return wasm;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
async function __wbg_load(module, imports) {
|
|
583
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
584
|
+
if (!module.ok) {
|
|
585
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
589
|
+
try {
|
|
590
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
591
|
+
} catch (e) {
|
|
592
|
+
const validResponse = expectedResponseType(module.type);
|
|
593
|
+
|
|
594
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
595
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
596
|
+
|
|
597
|
+
} else { throw e; }
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const bytes = await module.arrayBuffer();
|
|
602
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
603
|
+
} else {
|
|
604
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
605
|
+
|
|
606
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
607
|
+
return { instance, module };
|
|
608
|
+
} else {
|
|
609
|
+
return instance;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function expectedResponseType(type) {
|
|
614
|
+
switch (type) {
|
|
615
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
616
|
+
}
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
function initSync(module) {
|
|
622
|
+
if (wasm !== undefined) return wasm;
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
if (module !== undefined) {
|
|
626
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
627
|
+
({module} = module)
|
|
628
|
+
} else {
|
|
629
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
const imports = __wbg_get_imports();
|
|
634
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
635
|
+
module = new WebAssembly.Module(module);
|
|
636
|
+
}
|
|
637
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
638
|
+
return __wbg_finalize_init(instance, module);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
async function __wbg_init(module_or_path) {
|
|
642
|
+
if (wasm !== undefined) return wasm;
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
if (module_or_path !== undefined) {
|
|
646
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
647
|
+
({module_or_path} = module_or_path)
|
|
648
|
+
} else {
|
|
649
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
if (module_or_path === undefined) {
|
|
654
|
+
module_or_path = new URL('esf_dogma_engine_bg.wasm', import.meta.url);
|
|
655
|
+
}
|
|
656
|
+
const imports = __wbg_get_imports();
|
|
657
|
+
|
|
658
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
659
|
+
module_or_path = fetch(module_or_path);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
663
|
+
|
|
664
|
+
return __wbg_finalize_init(instance, module);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
export { initSync, __wbg_init as default };
|
package/esf_dogma_engine_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"EVEShipFit Team <info@eveship.fit>"
|
|
6
6
|
],
|
|
7
7
|
"description": "Library to calculate statistics for EVE Online ship fits",
|
|
8
|
-
"version": "
|
|
8
|
+
"version": "12.0.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -14,13 +14,11 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"esf_dogma_engine_bg.wasm",
|
|
16
16
|
"esf_dogma_engine.js",
|
|
17
|
-
"esf_dogma_engine_bg.js",
|
|
18
17
|
"esf_dogma_engine.d.ts"
|
|
19
18
|
],
|
|
20
19
|
"main": "esf_dogma_engine.js",
|
|
21
20
|
"types": "esf_dogma_engine.d.ts",
|
|
22
21
|
"sideEffects": [
|
|
23
|
-
"./esf_dogma_engine.js",
|
|
24
22
|
"./snippets/*"
|
|
25
23
|
]
|
|
26
24
|
}
|
package/esf_dogma_engine_bg.js
DELETED
|
@@ -1,563 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What a beacon in space hands to every fit in there with it. Put the result
|
|
3
|
-
* in `incoming` of a fit to have it applied.
|
|
4
|
-
* @param {number} type_id
|
|
5
|
-
* @returns {Projection}
|
|
6
|
-
*/
|
|
7
|
-
export function beacon(type_id) {
|
|
8
|
-
const ret = wasm.beacon(type_id);
|
|
9
|
-
if (ret[2]) {
|
|
10
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
11
|
-
}
|
|
12
|
-
return takeFromExternrefTable0(ret[0]);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* `options` may be left out; it then uses the defaults.
|
|
17
|
-
* @param {Fit} fit
|
|
18
|
-
* @param {Options | null} [options]
|
|
19
|
-
* @returns {Calculation}
|
|
20
|
-
*/
|
|
21
|
-
export function calculate(fit, options) {
|
|
22
|
-
const ret = wasm.calculate(fit, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
23
|
-
if (ret[2]) {
|
|
24
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
25
|
-
}
|
|
26
|
-
return takeFromExternrefTable0(ret[0]);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function init() {
|
|
30
|
-
wasm.init();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Load a fit from EFT, the text format EVE copies a fit to the clipboard in.
|
|
35
|
-
* @param {string} eft
|
|
36
|
-
* @returns {Fit}
|
|
37
|
-
*/
|
|
38
|
-
export function load_eft(eft) {
|
|
39
|
-
const ptr0 = passStringToWasm0(eft, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
40
|
-
const len0 = WASM_VECTOR_LEN;
|
|
41
|
-
const ret = wasm.load_eft(ptr0, len0);
|
|
42
|
-
if (ret[2]) {
|
|
43
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
44
|
-
}
|
|
45
|
-
return takeFromExternrefTable0(ret[0]);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Load `names.dat`, so an EFT written in another language than English also
|
|
50
|
-
* imports. Optional; without it only English names match. Has to be called
|
|
51
|
-
* after `load_sde`, and calling it twice is an error.
|
|
52
|
-
* @param {Uint8Array} bytes
|
|
53
|
-
* @returns {number}
|
|
54
|
-
*/
|
|
55
|
-
export function load_names(bytes) {
|
|
56
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
57
|
-
const len0 = WASM_VECTOR_LEN;
|
|
58
|
-
const ret = wasm.load_names(ptr0, len0);
|
|
59
|
-
if (ret[2]) {
|
|
60
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
61
|
-
}
|
|
62
|
-
return ret[0];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Load `sde.dat`. Has to be called before `calculate`; calling it twice is an
|
|
67
|
-
* error, as the first buffer is borrowed for the rest of the session.
|
|
68
|
-
* @param {Uint8Array} bytes
|
|
69
|
-
* @returns {number}
|
|
70
|
-
*/
|
|
71
|
-
export function load_sde(bytes) {
|
|
72
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
73
|
-
const len0 = WASM_VECTOR_LEN;
|
|
74
|
-
const ret = wasm.load_sde(ptr0, len0);
|
|
75
|
-
if (ret[2]) {
|
|
76
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
77
|
-
}
|
|
78
|
-
return ret[0];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Write a fit as EFT, the text format EVE copies a fit to the clipboard in.
|
|
83
|
-
* @param {Fit} fit
|
|
84
|
-
* @returns {string}
|
|
85
|
-
*/
|
|
86
|
-
export function save_eft(fit) {
|
|
87
|
-
let deferred2_0;
|
|
88
|
-
let deferred2_1;
|
|
89
|
-
try {
|
|
90
|
-
const ret = wasm.save_eft(fit);
|
|
91
|
-
var ptr1 = ret[0];
|
|
92
|
-
var len1 = ret[1];
|
|
93
|
-
if (ret[3]) {
|
|
94
|
-
ptr1 = 0; len1 = 0;
|
|
95
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
96
|
-
}
|
|
97
|
-
deferred2_0 = ptr1;
|
|
98
|
-
deferred2_1 = len1;
|
|
99
|
-
return getStringFromWasm0(ptr1, len1);
|
|
100
|
-
} finally {
|
|
101
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Report the fitting rules the fit breaks. Calculates the fit itself, as
|
|
107
|
-
* every rule reads the values after skills and modules changed them.
|
|
108
|
-
* @param {Fit} fit
|
|
109
|
-
* @returns {Violation[]}
|
|
110
|
-
*/
|
|
111
|
-
export function validate(fit) {
|
|
112
|
-
const ret = wasm.validate(fit);
|
|
113
|
-
if (ret[2]) {
|
|
114
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
115
|
-
}
|
|
116
|
-
return takeFromExternrefTable0(ret[0]);
|
|
117
|
-
}
|
|
118
|
-
export function __wbg_Error_67e7344beaa85059(arg0, arg1) {
|
|
119
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
120
|
-
return ret;
|
|
121
|
-
}
|
|
122
|
-
export function __wbg_Number_c54e7112a3fa7e3e(arg0) {
|
|
123
|
-
const ret = Number(arg0);
|
|
124
|
-
return ret;
|
|
125
|
-
}
|
|
126
|
-
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
127
|
-
const ret = String(arg1);
|
|
128
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
129
|
-
const len1 = WASM_VECTOR_LEN;
|
|
130
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
131
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
132
|
-
}
|
|
133
|
-
export function __wbg___wbindgen_bigint_get_as_i64_b482365c149396c8(arg0, arg1) {
|
|
134
|
-
const v = arg1;
|
|
135
|
-
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
136
|
-
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
137
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
138
|
-
}
|
|
139
|
-
export function __wbg___wbindgen_boolean_get_7a12af2b3f899c5a(arg0) {
|
|
140
|
-
const v = arg0;
|
|
141
|
-
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
142
|
-
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
143
|
-
}
|
|
144
|
-
export function __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0(arg0, arg1) {
|
|
145
|
-
const ret = debugString(arg1);
|
|
146
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
147
|
-
const len1 = WASM_VECTOR_LEN;
|
|
148
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
149
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
150
|
-
}
|
|
151
|
-
export function __wbg___wbindgen_in_50072d4d6e45c193(arg0, arg1) {
|
|
152
|
-
const ret = arg0 in arg1;
|
|
153
|
-
return ret;
|
|
154
|
-
}
|
|
155
|
-
export function __wbg___wbindgen_is_bigint_60fc0336cb14f5d7(arg0) {
|
|
156
|
-
const ret = typeof(arg0) === 'bigint';
|
|
157
|
-
return ret;
|
|
158
|
-
}
|
|
159
|
-
export function __wbg___wbindgen_is_function_fcda5e3902d732fe(arg0) {
|
|
160
|
-
const ret = typeof(arg0) === 'function';
|
|
161
|
-
return ret;
|
|
162
|
-
}
|
|
163
|
-
export function __wbg___wbindgen_is_object_edb6b15aa3afe12e(arg0) {
|
|
164
|
-
const val = arg0;
|
|
165
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
166
|
-
return ret;
|
|
167
|
-
}
|
|
168
|
-
export function __wbg___wbindgen_is_string_c4f7cb494a2a21f1(arg0) {
|
|
169
|
-
const ret = typeof(arg0) === 'string';
|
|
170
|
-
return ret;
|
|
171
|
-
}
|
|
172
|
-
export function __wbg___wbindgen_is_undefined_8c687d0b90d5b524(arg0) {
|
|
173
|
-
const ret = arg0 === undefined;
|
|
174
|
-
return ret;
|
|
175
|
-
}
|
|
176
|
-
export function __wbg___wbindgen_jsval_eq_9fdcd3c0a860dd3b(arg0, arg1) {
|
|
177
|
-
const ret = arg0 === arg1;
|
|
178
|
-
return ret;
|
|
179
|
-
}
|
|
180
|
-
export function __wbg___wbindgen_jsval_loose_eq_3c30021c243b64cd(arg0, arg1) {
|
|
181
|
-
const ret = arg0 == arg1;
|
|
182
|
-
return ret;
|
|
183
|
-
}
|
|
184
|
-
export function __wbg___wbindgen_number_get_1dc732b810cb937c(arg0, arg1) {
|
|
185
|
-
const obj = arg1;
|
|
186
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
187
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
188
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
189
|
-
}
|
|
190
|
-
export function __wbg___wbindgen_string_get_92ab86bb19cbc12f(arg0, arg1) {
|
|
191
|
-
const obj = arg1;
|
|
192
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
193
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
194
|
-
var len1 = WASM_VECTOR_LEN;
|
|
195
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
196
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
197
|
-
}
|
|
198
|
-
export function __wbg___wbindgen_throw_5d9e815e6fdf150f(arg0, arg1) {
|
|
199
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
200
|
-
}
|
|
201
|
-
export function __wbg_call_269c5566fbede3eb() { return handleError(function (arg0, arg1) {
|
|
202
|
-
const ret = arg0.call(arg1);
|
|
203
|
-
return ret;
|
|
204
|
-
}, arguments); }
|
|
205
|
-
export function __wbg_done_cffed884d87aa22e(arg0) {
|
|
206
|
-
const ret = arg0.done;
|
|
207
|
-
return ret;
|
|
208
|
-
}
|
|
209
|
-
export function __wbg_entries_972a87586902cf87(arg0) {
|
|
210
|
-
const ret = Object.entries(arg0);
|
|
211
|
-
return ret;
|
|
212
|
-
}
|
|
213
|
-
export function __wbg_error_757e9472f8410341(arg0, arg1) {
|
|
214
|
-
let deferred0_0;
|
|
215
|
-
let deferred0_1;
|
|
216
|
-
try {
|
|
217
|
-
deferred0_0 = arg0;
|
|
218
|
-
deferred0_1 = arg1;
|
|
219
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
220
|
-
} finally {
|
|
221
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
export function __wbg_get_6cf5a4d4d8ad3c5a() { return handleError(function (arg0, arg1) {
|
|
225
|
-
const ret = Reflect.get(arg0, arg1);
|
|
226
|
-
return ret;
|
|
227
|
-
}, arguments); }
|
|
228
|
-
export function __wbg_get_b1f0ab13c737f856(arg0, arg1) {
|
|
229
|
-
const ret = arg0[arg1 >>> 0];
|
|
230
|
-
return ret;
|
|
231
|
-
}
|
|
232
|
-
export function __wbg_get_unchecked_363572bdd397d473(arg0, arg1) {
|
|
233
|
-
const ret = arg0[arg1 >>> 0];
|
|
234
|
-
return ret;
|
|
235
|
-
}
|
|
236
|
-
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
237
|
-
const ret = arg0[arg1];
|
|
238
|
-
return ret;
|
|
239
|
-
}
|
|
240
|
-
export function __wbg_instanceof_ArrayBuffer_d4ff01f8247925ae(arg0) {
|
|
241
|
-
let result;
|
|
242
|
-
try {
|
|
243
|
-
result = arg0 instanceof ArrayBuffer;
|
|
244
|
-
} catch (_) {
|
|
245
|
-
result = false;
|
|
246
|
-
}
|
|
247
|
-
const ret = result;
|
|
248
|
-
return ret;
|
|
249
|
-
}
|
|
250
|
-
export function __wbg_instanceof_Map_1ff6a2b54c899f0d(arg0) {
|
|
251
|
-
let result;
|
|
252
|
-
try {
|
|
253
|
-
result = arg0 instanceof Map;
|
|
254
|
-
} catch (_) {
|
|
255
|
-
result = false;
|
|
256
|
-
}
|
|
257
|
-
const ret = result;
|
|
258
|
-
return ret;
|
|
259
|
-
}
|
|
260
|
-
export function __wbg_instanceof_Uint8Array_598adc0fef426aa8(arg0) {
|
|
261
|
-
let result;
|
|
262
|
-
try {
|
|
263
|
-
result = arg0 instanceof Uint8Array;
|
|
264
|
-
} catch (_) {
|
|
265
|
-
result = false;
|
|
266
|
-
}
|
|
267
|
-
const ret = result;
|
|
268
|
-
return ret;
|
|
269
|
-
}
|
|
270
|
-
export function __wbg_isArray_5674713bb7b79043(arg0) {
|
|
271
|
-
const ret = Array.isArray(arg0);
|
|
272
|
-
return ret;
|
|
273
|
-
}
|
|
274
|
-
export function __wbg_isSafeInteger_8f51c743827d1ec5(arg0) {
|
|
275
|
-
const ret = Number.isSafeInteger(arg0);
|
|
276
|
-
return ret;
|
|
277
|
-
}
|
|
278
|
-
export function __wbg_iterator_22ddeb808cf55a6f() {
|
|
279
|
-
const ret = Symbol.iterator;
|
|
280
|
-
return ret;
|
|
281
|
-
}
|
|
282
|
-
export function __wbg_length_31bdaf014f5fbde2(arg0) {
|
|
283
|
-
const ret = arg0.length;
|
|
284
|
-
return ret;
|
|
285
|
-
}
|
|
286
|
-
export function __wbg_length_4e1adc0d42e23620(arg0) {
|
|
287
|
-
const ret = arg0.length;
|
|
288
|
-
return ret;
|
|
289
|
-
}
|
|
290
|
-
export function __wbg_new_1da3429bc3c4541c(arg0) {
|
|
291
|
-
const ret = new Uint8Array(arg0);
|
|
292
|
-
return ret;
|
|
293
|
-
}
|
|
294
|
-
export function __wbg_new_227d7c05414eb861() {
|
|
295
|
-
const ret = new Error();
|
|
296
|
-
return ret;
|
|
297
|
-
}
|
|
298
|
-
export function __wbg_new_8d36e20aa758e411() {
|
|
299
|
-
const ret = new Map();
|
|
300
|
-
return ret;
|
|
301
|
-
}
|
|
302
|
-
export function __wbg_new_bebc3f4757acf305() {
|
|
303
|
-
const ret = new Object();
|
|
304
|
-
return ret;
|
|
305
|
-
}
|
|
306
|
-
export function __wbg_new_ffa92086ea89f79c() {
|
|
307
|
-
const ret = new Array();
|
|
308
|
-
return ret;
|
|
309
|
-
}
|
|
310
|
-
export function __wbg_next_95053e306b1c3aed(arg0) {
|
|
311
|
-
const ret = arg0.next;
|
|
312
|
-
return ret;
|
|
313
|
-
}
|
|
314
|
-
export function __wbg_next_f31ecb8646d2c605() { return handleError(function (arg0) {
|
|
315
|
-
const ret = arg0.next();
|
|
316
|
-
return ret;
|
|
317
|
-
}, arguments); }
|
|
318
|
-
export function __wbg_prototypesetcall_ae9f5e7459250748(arg0, arg1, arg2) {
|
|
319
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
320
|
-
}
|
|
321
|
-
export function __wbg_set_13d25b81ab403f5e(arg0, arg1, arg2) {
|
|
322
|
-
arg0[arg1 >>> 0] = arg2;
|
|
323
|
-
}
|
|
324
|
-
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
325
|
-
arg0[arg1] = arg2;
|
|
326
|
-
}
|
|
327
|
-
export function __wbg_set_bf6dde4923b9b059(arg0, arg1, arg2) {
|
|
328
|
-
const ret = arg0.set(arg1, arg2);
|
|
329
|
-
return ret;
|
|
330
|
-
}
|
|
331
|
-
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
332
|
-
const ret = arg1.stack;
|
|
333
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
334
|
-
const len1 = WASM_VECTOR_LEN;
|
|
335
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
336
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
337
|
-
}
|
|
338
|
-
export function __wbg_value_c227f843d21da141(arg0) {
|
|
339
|
-
const ret = arg0.value;
|
|
340
|
-
return ret;
|
|
341
|
-
}
|
|
342
|
-
export function __wbindgen_generic_0000000000000001(arg0) {
|
|
343
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
344
|
-
const ret = arg0;
|
|
345
|
-
return ret;
|
|
346
|
-
}
|
|
347
|
-
export function __wbindgen_generic_0000000000000002(arg0) {
|
|
348
|
-
// Cast intrinsic for `I64 -> Externref`.
|
|
349
|
-
const ret = arg0;
|
|
350
|
-
return ret;
|
|
351
|
-
}
|
|
352
|
-
export function __wbindgen_generic_0000000000000003(arg0, arg1) {
|
|
353
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
354
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
355
|
-
return ret;
|
|
356
|
-
}
|
|
357
|
-
export function __wbindgen_generic_0000000000000004(arg0) {
|
|
358
|
-
// Cast intrinsic for `U64 -> Externref`.
|
|
359
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
360
|
-
return ret;
|
|
361
|
-
}
|
|
362
|
-
export function __wbindgen_init_externref_table() {
|
|
363
|
-
const table = wasm.__wbindgen_externrefs;
|
|
364
|
-
const offset = table.grow(4);
|
|
365
|
-
table.set(0, undefined);
|
|
366
|
-
table.set(offset + 0, undefined);
|
|
367
|
-
table.set(offset + 1, null);
|
|
368
|
-
table.set(offset + 2, true);
|
|
369
|
-
table.set(offset + 3, false);
|
|
370
|
-
}
|
|
371
|
-
function addToExternrefTable0(obj) {
|
|
372
|
-
const idx = wasm.__externref_table_alloc();
|
|
373
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
374
|
-
return idx;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
function debugString(val) {
|
|
378
|
-
// primitive types
|
|
379
|
-
const type = typeof val;
|
|
380
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
381
|
-
return `${val}`;
|
|
382
|
-
}
|
|
383
|
-
if (type == 'string') {
|
|
384
|
-
return `"${val}"`;
|
|
385
|
-
}
|
|
386
|
-
if (type == 'symbol') {
|
|
387
|
-
const description = val.description;
|
|
388
|
-
if (description == null) {
|
|
389
|
-
return 'Symbol';
|
|
390
|
-
} else {
|
|
391
|
-
return `Symbol(${description})`;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (type == 'function') {
|
|
395
|
-
const name = val.name;
|
|
396
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
397
|
-
return `Function(${name})`;
|
|
398
|
-
} else {
|
|
399
|
-
return 'Function';
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
// objects
|
|
403
|
-
if (Array.isArray(val)) {
|
|
404
|
-
const length = val.length;
|
|
405
|
-
let debug = '[';
|
|
406
|
-
if (length > 0) {
|
|
407
|
-
debug += debugString(val[0]);
|
|
408
|
-
}
|
|
409
|
-
for(let i = 1; i < length; i++) {
|
|
410
|
-
debug += ', ' + debugString(val[i]);
|
|
411
|
-
}
|
|
412
|
-
debug += ']';
|
|
413
|
-
return debug;
|
|
414
|
-
}
|
|
415
|
-
// Test for built-in
|
|
416
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
417
|
-
let className;
|
|
418
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
419
|
-
className = builtInMatches[1];
|
|
420
|
-
} else {
|
|
421
|
-
// Failed to match the standard '[object ClassName]'
|
|
422
|
-
return toString.call(val);
|
|
423
|
-
}
|
|
424
|
-
if (className == 'Object') {
|
|
425
|
-
// we're a user defined class or Object
|
|
426
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
427
|
-
// easier than looping through ownProperties of `val`.
|
|
428
|
-
try {
|
|
429
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
430
|
-
} catch (_) {
|
|
431
|
-
return 'Object';
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
// errors
|
|
435
|
-
if (val instanceof Error) {
|
|
436
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
437
|
-
}
|
|
438
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
439
|
-
return className;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
443
|
-
ptr = ptr >>> 0;
|
|
444
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
let cachedDataViewMemory0 = null;
|
|
448
|
-
function getDataViewMemory0() {
|
|
449
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
450
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
451
|
-
}
|
|
452
|
-
return cachedDataViewMemory0;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function getStringFromWasm0(ptr, len) {
|
|
456
|
-
return decodeText(ptr >>> 0, len);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
let cachedUint8ArrayMemory0 = null;
|
|
460
|
-
function getUint8ArrayMemory0() {
|
|
461
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
462
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
463
|
-
}
|
|
464
|
-
return cachedUint8ArrayMemory0;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
function handleError(f, args) {
|
|
468
|
-
try {
|
|
469
|
-
return f.apply(this, args);
|
|
470
|
-
} catch (e) {
|
|
471
|
-
const idx = addToExternrefTable0(e);
|
|
472
|
-
wasm.__wbindgen_exn_store(idx);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
function isLikeNone(x) {
|
|
477
|
-
return x === undefined || x === null;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
481
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
482
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
483
|
-
WASM_VECTOR_LEN = arg.length;
|
|
484
|
-
return ptr;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
488
|
-
if (realloc === undefined) {
|
|
489
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
490
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
491
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
492
|
-
WASM_VECTOR_LEN = buf.length;
|
|
493
|
-
return ptr;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
let len = arg.length;
|
|
497
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
498
|
-
|
|
499
|
-
const mem = getUint8ArrayMemory0();
|
|
500
|
-
|
|
501
|
-
let offset = 0;
|
|
502
|
-
|
|
503
|
-
for (; offset < len; offset++) {
|
|
504
|
-
const code = arg.charCodeAt(offset);
|
|
505
|
-
if (code > 0x7F) break;
|
|
506
|
-
mem[ptr + offset] = code;
|
|
507
|
-
}
|
|
508
|
-
if (offset !== len) {
|
|
509
|
-
if (offset !== 0) {
|
|
510
|
-
arg = arg.slice(offset);
|
|
511
|
-
}
|
|
512
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
513
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
514
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
515
|
-
|
|
516
|
-
offset += ret.written;
|
|
517
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
WASM_VECTOR_LEN = offset;
|
|
521
|
-
return ptr;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
function takeFromExternrefTable0(idx) {
|
|
525
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
526
|
-
wasm.__externref_table_dealloc(idx);
|
|
527
|
-
return value;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
531
|
-
cachedTextDecoder.decode();
|
|
532
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
533
|
-
let numBytesDecoded = 0;
|
|
534
|
-
function decodeText(ptr, len) {
|
|
535
|
-
numBytesDecoded += len;
|
|
536
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
537
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
538
|
-
cachedTextDecoder.decode();
|
|
539
|
-
numBytesDecoded = len;
|
|
540
|
-
}
|
|
541
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
const cachedTextEncoder = new TextEncoder();
|
|
545
|
-
|
|
546
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
547
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
548
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
549
|
-
view.set(buf);
|
|
550
|
-
return {
|
|
551
|
-
read: arg.length,
|
|
552
|
-
written: buf.length
|
|
553
|
-
};
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
let WASM_VECTOR_LEN = 0;
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
let wasm;
|
|
561
|
-
export function __wbg_set_wasm(val) {
|
|
562
|
-
wasm = val;
|
|
563
|
-
}
|