ballistics-engine 0.13.4 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -250
- package/ballistics_engine.d.ts +113 -103
- package/ballistics_engine.js +9 -610
- package/ballistics_engine_bg.js +552 -0
- package/ballistics_engine_bg.wasm +0 -0
- package/package.json +12 -5
package/ballistics_engine.js
CHANGED
|
@@ -1,610 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
13
|
-
|
|
14
|
-
cachedTextDecoder.decode();
|
|
15
|
-
|
|
16
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
17
|
-
let numBytesDecoded = 0;
|
|
18
|
-
function decodeText(ptr, len) {
|
|
19
|
-
numBytesDecoded += len;
|
|
20
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
21
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
-
cachedTextDecoder.decode();
|
|
23
|
-
numBytesDecoded = len;
|
|
24
|
-
}
|
|
25
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function getStringFromWasm0(ptr, len) {
|
|
29
|
-
ptr = ptr >>> 0;
|
|
30
|
-
return decodeText(ptr, len);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function addToExternrefTable0(obj) {
|
|
34
|
-
const idx = wasm.__externref_table_alloc();
|
|
35
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
36
|
-
return idx;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function handleError(f, args) {
|
|
40
|
-
try {
|
|
41
|
-
return f.apply(this, args);
|
|
42
|
-
} catch (e) {
|
|
43
|
-
const idx = addToExternrefTable0(e);
|
|
44
|
-
wasm.__wbindgen_exn_store(idx);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
49
|
-
ptr = ptr >>> 0;
|
|
50
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function isLikeNone(x) {
|
|
54
|
-
return x === undefined || x === null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let WASM_VECTOR_LEN = 0;
|
|
58
|
-
|
|
59
|
-
const cachedTextEncoder = new TextEncoder();
|
|
60
|
-
|
|
61
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
62
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
63
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
64
|
-
view.set(buf);
|
|
65
|
-
return {
|
|
66
|
-
read: arg.length,
|
|
67
|
-
written: buf.length
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
73
|
-
|
|
74
|
-
if (realloc === undefined) {
|
|
75
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
76
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
77
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
78
|
-
WASM_VECTOR_LEN = buf.length;
|
|
79
|
-
return ptr;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
let len = arg.length;
|
|
83
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
84
|
-
|
|
85
|
-
const mem = getUint8ArrayMemory0();
|
|
86
|
-
|
|
87
|
-
let offset = 0;
|
|
88
|
-
|
|
89
|
-
for (; offset < len; offset++) {
|
|
90
|
-
const code = arg.charCodeAt(offset);
|
|
91
|
-
if (code > 0x7F) break;
|
|
92
|
-
mem[ptr + offset] = code;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (offset !== len) {
|
|
96
|
-
if (offset !== 0) {
|
|
97
|
-
arg = arg.slice(offset);
|
|
98
|
-
}
|
|
99
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
100
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
101
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
102
|
-
|
|
103
|
-
offset += ret.written;
|
|
104
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
WASM_VECTOR_LEN = offset;
|
|
108
|
-
return ptr;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function takeFromExternrefTable0(idx) {
|
|
112
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
113
|
-
wasm.__externref_table_dealloc(idx);
|
|
114
|
-
return value;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const CalculatorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
118
|
-
? { register: () => {}, unregister: () => {} }
|
|
119
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_calculator_free(ptr >>> 0, 1));
|
|
120
|
-
/**
|
|
121
|
-
* Object-oriented calculator for programmatic use
|
|
122
|
-
* Provides a type-safe, fluent API alternative to the CLI interface
|
|
123
|
-
*/
|
|
124
|
-
export class Calculator {
|
|
125
|
-
|
|
126
|
-
static __wrap(ptr) {
|
|
127
|
-
ptr = ptr >>> 0;
|
|
128
|
-
const obj = Object.create(Calculator.prototype);
|
|
129
|
-
obj.__wbg_ptr = ptr;
|
|
130
|
-
CalculatorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
131
|
-
return obj;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
__destroy_into_raw() {
|
|
135
|
-
const ptr = this.__wbg_ptr;
|
|
136
|
-
this.__wbg_ptr = 0;
|
|
137
|
-
CalculatorFinalization.unregister(this);
|
|
138
|
-
return ptr;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
free() {
|
|
142
|
-
const ptr = this.__destroy_into_raw();
|
|
143
|
-
wasm.__wbg_calculator_free(ptr, 0);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* @param {number} altitude_ft
|
|
147
|
-
* @returns {Calculator}
|
|
148
|
-
*/
|
|
149
|
-
setAltitude(altitude_ft) {
|
|
150
|
-
const ptr = this.__destroy_into_raw();
|
|
151
|
-
const ret = wasm.calculator_setAltitude(ptr, altitude_ft);
|
|
152
|
-
return Calculator.__wrap(ret);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* @param {number} diameter_inches
|
|
156
|
-
* @returns {Calculator}
|
|
157
|
-
*/
|
|
158
|
-
setDiameter(diameter_inches) {
|
|
159
|
-
const ptr = this.__destroy_into_raw();
|
|
160
|
-
const ret = wasm.calculator_setDiameter(ptr, diameter_inches);
|
|
161
|
-
return Calculator.__wrap(ret);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* @param {number} humidity
|
|
165
|
-
* @returns {Calculator}
|
|
166
|
-
*/
|
|
167
|
-
setHumidity(humidity) {
|
|
168
|
-
const ptr = this.__destroy_into_raw();
|
|
169
|
-
const ret = wasm.calculator_setHumidity(ptr, humidity);
|
|
170
|
-
return Calculator.__wrap(ret);
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* @param {number} pressure_inhg
|
|
174
|
-
* @returns {Calculator}
|
|
175
|
-
*/
|
|
176
|
-
setPressure(pressure_inhg) {
|
|
177
|
-
const ptr = this.__destroy_into_raw();
|
|
178
|
-
const ret = wasm.calculator_setPressure(ptr, pressure_inhg);
|
|
179
|
-
return Calculator.__wrap(ret);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* @param {number} velocity_fps
|
|
183
|
-
* @returns {Calculator}
|
|
184
|
-
*/
|
|
185
|
-
setVelocity(velocity_fps) {
|
|
186
|
-
const ptr = this.__destroy_into_raw();
|
|
187
|
-
const ret = wasm.calculator_setVelocity(ptr, velocity_fps);
|
|
188
|
-
return Calculator.__wrap(ret);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* @param {number} range_yards
|
|
192
|
-
* @returns {Calculator}
|
|
193
|
-
*/
|
|
194
|
-
setMaxRange(range_yards) {
|
|
195
|
-
const ptr = this.__destroy_into_raw();
|
|
196
|
-
const ret = wasm.calculator_setMaxRange(ptr, range_yards);
|
|
197
|
-
return Calculator.__wrap(ret);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* @param {string} model
|
|
201
|
-
* @returns {Calculator}
|
|
202
|
-
*/
|
|
203
|
-
setDragModel(model) {
|
|
204
|
-
const ptr = this.__destroy_into_raw();
|
|
205
|
-
const ptr0 = passStringToWasm0(model, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
206
|
-
const len0 = WASM_VECTOR_LEN;
|
|
207
|
-
const ret = wasm.calculator_setDragModel(ptr, ptr0, len0);
|
|
208
|
-
return Calculator.__wrap(ret);
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* @param {number} range_yards
|
|
212
|
-
* @returns {Calculator}
|
|
213
|
-
*/
|
|
214
|
-
setZeroRange(range_yards) {
|
|
215
|
-
const ptr = this.__destroy_into_raw();
|
|
216
|
-
const ret = wasm.calculator_setZeroRange(ptr, range_yards);
|
|
217
|
-
return Calculator.__wrap(ret);
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* @param {number} temp_f
|
|
221
|
-
* @returns {Calculator}
|
|
222
|
-
*/
|
|
223
|
-
setTemperature(temp_f) {
|
|
224
|
-
const ptr = this.__destroy_into_raw();
|
|
225
|
-
const ret = wasm.calculator_setTemperature(ptr, temp_f);
|
|
226
|
-
return Calculator.__wrap(ret);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* @param {number} height_inches
|
|
230
|
-
* @returns {Calculator}
|
|
231
|
-
*/
|
|
232
|
-
setSightHeight(height_inches) {
|
|
233
|
-
const ptr = this.__destroy_into_raw();
|
|
234
|
-
const ret = wasm.calculator_setSightHeight(ptr, height_inches);
|
|
235
|
-
return Calculator.__wrap(ret);
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* @param {boolean} enabled
|
|
239
|
-
* @param {number | null} [latitude]
|
|
240
|
-
* @returns {Calculator}
|
|
241
|
-
*/
|
|
242
|
-
enableCoriolis(enabled, latitude) {
|
|
243
|
-
const ptr = this.__destroy_into_raw();
|
|
244
|
-
const ret = wasm.calculator_enableCoriolis(ptr, enabled, !isLikeNone(latitude), isLikeNone(latitude) ? 0 : latitude);
|
|
245
|
-
return Calculator.__wrap(ret);
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Get full trajectory table as array of points
|
|
249
|
-
* Returns array of: [{ range_yards, drop_inches, windage_inches, velocity_fps, energy_ftlb, time_sec }, ...]
|
|
250
|
-
* @returns {any}
|
|
251
|
-
*/
|
|
252
|
-
getFullTrajectory() {
|
|
253
|
-
const ret = wasm.calculator_getFullTrajectory(this.__wbg_ptr);
|
|
254
|
-
if (ret[2]) {
|
|
255
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
256
|
-
}
|
|
257
|
-
return takeFromExternrefTable0(ret[0]);
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Calculate trajectory and return result as JavaScript object
|
|
261
|
-
* Returns: { range_yards, drop_inches, windage_inches, velocity_fps, energy_ftlb, time_sec }
|
|
262
|
-
* @param {number} range_yards
|
|
263
|
-
* @returns {any}
|
|
264
|
-
*/
|
|
265
|
-
calculateTrajectory(range_yards) {
|
|
266
|
-
const ret = wasm.calculator_calculateTrajectory(this.__wbg_ptr, range_yards);
|
|
267
|
-
if (ret[2]) {
|
|
268
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
269
|
-
}
|
|
270
|
-
return takeFromExternrefTable0(ret[0]);
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* @param {boolean} enabled
|
|
274
|
-
* @param {number | null} [twist_rate]
|
|
275
|
-
* @returns {Calculator}
|
|
276
|
-
*/
|
|
277
|
-
enableSpinDrift(enabled, twist_rate) {
|
|
278
|
-
const ptr = this.__destroy_into_raw();
|
|
279
|
-
const ret = wasm.calculator_enableSpinDrift(ptr, enabled, !isLikeNone(twist_rate), isLikeNone(twist_rate) ? 0 : twist_rate);
|
|
280
|
-
return Calculator.__wrap(ret);
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Create a new calculator with default values
|
|
284
|
-
* Defaults: .308 Winchester 168gr at 2700 fps, standard atmosphere
|
|
285
|
-
*/
|
|
286
|
-
constructor() {
|
|
287
|
-
const ret = wasm.calculator_new();
|
|
288
|
-
this.__wbg_ptr = ret >>> 0;
|
|
289
|
-
CalculatorFinalization.register(this, this.__wbg_ptr, this);
|
|
290
|
-
return this;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* @param {number} bc
|
|
294
|
-
* @returns {Calculator}
|
|
295
|
-
*/
|
|
296
|
-
setBC(bc) {
|
|
297
|
-
const ptr = this.__destroy_into_raw();
|
|
298
|
-
const ret = wasm.calculator_setBC(ptr, bc);
|
|
299
|
-
return Calculator.__wrap(ret);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* @param {number} mass_grains
|
|
303
|
-
* @returns {Calculator}
|
|
304
|
-
*/
|
|
305
|
-
setMass(mass_grains) {
|
|
306
|
-
const ptr = this.__destroy_into_raw();
|
|
307
|
-
const ret = wasm.calculator_setMass(ptr, mass_grains);
|
|
308
|
-
return Calculator.__wrap(ret);
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* @param {number} speed_mph
|
|
312
|
-
* @param {number} direction_deg
|
|
313
|
-
* @returns {Calculator}
|
|
314
|
-
*/
|
|
315
|
-
setWind(speed_mph, direction_deg) {
|
|
316
|
-
const ptr = this.__destroy_into_raw();
|
|
317
|
-
const ret = wasm.calculator_setWind(ptr, speed_mph, direction_deg);
|
|
318
|
-
return Calculator.__wrap(ret);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
if (Symbol.dispose) Calculator.prototype[Symbol.dispose] = Calculator.prototype.free;
|
|
322
|
-
|
|
323
|
-
const WasmBallisticsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
324
|
-
? { register: () => {}, unregister: () => {} }
|
|
325
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmballistics_free(ptr >>> 0, 1));
|
|
326
|
-
|
|
327
|
-
export class WasmBallistics {
|
|
328
|
-
|
|
329
|
-
__destroy_into_raw() {
|
|
330
|
-
const ptr = this.__wbg_ptr;
|
|
331
|
-
this.__wbg_ptr = 0;
|
|
332
|
-
WasmBallisticsFinalization.unregister(this);
|
|
333
|
-
return ptr;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
free() {
|
|
337
|
-
const ptr = this.__destroy_into_raw();
|
|
338
|
-
wasm.__wbg_wasmballistics_free(ptr, 0);
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Run a command and return the output
|
|
342
|
-
* @param {string} command
|
|
343
|
-
* @returns {string}
|
|
344
|
-
*/
|
|
345
|
-
runCommand(command) {
|
|
346
|
-
let deferred3_0;
|
|
347
|
-
let deferred3_1;
|
|
348
|
-
try {
|
|
349
|
-
const ptr0 = passStringToWasm0(command, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
350
|
-
const len0 = WASM_VECTOR_LEN;
|
|
351
|
-
const ret = wasm.wasmballistics_runCommand(this.__wbg_ptr, ptr0, len0);
|
|
352
|
-
var ptr2 = ret[0];
|
|
353
|
-
var len2 = ret[1];
|
|
354
|
-
if (ret[3]) {
|
|
355
|
-
ptr2 = 0; len2 = 0;
|
|
356
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
357
|
-
}
|
|
358
|
-
deferred3_0 = ptr2;
|
|
359
|
-
deferred3_1 = len2;
|
|
360
|
-
return getStringFromWasm0(ptr2, len2);
|
|
361
|
-
} finally {
|
|
362
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
constructor() {
|
|
366
|
-
const ret = wasm.wasmballistics_new();
|
|
367
|
-
this.__wbg_ptr = ret >>> 0;
|
|
368
|
-
WasmBallisticsFinalization.register(this, this.__wbg_ptr, this);
|
|
369
|
-
return this;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
if (Symbol.dispose) WasmBallistics.prototype[Symbol.dispose] = WasmBallistics.prototype.free;
|
|
373
|
-
|
|
374
|
-
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
375
|
-
|
|
376
|
-
async function __wbg_load(module, imports) {
|
|
377
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
378
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
379
|
-
try {
|
|
380
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
381
|
-
|
|
382
|
-
} catch (e) {
|
|
383
|
-
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
384
|
-
|
|
385
|
-
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
386
|
-
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);
|
|
387
|
-
|
|
388
|
-
} else {
|
|
389
|
-
throw e;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
const bytes = await module.arrayBuffer();
|
|
395
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
396
|
-
|
|
397
|
-
} else {
|
|
398
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
399
|
-
|
|
400
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
401
|
-
return { instance, module };
|
|
402
|
-
|
|
403
|
-
} else {
|
|
404
|
-
return instance;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
function __wbg_get_imports() {
|
|
410
|
-
const imports = {};
|
|
411
|
-
imports.wbg = {};
|
|
412
|
-
imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
|
|
413
|
-
const ret = typeof(arg0) === 'function';
|
|
414
|
-
return ret;
|
|
415
|
-
};
|
|
416
|
-
imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
|
|
417
|
-
const val = arg0;
|
|
418
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
419
|
-
return ret;
|
|
420
|
-
};
|
|
421
|
-
imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
|
|
422
|
-
const ret = typeof(arg0) === 'string';
|
|
423
|
-
return ret;
|
|
424
|
-
};
|
|
425
|
-
imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
|
|
426
|
-
const ret = arg0 === undefined;
|
|
427
|
-
return ret;
|
|
428
|
-
};
|
|
429
|
-
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
430
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
431
|
-
};
|
|
432
|
-
imports.wbg.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
|
|
433
|
-
const ret = arg0.call(arg1, arg2);
|
|
434
|
-
return ret;
|
|
435
|
-
}, arguments) };
|
|
436
|
-
imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
|
|
437
|
-
const ret = arg0.call(arg1);
|
|
438
|
-
return ret;
|
|
439
|
-
}, arguments) };
|
|
440
|
-
imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
441
|
-
const ret = arg0.crypto;
|
|
442
|
-
return ret;
|
|
443
|
-
};
|
|
444
|
-
imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
|
|
445
|
-
arg0.getRandomValues(arg1);
|
|
446
|
-
}, arguments) };
|
|
447
|
-
imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
|
|
448
|
-
const ret = arg0.length;
|
|
449
|
-
return ret;
|
|
450
|
-
};
|
|
451
|
-
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
452
|
-
const ret = arg0.msCrypto;
|
|
453
|
-
return ret;
|
|
454
|
-
};
|
|
455
|
-
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
456
|
-
const ret = new Object();
|
|
457
|
-
return ret;
|
|
458
|
-
};
|
|
459
|
-
imports.wbg.__wbg_new_e17d9f43105b08be = function() {
|
|
460
|
-
const ret = new Array();
|
|
461
|
-
return ret;
|
|
462
|
-
};
|
|
463
|
-
imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
|
|
464
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
465
|
-
return ret;
|
|
466
|
-
};
|
|
467
|
-
imports.wbg.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
|
|
468
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
469
|
-
return ret;
|
|
470
|
-
};
|
|
471
|
-
imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
472
|
-
const ret = arg0.node;
|
|
473
|
-
return ret;
|
|
474
|
-
};
|
|
475
|
-
imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
476
|
-
const ret = arg0.process;
|
|
477
|
-
return ret;
|
|
478
|
-
};
|
|
479
|
-
imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
|
|
480
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
481
|
-
};
|
|
482
|
-
imports.wbg.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
|
|
483
|
-
const ret = arg0.push(arg1);
|
|
484
|
-
return ret;
|
|
485
|
-
};
|
|
486
|
-
imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
|
|
487
|
-
arg0.randomFillSync(arg1);
|
|
488
|
-
}, arguments) };
|
|
489
|
-
imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
|
|
490
|
-
const ret = module.require;
|
|
491
|
-
return ret;
|
|
492
|
-
}, arguments) };
|
|
493
|
-
imports.wbg.__wbg_set_c2abbebe8b9ebee1 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
494
|
-
const ret = Reflect.set(arg0, arg1, arg2);
|
|
495
|
-
return ret;
|
|
496
|
-
}, arguments) };
|
|
497
|
-
imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
|
|
498
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
499
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
500
|
-
};
|
|
501
|
-
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
|
|
502
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
503
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
504
|
-
};
|
|
505
|
-
imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
|
|
506
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
507
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
508
|
-
};
|
|
509
|
-
imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
|
|
510
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
511
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
512
|
-
};
|
|
513
|
-
imports.wbg.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
|
|
514
|
-
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
515
|
-
return ret;
|
|
516
|
-
};
|
|
517
|
-
imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
518
|
-
const ret = arg0.versions;
|
|
519
|
-
return ret;
|
|
520
|
-
};
|
|
521
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
522
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
523
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
524
|
-
return ret;
|
|
525
|
-
};
|
|
526
|
-
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
527
|
-
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
528
|
-
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
529
|
-
return ret;
|
|
530
|
-
};
|
|
531
|
-
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
532
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
533
|
-
const ret = arg0;
|
|
534
|
-
return ret;
|
|
535
|
-
};
|
|
536
|
-
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
537
|
-
const table = wasm.__wbindgen_externrefs;
|
|
538
|
-
const offset = table.grow(4);
|
|
539
|
-
table.set(0, undefined);
|
|
540
|
-
table.set(offset + 0, undefined);
|
|
541
|
-
table.set(offset + 1, null);
|
|
542
|
-
table.set(offset + 2, true);
|
|
543
|
-
table.set(offset + 3, false);
|
|
544
|
-
;
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
return imports;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
function __wbg_finalize_init(instance, module) {
|
|
551
|
-
wasm = instance.exports;
|
|
552
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
553
|
-
cachedUint8ArrayMemory0 = null;
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
wasm.__wbindgen_start();
|
|
557
|
-
return wasm;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
function initSync(module) {
|
|
561
|
-
if (wasm !== undefined) return wasm;
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
if (typeof module !== 'undefined') {
|
|
565
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
566
|
-
({module} = module)
|
|
567
|
-
} else {
|
|
568
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
const imports = __wbg_get_imports();
|
|
573
|
-
|
|
574
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
575
|
-
module = new WebAssembly.Module(module);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
579
|
-
|
|
580
|
-
return __wbg_finalize_init(instance, module);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
async function __wbg_init(module_or_path) {
|
|
584
|
-
if (wasm !== undefined) return wasm;
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if (typeof module_or_path !== 'undefined') {
|
|
588
|
-
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
589
|
-
({module_or_path} = module_or_path)
|
|
590
|
-
} else {
|
|
591
|
-
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
if (typeof module_or_path === 'undefined') {
|
|
596
|
-
module_or_path = new URL('ballistics_engine_bg.wasm', import.meta.url);
|
|
597
|
-
}
|
|
598
|
-
const imports = __wbg_get_imports();
|
|
599
|
-
|
|
600
|
-
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
601
|
-
module_or_path = fetch(module_or_path);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
605
|
-
|
|
606
|
-
return __wbg_finalize_init(instance, module);
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
export { initSync };
|
|
610
|
-
export default __wbg_init;
|
|
1
|
+
/* @ts-self-types="./ballistics_engine.d.ts" */
|
|
2
|
+
|
|
3
|
+
import * as wasm from "./ballistics_engine_bg.wasm";
|
|
4
|
+
import { __wbg_set_wasm } from "./ballistics_engine_bg.js";
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
Calculator, WasmBallistics
|
|
9
|
+
} from "./ballistics_engine_bg.js";
|