@layers/amba-core-wasm 1.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.
@@ -0,0 +1,1575 @@
1
+ /* @ts-self-types="./amba_core.d.ts" */
2
+
3
+ /**
4
+ * JS-callable opaque handle to [`AmbaCore`].
5
+ *
6
+ * The JS side instantiates it via `AmbaCoreWasm.init(configJson, fetchFn)`
7
+ * and stashes it for the lifetime of the page.
8
+ */
9
+ export class AmbaCoreWasm {
10
+ static __wrap(ptr) {
11
+ const obj = Object.create(AmbaCoreWasm.prototype);
12
+ obj.__wbg_ptr = ptr;
13
+ AmbaCoreWasmFinalization.register(obj, obj.__wbg_ptr, obj);
14
+ return obj;
15
+ }
16
+ __destroy_into_raw() {
17
+ const ptr = this.__wbg_ptr;
18
+ this.__wbg_ptr = 0;
19
+ AmbaCoreWasmFinalization.unregister(this);
20
+ return ptr;
21
+ }
22
+ free() {
23
+ const ptr = this.__destroy_into_raw();
24
+ wasm.__wbg_ambacorewasm_free(ptr, 0);
25
+ }
26
+ /**
27
+ * @returns {Promise<any>}
28
+ */
29
+ achievementsGetAll() {
30
+ const ret = wasm.ambacorewasm_achievementsGetAll(this.__wbg_ptr);
31
+ return takeObject(ret);
32
+ }
33
+ /**
34
+ * @returns {Promise<any>}
35
+ */
36
+ achievementsGetProgress() {
37
+ const ret = wasm.ambacorewasm_achievementsGetProgress(this.__wbg_ptr);
38
+ return takeObject(ret);
39
+ }
40
+ /**
41
+ * @param {string} request_json
42
+ * @returns {Promise<any>}
43
+ */
44
+ aiAnthropicMessages(request_json) {
45
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
46
+ const len0 = WASM_VECTOR_LEN;
47
+ const ret = wasm.ambacorewasm_aiAnthropicMessages(this.__wbg_ptr, ptr0, len0);
48
+ return takeObject(ret);
49
+ }
50
+ /**
51
+ * @returns {string}
52
+ */
53
+ anonymousId() {
54
+ let deferred1_0;
55
+ let deferred1_1;
56
+ try {
57
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
58
+ wasm.ambacorewasm_anonymousId(retptr, this.__wbg_ptr);
59
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
60
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
61
+ deferred1_0 = r0;
62
+ deferred1_1 = r1;
63
+ return getStringFromWasm0(r0, r1);
64
+ } finally {
65
+ wasm.__wbindgen_add_to_stack_pointer(16);
66
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
67
+ }
68
+ }
69
+ /**
70
+ * @returns {string | undefined}
71
+ */
72
+ appUserId() {
73
+ try {
74
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
75
+ wasm.ambacorewasm_appUserId(retptr, this.__wbg_ptr);
76
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
77
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
78
+ let v1;
79
+ if (r0 !== 0) {
80
+ v1 = getStringFromWasm0(r0, r1).slice();
81
+ wasm.__wbindgen_export5(r0, r1 * 1, 1);
82
+ }
83
+ return v1;
84
+ } finally {
85
+ wasm.__wbindgen_add_to_stack_pointer(16);
86
+ }
87
+ }
88
+ /**
89
+ * @returns {Promise<any>}
90
+ */
91
+ catalogList() {
92
+ const ret = wasm.ambacorewasm_catalogList(this.__wbg_ptr);
93
+ return takeObject(ret);
94
+ }
95
+ /**
96
+ * @param {string} id
97
+ * @returns {Promise<any>}
98
+ */
99
+ challengesClaim(id) {
100
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
101
+ const len0 = WASM_VECTOR_LEN;
102
+ const ret = wasm.ambacorewasm_challengesClaim(this.__wbg_ptr, ptr0, len0);
103
+ return takeObject(ret);
104
+ }
105
+ /**
106
+ * @param {string} id
107
+ * @returns {Promise<any>}
108
+ */
109
+ challengesGet(id) {
110
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
111
+ const len0 = WASM_VECTOR_LEN;
112
+ const ret = wasm.ambacorewasm_challengesGet(this.__wbg_ptr, ptr0, len0);
113
+ return takeObject(ret);
114
+ }
115
+ /**
116
+ * @returns {Promise<any>}
117
+ */
118
+ challengesGetActive() {
119
+ const ret = wasm.ambacorewasm_challengesGetActive(this.__wbg_ptr);
120
+ return takeObject(ret);
121
+ }
122
+ /**
123
+ * @param {string} id
124
+ * @returns {Promise<any>}
125
+ */
126
+ challengesGetProgress(id) {
127
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
128
+ const len0 = WASM_VECTOR_LEN;
129
+ const ret = wasm.ambacorewasm_challengesGetProgress(this.__wbg_ptr, ptr0, len0);
130
+ return takeObject(ret);
131
+ }
132
+ /**
133
+ * @param {string} collection
134
+ * @param {string} id
135
+ * @returns {Promise<any>}
136
+ */
137
+ collectionsDelete(collection, id) {
138
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
139
+ const len0 = WASM_VECTOR_LEN;
140
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
141
+ const len1 = WASM_VECTOR_LEN;
142
+ const ret = wasm.ambacorewasm_collectionsDelete(this.__wbg_ptr, ptr0, len0, ptr1, len1);
143
+ return takeObject(ret);
144
+ }
145
+ /**
146
+ * @param {string} collection
147
+ * @param {string} options_json
148
+ * @returns {Promise<any>}
149
+ */
150
+ collectionsFind(collection, options_json) {
151
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
152
+ const len0 = WASM_VECTOR_LEN;
153
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
154
+ const len1 = WASM_VECTOR_LEN;
155
+ const ret = wasm.ambacorewasm_collectionsFind(this.__wbg_ptr, ptr0, len0, ptr1, len1);
156
+ return takeObject(ret);
157
+ }
158
+ /**
159
+ * @param {string} collection
160
+ * @param {string} id
161
+ * @returns {Promise<any>}
162
+ */
163
+ collectionsFindOne(collection, id) {
164
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
165
+ const len0 = WASM_VECTOR_LEN;
166
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
167
+ const len1 = WASM_VECTOR_LEN;
168
+ const ret = wasm.ambacorewasm_collectionsFindOne(this.__wbg_ptr, ptr0, len0, ptr1, len1);
169
+ return takeObject(ret);
170
+ }
171
+ /**
172
+ * @param {string} collection
173
+ * @param {string} row_json
174
+ * @returns {Promise<any>}
175
+ */
176
+ collectionsInsert(collection, row_json) {
177
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
178
+ const len0 = WASM_VECTOR_LEN;
179
+ const ptr1 = passStringToWasm0(row_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
180
+ const len1 = WASM_VECTOR_LEN;
181
+ const ret = wasm.ambacorewasm_collectionsInsert(this.__wbg_ptr, ptr0, len0, ptr1, len1);
182
+ return takeObject(ret);
183
+ }
184
+ /**
185
+ * @param {string} collection
186
+ * @param {string} id
187
+ * @param {string} set_json
188
+ * @returns {Promise<any>}
189
+ */
190
+ collectionsUpdate(collection, id, set_json) {
191
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
192
+ const len0 = WASM_VECTOR_LEN;
193
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
194
+ const len1 = WASM_VECTOR_LEN;
195
+ const ptr2 = passStringToWasm0(set_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
196
+ const len2 = WASM_VECTOR_LEN;
197
+ const ret = wasm.ambacorewasm_collectionsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
198
+ return takeObject(ret);
199
+ }
200
+ /**
201
+ * @returns {Promise<any>}
202
+ */
203
+ configFetch() {
204
+ const ret = wasm.ambacorewasm_configFetch(this.__wbg_ptr);
205
+ return takeObject(ret);
206
+ }
207
+ /**
208
+ * @param {string} channel
209
+ * @param {string} item_json
210
+ * @returns {Promise<any>}
211
+ */
212
+ contentCreateItem(channel, item_json) {
213
+ const ptr0 = passStringToWasm0(channel, wasm.__wbindgen_export, wasm.__wbindgen_export2);
214
+ const len0 = WASM_VECTOR_LEN;
215
+ const ptr1 = passStringToWasm0(item_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
216
+ const len1 = WASM_VECTOR_LEN;
217
+ const ret = wasm.ambacorewasm_contentCreateItem(this.__wbg_ptr, ptr0, len0, ptr1, len1);
218
+ return takeObject(ret);
219
+ }
220
+ /**
221
+ * @param {string} id
222
+ * @returns {Promise<any>}
223
+ */
224
+ contentGetItem(id) {
225
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
226
+ const len0 = WASM_VECTOR_LEN;
227
+ const ret = wasm.ambacorewasm_contentGetItem(this.__wbg_ptr, ptr0, len0);
228
+ return takeObject(ret);
229
+ }
230
+ /**
231
+ * `channel` is optional; `limit` caps results per page; `cursor` is
232
+ * the server-issued opaque pagination token. Mirror the TS wrapper
233
+ * signature: getLibrary(channel?, { limit?, cursor? }).
234
+ * @param {string | null} [channel]
235
+ * @param {number | null} [limit]
236
+ * @param {string | null} [cursor]
237
+ * @returns {Promise<any>}
238
+ */
239
+ contentGetLibrary(channel, limit, cursor) {
240
+ var ptr0 = isLikeNone(channel) ? 0 : passStringToWasm0(channel, wasm.__wbindgen_export, wasm.__wbindgen_export2);
241
+ var len0 = WASM_VECTOR_LEN;
242
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
243
+ var len1 = WASM_VECTOR_LEN;
244
+ const ret = wasm.ambacorewasm_contentGetLibrary(this.__wbg_ptr, ptr0, len0, isLikeNone(limit) ? Number.MAX_SAFE_INTEGER : (limit) >>> 0, ptr1, len1);
245
+ return takeObject(ret);
246
+ }
247
+ /**
248
+ * `channel` is optional; when omitted, FFI defaults to `"default"` so
249
+ * single-channel apps can call `Amba.content.getToday()` without args.
250
+ * @param {string | null} [channel]
251
+ * @returns {Promise<any>}
252
+ */
253
+ contentGetToday(channel) {
254
+ var ptr0 = isLikeNone(channel) ? 0 : passStringToWasm0(channel, wasm.__wbindgen_export, wasm.__wbindgen_export2);
255
+ var len0 = WASM_VECTOR_LEN;
256
+ const ret = wasm.ambacorewasm_contentGetToday(this.__wbg_ptr, ptr0, len0);
257
+ return takeObject(ret);
258
+ }
259
+ /**
260
+ * @param {string} id
261
+ * @param {string} state_json
262
+ * @returns {Promise<any>}
263
+ */
264
+ contentUpdateItem(id, state_json) {
265
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ const ptr1 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
268
+ const len1 = WASM_VECTOR_LEN;
269
+ const ret = wasm.ambacorewasm_contentUpdateItem(this.__wbg_ptr, ptr0, len0, ptr1, len1);
270
+ return takeObject(ret);
271
+ }
272
+ /**
273
+ * @returns {Promise<any>}
274
+ */
275
+ currenciesGetBalance() {
276
+ const ret = wasm.ambacorewasm_currenciesGetBalance(this.__wbg_ptr);
277
+ return takeObject(ret);
278
+ }
279
+ /**
280
+ * @param {string} currency_key
281
+ * @returns {Promise<any>}
282
+ */
283
+ currenciesGetTransactions(currency_key) {
284
+ const ptr0 = passStringToWasm0(currency_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
285
+ const len0 = WASM_VECTOR_LEN;
286
+ const ret = wasm.ambacorewasm_currenciesGetTransactions(this.__wbg_ptr, ptr0, len0);
287
+ return takeObject(ret);
288
+ }
289
+ /**
290
+ * @param {string} params_json
291
+ * @returns {Promise<any>}
292
+ */
293
+ deepLinksCreate(params_json) {
294
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ const ret = wasm.ambacorewasm_deepLinksCreate(this.__wbg_ptr, ptr0, len0);
297
+ return takeObject(ret);
298
+ }
299
+ /**
300
+ * @param {string} short_code
301
+ * @returns {Promise<any>}
302
+ */
303
+ deepLinksGet(short_code) {
304
+ const ptr0 = passStringToWasm0(short_code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
305
+ const len0 = WASM_VECTOR_LEN;
306
+ const ret = wasm.ambacorewasm_deepLinksGet(this.__wbg_ptr, ptr0, len0);
307
+ return takeObject(ret);
308
+ }
309
+ /**
310
+ * @param {string} name
311
+ * @returns {Promise<any>}
312
+ */
313
+ entitlementsHas(name) {
314
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
315
+ const len0 = WASM_VECTOR_LEN;
316
+ const ret = wasm.ambacorewasm_entitlementsHas(this.__wbg_ptr, ptr0, len0);
317
+ return takeObject(ret);
318
+ }
319
+ /**
320
+ * @returns {Promise<any>}
321
+ */
322
+ entitlementsList() {
323
+ const ret = wasm.ambacorewasm_entitlementsList(this.__wbg_ptr);
324
+ return takeObject(ret);
325
+ }
326
+ /**
327
+ * @param {string | null} [feed]
328
+ * @param {string | null} [cursor]
329
+ * @returns {Promise<any>}
330
+ */
331
+ feedsGetActivity(feed, cursor) {
332
+ var ptr0 = isLikeNone(feed) ? 0 : passStringToWasm0(feed, wasm.__wbindgen_export, wasm.__wbindgen_export2);
333
+ var len0 = WASM_VECTOR_LEN;
334
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
335
+ var len1 = WASM_VECTOR_LEN;
336
+ const ret = wasm.ambacorewasm_feedsGetActivity(this.__wbg_ptr, ptr0, len0, ptr1, len1);
337
+ return takeObject(ret);
338
+ }
339
+ /**
340
+ * @returns {Promise<any>}
341
+ */
342
+ flagsFetch() {
343
+ const ret = wasm.ambacorewasm_flagsFetch(this.__wbg_ptr);
344
+ return takeObject(ret);
345
+ }
346
+ /**
347
+ * @param {string} user_id
348
+ * @returns {Promise<any>}
349
+ */
350
+ friendsBlockUser(user_id) {
351
+ const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
352
+ const len0 = WASM_VECTOR_LEN;
353
+ const ret = wasm.ambacorewasm_friendsBlockUser(this.__wbg_ptr, ptr0, len0);
354
+ return takeObject(ret);
355
+ }
356
+ /**
357
+ * @returns {Promise<any>}
358
+ */
359
+ friendsGetFriends() {
360
+ const ret = wasm.ambacorewasm_friendsGetFriends(this.__wbg_ptr);
361
+ return takeObject(ret);
362
+ }
363
+ /**
364
+ * @returns {Promise<any>}
365
+ */
366
+ friendsGetList() {
367
+ const ret = wasm.ambacorewasm_friendsGetList(this.__wbg_ptr);
368
+ return takeObject(ret);
369
+ }
370
+ /**
371
+ * @param {string} friendship_id
372
+ * @returns {Promise<any>}
373
+ */
374
+ friendsRemoveBlock(friendship_id) {
375
+ const ptr0 = passStringToWasm0(friendship_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
376
+ const len0 = WASM_VECTOR_LEN;
377
+ const ret = wasm.ambacorewasm_friendsRemoveBlock(this.__wbg_ptr, ptr0, len0);
378
+ return takeObject(ret);
379
+ }
380
+ /**
381
+ * @param {string} user_id
382
+ * @returns {Promise<any>}
383
+ */
384
+ friendsUnblockUser(user_id) {
385
+ const ptr0 = passStringToWasm0(user_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
386
+ const len0 = WASM_VECTOR_LEN;
387
+ const ret = wasm.ambacorewasm_friendsUnblockUser(this.__wbg_ptr, ptr0, len0);
388
+ return takeObject(ret);
389
+ }
390
+ /**
391
+ * @param {string} params_json
392
+ * @returns {Promise<any>}
393
+ */
394
+ groupsCreate(params_json) {
395
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
396
+ const len0 = WASM_VECTOR_LEN;
397
+ const ret = wasm.ambacorewasm_groupsCreate(this.__wbg_ptr, ptr0, len0);
398
+ return takeObject(ret);
399
+ }
400
+ /**
401
+ * @param {string} id
402
+ * @returns {Promise<any>}
403
+ */
404
+ groupsDelete(id) {
405
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
406
+ const len0 = WASM_VECTOR_LEN;
407
+ const ret = wasm.ambacorewasm_groupsDelete(this.__wbg_ptr, ptr0, len0);
408
+ return takeObject(ret);
409
+ }
410
+ /**
411
+ * @param {string} id
412
+ * @returns {Promise<any>}
413
+ */
414
+ groupsGet(id) {
415
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
416
+ const len0 = WASM_VECTOR_LEN;
417
+ const ret = wasm.ambacorewasm_groupsGet(this.__wbg_ptr, ptr0, len0);
418
+ return takeObject(ret);
419
+ }
420
+ /**
421
+ * @param {string} id
422
+ * @returns {Promise<any>}
423
+ */
424
+ groupsGetMembers(id) {
425
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
426
+ const len0 = WASM_VECTOR_LEN;
427
+ const ret = wasm.ambacorewasm_groupsGetMembers(this.__wbg_ptr, ptr0, len0);
428
+ return takeObject(ret);
429
+ }
430
+ /**
431
+ * @param {string} id
432
+ * @param {string} user_id
433
+ * @returns {Promise<any>}
434
+ */
435
+ groupsInvite(id, user_id) {
436
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
437
+ const len0 = WASM_VECTOR_LEN;
438
+ const ptr1 = passStringToWasm0(user_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
439
+ const len1 = WASM_VECTOR_LEN;
440
+ const ret = wasm.ambacorewasm_groupsInvite(this.__wbg_ptr, ptr0, len0, ptr1, len1);
441
+ return takeObject(ret);
442
+ }
443
+ /**
444
+ * @param {string} id
445
+ * @returns {Promise<any>}
446
+ */
447
+ groupsJoin(id) {
448
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
449
+ const len0 = WASM_VECTOR_LEN;
450
+ const ret = wasm.ambacorewasm_groupsJoin(this.__wbg_ptr, ptr0, len0);
451
+ return takeObject(ret);
452
+ }
453
+ /**
454
+ * @param {string} id
455
+ * @returns {Promise<any>}
456
+ */
457
+ groupsLeave(id) {
458
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
459
+ const len0 = WASM_VECTOR_LEN;
460
+ const ret = wasm.ambacorewasm_groupsLeave(this.__wbg_ptr, ptr0, len0);
461
+ return takeObject(ret);
462
+ }
463
+ /**
464
+ * @param {string} id
465
+ * @param {string} patch_json
466
+ * @returns {Promise<any>}
467
+ */
468
+ groupsUpdate(id, patch_json) {
469
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
470
+ const len0 = WASM_VECTOR_LEN;
471
+ const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
472
+ const len1 = WASM_VECTOR_LEN;
473
+ const ret = wasm.ambacorewasm_groupsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1);
474
+ return takeObject(ret);
475
+ }
476
+ /**
477
+ * Initialize the SDK.
478
+ *
479
+ * `config_json`: JSON-stringified `AmbaConfig` (api_key, base_url,
480
+ * sdk_platform, sdk_wrapper_version, consent_required, debug).
481
+ *
482
+ * `fetch_fn`: a JS function `(url, init) => Promise<Response>`
483
+ * matching the global `fetch` signature. The wrapper passes
484
+ * `window.fetch.bind(window)` or a server-side polyfill.
485
+ * @param {string} config_json
486
+ * @param {Function} fetch_fn
487
+ * @returns {AmbaCoreWasm}
488
+ */
489
+ static init(config_json, fetch_fn) {
490
+ try {
491
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
492
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
493
+ const len0 = WASM_VECTOR_LEN;
494
+ wasm.ambacorewasm_init(retptr, ptr0, len0, addHeapObject(fetch_fn));
495
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
496
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
497
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
498
+ if (r2) {
499
+ throw takeObject(r1);
500
+ }
501
+ return AmbaCoreWasm.__wrap(r0);
502
+ } finally {
503
+ wasm.__wbindgen_add_to_stack_pointer(16);
504
+ }
505
+ }
506
+ /**
507
+ * @param {string} request_json
508
+ * @returns {Promise<any>}
509
+ */
510
+ inventoryConsume(request_json) {
511
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
512
+ const len0 = WASM_VECTOR_LEN;
513
+ const ret = wasm.ambacorewasm_inventoryConsume(this.__wbg_ptr, ptr0, len0);
514
+ return takeObject(ret);
515
+ }
516
+ /**
517
+ * @param {string} id
518
+ * @returns {Promise<any>}
519
+ */
520
+ inventoryGetItem(id) {
521
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
522
+ const len0 = WASM_VECTOR_LEN;
523
+ const ret = wasm.ambacorewasm_inventoryGetItem(this.__wbg_ptr, ptr0, len0);
524
+ return takeObject(ret);
525
+ }
526
+ /**
527
+ * @returns {Promise<any>}
528
+ */
529
+ inventoryGetItems() {
530
+ const ret = wasm.ambacorewasm_inventoryGetItems(this.__wbg_ptr);
531
+ return takeObject(ret);
532
+ }
533
+ /**
534
+ * @param {string} request_json
535
+ * @returns {Promise<any>}
536
+ */
537
+ inventoryPurchase(request_json) {
538
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
539
+ const len0 = WASM_VECTOR_LEN;
540
+ const ret = wasm.ambacorewasm_inventoryPurchase(this.__wbg_ptr, ptr0, len0);
541
+ return takeObject(ret);
542
+ }
543
+ /**
544
+ * @returns {boolean}
545
+ */
546
+ isAuthenticated() {
547
+ const ret = wasm.ambacorewasm_isAuthenticated(this.__wbg_ptr);
548
+ return ret !== 0;
549
+ }
550
+ /**
551
+ * @param {string} key
552
+ * @returns {Promise<any>}
553
+ */
554
+ leaderboardsGet(key) {
555
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
556
+ const len0 = WASM_VECTOR_LEN;
557
+ const ret = wasm.ambacorewasm_leaderboardsGet(this.__wbg_ptr, ptr0, len0);
558
+ return takeObject(ret);
559
+ }
560
+ /**
561
+ * @param {string} key
562
+ * @param {number | null} [limit]
563
+ * @returns {Promise<any>}
564
+ */
565
+ leaderboardsGetEntries(key, limit) {
566
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
567
+ const len0 = WASM_VECTOR_LEN;
568
+ const ret = wasm.ambacorewasm_leaderboardsGetEntries(this.__wbg_ptr, ptr0, len0, isLikeNone(limit) ? Number.MAX_SAFE_INTEGER : (limit) >>> 0);
569
+ return takeObject(ret);
570
+ }
571
+ /**
572
+ * @param {string} key
573
+ * @returns {Promise<any>}
574
+ */
575
+ leaderboardsGetMyRank(key) {
576
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
577
+ const len0 = WASM_VECTOR_LEN;
578
+ const ret = wasm.ambacorewasm_leaderboardsGetMyRank(this.__wbg_ptr, ptr0, len0);
579
+ return takeObject(ret);
580
+ }
581
+ /**
582
+ * @returns {Promise<any>}
583
+ */
584
+ me() {
585
+ const ret = wasm.ambacorewasm_me(this.__wbg_ptr);
586
+ return takeObject(ret);
587
+ }
588
+ /**
589
+ * @returns {Promise<any>}
590
+ */
591
+ messagingGetConversations() {
592
+ const ret = wasm.ambacorewasm_messagingGetConversations(this.__wbg_ptr);
593
+ return takeObject(ret);
594
+ }
595
+ /**
596
+ * @param {string} id
597
+ * @returns {Promise<any>}
598
+ */
599
+ messagingGetMessage(id) {
600
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
601
+ const len0 = WASM_VECTOR_LEN;
602
+ const ret = wasm.ambacorewasm_messagingGetMessage(this.__wbg_ptr, ptr0, len0);
603
+ return takeObject(ret);
604
+ }
605
+ /**
606
+ * @param {string} request_json
607
+ * @returns {Promise<any>}
608
+ */
609
+ messagingSendMessage(request_json) {
610
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
611
+ const len0 = WASM_VECTOR_LEN;
612
+ const ret = wasm.ambacorewasm_messagingSendMessage(this.__wbg_ptr, ptr0, len0);
613
+ return takeObject(ret);
614
+ }
615
+ /**
616
+ * @param {string} id
617
+ * @returns {Promise<any>}
618
+ */
619
+ moderationGetReportStatus(id) {
620
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
621
+ const len0 = WASM_VECTOR_LEN;
622
+ const ret = wasm.ambacorewasm_moderationGetReportStatus(this.__wbg_ptr, ptr0, len0);
623
+ return takeObject(ret);
624
+ }
625
+ /**
626
+ * @param {string} request_json
627
+ * @returns {Promise<any>}
628
+ */
629
+ moderationReportContent(request_json) {
630
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
631
+ const len0 = WASM_VECTOR_LEN;
632
+ const ret = wasm.ambacorewasm_moderationReportContent(this.__wbg_ptr, ptr0, len0);
633
+ return takeObject(ret);
634
+ }
635
+ /**
636
+ * @param {string} request_json
637
+ * @returns {Promise<any>}
638
+ */
639
+ moderationReportUser(request_json) {
640
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
641
+ const len0 = WASM_VECTOR_LEN;
642
+ const ret = wasm.ambacorewasm_moderationReportUser(this.__wbg_ptr, ptr0, len0);
643
+ return takeObject(ret);
644
+ }
645
+ /**
646
+ * @returns {Promise<any>}
647
+ */
648
+ onboardingComplete() {
649
+ const ret = wasm.ambacorewasm_onboardingComplete(this.__wbg_ptr);
650
+ return takeObject(ret);
651
+ }
652
+ /**
653
+ * @returns {Promise<any>}
654
+ */
655
+ onboardingGetStatus() {
656
+ const ret = wasm.ambacorewasm_onboardingGetStatus(this.__wbg_ptr);
657
+ return takeObject(ret);
658
+ }
659
+ /**
660
+ * @param {string} payload_json
661
+ * @returns {Promise<any>}
662
+ */
663
+ onboardingNextStep(payload_json) {
664
+ const ptr0 = passStringToWasm0(payload_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
665
+ const len0 = WASM_VECTOR_LEN;
666
+ const ret = wasm.ambacorewasm_onboardingNextStep(this.__wbg_ptr, ptr0, len0);
667
+ return takeObject(ret);
668
+ }
669
+ /**
670
+ * @returns {Promise<any>}
671
+ */
672
+ onboardingSkipStep() {
673
+ const ret = wasm.ambacorewasm_onboardingSkipStep(this.__wbg_ptr);
674
+ return takeObject(ret);
675
+ }
676
+ /**
677
+ * @returns {Promise<any>}
678
+ */
679
+ pushGetTokens() {
680
+ const ret = wasm.ambacorewasm_pushGetTokens(this.__wbg_ptr);
681
+ return takeObject(ret);
682
+ }
683
+ /**
684
+ * @param {string} token
685
+ * @param {string} platform
686
+ * @param {string | null} [bundle_id]
687
+ * @returns {Promise<any>}
688
+ */
689
+ pushRegister(token, platform, bundle_id) {
690
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
691
+ const len0 = WASM_VECTOR_LEN;
692
+ const ptr1 = passStringToWasm0(platform, wasm.__wbindgen_export, wasm.__wbindgen_export2);
693
+ const len1 = WASM_VECTOR_LEN;
694
+ var ptr2 = isLikeNone(bundle_id) ? 0 : passStringToWasm0(bundle_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
695
+ var len2 = WASM_VECTOR_LEN;
696
+ const ret = wasm.ambacorewasm_pushRegister(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
697
+ return takeObject(ret);
698
+ }
699
+ /**
700
+ * @param {string} topic
701
+ * @returns {Promise<any>}
702
+ */
703
+ pushSubscribe(topic) {
704
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_export, wasm.__wbindgen_export2);
705
+ const len0 = WASM_VECTOR_LEN;
706
+ const ret = wasm.ambacorewasm_pushSubscribe(this.__wbg_ptr, ptr0, len0);
707
+ return takeObject(ret);
708
+ }
709
+ /**
710
+ * @param {string} token
711
+ * @returns {Promise<any>}
712
+ */
713
+ pushUnregister(token) {
714
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
715
+ const len0 = WASM_VECTOR_LEN;
716
+ const ret = wasm.ambacorewasm_pushUnregister(this.__wbg_ptr, ptr0, len0);
717
+ return takeObject(ret);
718
+ }
719
+ /**
720
+ * @param {string} topic
721
+ * @returns {Promise<any>}
722
+ */
723
+ pushUnsubscribe(topic) {
724
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_export, wasm.__wbindgen_export2);
725
+ const len0 = WASM_VECTOR_LEN;
726
+ const ret = wasm.ambacorewasm_pushUnsubscribe(this.__wbg_ptr, ptr0, len0);
727
+ return takeObject(ret);
728
+ }
729
+ /**
730
+ * @param {string} code
731
+ * @returns {Promise<any>}
732
+ */
733
+ referralsClaimReferral(code) {
734
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
735
+ const len0 = WASM_VECTOR_LEN;
736
+ const ret = wasm.ambacorewasm_referralsClaimReferral(this.__wbg_ptr, ptr0, len0);
737
+ return takeObject(ret);
738
+ }
739
+ /**
740
+ * @param {string | null} [code]
741
+ * @param {number | null} [max_uses]
742
+ * @returns {Promise<any>}
743
+ */
744
+ referralsCreate(code, max_uses) {
745
+ var ptr0 = isLikeNone(code) ? 0 : passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
746
+ var len0 = WASM_VECTOR_LEN;
747
+ const ret = wasm.ambacorewasm_referralsCreate(this.__wbg_ptr, ptr0, len0, isLikeNone(max_uses) ? Number.MAX_SAFE_INTEGER : (max_uses) >>> 0);
748
+ return takeObject(ret);
749
+ }
750
+ /**
751
+ * @returns {Promise<any>}
752
+ */
753
+ referralsGetReferralCode() {
754
+ const ret = wasm.ambacorewasm_referralsGetReferralCode(this.__wbg_ptr);
755
+ return takeObject(ret);
756
+ }
757
+ /**
758
+ * @returns {Promise<any>}
759
+ */
760
+ refreshSession() {
761
+ const ret = wasm.ambacorewasm_refreshSession(this.__wbg_ptr);
762
+ return takeObject(ret);
763
+ }
764
+ /**
765
+ * @param {string} params_json
766
+ * @returns {Promise<any>}
767
+ */
768
+ reviewsCreate(params_json) {
769
+ const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
770
+ const len0 = WASM_VECTOR_LEN;
771
+ const ret = wasm.ambacorewasm_reviewsCreate(this.__wbg_ptr, ptr0, len0);
772
+ return takeObject(ret);
773
+ }
774
+ /**
775
+ * @param {string} id
776
+ * @returns {Promise<any>}
777
+ */
778
+ reviewsDelete(id) {
779
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
780
+ const len0 = WASM_VECTOR_LEN;
781
+ const ret = wasm.ambacorewasm_reviewsDelete(this.__wbg_ptr, ptr0, len0);
782
+ return takeObject(ret);
783
+ }
784
+ /**
785
+ * @param {string} target_type
786
+ * @param {string} target_id
787
+ * @returns {Promise<any>}
788
+ */
789
+ reviewsList(target_type, target_id) {
790
+ const ptr0 = passStringToWasm0(target_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
791
+ const len0 = WASM_VECTOR_LEN;
792
+ const ptr1 = passStringToWasm0(target_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
793
+ const len1 = WASM_VECTOR_LEN;
794
+ const ret = wasm.ambacorewasm_reviewsList(this.__wbg_ptr, ptr0, len0, ptr1, len1);
795
+ return takeObject(ret);
796
+ }
797
+ /**
798
+ * @param {string} id
799
+ * @param {string} patch_json
800
+ * @returns {Promise<any>}
801
+ */
802
+ reviewsUpdate(id, patch_json) {
803
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
804
+ const len0 = WASM_VECTOR_LEN;
805
+ const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
806
+ const len1 = WASM_VECTOR_LEN;
807
+ const ret = wasm.ambacorewasm_reviewsUpdate(this.__wbg_ptr, ptr0, len0, ptr1, len1);
808
+ return takeObject(ret);
809
+ }
810
+ /**
811
+ * @returns {Promise<any>}
812
+ */
813
+ rolesGetMyRoles() {
814
+ const ret = wasm.ambacorewasm_rolesGetMyRoles(this.__wbg_ptr);
815
+ return takeObject(ret);
816
+ }
817
+ /**
818
+ * @param {string} permission
819
+ * @returns {Promise<any>}
820
+ */
821
+ rolesHasPermission(permission) {
822
+ const ptr0 = passStringToWasm0(permission, wasm.__wbindgen_export, wasm.__wbindgen_export2);
823
+ const len0 = WASM_VECTOR_LEN;
824
+ const ret = wasm.ambacorewasm_rolesHasPermission(this.__wbg_ptr, ptr0, len0);
825
+ return takeObject(ret);
826
+ }
827
+ /**
828
+ * @param {boolean} enabled
829
+ */
830
+ setDebug(enabled) {
831
+ wasm.ambacorewasm_setDebug(this.__wbg_ptr, enabled);
832
+ }
833
+ /**
834
+ * @returns {Promise<any>}
835
+ */
836
+ signInAnonymously() {
837
+ const ret = wasm.ambacorewasm_signInAnonymously(this.__wbg_ptr);
838
+ return takeObject(ret);
839
+ }
840
+ /**
841
+ * @param {string} email
842
+ * @param {string} password
843
+ * @returns {Promise<any>}
844
+ */
845
+ signInWithEmail(email, password) {
846
+ const ptr0 = passStringToWasm0(email, wasm.__wbindgen_export, wasm.__wbindgen_export2);
847
+ const len0 = WASM_VECTOR_LEN;
848
+ const ptr1 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
849
+ const len1 = WASM_VECTOR_LEN;
850
+ const ret = wasm.ambacorewasm_signInWithEmail(this.__wbg_ptr, ptr0, len0, ptr1, len1);
851
+ return takeObject(ret);
852
+ }
853
+ /**
854
+ * @param {string} provider
855
+ * @param {string} id_token
856
+ * @returns {Promise<any>}
857
+ */
858
+ signInWithSocial(provider, id_token) {
859
+ const ptr0 = passStringToWasm0(provider, wasm.__wbindgen_export, wasm.__wbindgen_export2);
860
+ const len0 = WASM_VECTOR_LEN;
861
+ const ptr1 = passStringToWasm0(id_token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
862
+ const len1 = WASM_VECTOR_LEN;
863
+ const ret = wasm.ambacorewasm_signInWithSocial(this.__wbg_ptr, ptr0, len0, ptr1, len1);
864
+ return takeObject(ret);
865
+ }
866
+ /**
867
+ * @param {boolean} rotate_anonymous_id
868
+ * @returns {Promise<any>}
869
+ */
870
+ signOut(rotate_anonymous_id) {
871
+ const ret = wasm.ambacorewasm_signOut(this.__wbg_ptr, rotate_anonymous_id);
872
+ return takeObject(ret);
873
+ }
874
+ /**
875
+ * @param {string} email
876
+ * @param {string} password
877
+ * @returns {Promise<any>}
878
+ */
879
+ signUpWithEmail(email, password) {
880
+ const ptr0 = passStringToWasm0(email, wasm.__wbindgen_export, wasm.__wbindgen_export2);
881
+ const len0 = WASM_VECTOR_LEN;
882
+ const ptr1 = passStringToWasm0(password, wasm.__wbindgen_export, wasm.__wbindgen_export2);
883
+ const len1 = WASM_VECTOR_LEN;
884
+ const ret = wasm.ambacorewasm_signUpWithEmail(this.__wbg_ptr, ptr0, len0, ptr1, len1);
885
+ return takeObject(ret);
886
+ }
887
+ /**
888
+ * @param {string} upload_id
889
+ * @param {string} asset_id
890
+ * @returns {Promise<any>}
891
+ */
892
+ storageCommit(upload_id, asset_id) {
893
+ const ptr0 = passStringToWasm0(upload_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
894
+ const len0 = WASM_VECTOR_LEN;
895
+ const ptr1 = passStringToWasm0(asset_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
896
+ const len1 = WASM_VECTOR_LEN;
897
+ const ret = wasm.ambacorewasm_storageCommit(this.__wbg_ptr, ptr0, len0, ptr1, len1);
898
+ return takeObject(ret);
899
+ }
900
+ /**
901
+ * @param {string} bucket
902
+ * @param {string} filename
903
+ * @param {string} mime_type
904
+ * @param {number} size_bytes
905
+ * @param {number | null} [retention_days]
906
+ * @returns {Promise<any>}
907
+ */
908
+ storagePresign(bucket, filename, mime_type, size_bytes, retention_days) {
909
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
910
+ const len0 = WASM_VECTOR_LEN;
911
+ const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_export, wasm.__wbindgen_export2);
912
+ const len1 = WASM_VECTOR_LEN;
913
+ const ptr2 = passStringToWasm0(mime_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
914
+ const len2 = WASM_VECTOR_LEN;
915
+ const ret = wasm.ambacorewasm_storagePresign(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, size_bytes, isLikeNone(retention_days) ? Number.MAX_SAFE_INTEGER : (retention_days) >>> 0);
916
+ return takeObject(ret);
917
+ }
918
+ /**
919
+ * @param {string} store_key
920
+ * @returns {Promise<any>}
921
+ */
922
+ storesGetPurchaseOptions(store_key) {
923
+ const ptr0 = passStringToWasm0(store_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
924
+ const len0 = WASM_VECTOR_LEN;
925
+ const ret = wasm.ambacorewasm_storesGetPurchaseOptions(this.__wbg_ptr, ptr0, len0);
926
+ return takeObject(ret);
927
+ }
928
+ /**
929
+ * @returns {Promise<any>}
930
+ */
931
+ storesList() {
932
+ const ret = wasm.ambacorewasm_storesList(this.__wbg_ptr);
933
+ return takeObject(ret);
934
+ }
935
+ /**
936
+ * @param {string} store_key
937
+ * @param {string} purchase_option_id
938
+ * @param {string} receipt_json
939
+ * @returns {Promise<any>}
940
+ */
941
+ storesPurchase(store_key, purchase_option_id, receipt_json) {
942
+ const ptr0 = passStringToWasm0(store_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
943
+ const len0 = WASM_VECTOR_LEN;
944
+ const ptr1 = passStringToWasm0(purchase_option_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
945
+ const len1 = WASM_VECTOR_LEN;
946
+ const ptr2 = passStringToWasm0(receipt_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
947
+ const len2 = WASM_VECTOR_LEN;
948
+ const ret = wasm.ambacorewasm_storesPurchase(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
949
+ return takeObject(ret);
950
+ }
951
+ /**
952
+ * @returns {Promise<any>}
953
+ */
954
+ streaksGetAll() {
955
+ const ret = wasm.ambacorewasm_streaksGetAll(this.__wbg_ptr);
956
+ return takeObject(ret);
957
+ }
958
+ /**
959
+ * @param {string} streak_key
960
+ * @returns {Promise<any>}
961
+ */
962
+ streaksQualify(streak_key) {
963
+ const ptr0 = passStringToWasm0(streak_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
964
+ const len0 = WASM_VECTOR_LEN;
965
+ const ret = wasm.ambacorewasm_streaksQualify(this.__wbg_ptr, ptr0, len0);
966
+ return takeObject(ret);
967
+ }
968
+ /**
969
+ * Track an event. Returns a Promise that resolves to undefined on success.
970
+ * @param {string} event
971
+ * @param {string | null} [properties_json]
972
+ * @returns {Promise<any>}
973
+ */
974
+ track(event, properties_json) {
975
+ const ptr0 = passStringToWasm0(event, wasm.__wbindgen_export, wasm.__wbindgen_export2);
976
+ const len0 = WASM_VECTOR_LEN;
977
+ var ptr1 = isLikeNone(properties_json) ? 0 : passStringToWasm0(properties_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
978
+ var len1 = WASM_VECTOR_LEN;
979
+ const ret = wasm.ambacorewasm_track(this.__wbg_ptr, ptr0, len0, ptr1, len1);
980
+ return takeObject(ret);
981
+ }
982
+ /**
983
+ * @param {string} grant_key
984
+ * @returns {Promise<any>}
985
+ */
986
+ xpClaim(grant_key) {
987
+ const ptr0 = passStringToWasm0(grant_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
988
+ const len0 = WASM_VECTOR_LEN;
989
+ const ret = wasm.ambacorewasm_xpClaim(this.__wbg_ptr, ptr0, len0);
990
+ return takeObject(ret);
991
+ }
992
+ /**
993
+ * @returns {Promise<any>}
994
+ */
995
+ xpGetBalance() {
996
+ const ret = wasm.ambacorewasm_xpGetBalance(this.__wbg_ptr);
997
+ return takeObject(ret);
998
+ }
999
+ /**
1000
+ * @param {number | null} [limit]
1001
+ * @returns {Promise<any>}
1002
+ */
1003
+ xpGetHistory(limit) {
1004
+ const ret = wasm.ambacorewasm_xpGetHistory(this.__wbg_ptr, isLikeNone(limit) ? Number.MAX_SAFE_INTEGER : (limit) >>> 0);
1005
+ return takeObject(ret);
1006
+ }
1007
+ }
1008
+ if (Symbol.dispose) AmbaCoreWasm.prototype[Symbol.dispose] = AmbaCoreWasm.prototype.free;
1009
+ function __wbg_get_imports() {
1010
+ const import0 = {
1011
+ __proto__: null,
1012
+ __wbg_Error_bce6d499ff0a4aff: function(arg0, arg1) {
1013
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1014
+ return addHeapObject(ret);
1015
+ },
1016
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
1017
+ const ret = String(getObject(arg1));
1018
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1019
+ const len1 = WASM_VECTOR_LEN;
1020
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1021
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1022
+ },
1023
+ __wbg___wbindgen_debug_string_edece8177ad01481: function(arg0, arg1) {
1024
+ const ret = debugString(getObject(arg1));
1025
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1026
+ const len1 = WASM_VECTOR_LEN;
1027
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1028
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1029
+ },
1030
+ __wbg___wbindgen_is_function_5cd60d5cf78b4eef: function(arg0) {
1031
+ const ret = typeof(getObject(arg0)) === 'function';
1032
+ return ret;
1033
+ },
1034
+ __wbg___wbindgen_is_string_dde0fd9020db4434: function(arg0) {
1035
+ const ret = typeof(getObject(arg0)) === 'string';
1036
+ return ret;
1037
+ },
1038
+ __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
1039
+ const ret = getObject(arg0) === undefined;
1040
+ return ret;
1041
+ },
1042
+ __wbg___wbindgen_number_get_f73a1244370fcc2c: function(arg0, arg1) {
1043
+ const obj = getObject(arg1);
1044
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1045
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1046
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1047
+ },
1048
+ __wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
1049
+ const obj = getObject(arg1);
1050
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1051
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1052
+ var len1 = WASM_VECTOR_LEN;
1053
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1054
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1055
+ },
1056
+ __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
1057
+ throw new Error(getStringFromWasm0(arg0, arg1));
1058
+ },
1059
+ __wbg__wbg_cb_unref_3fa391f3fcdb55f8: function(arg0) {
1060
+ getObject(arg0)._wbg_cb_unref();
1061
+ },
1062
+ __wbg_call_13665d9f14390edc: function() { return handleError(function (arg0, arg1) {
1063
+ const ret = getObject(arg0).call(getObject(arg1));
1064
+ return addHeapObject(ret);
1065
+ }, arguments); },
1066
+ __wbg_call_dfde26266607c996: function() { return handleError(function (arg0, arg1, arg2) {
1067
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1068
+ return addHeapObject(ret);
1069
+ }, arguments); },
1070
+ __wbg_call_faa0a261f288f846: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1071
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
1072
+ return addHeapObject(ret);
1073
+ }, arguments); },
1074
+ __wbg_getRandomValues_ef12552bf5acd2fe: function() { return handleError(function (arg0, arg1) {
1075
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1076
+ }, arguments); },
1077
+ __wbg_getTime_09f1dd40a44edb30: function(arg0) {
1078
+ const ret = getObject(arg0).getTime();
1079
+ return ret;
1080
+ },
1081
+ __wbg_get_dcf82ab8aad1a593: function() { return handleError(function (arg0, arg1) {
1082
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1083
+ return addHeapObject(ret);
1084
+ }, arguments); },
1085
+ __wbg_length_56fcd3e2b7e0299d: function(arg0) {
1086
+ const ret = getObject(arg0).length;
1087
+ return ret;
1088
+ },
1089
+ __wbg_new_02d162bc6cf02f60: function() {
1090
+ const ret = new Object();
1091
+ return addHeapObject(ret);
1092
+ },
1093
+ __wbg_new_070df68d66325372: function() {
1094
+ const ret = new Map();
1095
+ return addHeapObject(ret);
1096
+ },
1097
+ __wbg_new_0_2722fcdb71a888a6: function() {
1098
+ const ret = new Date();
1099
+ return addHeapObject(ret);
1100
+ },
1101
+ __wbg_new_310879b66b6e95e1: function() {
1102
+ const ret = new Array();
1103
+ return addHeapObject(ret);
1104
+ },
1105
+ __wbg_new_7ddec6de44ff8f5d: function(arg0) {
1106
+ const ret = new Uint8Array(getObject(arg0));
1107
+ return addHeapObject(ret);
1108
+ },
1109
+ __wbg_new_typed_c072c4ce9a2a0cdf: function(arg0, arg1) {
1110
+ try {
1111
+ var state0 = {a: arg0, b: arg1};
1112
+ var cb0 = (arg0, arg1) => {
1113
+ const a = state0.a;
1114
+ state0.a = 0;
1115
+ try {
1116
+ return __wasm_bindgen_func_elem_2351_96(a, state0.b, arg0, arg1);
1117
+ } finally {
1118
+ state0.a = a;
1119
+ }
1120
+ };
1121
+ const ret = new Promise(cb0);
1122
+ return addHeapObject(ret);
1123
+ } finally {
1124
+ state0.a = 0;
1125
+ }
1126
+ },
1127
+ __wbg_new_with_length_99887c91eae4abab: function(arg0) {
1128
+ const ret = new Uint8Array(arg0 >>> 0);
1129
+ return addHeapObject(ret);
1130
+ },
1131
+ __wbg_prototypesetcall_5f9bdc8d75e07276: function(arg0, arg1, arg2) {
1132
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1133
+ },
1134
+ __wbg_queueMicrotask_78d584b53af520f5: function(arg0) {
1135
+ const ret = getObject(arg0).queueMicrotask;
1136
+ return addHeapObject(ret);
1137
+ },
1138
+ __wbg_queueMicrotask_b39ea83c7f01971a: function(arg0) {
1139
+ queueMicrotask(getObject(arg0));
1140
+ },
1141
+ __wbg_resolve_d17db9352f5a220e: function(arg0) {
1142
+ const ret = Promise.resolve(getObject(arg0));
1143
+ return addHeapObject(ret);
1144
+ },
1145
+ __wbg_set_24d0fa9e104112f9: function(arg0, arg1, arg2) {
1146
+ getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
1147
+ },
1148
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1149
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1150
+ },
1151
+ __wbg_set_78ea6a19f4818587: function(arg0, arg1, arg2) {
1152
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1153
+ },
1154
+ __wbg_set_a0e911be3da02782: function() { return handleError(function (arg0, arg1, arg2) {
1155
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1156
+ return ret;
1157
+ }, arguments); },
1158
+ __wbg_set_facb7a5914e0fa39: function(arg0, arg1, arg2) {
1159
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1160
+ return addHeapObject(ret);
1161
+ },
1162
+ __wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9: function() {
1163
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1164
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1165
+ },
1166
+ __wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54: function() {
1167
+ const ret = typeof global === 'undefined' ? null : global;
1168
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1169
+ },
1170
+ __wbg_static_accessor_SELF_9b2406c23aeb2023: function() {
1171
+ const ret = typeof self === 'undefined' ? null : self;
1172
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1173
+ },
1174
+ __wbg_static_accessor_WINDOW_b34d2126934e16ba: function() {
1175
+ const ret = typeof window === 'undefined' ? null : window;
1176
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1177
+ },
1178
+ __wbg_then_837494e384b37459: function(arg0, arg1) {
1179
+ const ret = getObject(arg0).then(getObject(arg1));
1180
+ return addHeapObject(ret);
1181
+ },
1182
+ __wbg_then_bd927500e8905df2: function(arg0, arg1, arg2) {
1183
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1184
+ return addHeapObject(ret);
1185
+ },
1186
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1187
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref, Externref], shim_idx: 581, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1188
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2351);
1189
+ return addHeapObject(ret);
1190
+ },
1191
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1192
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 576, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1193
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2347);
1194
+ return addHeapObject(ret);
1195
+ },
1196
+ __wbindgen_cast_0000000000000003: function(arg0) {
1197
+ // Cast intrinsic for `F64 -> Externref`.
1198
+ const ret = arg0;
1199
+ return addHeapObject(ret);
1200
+ },
1201
+ __wbindgen_cast_0000000000000004: function(arg0) {
1202
+ // Cast intrinsic for `I64 -> Externref`.
1203
+ const ret = arg0;
1204
+ return addHeapObject(ret);
1205
+ },
1206
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1207
+ // Cast intrinsic for `Ref(String) -> Externref`.
1208
+ const ret = getStringFromWasm0(arg0, arg1);
1209
+ return addHeapObject(ret);
1210
+ },
1211
+ __wbindgen_cast_0000000000000006: function(arg0) {
1212
+ // Cast intrinsic for `U64 -> Externref`.
1213
+ const ret = BigInt.asUintN(64, arg0);
1214
+ return addHeapObject(ret);
1215
+ },
1216
+ __wbindgen_object_clone_ref: function(arg0) {
1217
+ const ret = getObject(arg0);
1218
+ return addHeapObject(ret);
1219
+ },
1220
+ __wbindgen_object_drop_ref: function(arg0) {
1221
+ takeObject(arg0);
1222
+ },
1223
+ };
1224
+ return {
1225
+ __proto__: null,
1226
+ "./amba_core_bg.js": import0,
1227
+ };
1228
+ }
1229
+
1230
+ function __wasm_bindgen_func_elem_2351(arg0, arg1, arg2, arg3) {
1231
+ wasm.__wasm_bindgen_func_elem_2351(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1232
+ }
1233
+
1234
+ function __wasm_bindgen_func_elem_2347(arg0, arg1, arg2) {
1235
+ try {
1236
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1237
+ wasm.__wasm_bindgen_func_elem_2347(retptr, arg0, arg1, addHeapObject(arg2));
1238
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1239
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1240
+ if (r1) {
1241
+ throw takeObject(r0);
1242
+ }
1243
+ } finally {
1244
+ wasm.__wbindgen_add_to_stack_pointer(16);
1245
+ }
1246
+ }
1247
+
1248
+ function __wasm_bindgen_func_elem_2351_96(arg0, arg1, arg2, arg3) {
1249
+ wasm.__wasm_bindgen_func_elem_2351_96(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1250
+ }
1251
+
1252
+ const AmbaCoreWasmFinalization = (typeof FinalizationRegistry === 'undefined')
1253
+ ? { register: () => {}, unregister: () => {} }
1254
+ : new FinalizationRegistry(ptr => wasm.__wbg_ambacorewasm_free(ptr, 1));
1255
+
1256
+ function addHeapObject(obj) {
1257
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1258
+ const idx = heap_next;
1259
+ heap_next = heap[idx];
1260
+
1261
+ heap[idx] = obj;
1262
+ return idx;
1263
+ }
1264
+
1265
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1266
+ ? { register: () => {}, unregister: () => {} }
1267
+ : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
1268
+
1269
+ function debugString(val) {
1270
+ // primitive types
1271
+ const type = typeof val;
1272
+ if (type == 'number' || type == 'boolean' || val == null) {
1273
+ return `${val}`;
1274
+ }
1275
+ if (type == 'string') {
1276
+ return `"${val}"`;
1277
+ }
1278
+ if (type == 'symbol') {
1279
+ const description = val.description;
1280
+ if (description == null) {
1281
+ return 'Symbol';
1282
+ } else {
1283
+ return `Symbol(${description})`;
1284
+ }
1285
+ }
1286
+ if (type == 'function') {
1287
+ const name = val.name;
1288
+ if (typeof name == 'string' && name.length > 0) {
1289
+ return `Function(${name})`;
1290
+ } else {
1291
+ return 'Function';
1292
+ }
1293
+ }
1294
+ // objects
1295
+ if (Array.isArray(val)) {
1296
+ const length = val.length;
1297
+ let debug = '[';
1298
+ if (length > 0) {
1299
+ debug += debugString(val[0]);
1300
+ }
1301
+ for(let i = 1; i < length; i++) {
1302
+ debug += ', ' + debugString(val[i]);
1303
+ }
1304
+ debug += ']';
1305
+ return debug;
1306
+ }
1307
+ // Test for built-in
1308
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1309
+ let className;
1310
+ if (builtInMatches && builtInMatches.length > 1) {
1311
+ className = builtInMatches[1];
1312
+ } else {
1313
+ // Failed to match the standard '[object ClassName]'
1314
+ return toString.call(val);
1315
+ }
1316
+ if (className == 'Object') {
1317
+ // we're a user defined class or Object
1318
+ // JSON.stringify avoids problems with cycles, and is generally much
1319
+ // easier than looping through ownProperties of `val`.
1320
+ try {
1321
+ return 'Object(' + JSON.stringify(val) + ')';
1322
+ } catch (_) {
1323
+ return 'Object';
1324
+ }
1325
+ }
1326
+ // errors
1327
+ if (val instanceof Error) {
1328
+ return `${val.name}: ${val.message}\n${val.stack}`;
1329
+ }
1330
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1331
+ return className;
1332
+ }
1333
+
1334
+ function dropObject(idx) {
1335
+ if (idx < 1028) return;
1336
+ heap[idx] = heap_next;
1337
+ heap_next = idx;
1338
+ }
1339
+
1340
+ function getArrayU8FromWasm0(ptr, len) {
1341
+ ptr = ptr >>> 0;
1342
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1343
+ }
1344
+
1345
+ let cachedDataViewMemory0 = null;
1346
+ function getDataViewMemory0() {
1347
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1348
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1349
+ }
1350
+ return cachedDataViewMemory0;
1351
+ }
1352
+
1353
+ function getStringFromWasm0(ptr, len) {
1354
+ return decodeText(ptr >>> 0, len);
1355
+ }
1356
+
1357
+ let cachedUint8ArrayMemory0 = null;
1358
+ function getUint8ArrayMemory0() {
1359
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1360
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1361
+ }
1362
+ return cachedUint8ArrayMemory0;
1363
+ }
1364
+
1365
+ function getObject(idx) { return heap[idx]; }
1366
+
1367
+ function handleError(f, args) {
1368
+ try {
1369
+ return f.apply(this, args);
1370
+ } catch (e) {
1371
+ wasm.__wbindgen_export3(addHeapObject(e));
1372
+ }
1373
+ }
1374
+
1375
+ let heap = new Array(1024).fill(undefined);
1376
+ heap.push(undefined, null, true, false);
1377
+
1378
+ let heap_next = heap.length;
1379
+
1380
+ function isLikeNone(x) {
1381
+ return x === undefined || x === null;
1382
+ }
1383
+
1384
+ function makeMutClosure(arg0, arg1, f) {
1385
+ const state = { a: arg0, b: arg1, cnt: 1 };
1386
+ const real = (...args) => {
1387
+
1388
+ // First up with a closure we increment the internal reference
1389
+ // count. This ensures that the Rust closure environment won't
1390
+ // be deallocated while we're invoking it.
1391
+ state.cnt++;
1392
+ const a = state.a;
1393
+ state.a = 0;
1394
+ try {
1395
+ return f(a, state.b, ...args);
1396
+ } finally {
1397
+ state.a = a;
1398
+ real._wbg_cb_unref();
1399
+ }
1400
+ };
1401
+ real._wbg_cb_unref = () => {
1402
+ if (--state.cnt === 0) {
1403
+ wasm.__wbindgen_export4(state.a, state.b);
1404
+ state.a = 0;
1405
+ CLOSURE_DTORS.unregister(state);
1406
+ }
1407
+ };
1408
+ CLOSURE_DTORS.register(real, state, state);
1409
+ return real;
1410
+ }
1411
+
1412
+ function passStringToWasm0(arg, malloc, realloc) {
1413
+ if (realloc === undefined) {
1414
+ const buf = cachedTextEncoder.encode(arg);
1415
+ const ptr = malloc(buf.length, 1) >>> 0;
1416
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1417
+ WASM_VECTOR_LEN = buf.length;
1418
+ return ptr;
1419
+ }
1420
+
1421
+ let len = arg.length;
1422
+ let ptr = malloc(len, 1) >>> 0;
1423
+
1424
+ const mem = getUint8ArrayMemory0();
1425
+
1426
+ let offset = 0;
1427
+
1428
+ for (; offset < len; offset++) {
1429
+ const code = arg.charCodeAt(offset);
1430
+ if (code > 0x7F) break;
1431
+ mem[ptr + offset] = code;
1432
+ }
1433
+ if (offset !== len) {
1434
+ if (offset !== 0) {
1435
+ arg = arg.slice(offset);
1436
+ }
1437
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1438
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1439
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1440
+
1441
+ offset += ret.written;
1442
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1443
+ }
1444
+
1445
+ WASM_VECTOR_LEN = offset;
1446
+ return ptr;
1447
+ }
1448
+
1449
+ function takeObject(idx) {
1450
+ const ret = getObject(idx);
1451
+ dropObject(idx);
1452
+ return ret;
1453
+ }
1454
+
1455
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1456
+ cachedTextDecoder.decode();
1457
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1458
+ let numBytesDecoded = 0;
1459
+ function decodeText(ptr, len) {
1460
+ numBytesDecoded += len;
1461
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1462
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1463
+ cachedTextDecoder.decode();
1464
+ numBytesDecoded = len;
1465
+ }
1466
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1467
+ }
1468
+
1469
+ const cachedTextEncoder = new TextEncoder();
1470
+
1471
+ if (!('encodeInto' in cachedTextEncoder)) {
1472
+ cachedTextEncoder.encodeInto = function (arg, view) {
1473
+ const buf = cachedTextEncoder.encode(arg);
1474
+ view.set(buf);
1475
+ return {
1476
+ read: arg.length,
1477
+ written: buf.length
1478
+ };
1479
+ };
1480
+ }
1481
+
1482
+ let WASM_VECTOR_LEN = 0;
1483
+
1484
+ let wasmModule, wasmInstance, wasm;
1485
+ function __wbg_finalize_init(instance, module) {
1486
+ wasmInstance = instance;
1487
+ wasm = instance.exports;
1488
+ wasmModule = module;
1489
+ cachedDataViewMemory0 = null;
1490
+ cachedUint8ArrayMemory0 = null;
1491
+ return wasm;
1492
+ }
1493
+
1494
+ async function __wbg_load(module, imports) {
1495
+ if (typeof Response === 'function' && module instanceof Response) {
1496
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1497
+ try {
1498
+ return await WebAssembly.instantiateStreaming(module, imports);
1499
+ } catch (e) {
1500
+ const validResponse = module.ok && expectedResponseType(module.type);
1501
+
1502
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1503
+ 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);
1504
+
1505
+ } else { throw e; }
1506
+ }
1507
+ }
1508
+
1509
+ const bytes = await module.arrayBuffer();
1510
+ return await WebAssembly.instantiate(bytes, imports);
1511
+ } else {
1512
+ const instance = await WebAssembly.instantiate(module, imports);
1513
+
1514
+ if (instance instanceof WebAssembly.Instance) {
1515
+ return { instance, module };
1516
+ } else {
1517
+ return instance;
1518
+ }
1519
+ }
1520
+
1521
+ function expectedResponseType(type) {
1522
+ switch (type) {
1523
+ case 'basic': case 'cors': case 'default': return true;
1524
+ }
1525
+ return false;
1526
+ }
1527
+ }
1528
+
1529
+ function initSync(module) {
1530
+ if (wasm !== undefined) return wasm;
1531
+
1532
+
1533
+ if (module !== undefined) {
1534
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1535
+ ({module} = module)
1536
+ } else {
1537
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1538
+ }
1539
+ }
1540
+
1541
+ const imports = __wbg_get_imports();
1542
+ if (!(module instanceof WebAssembly.Module)) {
1543
+ module = new WebAssembly.Module(module);
1544
+ }
1545
+ const instance = new WebAssembly.Instance(module, imports);
1546
+ return __wbg_finalize_init(instance, module);
1547
+ }
1548
+
1549
+ async function __wbg_init(module_or_path) {
1550
+ if (wasm !== undefined) return wasm;
1551
+
1552
+
1553
+ if (module_or_path !== undefined) {
1554
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1555
+ ({module_or_path} = module_or_path)
1556
+ } else {
1557
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1558
+ }
1559
+ }
1560
+
1561
+ if (module_or_path === undefined) {
1562
+ module_or_path = new URL('amba_core_bg.wasm', import.meta.url);
1563
+ }
1564
+ const imports = __wbg_get_imports();
1565
+
1566
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1567
+ module_or_path = fetch(module_or_path);
1568
+ }
1569
+
1570
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1571
+
1572
+ return __wbg_finalize_init(instance, module);
1573
+ }
1574
+
1575
+ export { initSync, __wbg_init as default };