@ultralytics/yolo 0.0.20

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.
@@ -0,0 +1,1299 @@
1
+ /* @ts-self-types="./ultralytics_inference_web.d.ts" */
2
+ import { initRuntime } from './snippets/ort-web-c7b42e3e9fb58316/_loader.js';
3
+ import { trackSessionInit } from './snippets/ort-web-c7b42e3e9fb58316/_telemetry.js';
4
+
5
+
6
+ /**
7
+ * A loaded YOLO model ready for inference in the browser.
8
+ *
9
+ * Created via [`YoloModel::load_bytes`]; run with [`YoloModel::predict`]. The
10
+ * TypeScript wrapper exposes this as `YOLO`.
11
+ */
12
+ export class YoloModel {
13
+ static __wrap(ptr) {
14
+ const obj = Object.create(YoloModel.prototype);
15
+ obj.__wbg_ptr = ptr;
16
+ YoloModelFinalization.register(obj, obj.__wbg_ptr, obj);
17
+ return obj;
18
+ }
19
+ __destroy_into_raw() {
20
+ const ptr = this.__wbg_ptr;
21
+ this.__wbg_ptr = 0;
22
+ YoloModelFinalization.unregister(this);
23
+ return ptr;
24
+ }
25
+ free() {
26
+ const ptr = this.__destroy_into_raw();
27
+ wasm.__wbg_yolomodel_free(ptr, 0);
28
+ }
29
+ /**
30
+ * The active device: `"webgpu"` or `"cpu"` (the fallback when WebGPU is
31
+ * unavailable). Mirrors the native `Device` display.
32
+ * @returns {string}
33
+ */
34
+ get device() {
35
+ let deferred1_0;
36
+ let deferred1_1;
37
+ try {
38
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
39
+ wasm.yolomodel_device(retptr, this.__wbg_ptr);
40
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
41
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
42
+ deferred1_0 = r0;
43
+ deferred1_1 = r1;
44
+ return getStringFromWasm0(r0, r1);
45
+ } finally {
46
+ wasm.__wbindgen_add_to_stack_pointer(16);
47
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
48
+ }
49
+ }
50
+ /**
51
+ * Load a model from raw ONNX bytes (fetched by the JS wrapper).
52
+ *
53
+ * Initializes the accelerated backend on first use, reads the embedded
54
+ * Ultralytics metadata from the model bytes, then commits an ONNX Runtime
55
+ * session on the requested execution provider. Equivalent to Python's
56
+ * `YOLO('model.onnx')`.
57
+ *
58
+ * `device` is `"webgpu"` or `"cpu"` (the browser picks the GPU adapter
59
+ * automatically). WebGPU is registered with `error_on_failure`, so if the
60
+ * session cannot commit on it the load falls back to CPU and
61
+ * [`device`](Self::device) reports what actually ran.
62
+ *
63
+ * # Errors
64
+ * Returns a JS error if the backend cannot start, the bytes are not a valid
65
+ * model, or the model lacks Ultralytics metadata.
66
+ * @param {Uint8Array} bytes
67
+ * @param {string | null | undefined} ort_base_url
68
+ * @param {string} device
69
+ * @returns {Promise<YoloModel>}
70
+ */
71
+ static load_bytes(bytes, ort_base_url, device) {
72
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
73
+ const len0 = WASM_VECTOR_LEN;
74
+ var ptr1 = isLikeNone(ort_base_url) ? 0 : passStringToWasm0(ort_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
75
+ var len1 = WASM_VECTOR_LEN;
76
+ const ptr2 = passStringToWasm0(device, wasm.__wbindgen_export, wasm.__wbindgen_export2);
77
+ const len2 = WASM_VECTOR_LEN;
78
+ const ret = wasm.yolomodel_load_bytes(ptr0, len0, ptr1, len1, ptr2, len2);
79
+ return takeObject(ret);
80
+ }
81
+ /**
82
+ * Class id -> name map (like Ultralytics `model.names`), as a JS object.
83
+ *
84
+ * # Errors
85
+ * Returns a JS error only if serialization fails (not expected).
86
+ * @returns {any}
87
+ */
88
+ get names() {
89
+ try {
90
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
91
+ wasm.yolomodel_names(retptr, this.__wbg_ptr);
92
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
93
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
94
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
95
+ if (r2) {
96
+ throw takeObject(r1);
97
+ }
98
+ return takeObject(r0);
99
+ } finally {
100
+ wasm.__wbindgen_add_to_stack_pointer(16);
101
+ }
102
+ }
103
+ /**
104
+ * Run inference on a single encoded image (JPEG or PNG bytes).
105
+ *
106
+ * `conf` and `iou` are the confidence and NMS IoU thresholds (pass the model
107
+ * defaults 0.25 / 0.7 to match Ultralytics); `classes` optionally keeps only
108
+ * the given class ids (for semantic, other pixels become background).
109
+ * Returns a plain JS object whose shape mirrors the Ultralytics `Results` API.
110
+ *
111
+ * # Errors
112
+ * Returns a JS error if the image cannot be decoded or inference fails.
113
+ * @param {Uint8Array} image
114
+ * @param {number} conf
115
+ * @param {number} iou
116
+ * @param {Uint32Array | null} [classes]
117
+ * @returns {Promise<any>}
118
+ */
119
+ predict(image, conf, iou, classes) {
120
+ const ptr0 = passArray8ToWasm0(image, wasm.__wbindgen_export);
121
+ const len0 = WASM_VECTOR_LEN;
122
+ var ptr1 = isLikeNone(classes) ? 0 : passArray32ToWasm0(classes, wasm.__wbindgen_export);
123
+ var len1 = WASM_VECTOR_LEN;
124
+ const ret = wasm.yolomodel_predict(this.__wbg_ptr, ptr0, len0, conf, iou, ptr1, len1);
125
+ return takeObject(ret);
126
+ }
127
+ /**
128
+ * Run inference on raw `RGBA` pixels (e.g. a canvas/webcam `ImageData`).
129
+ *
130
+ * Skips image encoding/decoding entirely, so it is the fast path for live
131
+ * video. `rgba` is `width * height * 4` bytes, row-major.
132
+ *
133
+ * # Errors
134
+ * Returns a JS error if the buffer size is wrong or inference fails.
135
+ * @param {Uint8Array} rgba
136
+ * @param {number} width
137
+ * @param {number} height
138
+ * @param {number} conf
139
+ * @param {number} iou
140
+ * @param {Uint32Array | null} [classes]
141
+ * @returns {Promise<any>}
142
+ */
143
+ predict_rgba(rgba, width, height, conf, iou, classes) {
144
+ const ptr0 = passArray8ToWasm0(rgba, wasm.__wbindgen_export);
145
+ const len0 = WASM_VECTOR_LEN;
146
+ var ptr1 = isLikeNone(classes) ? 0 : passArray32ToWasm0(classes, wasm.__wbindgen_export);
147
+ var len1 = WASM_VECTOR_LEN;
148
+ const ret = wasm.yolomodel_predict_rgba(this.__wbg_ptr, ptr0, len0, width, height, conf, iou, ptr1, len1);
149
+ return takeObject(ret);
150
+ }
151
+ /**
152
+ * The model's task (`"detect"`, `"segment"`, `"pose"`, `"classify"`,
153
+ * `"obb"`, or `"semantic"`).
154
+ * @returns {string}
155
+ */
156
+ get task() {
157
+ let deferred1_0;
158
+ let deferred1_1;
159
+ try {
160
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
161
+ wasm.yolomodel_task(retptr, this.__wbg_ptr);
162
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
163
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
164
+ deferred1_0 = r0;
165
+ deferred1_1 = r1;
166
+ return getStringFromWasm0(r0, r1);
167
+ } finally {
168
+ wasm.__wbindgen_add_to_stack_pointer(16);
169
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
170
+ }
171
+ }
172
+ }
173
+ if (Symbol.dispose) YoloModel.prototype[Symbol.dispose] = YoloModel.prototype.free;
174
+
175
+ /**
176
+ * Return the Ultralytics pose skeleton + keypoint/limb colors (constant). The
177
+ * JS annotator calls this once to color pose overlays from the shared palette.
178
+ *
179
+ * # Errors
180
+ * Returns a JS error only if serialization fails (not expected).
181
+ * @returns {any}
182
+ */
183
+ export function pose_palette() {
184
+ try {
185
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
186
+ wasm.pose_palette(retptr);
187
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
188
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
189
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
190
+ if (r2) {
191
+ throw takeObject(r1);
192
+ }
193
+ return takeObject(r0);
194
+ } finally {
195
+ wasm.__wbindgen_add_to_stack_pointer(16);
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Install a panic hook that logs Rust panics to the browser console.
201
+ */
202
+ export function start() {
203
+ wasm.start();
204
+ }
205
+ function __wbg_get_imports() {
206
+ const import0 = {
207
+ __proto__: null,
208
+ __wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
209
+ const ret = Error(getStringFromWasm0(arg0, arg1));
210
+ return addHeapObject(ret);
211
+ },
212
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
213
+ const ret = String(getObject(arg1));
214
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
215
+ const len1 = WASM_VECTOR_LEN;
216
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
217
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
218
+ },
219
+ __wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d: function(arg0, arg1) {
220
+ const v = getObject(arg1);
221
+ const ret = typeof(v) === 'bigint' ? v : undefined;
222
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
223
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
224
+ },
225
+ __wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
226
+ const v = getObject(arg0);
227
+ const ret = typeof(v) === 'boolean' ? v : undefined;
228
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
229
+ },
230
+ __wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
231
+ const ret = debugString(getObject(arg1));
232
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
233
+ const len1 = WASM_VECTOR_LEN;
234
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
235
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
236
+ },
237
+ __wbg___wbindgen_in_70a403a56e771704: function(arg0, arg1) {
238
+ const ret = getObject(arg0) in getObject(arg1);
239
+ return ret;
240
+ },
241
+ __wbg___wbindgen_is_bigint_6ffd6468a9bc44b9: function(arg0) {
242
+ const ret = typeof(getObject(arg0)) === 'bigint';
243
+ return ret;
244
+ },
245
+ __wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
246
+ const ret = typeof(getObject(arg0)) === 'function';
247
+ return ret;
248
+ },
249
+ __wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
250
+ const val = getObject(arg0);
251
+ const ret = typeof(val) === 'object' && val !== null;
252
+ return ret;
253
+ },
254
+ __wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
255
+ const ret = typeof(getObject(arg0)) === 'string';
256
+ return ret;
257
+ },
258
+ __wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
259
+ const ret = getObject(arg0) === undefined;
260
+ return ret;
261
+ },
262
+ __wbg___wbindgen_jsval_eq_1068e624fa87f6ab: function(arg0, arg1) {
263
+ const ret = getObject(arg0) === getObject(arg1);
264
+ return ret;
265
+ },
266
+ __wbg___wbindgen_jsval_loose_eq_2c56564c75129511: function(arg0, arg1) {
267
+ const ret = getObject(arg0) == getObject(arg1);
268
+ return ret;
269
+ },
270
+ __wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
271
+ const obj = getObject(arg1);
272
+ const ret = typeof(obj) === 'number' ? obj : undefined;
273
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
274
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
275
+ },
276
+ __wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
277
+ const obj = getObject(arg1);
278
+ const ret = typeof(obj) === 'string' ? obj : undefined;
279
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
280
+ var len1 = WASM_VECTOR_LEN;
281
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
282
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
283
+ },
284
+ __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
285
+ throw new Error(getStringFromWasm0(arg0, arg1));
286
+ },
287
+ __wbg__wbg_cb_unref_61db23ac97f16c31: function(arg0) {
288
+ getObject(arg0)._wbg_cb_unref();
289
+ },
290
+ __wbg_buffer_d370c8cae5692933: function(arg0) {
291
+ const ret = getObject(arg0).buffer;
292
+ return addHeapObject(ret);
293
+ },
294
+ __wbg_byteLength_2c6dc3b4b85d3547: function(arg0) {
295
+ const ret = getObject(arg0).byteLength;
296
+ return ret;
297
+ },
298
+ __wbg_byteOffset_349aa9bf0a183eca: function(arg0) {
299
+ const ret = getObject(arg0).byteOffset;
300
+ return ret;
301
+ },
302
+ __wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
303
+ const ret = getObject(arg0).call(getObject(arg1));
304
+ return addHeapObject(ret);
305
+ }, arguments); },
306
+ __wbg_call_9c758de292015997: function() { return handleError(function (arg0, arg1, arg2) {
307
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
308
+ return addHeapObject(ret);
309
+ }, arguments); },
310
+ __wbg_create_604d3dd8b0220101: function() { return handleError(function (arg0, arg1, arg2) {
311
+ const ret = ort.InferenceSession.create(getStringFromWasm0(arg0, arg1), takeObject(arg2));
312
+ return addHeapObject(ret);
313
+ }, arguments); },
314
+ __wbg_create_aa26088c323fe759: function() { return handleError(function (arg0, arg1) {
315
+ const ret = ort.InferenceSession.create(getObject(arg0), takeObject(arg1));
316
+ return addHeapObject(ret);
317
+ }, arguments); },
318
+ __wbg_data_f77ae23e62caa57c: function() { return handleError(function (arg0) {
319
+ const ret = getObject(arg0).data;
320
+ return addHeapObject(ret);
321
+ }, arguments); },
322
+ __wbg_dims_4cbc39371d1db46c: function(arg0, arg1) {
323
+ const ret = getObject(arg1).dims;
324
+ const ptr1 = passArray32ToWasm0(ret, wasm.__wbindgen_export);
325
+ const len1 = WASM_VECTOR_LEN;
326
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
327
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
328
+ },
329
+ __wbg_done_60cf307fcc680536: function(arg0) {
330
+ const ret = getObject(arg0).done;
331
+ return ret;
332
+ },
333
+ __wbg_entries_04b37a02507f1713: function(arg0) {
334
+ const ret = Object.entries(getObject(arg0));
335
+ return addHeapObject(ret);
336
+ },
337
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
338
+ let deferred0_0;
339
+ let deferred0_1;
340
+ try {
341
+ deferred0_0 = arg0;
342
+ deferred0_1 = arg1;
343
+ console.error(getStringFromWasm0(arg0, arg1));
344
+ } finally {
345
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
346
+ }
347
+ },
348
+ __wbg_from_d300fe49deab18f5: function(arg0) {
349
+ const ret = Array.from(getObject(arg0));
350
+ return addHeapObject(ret);
351
+ },
352
+ __wbg_getData_87474928ad362e4c: function() { return handleError(function (arg0) {
353
+ const ret = getObject(arg0).getData();
354
+ return addHeapObject(ret);
355
+ }, arguments); },
356
+ __wbg_get_1f8f054ddbaa7db2: function() { return handleError(function (arg0, arg1) {
357
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
358
+ return addHeapObject(ret);
359
+ }, arguments); },
360
+ __wbg_get_2b48c7d0d006a781: function(arg0, arg1) {
361
+ const ret = getObject(arg0)[arg1 >>> 0];
362
+ return addHeapObject(ret);
363
+ },
364
+ __wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
365
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
366
+ return addHeapObject(ret);
367
+ }, arguments); },
368
+ __wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
369
+ const ret = getObject(arg0)[arg1 >>> 0];
370
+ return addHeapObject(ret);
371
+ },
372
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
373
+ const ret = getObject(arg0)[getObject(arg1)];
374
+ return addHeapObject(ret);
375
+ },
376
+ __wbg_initRuntime_8e839bc51a59b99d: function() { return handleError(function (arg0, arg1) {
377
+ const ret = initRuntime(arg0, takeObject(arg1));
378
+ return addHeapObject(ret);
379
+ }, arguments); },
380
+ __wbg_inputMetadata_87b8670ec1aecff3: function(arg0, arg1) {
381
+ const ret = getObject(arg1).inputMetadata;
382
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
383
+ const len1 = WASM_VECTOR_LEN;
384
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
385
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
386
+ },
387
+ __wbg_inputNames_006e79de2e9d06b0: function(arg0, arg1) {
388
+ const ret = getObject(arg1).inputNames;
389
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
390
+ const len1 = WASM_VECTOR_LEN;
391
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
392
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
393
+ },
394
+ __wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
395
+ let result;
396
+ try {
397
+ result = getObject(arg0) instanceof ArrayBuffer;
398
+ } catch (_) {
399
+ result = false;
400
+ }
401
+ const ret = result;
402
+ return ret;
403
+ },
404
+ __wbg_instanceof_Map_9fc06d9a951bcee6: function(arg0) {
405
+ let result;
406
+ try {
407
+ result = getObject(arg0) instanceof Map;
408
+ } catch (_) {
409
+ result = false;
410
+ }
411
+ const ret = result;
412
+ return ret;
413
+ },
414
+ __wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
415
+ let result;
416
+ try {
417
+ result = getObject(arg0) instanceof Uint8Array;
418
+ } catch (_) {
419
+ result = false;
420
+ }
421
+ const ret = result;
422
+ return ret;
423
+ },
424
+ __wbg_instanceof_Window_e093be59ee9a8e14: function(arg0) {
425
+ let result;
426
+ try {
427
+ result = getObject(arg0) instanceof Window;
428
+ } catch (_) {
429
+ result = false;
430
+ }
431
+ const ret = result;
432
+ return ret;
433
+ },
434
+ __wbg_isArray_67c2c9c4313f4448: function(arg0) {
435
+ const ret = Array.isArray(getObject(arg0));
436
+ return ret;
437
+ },
438
+ __wbg_isSafeInteger_66acec27e09e99a7: function(arg0) {
439
+ const ret = Number.isSafeInteger(getObject(arg0));
440
+ return ret;
441
+ },
442
+ __wbg_iterator_8732428d309e270e: function() {
443
+ const ret = Symbol.iterator;
444
+ return addHeapObject(ret);
445
+ },
446
+ __wbg_length_4a591ecaa01354d9: function(arg0) {
447
+ const ret = getObject(arg0).length;
448
+ return ret;
449
+ },
450
+ __wbg_length_66f1a4b2e9026940: function(arg0) {
451
+ const ret = getObject(arg0).length;
452
+ return ret;
453
+ },
454
+ __wbg_location_40d7e9906760d235: function(arg0) {
455
+ const ret = getObject(arg0).location;
456
+ return (__wbindgen_enum_DataLocation.indexOf(ret) + 1 || 7) - 1;
457
+ },
458
+ __wbg_new_227d7c05414eb861: function() {
459
+ const ret = new Error();
460
+ return addHeapObject(ret);
461
+ },
462
+ __wbg_new_578aeef4b6b94378: function(arg0) {
463
+ const ret = new Uint8Array(getObject(arg0));
464
+ return addHeapObject(ret);
465
+ },
466
+ __wbg_new_622fc80556be2e26: function() {
467
+ const ret = new Map();
468
+ return addHeapObject(ret);
469
+ },
470
+ __wbg_new_ce1ab61c1c2b300d: function() {
471
+ const ret = new Object();
472
+ return addHeapObject(ret);
473
+ },
474
+ __wbg_new_d90091b82fdf5b91: function() {
475
+ const ret = new Array();
476
+ return addHeapObject(ret);
477
+ },
478
+ __wbg_new_from_buffer_raw_4a1de2fd5040de11: function() { return handleError(function (arg0, arg1, arg2) {
479
+ const ret = new ort.Tensor(__wbindgen_enum_DataType[arg0], takeObject(arg1), takeObject(arg2));
480
+ return addHeapObject(ret);
481
+ }, arguments); },
482
+ __wbg_new_typed_bf31d18f92484486: function(arg0, arg1) {
483
+ try {
484
+ var state0 = {a: arg0, b: arg1};
485
+ var cb0 = (arg0, arg1) => {
486
+ const a = state0.a;
487
+ state0.a = 0;
488
+ try {
489
+ return __wasm_bindgen_func_elem_2281(a, state0.b, arg0, arg1);
490
+ } finally {
491
+ state0.a = a;
492
+ }
493
+ };
494
+ const ret = new Promise(cb0);
495
+ return addHeapObject(ret);
496
+ } finally {
497
+ state0.a = 0;
498
+ }
499
+ },
500
+ __wbg_new_with_byte_offset_and_length_d836f26d916dd9ad: function(arg0, arg1, arg2) {
501
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
502
+ return addHeapObject(ret);
503
+ },
504
+ __wbg_new_with_length_1eb3643ef8ff666a: function(arg0) {
505
+ const ret = new Int32Array(arg0 >>> 0);
506
+ return addHeapObject(ret);
507
+ },
508
+ __wbg_new_with_length_21806dff02ad1c3e: function(arg0) {
509
+ const ret = new Uint32Array(arg0 >>> 0);
510
+ return addHeapObject(ret);
511
+ },
512
+ __wbg_new_with_length_36a4998e27b014c5: function(arg0) {
513
+ const ret = new Uint8Array(arg0 >>> 0);
514
+ return addHeapObject(ret);
515
+ },
516
+ __wbg_new_with_length_48a9c83b8a87d11f: function(arg0) {
517
+ const ret = new BigInt64Array(arg0 >>> 0);
518
+ return addHeapObject(ret);
519
+ },
520
+ __wbg_new_with_length_4bcd86182574c707: function(arg0) {
521
+ const ret = new BigUint64Array(arg0 >>> 0);
522
+ return addHeapObject(ret);
523
+ },
524
+ __wbg_new_with_length_5a54328420579213: function(arg0) {
525
+ const ret = new Int8Array(arg0 >>> 0);
526
+ return addHeapObject(ret);
527
+ },
528
+ __wbg_new_with_length_7d20818cf1afe359: function(arg0) {
529
+ const ret = new Float32Array(arg0 >>> 0);
530
+ return addHeapObject(ret);
531
+ },
532
+ __wbg_new_with_length_8f9278dbad0d5670: function(arg0) {
533
+ const ret = new Uint16Array(arg0 >>> 0);
534
+ return addHeapObject(ret);
535
+ },
536
+ __wbg_new_with_length_9ac6a9917b8558cb: function(arg0) {
537
+ const ret = new Int16Array(arg0 >>> 0);
538
+ return addHeapObject(ret);
539
+ },
540
+ __wbg_new_with_length_b4a87ccced374381: function(arg0) {
541
+ const ret = new Float64Array(arg0 >>> 0);
542
+ return addHeapObject(ret);
543
+ },
544
+ __wbg_next_9e03acdf51c4960d: function(arg0) {
545
+ const ret = getObject(arg0).next;
546
+ return addHeapObject(ret);
547
+ },
548
+ __wbg_next_eb8ca7351fa27906: function() { return handleError(function (arg0) {
549
+ const ret = getObject(arg0).next();
550
+ return addHeapObject(ret);
551
+ }, arguments); },
552
+ __wbg_now_f565250295e2d180: function(arg0) {
553
+ const ret = getObject(arg0).now();
554
+ return ret;
555
+ },
556
+ __wbg_outputMetadata_f60f543c30563643: function(arg0, arg1) {
557
+ const ret = getObject(arg1).outputMetadata;
558
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
559
+ const len1 = WASM_VECTOR_LEN;
560
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
561
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
562
+ },
563
+ __wbg_outputNames_5e88e61bf53e5de8: function(arg0, arg1) {
564
+ const ret = getObject(arg1).outputNames;
565
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
566
+ const len1 = WASM_VECTOR_LEN;
567
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
568
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
569
+ },
570
+ __wbg_ownKeys_0587b8fe286a40e6: function() { return handleError(function (arg0) {
571
+ const ret = Reflect.ownKeys(getObject(arg0));
572
+ return addHeapObject(ret);
573
+ }, arguments); },
574
+ __wbg_performance_68499ca0718837f5: function(arg0) {
575
+ const ret = getObject(arg0).performance;
576
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
577
+ },
578
+ __wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
579
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
580
+ },
581
+ __wbg_push_a6822215aa43e71c: function(arg0, arg1) {
582
+ const ret = getObject(arg0).push(getObject(arg1));
583
+ return ret;
584
+ },
585
+ __wbg_queueMicrotask_35c611f4a14830b2: function(arg0) {
586
+ queueMicrotask(getObject(arg0));
587
+ },
588
+ __wbg_queueMicrotask_404ed0a58e0b63cc: function(arg0) {
589
+ const ret = getObject(arg0).queueMicrotask;
590
+ return addHeapObject(ret);
591
+ },
592
+ __wbg_resolve_25a7e548d5881dca: function(arg0) {
593
+ const ret = Promise.resolve(getObject(arg0));
594
+ return addHeapObject(ret);
595
+ },
596
+ __wbg_run_91f1b7e43bde55af: function() { return handleError(function (arg0, arg1) {
597
+ const ret = getObject(arg0).run(takeObject(arg1));
598
+ return addHeapObject(ret);
599
+ }, arguments); },
600
+ __wbg_set_29c99a8aac1c01e5: function(arg0, arg1, arg2) {
601
+ getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
602
+ },
603
+ __wbg_set_52b1e1eb5bed906a: function(arg0, arg1, arg2) {
604
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
605
+ return addHeapObject(ret);
606
+ },
607
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
608
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
609
+ },
610
+ __wbg_set_6e30c9374c26414c: function() { return handleError(function (arg0, arg1, arg2) {
611
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
612
+ return ret;
613
+ }, arguments); },
614
+ __wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
615
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
616
+ },
617
+ __wbg_slice_765bd2e8494bd9b4: function(arg0, arg1) {
618
+ const ret = getObject(arg1).slice();
619
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
620
+ const len1 = WASM_VECTOR_LEN;
621
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
622
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
623
+ },
624
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
625
+ const ret = getObject(arg1).stack;
626
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
627
+ const len1 = WASM_VECTOR_LEN;
628
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
629
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
630
+ },
631
+ __wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function() {
632
+ const ret = typeof global === 'undefined' ? null : global;
633
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
634
+ },
635
+ __wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function() {
636
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
637
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
638
+ },
639
+ __wbg_static_accessor_SELF_4c59f6c7ea29a144: function() {
640
+ const ret = typeof self === 'undefined' ? null : self;
641
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
642
+ },
643
+ __wbg_static_accessor_WINDOW_e70ae9f2eb052253: function() {
644
+ const ret = typeof window === 'undefined' ? null : window;
645
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
646
+ },
647
+ __wbg_then_18f476d590e58992: function(arg0, arg1, arg2) {
648
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
649
+ return addHeapObject(ret);
650
+ },
651
+ __wbg_then_ac7b025999b52837: function(arg0, arg1) {
652
+ const ret = getObject(arg0).then(getObject(arg1));
653
+ return addHeapObject(ret);
654
+ },
655
+ __wbg_toString_3d301e24a7e4b208: function(arg0) {
656
+ const ret = getObject(arg0).toString();
657
+ return addHeapObject(ret);
658
+ },
659
+ __wbg_trackSessionInit_d2f5559748b8ff80: function() { return handleError(function () {
660
+ const ret = trackSessionInit();
661
+ return addHeapObject(ret);
662
+ }, arguments); },
663
+ __wbg_type_5bf9facd6ac793eb: function(arg0) {
664
+ const ret = getObject(arg0).type;
665
+ return (__wbindgen_enum_DataType.indexOf(ret) + 1 || 16) - 1;
666
+ },
667
+ __wbg_value_f3625092ee4b37f4: function(arg0) {
668
+ const ret = getObject(arg0).value;
669
+ return addHeapObject(ret);
670
+ },
671
+ __wbg_yolomodel_new: function(arg0) {
672
+ const ret = YoloModel.__wrap(arg0);
673
+ return addHeapObject(ret);
674
+ },
675
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
676
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 688, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
677
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1874);
678
+ return addHeapObject(ret);
679
+ },
680
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
681
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 797, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
682
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2272);
683
+ return addHeapObject(ret);
684
+ },
685
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
686
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("boolean")], shim_idx: 688, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
687
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1874_2);
688
+ return addHeapObject(ret);
689
+ },
690
+ __wbindgen_cast_0000000000000004: function(arg0) {
691
+ // Cast intrinsic for `F64 -> Externref`.
692
+ const ret = arg0;
693
+ return addHeapObject(ret);
694
+ },
695
+ __wbindgen_cast_0000000000000005: function(arg0) {
696
+ // Cast intrinsic for `I64 -> Externref`.
697
+ const ret = arg0;
698
+ return addHeapObject(ret);
699
+ },
700
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
701
+ // Cast intrinsic for `Ref(Slice(F32)) -> NamedExternref("Float32Array")`.
702
+ const ret = getArrayF32FromWasm0(arg0, arg1);
703
+ return addHeapObject(ret);
704
+ },
705
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
706
+ // Cast intrinsic for `Ref(Slice(F64)) -> NamedExternref("Float64Array")`.
707
+ const ret = getArrayF64FromWasm0(arg0, arg1);
708
+ return addHeapObject(ret);
709
+ },
710
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
711
+ // Cast intrinsic for `Ref(Slice(I16)) -> NamedExternref("Int16Array")`.
712
+ const ret = getArrayI16FromWasm0(arg0, arg1);
713
+ return addHeapObject(ret);
714
+ },
715
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
716
+ // Cast intrinsic for `Ref(Slice(I32)) -> NamedExternref("Int32Array")`.
717
+ const ret = getArrayI32FromWasm0(arg0, arg1);
718
+ return addHeapObject(ret);
719
+ },
720
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
721
+ // Cast intrinsic for `Ref(Slice(I64)) -> NamedExternref("BigInt64Array")`.
722
+ const ret = getArrayI64FromWasm0(arg0, arg1);
723
+ return addHeapObject(ret);
724
+ },
725
+ __wbindgen_cast_000000000000000b: function(arg0, arg1) {
726
+ // Cast intrinsic for `Ref(Slice(I8)) -> NamedExternref("Int8Array")`.
727
+ const ret = getArrayI8FromWasm0(arg0, arg1);
728
+ return addHeapObject(ret);
729
+ },
730
+ __wbindgen_cast_000000000000000c: function(arg0, arg1) {
731
+ // Cast intrinsic for `Ref(Slice(U16)) -> NamedExternref("Uint16Array")`.
732
+ const ret = getArrayU16FromWasm0(arg0, arg1);
733
+ return addHeapObject(ret);
734
+ },
735
+ __wbindgen_cast_000000000000000d: function(arg0, arg1) {
736
+ // Cast intrinsic for `Ref(Slice(U32)) -> NamedExternref("Uint32Array")`.
737
+ const ret = getArrayU32FromWasm0(arg0, arg1);
738
+ return addHeapObject(ret);
739
+ },
740
+ __wbindgen_cast_000000000000000e: function(arg0, arg1) {
741
+ // Cast intrinsic for `Ref(Slice(U64)) -> NamedExternref("BigUint64Array")`.
742
+ const ret = getArrayU64FromWasm0(arg0, arg1);
743
+ return addHeapObject(ret);
744
+ },
745
+ __wbindgen_cast_000000000000000f: function(arg0, arg1) {
746
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
747
+ const ret = getArrayU8FromWasm0(arg0, arg1);
748
+ return addHeapObject(ret);
749
+ },
750
+ __wbindgen_cast_0000000000000010: function(arg0, arg1) {
751
+ // Cast intrinsic for `Ref(String) -> Externref`.
752
+ const ret = getStringFromWasm0(arg0, arg1);
753
+ return addHeapObject(ret);
754
+ },
755
+ __wbindgen_cast_0000000000000011: function(arg0) {
756
+ // Cast intrinsic for `U64 -> Externref`.
757
+ const ret = BigInt.asUintN(64, arg0);
758
+ return addHeapObject(ret);
759
+ },
760
+ __wbindgen_object_clone_ref: function(arg0) {
761
+ const ret = getObject(arg0);
762
+ return addHeapObject(ret);
763
+ },
764
+ __wbindgen_object_drop_ref: function(arg0) {
765
+ takeObject(arg0);
766
+ },
767
+ };
768
+ return {
769
+ __proto__: null,
770
+ "./ultralytics_inference_web_bg.js": import0,
771
+ };
772
+ }
773
+
774
+ function __wasm_bindgen_func_elem_1874(arg0, arg1, arg2) {
775
+ try {
776
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
777
+ wasm.__wasm_bindgen_func_elem_1874(retptr, arg0, arg1, addHeapObject(arg2));
778
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
779
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
780
+ if (r1) {
781
+ throw takeObject(r0);
782
+ }
783
+ } finally {
784
+ wasm.__wbindgen_add_to_stack_pointer(16);
785
+ }
786
+ }
787
+
788
+ function __wasm_bindgen_func_elem_2272(arg0, arg1, arg2) {
789
+ try {
790
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
791
+ wasm.__wasm_bindgen_func_elem_2272(retptr, arg0, arg1, addHeapObject(arg2));
792
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
793
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
794
+ if (r1) {
795
+ throw takeObject(r0);
796
+ }
797
+ } finally {
798
+ wasm.__wbindgen_add_to_stack_pointer(16);
799
+ }
800
+ }
801
+
802
+ function __wasm_bindgen_func_elem_1874_2(arg0, arg1, arg2) {
803
+ try {
804
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
805
+ wasm.__wasm_bindgen_func_elem_1874_2(retptr, arg0, arg1, addHeapObject(arg2));
806
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
807
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
808
+ if (r1) {
809
+ throw takeObject(r0);
810
+ }
811
+ } finally {
812
+ wasm.__wbindgen_add_to_stack_pointer(16);
813
+ }
814
+ }
815
+
816
+ function __wasm_bindgen_func_elem_2281(arg0, arg1, arg2, arg3) {
817
+ wasm.__wasm_bindgen_func_elem_2281(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
818
+ }
819
+
820
+
821
+ const __wbindgen_enum_DataLocation = ["none", "cpu", "cpu-pinned", "texture", "gpu-buffer", "ml-tensor"];
822
+
823
+
824
+ const __wbindgen_enum_DataType = ["bool", "float16", "float32", "float64", "int4", "int8", "int16", "int32", "int64", "uint4", "uint8", "uint16", "uint32", "uint64", "string"];
825
+ const YoloModelFinalization = (typeof FinalizationRegistry === 'undefined')
826
+ ? { register: () => {}, unregister: () => {} }
827
+ : new FinalizationRegistry(ptr => wasm.__wbg_yolomodel_free(ptr, 1));
828
+
829
+ function addHeapObject(obj) {
830
+ if (heap_next === heap.length) heap.push(heap.length + 1);
831
+ const idx = heap_next;
832
+ heap_next = heap[idx];
833
+
834
+ heap[idx] = obj;
835
+ return idx;
836
+ }
837
+
838
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
839
+ ? { register: () => {}, unregister: () => {} }
840
+ : new FinalizationRegistry(state => wasm.__wbindgen_export5(state.a, state.b));
841
+
842
+ function debugString(val) {
843
+ // primitive types
844
+ const type = typeof val;
845
+ if (type == 'number' || type == 'boolean' || val == null) {
846
+ return `${val}`;
847
+ }
848
+ if (type == 'string') {
849
+ return `"${val}"`;
850
+ }
851
+ if (type == 'symbol') {
852
+ const description = val.description;
853
+ if (description == null) {
854
+ return 'Symbol';
855
+ } else {
856
+ return `Symbol(${description})`;
857
+ }
858
+ }
859
+ if (type == 'function') {
860
+ const name = val.name;
861
+ if (typeof name == 'string' && name.length > 0) {
862
+ return `Function(${name})`;
863
+ } else {
864
+ return 'Function';
865
+ }
866
+ }
867
+ // objects
868
+ if (Array.isArray(val)) {
869
+ const length = val.length;
870
+ let debug = '[';
871
+ if (length > 0) {
872
+ debug += debugString(val[0]);
873
+ }
874
+ for(let i = 1; i < length; i++) {
875
+ debug += ', ' + debugString(val[i]);
876
+ }
877
+ debug += ']';
878
+ return debug;
879
+ }
880
+ // Test for built-in
881
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
882
+ let className;
883
+ if (builtInMatches && builtInMatches.length > 1) {
884
+ className = builtInMatches[1];
885
+ } else {
886
+ // Failed to match the standard '[object ClassName]'
887
+ return toString.call(val);
888
+ }
889
+ if (className == 'Object') {
890
+ // we're a user defined class or Object
891
+ // JSON.stringify avoids problems with cycles, and is generally much
892
+ // easier than looping through ownProperties of `val`.
893
+ try {
894
+ return 'Object(' + JSON.stringify(val) + ')';
895
+ } catch (_) {
896
+ return 'Object';
897
+ }
898
+ }
899
+ // errors
900
+ if (val instanceof Error) {
901
+ return `${val.name}: ${val.message}\n${val.stack}`;
902
+ }
903
+ // TODO we could test for more things here, like `Set`s and `Map`s.
904
+ return className;
905
+ }
906
+
907
+ function dropObject(idx) {
908
+ if (idx < 1028) return;
909
+ heap[idx] = heap_next;
910
+ heap_next = idx;
911
+ }
912
+
913
+ function getArrayF32FromWasm0(ptr, len) {
914
+ ptr = ptr >>> 0;
915
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
916
+ }
917
+
918
+ function getArrayF64FromWasm0(ptr, len) {
919
+ ptr = ptr >>> 0;
920
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
921
+ }
922
+
923
+ function getArrayI16FromWasm0(ptr, len) {
924
+ ptr = ptr >>> 0;
925
+ return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
926
+ }
927
+
928
+ function getArrayI32FromWasm0(ptr, len) {
929
+ ptr = ptr >>> 0;
930
+ return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
931
+ }
932
+
933
+ function getArrayI64FromWasm0(ptr, len) {
934
+ ptr = ptr >>> 0;
935
+ return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
936
+ }
937
+
938
+ function getArrayI8FromWasm0(ptr, len) {
939
+ ptr = ptr >>> 0;
940
+ return getInt8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
941
+ }
942
+
943
+ function getArrayU16FromWasm0(ptr, len) {
944
+ ptr = ptr >>> 0;
945
+ return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
946
+ }
947
+
948
+ function getArrayU32FromWasm0(ptr, len) {
949
+ ptr = ptr >>> 0;
950
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
951
+ }
952
+
953
+ function getArrayU64FromWasm0(ptr, len) {
954
+ ptr = ptr >>> 0;
955
+ return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
956
+ }
957
+
958
+ function getArrayU8FromWasm0(ptr, len) {
959
+ ptr = ptr >>> 0;
960
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
961
+ }
962
+
963
+ let cachedBigInt64ArrayMemory0 = null;
964
+ function getBigInt64ArrayMemory0() {
965
+ if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
966
+ cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
967
+ }
968
+ return cachedBigInt64ArrayMemory0;
969
+ }
970
+
971
+ let cachedBigUint64ArrayMemory0 = null;
972
+ function getBigUint64ArrayMemory0() {
973
+ if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
974
+ cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
975
+ }
976
+ return cachedBigUint64ArrayMemory0;
977
+ }
978
+
979
+ let cachedDataViewMemory0 = null;
980
+ function getDataViewMemory0() {
981
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
982
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
983
+ }
984
+ return cachedDataViewMemory0;
985
+ }
986
+
987
+ let cachedFloat32ArrayMemory0 = null;
988
+ function getFloat32ArrayMemory0() {
989
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
990
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
991
+ }
992
+ return cachedFloat32ArrayMemory0;
993
+ }
994
+
995
+ let cachedFloat64ArrayMemory0 = null;
996
+ function getFloat64ArrayMemory0() {
997
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
998
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
999
+ }
1000
+ return cachedFloat64ArrayMemory0;
1001
+ }
1002
+
1003
+ let cachedInt16ArrayMemory0 = null;
1004
+ function getInt16ArrayMemory0() {
1005
+ if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) {
1006
+ cachedInt16ArrayMemory0 = new Int16Array(wasm.memory.buffer);
1007
+ }
1008
+ return cachedInt16ArrayMemory0;
1009
+ }
1010
+
1011
+ let cachedInt32ArrayMemory0 = null;
1012
+ function getInt32ArrayMemory0() {
1013
+ if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
1014
+ cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
1015
+ }
1016
+ return cachedInt32ArrayMemory0;
1017
+ }
1018
+
1019
+ let cachedInt8ArrayMemory0 = null;
1020
+ function getInt8ArrayMemory0() {
1021
+ if (cachedInt8ArrayMemory0 === null || cachedInt8ArrayMemory0.byteLength === 0) {
1022
+ cachedInt8ArrayMemory0 = new Int8Array(wasm.memory.buffer);
1023
+ }
1024
+ return cachedInt8ArrayMemory0;
1025
+ }
1026
+
1027
+ function getStringFromWasm0(ptr, len) {
1028
+ return decodeText(ptr >>> 0, len);
1029
+ }
1030
+
1031
+ let cachedUint16ArrayMemory0 = null;
1032
+ function getUint16ArrayMemory0() {
1033
+ if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
1034
+ cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
1035
+ }
1036
+ return cachedUint16ArrayMemory0;
1037
+ }
1038
+
1039
+ let cachedUint32ArrayMemory0 = null;
1040
+ function getUint32ArrayMemory0() {
1041
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1042
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1043
+ }
1044
+ return cachedUint32ArrayMemory0;
1045
+ }
1046
+
1047
+ let cachedUint8ArrayMemory0 = null;
1048
+ function getUint8ArrayMemory0() {
1049
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1050
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1051
+ }
1052
+ return cachedUint8ArrayMemory0;
1053
+ }
1054
+
1055
+ function getObject(idx) { return heap[idx]; }
1056
+
1057
+ function handleError(f, args) {
1058
+ try {
1059
+ return f.apply(this, args);
1060
+ } catch (e) {
1061
+ wasm.__wbindgen_export3(addHeapObject(e));
1062
+ }
1063
+ }
1064
+
1065
+ let heap = new Array(1024).fill(undefined);
1066
+ heap.push(undefined, null, true, false);
1067
+
1068
+ let heap_next = heap.length;
1069
+
1070
+ function isLikeNone(x) {
1071
+ return x === undefined || x === null;
1072
+ }
1073
+
1074
+ function makeMutClosure(arg0, arg1, f) {
1075
+ const state = { a: arg0, b: arg1, cnt: 1 };
1076
+ const real = (...args) => {
1077
+
1078
+ // First up with a closure we increment the internal reference
1079
+ // count. This ensures that the Rust closure environment won't
1080
+ // be deallocated while we're invoking it.
1081
+ state.cnt++;
1082
+ const a = state.a;
1083
+ state.a = 0;
1084
+ try {
1085
+ return f(a, state.b, ...args);
1086
+ } finally {
1087
+ state.a = a;
1088
+ real._wbg_cb_unref();
1089
+ }
1090
+ };
1091
+ real._wbg_cb_unref = () => {
1092
+ if (--state.cnt === 0) {
1093
+ wasm.__wbindgen_export5(state.a, state.b);
1094
+ state.a = 0;
1095
+ CLOSURE_DTORS.unregister(state);
1096
+ }
1097
+ };
1098
+ CLOSURE_DTORS.register(real, state, state);
1099
+ return real;
1100
+ }
1101
+
1102
+ function passArray32ToWasm0(arg, malloc) {
1103
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1104
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1105
+ WASM_VECTOR_LEN = arg.length;
1106
+ return ptr;
1107
+ }
1108
+
1109
+ function passArray8ToWasm0(arg, malloc) {
1110
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1111
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1112
+ WASM_VECTOR_LEN = arg.length;
1113
+ return ptr;
1114
+ }
1115
+
1116
+ function passArrayJsValueToWasm0(array, malloc) {
1117
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1118
+ const mem = getDataViewMemory0();
1119
+ for (let i = 0; i < array.length; i++) {
1120
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
1121
+ }
1122
+ WASM_VECTOR_LEN = array.length;
1123
+ return ptr;
1124
+ }
1125
+
1126
+ function passStringToWasm0(arg, malloc, realloc) {
1127
+ if (realloc === undefined) {
1128
+ const buf = cachedTextEncoder.encode(arg);
1129
+ const ptr = malloc(buf.length, 1) >>> 0;
1130
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1131
+ WASM_VECTOR_LEN = buf.length;
1132
+ return ptr;
1133
+ }
1134
+
1135
+ let len = arg.length;
1136
+ let ptr = malloc(len, 1) >>> 0;
1137
+
1138
+ const mem = getUint8ArrayMemory0();
1139
+
1140
+ let offset = 0;
1141
+
1142
+ for (; offset < len; offset++) {
1143
+ const code = arg.charCodeAt(offset);
1144
+ if (code > 0x7F) break;
1145
+ mem[ptr + offset] = code;
1146
+ }
1147
+ if (offset !== len) {
1148
+ if (offset !== 0) {
1149
+ arg = arg.slice(offset);
1150
+ }
1151
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1152
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1153
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1154
+
1155
+ offset += ret.written;
1156
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1157
+ }
1158
+
1159
+ WASM_VECTOR_LEN = offset;
1160
+ return ptr;
1161
+ }
1162
+
1163
+ function takeObject(idx) {
1164
+ const ret = getObject(idx);
1165
+ dropObject(idx);
1166
+ return ret;
1167
+ }
1168
+
1169
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1170
+ cachedTextDecoder.decode();
1171
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1172
+ let numBytesDecoded = 0;
1173
+ function decodeText(ptr, len) {
1174
+ numBytesDecoded += len;
1175
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1176
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1177
+ cachedTextDecoder.decode();
1178
+ numBytesDecoded = len;
1179
+ }
1180
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1181
+ }
1182
+
1183
+ const cachedTextEncoder = new TextEncoder();
1184
+
1185
+ if (!('encodeInto' in cachedTextEncoder)) {
1186
+ cachedTextEncoder.encodeInto = function (arg, view) {
1187
+ const buf = cachedTextEncoder.encode(arg);
1188
+ view.set(buf);
1189
+ return {
1190
+ read: arg.length,
1191
+ written: buf.length
1192
+ };
1193
+ };
1194
+ }
1195
+
1196
+ let WASM_VECTOR_LEN = 0;
1197
+
1198
+ let wasmModule, wasmInstance, wasm;
1199
+ function __wbg_finalize_init(instance, module) {
1200
+ wasmInstance = instance;
1201
+ wasm = instance.exports;
1202
+ wasmModule = module;
1203
+ cachedBigInt64ArrayMemory0 = null;
1204
+ cachedBigUint64ArrayMemory0 = null;
1205
+ cachedDataViewMemory0 = null;
1206
+ cachedFloat32ArrayMemory0 = null;
1207
+ cachedFloat64ArrayMemory0 = null;
1208
+ cachedInt16ArrayMemory0 = null;
1209
+ cachedInt32ArrayMemory0 = null;
1210
+ cachedInt8ArrayMemory0 = null;
1211
+ cachedUint16ArrayMemory0 = null;
1212
+ cachedUint32ArrayMemory0 = null;
1213
+ cachedUint8ArrayMemory0 = null;
1214
+ wasm.__wbindgen_start();
1215
+ return wasm;
1216
+ }
1217
+
1218
+ async function __wbg_load(module, imports) {
1219
+ if (typeof Response === 'function' && module instanceof Response) {
1220
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1221
+ try {
1222
+ return await WebAssembly.instantiateStreaming(module, imports);
1223
+ } catch (e) {
1224
+ const validResponse = module.ok && expectedResponseType(module.type);
1225
+
1226
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1227
+ 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);
1228
+
1229
+ } else { throw e; }
1230
+ }
1231
+ }
1232
+
1233
+ const bytes = await module.arrayBuffer();
1234
+ return await WebAssembly.instantiate(bytes, imports);
1235
+ } else {
1236
+ const instance = await WebAssembly.instantiate(module, imports);
1237
+
1238
+ if (instance instanceof WebAssembly.Instance) {
1239
+ return { instance, module };
1240
+ } else {
1241
+ return instance;
1242
+ }
1243
+ }
1244
+
1245
+ function expectedResponseType(type) {
1246
+ switch (type) {
1247
+ case 'basic': case 'cors': case 'default': return true;
1248
+ }
1249
+ return false;
1250
+ }
1251
+ }
1252
+
1253
+ function initSync(module) {
1254
+ if (wasm !== undefined) return wasm;
1255
+
1256
+
1257
+ if (module !== undefined) {
1258
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1259
+ ({module} = module)
1260
+ } else {
1261
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1262
+ }
1263
+ }
1264
+
1265
+ const imports = __wbg_get_imports();
1266
+ if (!(module instanceof WebAssembly.Module)) {
1267
+ module = new WebAssembly.Module(module);
1268
+ }
1269
+ const instance = new WebAssembly.Instance(module, imports);
1270
+ return __wbg_finalize_init(instance, module);
1271
+ }
1272
+
1273
+ async function __wbg_init(module_or_path) {
1274
+ if (wasm !== undefined) return wasm;
1275
+
1276
+
1277
+ if (module_or_path !== undefined) {
1278
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1279
+ ({module_or_path} = module_or_path)
1280
+ } else {
1281
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1282
+ }
1283
+ }
1284
+
1285
+ if (module_or_path === undefined) {
1286
+ module_or_path = new URL('ultralytics_inference_web_bg.wasm', import.meta.url);
1287
+ }
1288
+ const imports = __wbg_get_imports();
1289
+
1290
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1291
+ module_or_path = fetch(module_or_path);
1292
+ }
1293
+
1294
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1295
+
1296
+ return __wbg_finalize_init(instance, module);
1297
+ }
1298
+
1299
+ export { initSync, __wbg_init as default };