@datadog/pup-wasm 0.0.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/pup_wasm.js ADDED
@@ -0,0 +1,1176 @@
1
+ /* @ts-self-types="./pup_wasm.d.ts" */
2
+
3
+ export class PupClient {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ PupClientFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_pupclient_free(ptr, 0);
13
+ }
14
+ /**
15
+ * Get a single dashboard by ID.
16
+ * @param {string} dashboard_id
17
+ * @returns {Promise<any>}
18
+ */
19
+ dashboards_get(dashboard_id) {
20
+ const ptr0 = passStringToWasm0(dashboard_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
21
+ const len0 = WASM_VECTOR_LEN;
22
+ const ret = wasm.pupclient_dashboards_get(this.__wbg_ptr, ptr0, len0);
23
+ return ret;
24
+ }
25
+ /**
26
+ * List all dashboards.
27
+ * @returns {Promise<any>}
28
+ */
29
+ dashboards_list() {
30
+ const ret = wasm.pupclient_dashboards_list(this.__wbg_ptr);
31
+ return ret;
32
+ }
33
+ /**
34
+ * Search events with a JSON body (v2 API).
35
+ * @param {string} body_json
36
+ * @returns {Promise<any>}
37
+ */
38
+ events_search(body_json) {
39
+ const ptr0 = passStringToWasm0(body_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40
+ const len0 = WASM_VECTOR_LEN;
41
+ const ret = wasm.pupclient_events_search(this.__wbg_ptr, ptr0, len0);
42
+ return ret;
43
+ }
44
+ /**
45
+ * Get a single incident by ID.
46
+ * @param {string} incident_id
47
+ * @returns {Promise<any>}
48
+ */
49
+ incidents_get(incident_id) {
50
+ const ptr0 = passStringToWasm0(incident_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
51
+ const len0 = WASM_VECTOR_LEN;
52
+ const ret = wasm.pupclient_incidents_get(this.__wbg_ptr, ptr0, len0);
53
+ return ret;
54
+ }
55
+ /**
56
+ * List incidents.
57
+ * @returns {Promise<any>}
58
+ */
59
+ incidents_list() {
60
+ const ret = wasm.pupclient_incidents_list(this.__wbg_ptr);
61
+ return ret;
62
+ }
63
+ /**
64
+ * Search logs with a JSON body (v2 API).
65
+ * @param {string} body_json
66
+ * @returns {Promise<any>}
67
+ */
68
+ logs_search(body_json) {
69
+ const ptr0 = passStringToWasm0(body_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
70
+ const len0 = WASM_VECTOR_LEN;
71
+ const ret = wasm.pupclient_logs_search(this.__wbg_ptr, ptr0, len0);
72
+ return ret;
73
+ }
74
+ /**
75
+ * List metric names, optionally filtered.
76
+ * @param {string | null} [filter]
77
+ * @returns {Promise<any>}
78
+ */
79
+ metrics_list(filter) {
80
+ var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
81
+ var len0 = WASM_VECTOR_LEN;
82
+ const ret = wasm.pupclient_metrics_list(this.__wbg_ptr, ptr0, len0);
83
+ return ret;
84
+ }
85
+ /**
86
+ * Query timeseries metrics.
87
+ * @param {string} query
88
+ * @param {bigint} from
89
+ * @param {bigint} to
90
+ * @returns {Promise<any>}
91
+ */
92
+ metrics_query(query, from, to) {
93
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
94
+ const len0 = WASM_VECTOR_LEN;
95
+ const ret = wasm.pupclient_metrics_query(this.__wbg_ptr, ptr0, len0, from, to);
96
+ return ret;
97
+ }
98
+ /**
99
+ * Create a monitor from a JSON body.
100
+ * @param {string} body_json
101
+ * @returns {Promise<any>}
102
+ */
103
+ monitors_create(body_json) {
104
+ const ptr0 = passStringToWasm0(body_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
105
+ const len0 = WASM_VECTOR_LEN;
106
+ const ret = wasm.pupclient_monitors_create(this.__wbg_ptr, ptr0, len0);
107
+ return ret;
108
+ }
109
+ /**
110
+ * Delete a monitor by ID.
111
+ * @param {bigint} monitor_id
112
+ * @returns {Promise<any>}
113
+ */
114
+ monitors_delete(monitor_id) {
115
+ const ret = wasm.pupclient_monitors_delete(this.__wbg_ptr, monitor_id);
116
+ return ret;
117
+ }
118
+ /**
119
+ * Get a single monitor by ID.
120
+ * @param {bigint} monitor_id
121
+ * @returns {Promise<any>}
122
+ */
123
+ monitors_get(monitor_id) {
124
+ const ret = wasm.pupclient_monitors_get(this.__wbg_ptr, monitor_id);
125
+ return ret;
126
+ }
127
+ /**
128
+ * List monitors, optionally filtered by name and/or tags.
129
+ * @param {string | null} [name]
130
+ * @param {string | null} [tags]
131
+ * @param {bigint | null} [page_size]
132
+ * @returns {Promise<any>}
133
+ */
134
+ monitors_list(name, tags, page_size) {
135
+ var ptr0 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136
+ var len0 = WASM_VECTOR_LEN;
137
+ var ptr1 = isLikeNone(tags) ? 0 : passStringToWasm0(tags, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
+ var len1 = WASM_VECTOR_LEN;
139
+ const ret = wasm.pupclient_monitors_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, !isLikeNone(page_size), isLikeNone(page_size) ? BigInt(0) : page_size);
140
+ return ret;
141
+ }
142
+ /**
143
+ * Create a new PupClient from options.
144
+ * @param {PupClientOptions} opts
145
+ */
146
+ constructor(opts) {
147
+ _assertClass(opts, PupClientOptions);
148
+ var ptr0 = opts.__destroy_into_raw();
149
+ const ret = wasm.pupclient_new(ptr0);
150
+ if (ret[2]) {
151
+ throw takeFromExternrefTable0(ret[1]);
152
+ }
153
+ this.__wbg_ptr = ret[0] >>> 0;
154
+ PupClientFinalization.register(this, this.__wbg_ptr, this);
155
+ return this;
156
+ }
157
+ /**
158
+ * Perform a raw DELETE request.
159
+ * @param {string} path
160
+ * @returns {Promise<any>}
161
+ */
162
+ raw_delete(path) {
163
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
164
+ const len0 = WASM_VECTOR_LEN;
165
+ const ret = wasm.pupclient_raw_delete(this.__wbg_ptr, ptr0, len0);
166
+ return ret;
167
+ }
168
+ /**
169
+ * Perform a raw GET request to any Datadog API path.
170
+ * @param {string} path
171
+ * @returns {Promise<any>}
172
+ */
173
+ raw_get(path) {
174
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
175
+ const len0 = WASM_VECTOR_LEN;
176
+ const ret = wasm.pupclient_raw_get(this.__wbg_ptr, ptr0, len0);
177
+ return ret;
178
+ }
179
+ /**
180
+ * Perform a raw PATCH request with a JSON body string.
181
+ * @param {string} path
182
+ * @param {string} body_json
183
+ * @returns {Promise<any>}
184
+ */
185
+ raw_patch(path, body_json) {
186
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
187
+ const len0 = WASM_VECTOR_LEN;
188
+ const ptr1 = passStringToWasm0(body_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
189
+ const len1 = WASM_VECTOR_LEN;
190
+ const ret = wasm.pupclient_raw_patch(this.__wbg_ptr, ptr0, len0, ptr1, len1);
191
+ return ret;
192
+ }
193
+ /**
194
+ * Perform a raw POST request with a JSON body string.
195
+ * @param {string} path
196
+ * @param {string} body_json
197
+ * @returns {Promise<any>}
198
+ */
199
+ raw_post(path, body_json) {
200
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
201
+ const len0 = WASM_VECTOR_LEN;
202
+ const ptr1 = passStringToWasm0(body_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
203
+ const len1 = WASM_VECTOR_LEN;
204
+ const ret = wasm.pupclient_raw_post(this.__wbg_ptr, ptr0, len0, ptr1, len1);
205
+ return ret;
206
+ }
207
+ /**
208
+ * Perform a raw PUT request with a JSON body string.
209
+ * @param {string} path
210
+ * @param {string} body_json
211
+ * @returns {Promise<any>}
212
+ */
213
+ raw_put(path, body_json) {
214
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
215
+ const len0 = WASM_VECTOR_LEN;
216
+ const ptr1 = passStringToWasm0(body_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
217
+ const len1 = WASM_VECTOR_LEN;
218
+ const ret = wasm.pupclient_raw_put(this.__wbg_ptr, ptr0, len0, ptr1, len1);
219
+ return ret;
220
+ }
221
+ /**
222
+ * Execute any `pup` command (reads, writes, `--jq`, `-o table`, `--file`,
223
+ * piped stdin) against this client's session or token configuration.
224
+ * @param {string[]} args
225
+ * @param {string | null} [stdin]
226
+ * @param {string | null} [files_json]
227
+ * @returns {Promise<any>}
228
+ */
229
+ run_cli(args, stdin, files_json) {
230
+ const ptr0 = passArrayJsValueToWasm0(args, wasm.__wbindgen_malloc);
231
+ const len0 = WASM_VECTOR_LEN;
232
+ var ptr1 = isLikeNone(stdin) ? 0 : passStringToWasm0(stdin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
233
+ var len1 = WASM_VECTOR_LEN;
234
+ var ptr2 = isLikeNone(files_json) ? 0 : passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
235
+ var len2 = WASM_VECTOR_LEN;
236
+ const ret = wasm.pupclient_run_cli(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
237
+ return ret;
238
+ }
239
+ /**
240
+ * Get a single SLO by ID.
241
+ * @param {string} slo_id
242
+ * @returns {Promise<any>}
243
+ */
244
+ slos_get(slo_id) {
245
+ const ptr0 = passStringToWasm0(slo_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
246
+ const len0 = WASM_VECTOR_LEN;
247
+ const ret = wasm.pupclient_slos_get(this.__wbg_ptr, ptr0, len0);
248
+ return ret;
249
+ }
250
+ /**
251
+ * List all SLOs.
252
+ * @returns {Promise<any>}
253
+ */
254
+ slos_list() {
255
+ const ret = wasm.pupclient_slos_list(this.__wbg_ptr);
256
+ return ret;
257
+ }
258
+ /**
259
+ * Return the pup library version.
260
+ * @returns {string}
261
+ */
262
+ version() {
263
+ let deferred1_0;
264
+ let deferred1_1;
265
+ try {
266
+ const ret = wasm.pupclient_version(this.__wbg_ptr);
267
+ deferred1_0 = ret[0];
268
+ deferred1_1 = ret[1];
269
+ return getStringFromWasm0(ret[0], ret[1]);
270
+ } finally {
271
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
272
+ }
273
+ }
274
+ }
275
+ if (Symbol.dispose) PupClient.prototype[Symbol.dispose] = PupClient.prototype.free;
276
+
277
+ export class PupClientOptions {
278
+ __destroy_into_raw() {
279
+ const ptr = this.__wbg_ptr;
280
+ this.__wbg_ptr = 0;
281
+ PupClientOptionsFinalization.unregister(this);
282
+ return ptr;
283
+ }
284
+ free() {
285
+ const ptr = this.__destroy_into_raw();
286
+ wasm.__wbg_pupclientoptions_free(ptr, 0);
287
+ }
288
+ /**
289
+ * @returns {string | undefined}
290
+ */
291
+ get access_token() {
292
+ const ret = wasm.__wbg_get_pupclientoptions_access_token(this.__wbg_ptr);
293
+ let v1;
294
+ if (ret[0] !== 0) {
295
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
296
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
297
+ }
298
+ return v1;
299
+ }
300
+ /**
301
+ * @returns {string | undefined}
302
+ */
303
+ get api_key() {
304
+ const ret = wasm.__wbg_get_pupclientoptions_api_key(this.__wbg_ptr);
305
+ let v1;
306
+ if (ret[0] !== 0) {
307
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
308
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
309
+ }
310
+ return v1;
311
+ }
312
+ /**
313
+ * @returns {string | undefined}
314
+ */
315
+ get app_key() {
316
+ const ret = wasm.__wbg_get_pupclientoptions_app_key(this.__wbg_ptr);
317
+ let v1;
318
+ if (ret[0] !== 0) {
319
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
320
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
321
+ }
322
+ return v1;
323
+ }
324
+ /**
325
+ * CSRF token sent as `x-csrf-token` in session mode (needed for writes).
326
+ * @returns {string | undefined}
327
+ */
328
+ get csrf_token() {
329
+ const ret = wasm.__wbg_get_pupclientoptions_csrf_token(this.__wbg_ptr);
330
+ let v1;
331
+ if (ret[0] !== 0) {
332
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
333
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
334
+ }
335
+ return v1;
336
+ }
337
+ /**
338
+ * Same-origin base URL: the page origin (e.g. `location.origin`).
339
+ * Authenticates with the session cookie, or with `access_token` as a
340
+ * Bearer token if set. Cannot be combined with `api_key` / `app_key`.
341
+ * @returns {string | undefined}
342
+ */
343
+ get session_origin() {
344
+ const ret = wasm.__wbg_get_pupclientoptions_session_origin(this.__wbg_ptr);
345
+ let v1;
346
+ if (ret[0] !== 0) {
347
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
348
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
349
+ }
350
+ return v1;
351
+ }
352
+ /**
353
+ * @param {string} site
354
+ */
355
+ constructor(site) {
356
+ const ptr0 = passStringToWasm0(site, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
357
+ const len0 = WASM_VECTOR_LEN;
358
+ const ret = wasm.pupclientoptions_new(ptr0, len0);
359
+ this.__wbg_ptr = ret >>> 0;
360
+ PupClientOptionsFinalization.register(this, this.__wbg_ptr, this);
361
+ return this;
362
+ }
363
+ /**
364
+ * @param {string | null} [arg0]
365
+ */
366
+ set access_token(arg0) {
367
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
+ var len0 = WASM_VECTOR_LEN;
369
+ wasm.__wbg_set_pupclientoptions_access_token(this.__wbg_ptr, ptr0, len0);
370
+ }
371
+ /**
372
+ * @param {string | null} [arg0]
373
+ */
374
+ set api_key(arg0) {
375
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
376
+ var len0 = WASM_VECTOR_LEN;
377
+ wasm.__wbg_set_pupclientoptions_api_key(this.__wbg_ptr, ptr0, len0);
378
+ }
379
+ /**
380
+ * @param {string | null} [arg0]
381
+ */
382
+ set app_key(arg0) {
383
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
384
+ var len0 = WASM_VECTOR_LEN;
385
+ wasm.__wbg_set_pupclientoptions_app_key(this.__wbg_ptr, ptr0, len0);
386
+ }
387
+ /**
388
+ * CSRF token sent as `x-csrf-token` in session mode (needed for writes).
389
+ * @param {string | null} [arg0]
390
+ */
391
+ set csrf_token(arg0) {
392
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
393
+ var len0 = WASM_VECTOR_LEN;
394
+ wasm.__wbg_set_pupclientoptions_csrf_token(this.__wbg_ptr, ptr0, len0);
395
+ }
396
+ /**
397
+ * Same-origin base URL: the page origin (e.g. `location.origin`).
398
+ * Authenticates with the session cookie, or with `access_token` as a
399
+ * Bearer token if set. Cannot be combined with `api_key` / `app_key`.
400
+ * @param {string | null} [arg0]
401
+ */
402
+ set session_origin(arg0) {
403
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
404
+ var len0 = WASM_VECTOR_LEN;
405
+ wasm.__wbg_set_pupclientoptions_session_origin(this.__wbg_ptr, ptr0, len0);
406
+ }
407
+ }
408
+ if (Symbol.dispose) PupClientOptions.prototype[Symbol.dispose] = PupClientOptions.prototype.free;
409
+
410
+ /**
411
+ * Execute `pup` with no credentials (offline `--help`, `version`, `agent schema`,
412
+ * `format`, `docs api`, etc.; API commands return pup's real auth error).
413
+ * @param {string} site
414
+ * @param {string[]} args
415
+ * @param {string | null} [stdin]
416
+ * @param {string | null} [files_json]
417
+ * @returns {Promise<any>}
418
+ */
419
+ export function run_unauthenticated_cli(site, args, stdin, files_json) {
420
+ const ptr0 = passStringToWasm0(site, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ const ptr1 = passArrayJsValueToWasm0(args, wasm.__wbindgen_malloc);
423
+ const len1 = WASM_VECTOR_LEN;
424
+ var ptr2 = isLikeNone(stdin) ? 0 : passStringToWasm0(stdin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
425
+ var len2 = WASM_VECTOR_LEN;
426
+ var ptr3 = isLikeNone(files_json) ? 0 : passStringToWasm0(files_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
427
+ var len3 = WASM_VECTOR_LEN;
428
+ const ret = wasm.run_unauthenticated_cli(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
429
+ return ret;
430
+ }
431
+
432
+ function __wbg_get_imports() {
433
+ const import0 = {
434
+ __proto__: null,
435
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
436
+ const ret = Error(getStringFromWasm0(arg0, arg1));
437
+ return ret;
438
+ },
439
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
440
+ const ret = debugString(arg1);
441
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
442
+ const len1 = WASM_VECTOR_LEN;
443
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
444
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
445
+ },
446
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
447
+ const ret = typeof(arg0) === 'function';
448
+ return ret;
449
+ },
450
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
451
+ const ret = arg0 === undefined;
452
+ return ret;
453
+ },
454
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
455
+ const obj = arg1;
456
+ const ret = typeof(obj) === 'number' ? obj : undefined;
457
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
458
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
459
+ },
460
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
461
+ const obj = arg1;
462
+ const ret = typeof(obj) === 'string' ? obj : undefined;
463
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
464
+ var len1 = WASM_VECTOR_LEN;
465
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
466
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
467
+ },
468
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
469
+ throw new Error(getStringFromWasm0(arg0, arg1));
470
+ },
471
+ __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
472
+ arg0._wbg_cb_unref();
473
+ },
474
+ __wbg_abort_5ef96933660780b7: function(arg0) {
475
+ arg0.abort();
476
+ },
477
+ __wbg_abort_6479c2d794ebf2ee: function(arg0, arg1) {
478
+ arg0.abort(arg1);
479
+ },
480
+ __wbg_append_48b3d4fc4c97ab8d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
481
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
482
+ }, arguments); },
483
+ __wbg_append_608dfb635ee8998f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
484
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
485
+ }, arguments); },
486
+ __wbg_append_83e47d4b428d97aa: function() { return handleError(function (arg0, arg1, arg2, arg3) {
487
+ arg0.append(getStringFromWasm0(arg1, arg2), arg3);
488
+ }, arguments); },
489
+ __wbg_append_bbf73d7e78ce268c: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
490
+ arg0.append(getStringFromWasm0(arg1, arg2), arg3, getStringFromWasm0(arg4, arg5));
491
+ }, arguments); },
492
+ __wbg_arrayBuffer_eb8e9ca620af2a19: function() { return handleError(function (arg0) {
493
+ const ret = arg0.arrayBuffer();
494
+ return ret;
495
+ }, arguments); },
496
+ __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
497
+ const ret = arg0.call(arg1, arg2);
498
+ return ret;
499
+ }, arguments); },
500
+ __wbg_call_dcc2662fa17a72cf: function() { return handleError(function (arg0, arg1, arg2, arg3) {
501
+ const ret = arg0.call(arg1, arg2, arg3);
502
+ return ret;
503
+ }, arguments); },
504
+ __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
505
+ const ret = arg0.call(arg1);
506
+ return ret;
507
+ }, arguments); },
508
+ __wbg_clearTimeout_2256f1e7b94ef517: function(arg0) {
509
+ const ret = clearTimeout(arg0);
510
+ return ret;
511
+ },
512
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
513
+ const ret = arg0.done;
514
+ return ret;
515
+ },
516
+ __wbg_entries_5b8fe91cea59610e: function(arg0) {
517
+ const ret = arg0.entries();
518
+ return ret;
519
+ },
520
+ __wbg_fetch_43b2f110608a59ff: function(arg0) {
521
+ const ret = fetch(arg0);
522
+ return ret;
523
+ },
524
+ __wbg_fetch_5550a88cf343aaa9: function(arg0, arg1) {
525
+ const ret = arg0.fetch(arg1);
526
+ return ret;
527
+ },
528
+ __wbg_getItem_a7cc1d4f154f2e6f: function() { return handleError(function (arg0, arg1, arg2, arg3) {
529
+ const ret = arg1.getItem(getStringFromWasm0(arg2, arg3));
530
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
531
+ var len1 = WASM_VECTOR_LEN;
532
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
533
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
534
+ }, arguments); },
535
+ __wbg_getRandomValues_ceb34d8ffce7e87f: function() { return handleError(function (arg0, arg1) {
536
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
537
+ }, arguments); },
538
+ __wbg_getTime_1dad7b5386ddd2d9: function(arg0) {
539
+ const ret = arg0.getTime();
540
+ return ret;
541
+ },
542
+ __wbg_getTimezoneOffset_639bcf2dde21158b: function(arg0) {
543
+ const ret = arg0.getTimezoneOffset();
544
+ return ret;
545
+ },
546
+ __wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
547
+ const ret = Reflect.get(arg0, arg1);
548
+ return ret;
549
+ }, arguments); },
550
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
551
+ const ret = arg0[arg1 >>> 0];
552
+ return ret;
553
+ },
554
+ __wbg_has_926ef2ff40b308cf: function() { return handleError(function (arg0, arg1) {
555
+ const ret = Reflect.has(arg0, arg1);
556
+ return ret;
557
+ }, arguments); },
558
+ __wbg_headers_eb2234545f9ff993: function(arg0) {
559
+ const ret = arg0.headers;
560
+ return ret;
561
+ },
562
+ __wbg_instanceof_Response_9b4d9fd451e051b1: function(arg0) {
563
+ let result;
564
+ try {
565
+ result = arg0 instanceof Response;
566
+ } catch (_) {
567
+ result = false;
568
+ }
569
+ const ret = result;
570
+ return ret;
571
+ },
572
+ __wbg_instanceof_Window_23e677d2c6843922: function(arg0) {
573
+ let result;
574
+ try {
575
+ result = arg0 instanceof Window;
576
+ } catch (_) {
577
+ result = false;
578
+ }
579
+ const ret = result;
580
+ return ret;
581
+ },
582
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
583
+ const ret = Array.isArray(arg0);
584
+ return ret;
585
+ },
586
+ __wbg_length_ea16607d7b61445b: function(arg0) {
587
+ const ret = arg0.length;
588
+ return ret;
589
+ },
590
+ __wbg_localStorage_51c38b3b222e1ed2: function() { return handleError(function (arg0) {
591
+ const ret = arg0.localStorage;
592
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
593
+ }, arguments); },
594
+ __wbg_new_0837727332ac86ba: function() { return handleError(function () {
595
+ const ret = new Headers();
596
+ return ret;
597
+ }, arguments); },
598
+ __wbg_new_0_1dcafdf5e786e876: function() {
599
+ const ret = new Date();
600
+ return ret;
601
+ },
602
+ __wbg_new_5cfc6a14488ab25a: function() { return handleError(function () {
603
+ const ret = new FormData();
604
+ return ret;
605
+ }, arguments); },
606
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
607
+ const ret = new Uint8Array(arg0);
608
+ return ret;
609
+ },
610
+ __wbg_new_a70fbab9066b301f: function() {
611
+ const ret = new Array();
612
+ return ret;
613
+ },
614
+ __wbg_new_ab79df5bd7c26067: function() {
615
+ const ret = new Object();
616
+ return ret;
617
+ },
618
+ __wbg_new_c518c60af666645b: function() { return handleError(function () {
619
+ const ret = new AbortController();
620
+ return ret;
621
+ }, arguments); },
622
+ __wbg_new_d098e265629cd10f: function(arg0, arg1) {
623
+ try {
624
+ var state0 = {a: arg0, b: arg1};
625
+ var cb0 = (arg0, arg1) => {
626
+ const a = state0.a;
627
+ state0.a = 0;
628
+ try {
629
+ return wasm_bindgen__convert__closures_____invoke__h5abb888779803111(a, state0.b, arg0, arg1);
630
+ } finally {
631
+ state0.a = a;
632
+ }
633
+ };
634
+ const ret = new Promise(cb0);
635
+ return ret;
636
+ } finally {
637
+ state0.a = state0.b = 0;
638
+ }
639
+ },
640
+ __wbg_new_d15cb560a6a0e5f0: function(arg0, arg1) {
641
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
642
+ return ret;
643
+ },
644
+ __wbg_new_fd94ca5c9639abd2: function(arg0) {
645
+ const ret = new Date(arg0);
646
+ return ret;
647
+ },
648
+ __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
649
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
650
+ return ret;
651
+ },
652
+ __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
653
+ try {
654
+ var state0 = {a: arg0, b: arg1};
655
+ var cb0 = (arg0, arg1) => {
656
+ const a = state0.a;
657
+ state0.a = 0;
658
+ try {
659
+ return wasm_bindgen__convert__closures_____invoke__h5abb888779803111(a, state0.b, arg0, arg1);
660
+ } finally {
661
+ state0.a = a;
662
+ }
663
+ };
664
+ const ret = new Promise(cb0);
665
+ return ret;
666
+ } finally {
667
+ state0.a = state0.b = 0;
668
+ }
669
+ },
670
+ __wbg_new_with_str_and_init_b4b54d1a819bc724: function() { return handleError(function (arg0, arg1, arg2) {
671
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
672
+ return ret;
673
+ }, arguments); },
674
+ __wbg_new_with_u8_array_sequence_and_options_de38f663e19ad899: function() { return handleError(function (arg0, arg1) {
675
+ const ret = new Blob(arg0, arg1);
676
+ return ret;
677
+ }, arguments); },
678
+ __wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
679
+ const ret = arg0.next();
680
+ return ret;
681
+ }, arguments); },
682
+ __wbg_now_16f0c993d5dd6c27: function() {
683
+ const ret = Date.now();
684
+ return ret;
685
+ },
686
+ __wbg_parse_e9eddd2a82c706eb: function() { return handleError(function (arg0, arg1) {
687
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
688
+ return ret;
689
+ }, arguments); },
690
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
691
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
692
+ },
693
+ __wbg_push_e87b0e732085a946: function(arg0, arg1) {
694
+ const ret = arg0.push(arg1);
695
+ return ret;
696
+ },
697
+ __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
698
+ const ret = arg0.queueMicrotask;
699
+ return ret;
700
+ },
701
+ __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
702
+ queueMicrotask(arg0);
703
+ },
704
+ __wbg_removeItem_95c258b9afdd7580: function() { return handleError(function (arg0, arg1, arg2) {
705
+ arg0.removeItem(getStringFromWasm0(arg1, arg2));
706
+ }, arguments); },
707
+ __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
708
+ const ret = Promise.resolve(arg0);
709
+ return ret;
710
+ },
711
+ __wbg_setItem_5f84aeef0d7f3c17: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
712
+ arg0.setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
713
+ }, arguments); },
714
+ __wbg_setTimeout_b188b3bcc8977c7d: function(arg0, arg1) {
715
+ const ret = setTimeout(arg0, arg1);
716
+ return ret;
717
+ },
718
+ __wbg_set_body_a3d856b097dfda04: function(arg0, arg1) {
719
+ arg0.body = arg1;
720
+ },
721
+ __wbg_set_cache_ec7e430c6056ebda: function(arg0, arg1) {
722
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
723
+ },
724
+ __wbg_set_credentials_ed63183445882c65: function(arg0, arg1) {
725
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
726
+ },
727
+ __wbg_set_headers_3c8fecc693b75327: function(arg0, arg1) {
728
+ arg0.headers = arg1;
729
+ },
730
+ __wbg_set_method_8c015e8bcafd7be1: function(arg0, arg1, arg2) {
731
+ arg0.method = getStringFromWasm0(arg1, arg2);
732
+ },
733
+ __wbg_set_mode_5a87f2c809cf37c2: function(arg0, arg1) {
734
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
735
+ },
736
+ __wbg_set_signal_0cebecb698f25d21: function(arg0, arg1) {
737
+ arg0.signal = arg1;
738
+ },
739
+ __wbg_set_type_33e79f1b45a78c37: function(arg0, arg1, arg2) {
740
+ arg0.type = getStringFromWasm0(arg1, arg2);
741
+ },
742
+ __wbg_signal_166e1da31adcac18: function(arg0) {
743
+ const ret = arg0.signal;
744
+ return ret;
745
+ },
746
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
747
+ const ret = typeof global === 'undefined' ? null : global;
748
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
749
+ },
750
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
751
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
752
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
753
+ },
754
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
755
+ const ret = typeof self === 'undefined' ? null : self;
756
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
757
+ },
758
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
759
+ const ret = typeof window === 'undefined' ? null : window;
760
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
761
+ },
762
+ __wbg_status_318629ab93a22955: function(arg0) {
763
+ const ret = arg0.status;
764
+ return ret;
765
+ },
766
+ __wbg_text_372f5b91442c50f9: function() { return handleError(function (arg0) {
767
+ const ret = arg0.text();
768
+ return ret;
769
+ }, arguments); },
770
+ __wbg_then_098abe61755d12f6: function(arg0, arg1) {
771
+ const ret = arg0.then(arg1);
772
+ return ret;
773
+ },
774
+ __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
775
+ const ret = arg0.then(arg1, arg2);
776
+ return ret;
777
+ },
778
+ __wbg_url_7fefc1820fba4e0c: function(arg0, arg1) {
779
+ const ret = arg1.url;
780
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
781
+ const len1 = WASM_VECTOR_LEN;
782
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
783
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
784
+ },
785
+ __wbg_value_21fc78aab0322612: function(arg0) {
786
+ const ret = arg0.value;
787
+ return ret;
788
+ },
789
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
790
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8592, function: Function { arguments: [], shim_idx: 8593, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
791
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h4fc79221b6076d71, wasm_bindgen__convert__closures_____invoke__he4a633bbbf50ef66);
792
+ return ret;
793
+ },
794
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
795
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 8627, function: Function { arguments: [Externref], shim_idx: 8664, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
796
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h60fad2bd86e5ae2f, wasm_bindgen__convert__closures_____invoke__had8c242e111a30d3);
797
+ return ret;
798
+ },
799
+ __wbindgen_cast_0000000000000003: function(arg0) {
800
+ // Cast intrinsic for `F64 -> Externref`.
801
+ const ret = arg0;
802
+ return ret;
803
+ },
804
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
805
+ // Cast intrinsic for `Ref(String) -> Externref`.
806
+ const ret = getStringFromWasm0(arg0, arg1);
807
+ return ret;
808
+ },
809
+ __wbindgen_init_externref_table: function() {
810
+ const table = wasm.__wbindgen_externrefs;
811
+ const offset = table.grow(4);
812
+ table.set(0, undefined);
813
+ table.set(offset + 0, undefined);
814
+ table.set(offset + 1, null);
815
+ table.set(offset + 2, true);
816
+ table.set(offset + 3, false);
817
+ },
818
+ };
819
+ return {
820
+ __proto__: null,
821
+ "./pup_wasm_bg.js": import0,
822
+ };
823
+ }
824
+
825
+ function wasm_bindgen__convert__closures_____invoke__he4a633bbbf50ef66(arg0, arg1) {
826
+ wasm.wasm_bindgen__convert__closures_____invoke__he4a633bbbf50ef66(arg0, arg1);
827
+ }
828
+
829
+ function wasm_bindgen__convert__closures_____invoke__had8c242e111a30d3(arg0, arg1, arg2) {
830
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__had8c242e111a30d3(arg0, arg1, arg2);
831
+ if (ret[1]) {
832
+ throw takeFromExternrefTable0(ret[0]);
833
+ }
834
+ }
835
+
836
+ function wasm_bindgen__convert__closures_____invoke__h5abb888779803111(arg0, arg1, arg2, arg3) {
837
+ wasm.wasm_bindgen__convert__closures_____invoke__h5abb888779803111(arg0, arg1, arg2, arg3);
838
+ }
839
+
840
+
841
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
842
+
843
+
844
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
845
+
846
+
847
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
848
+ const PupClientFinalization = (typeof FinalizationRegistry === 'undefined')
849
+ ? { register: () => {}, unregister: () => {} }
850
+ : new FinalizationRegistry(ptr => wasm.__wbg_pupclient_free(ptr >>> 0, 1));
851
+ const PupClientOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
852
+ ? { register: () => {}, unregister: () => {} }
853
+ : new FinalizationRegistry(ptr => wasm.__wbg_pupclientoptions_free(ptr >>> 0, 1));
854
+
855
+ function addToExternrefTable0(obj) {
856
+ const idx = wasm.__externref_table_alloc();
857
+ wasm.__wbindgen_externrefs.set(idx, obj);
858
+ return idx;
859
+ }
860
+
861
+ function _assertClass(instance, klass) {
862
+ if (!(instance instanceof klass)) {
863
+ throw new Error(`expected instance of ${klass.name}`);
864
+ }
865
+ }
866
+
867
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
868
+ ? { register: () => {}, unregister: () => {} }
869
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
870
+
871
+ function debugString(val) {
872
+ // primitive types
873
+ const type = typeof val;
874
+ if (type == 'number' || type == 'boolean' || val == null) {
875
+ return `${val}`;
876
+ }
877
+ if (type == 'string') {
878
+ return `"${val}"`;
879
+ }
880
+ if (type == 'symbol') {
881
+ const description = val.description;
882
+ if (description == null) {
883
+ return 'Symbol';
884
+ } else {
885
+ return `Symbol(${description})`;
886
+ }
887
+ }
888
+ if (type == 'function') {
889
+ const name = val.name;
890
+ if (typeof name == 'string' && name.length > 0) {
891
+ return `Function(${name})`;
892
+ } else {
893
+ return 'Function';
894
+ }
895
+ }
896
+ // objects
897
+ if (Array.isArray(val)) {
898
+ const length = val.length;
899
+ let debug = '[';
900
+ if (length > 0) {
901
+ debug += debugString(val[0]);
902
+ }
903
+ for(let i = 1; i < length; i++) {
904
+ debug += ', ' + debugString(val[i]);
905
+ }
906
+ debug += ']';
907
+ return debug;
908
+ }
909
+ // Test for built-in
910
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
911
+ let className;
912
+ if (builtInMatches && builtInMatches.length > 1) {
913
+ className = builtInMatches[1];
914
+ } else {
915
+ // Failed to match the standard '[object ClassName]'
916
+ return toString.call(val);
917
+ }
918
+ if (className == 'Object') {
919
+ // we're a user defined class or Object
920
+ // JSON.stringify avoids problems with cycles, and is generally much
921
+ // easier than looping through ownProperties of `val`.
922
+ try {
923
+ return 'Object(' + JSON.stringify(val) + ')';
924
+ } catch (_) {
925
+ return 'Object';
926
+ }
927
+ }
928
+ // errors
929
+ if (val instanceof Error) {
930
+ return `${val.name}: ${val.message}\n${val.stack}`;
931
+ }
932
+ // TODO we could test for more things here, like `Set`s and `Map`s.
933
+ return className;
934
+ }
935
+
936
+ function getArrayU8FromWasm0(ptr, len) {
937
+ ptr = ptr >>> 0;
938
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
939
+ }
940
+
941
+ let cachedDataViewMemory0 = null;
942
+ function getDataViewMemory0() {
943
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
944
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
945
+ }
946
+ return cachedDataViewMemory0;
947
+ }
948
+
949
+ function getStringFromWasm0(ptr, len) {
950
+ ptr = ptr >>> 0;
951
+ return decodeText(ptr, len);
952
+ }
953
+
954
+ let cachedUint8ArrayMemory0 = null;
955
+ function getUint8ArrayMemory0() {
956
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
957
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
958
+ }
959
+ return cachedUint8ArrayMemory0;
960
+ }
961
+
962
+ function handleError(f, args) {
963
+ try {
964
+ return f.apply(this, args);
965
+ } catch (e) {
966
+ const idx = addToExternrefTable0(e);
967
+ wasm.__wbindgen_exn_store(idx);
968
+ }
969
+ }
970
+
971
+ function isLikeNone(x) {
972
+ return x === undefined || x === null;
973
+ }
974
+
975
+ function makeMutClosure(arg0, arg1, dtor, f) {
976
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
977
+ const real = (...args) => {
978
+
979
+ // First up with a closure we increment the internal reference
980
+ // count. This ensures that the Rust closure environment won't
981
+ // be deallocated while we're invoking it.
982
+ state.cnt++;
983
+ const a = state.a;
984
+ state.a = 0;
985
+ try {
986
+ return f(a, state.b, ...args);
987
+ } finally {
988
+ state.a = a;
989
+ real._wbg_cb_unref();
990
+ }
991
+ };
992
+ real._wbg_cb_unref = () => {
993
+ if (--state.cnt === 0) {
994
+ state.dtor(state.a, state.b);
995
+ state.a = 0;
996
+ CLOSURE_DTORS.unregister(state);
997
+ }
998
+ };
999
+ CLOSURE_DTORS.register(real, state, state);
1000
+ return real;
1001
+ }
1002
+
1003
+ function passArrayJsValueToWasm0(array, malloc) {
1004
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1005
+ for (let i = 0; i < array.length; i++) {
1006
+ const add = addToExternrefTable0(array[i]);
1007
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
1008
+ }
1009
+ WASM_VECTOR_LEN = array.length;
1010
+ return ptr;
1011
+ }
1012
+
1013
+ function passStringToWasm0(arg, malloc, realloc) {
1014
+ if (realloc === undefined) {
1015
+ const buf = cachedTextEncoder.encode(arg);
1016
+ const ptr = malloc(buf.length, 1) >>> 0;
1017
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1018
+ WASM_VECTOR_LEN = buf.length;
1019
+ return ptr;
1020
+ }
1021
+
1022
+ let len = arg.length;
1023
+ let ptr = malloc(len, 1) >>> 0;
1024
+
1025
+ const mem = getUint8ArrayMemory0();
1026
+
1027
+ let offset = 0;
1028
+
1029
+ for (; offset < len; offset++) {
1030
+ const code = arg.charCodeAt(offset);
1031
+ if (code > 0x7F) break;
1032
+ mem[ptr + offset] = code;
1033
+ }
1034
+ if (offset !== len) {
1035
+ if (offset !== 0) {
1036
+ arg = arg.slice(offset);
1037
+ }
1038
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1039
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1040
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1041
+
1042
+ offset += ret.written;
1043
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1044
+ }
1045
+
1046
+ WASM_VECTOR_LEN = offset;
1047
+ return ptr;
1048
+ }
1049
+
1050
+ function takeFromExternrefTable0(idx) {
1051
+ const value = wasm.__wbindgen_externrefs.get(idx);
1052
+ wasm.__externref_table_dealloc(idx);
1053
+ return value;
1054
+ }
1055
+
1056
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1057
+ cachedTextDecoder.decode();
1058
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1059
+ let numBytesDecoded = 0;
1060
+ function decodeText(ptr, len) {
1061
+ numBytesDecoded += len;
1062
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1063
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1064
+ cachedTextDecoder.decode();
1065
+ numBytesDecoded = len;
1066
+ }
1067
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1068
+ }
1069
+
1070
+ const cachedTextEncoder = new TextEncoder();
1071
+
1072
+ if (!('encodeInto' in cachedTextEncoder)) {
1073
+ cachedTextEncoder.encodeInto = function (arg, view) {
1074
+ const buf = cachedTextEncoder.encode(arg);
1075
+ view.set(buf);
1076
+ return {
1077
+ read: arg.length,
1078
+ written: buf.length
1079
+ };
1080
+ };
1081
+ }
1082
+
1083
+ let WASM_VECTOR_LEN = 0;
1084
+
1085
+ let wasmModule, wasm;
1086
+ function __wbg_finalize_init(instance, module) {
1087
+ wasm = instance.exports;
1088
+ wasmModule = module;
1089
+ cachedDataViewMemory0 = null;
1090
+ cachedUint8ArrayMemory0 = null;
1091
+ wasm.__wbindgen_start();
1092
+ return wasm;
1093
+ }
1094
+
1095
+ async function __wbg_load(module, imports) {
1096
+ if (typeof Response === 'function' && module instanceof Response) {
1097
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1098
+ try {
1099
+ return await WebAssembly.instantiateStreaming(module, imports);
1100
+ } catch (e) {
1101
+ const validResponse = module.ok && expectedResponseType(module.type);
1102
+
1103
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1104
+ 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);
1105
+
1106
+ } else { throw e; }
1107
+ }
1108
+ }
1109
+
1110
+ const bytes = await module.arrayBuffer();
1111
+ return await WebAssembly.instantiate(bytes, imports);
1112
+ } else {
1113
+ const instance = await WebAssembly.instantiate(module, imports);
1114
+
1115
+ if (instance instanceof WebAssembly.Instance) {
1116
+ return { instance, module };
1117
+ } else {
1118
+ return instance;
1119
+ }
1120
+ }
1121
+
1122
+ function expectedResponseType(type) {
1123
+ switch (type) {
1124
+ case 'basic': case 'cors': case 'default': return true;
1125
+ }
1126
+ return false;
1127
+ }
1128
+ }
1129
+
1130
+ function initSync(module) {
1131
+ if (wasm !== undefined) return wasm;
1132
+
1133
+
1134
+ if (module !== undefined) {
1135
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1136
+ ({module} = module)
1137
+ } else {
1138
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1139
+ }
1140
+ }
1141
+
1142
+ const imports = __wbg_get_imports();
1143
+ if (!(module instanceof WebAssembly.Module)) {
1144
+ module = new WebAssembly.Module(module);
1145
+ }
1146
+ const instance = new WebAssembly.Instance(module, imports);
1147
+ return __wbg_finalize_init(instance, module);
1148
+ }
1149
+
1150
+ async function __wbg_init(module_or_path) {
1151
+ if (wasm !== undefined) return wasm;
1152
+
1153
+
1154
+ if (module_or_path !== undefined) {
1155
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1156
+ ({module_or_path} = module_or_path)
1157
+ } else {
1158
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1159
+ }
1160
+ }
1161
+
1162
+ if (module_or_path === undefined) {
1163
+ module_or_path = new URL('pup_wasm_bg.wasm', import.meta.url);
1164
+ }
1165
+ const imports = __wbg_get_imports();
1166
+
1167
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1168
+ module_or_path = fetch(module_or_path);
1169
+ }
1170
+
1171
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1172
+
1173
+ return __wbg_finalize_init(instance, module);
1174
+ }
1175
+
1176
+ export { initSync, __wbg_init as default };