@eveshipfit/dogma-engine 11.1.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.
@@ -1,9 +1,667 @@
1
1
  /* @ts-self-types="./esf_dogma_engine.d.ts" */
2
- import * as wasm from "./esf_dogma_engine_bg.wasm";
3
- import { __wbg_set_wasm } from "./esf_dogma_engine_bg.js";
4
-
5
- __wbg_set_wasm(wasm);
6
- wasm.__wbindgen_start();
7
- export {
8
- beacon, calculate, init, load_eft, load_names, load_sde, validate
9
- } from "./esf_dogma_engine_bg.js";
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 };
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": "11.1.0",
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
  }