@flipt-io/flipt-client-js 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,100 +1,334 @@
1
- let wasm;
2
-
3
- let cachedUint8ArrayMemory0 = null;
1
+ /* @ts-self-types="./flipt_engine_wasm_js.d.ts" */
4
2
 
5
- function getUint8ArrayMemory0() {
6
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
3
+ class Engine {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ EngineFinalization.unregister(this);
8
+ return ptr;
8
9
  }
9
- return cachedUint8ArrayMemory0;
10
- }
11
-
12
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
-
14
- cachedTextDecoder.decode();
15
-
16
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
- let numBytesDecoded = 0;
18
- function decodeText(ptr, len) {
19
- numBytesDecoded += len;
20
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
- cachedTextDecoder.decode();
23
- numBytesDecoded = len;
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_engine_free(ptr, 0);
24
13
  }
25
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
- }
27
-
28
- function getStringFromWasm0(ptr, len) {
29
- ptr = ptr >>> 0;
30
- return decodeText(ptr, len);
31
- }
32
-
33
- let WASM_VECTOR_LEN = 0;
34
-
35
- const cachedTextEncoder = new TextEncoder();
36
-
37
- if (!('encodeInto' in cachedTextEncoder)) {
38
- cachedTextEncoder.encodeInto = function (arg, view) {
39
- const buf = cachedTextEncoder.encode(arg);
40
- view.set(buf);
41
- return {
42
- read: arg.length,
43
- written: buf.length
44
- };
45
- };
46
- }
47
-
48
- function passStringToWasm0(arg, malloc, realloc) {
49
-
50
- if (realloc === undefined) {
51
- const buf = cachedTextEncoder.encode(arg);
52
- const ptr = malloc(buf.length, 1) >>> 0;
53
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
54
- WASM_VECTOR_LEN = buf.length;
55
- return ptr;
14
+ /**
15
+ * @param {any} request
16
+ * @returns {any}
17
+ */
18
+ evaluate_batch(request) {
19
+ const ret = wasm.engine_evaluate_batch(this.__wbg_ptr, request);
20
+ if (ret[2]) {
21
+ throw takeFromExternrefTable0(ret[1]);
22
+ }
23
+ return takeFromExternrefTable0(ret[0]);
56
24
  }
57
-
58
- let len = arg.length;
59
- let ptr = malloc(len, 1) >>> 0;
60
-
61
- const mem = getUint8ArrayMemory0();
62
-
63
- let offset = 0;
64
-
65
- for (; offset < len; offset++) {
66
- const code = arg.charCodeAt(offset);
67
- if (code > 0x7F) break;
68
- mem[ptr + offset] = code;
25
+ /**
26
+ * @param {any} request
27
+ * @returns {any}
28
+ */
29
+ evaluate_boolean(request) {
30
+ const ret = wasm.engine_evaluate_boolean(this.__wbg_ptr, request);
31
+ if (ret[2]) {
32
+ throw takeFromExternrefTable0(ret[1]);
33
+ }
34
+ return takeFromExternrefTable0(ret[0]);
69
35
  }
70
-
71
- if (offset !== len) {
72
- if (offset !== 0) {
73
- arg = arg.slice(offset);
36
+ /**
37
+ * @param {any} request
38
+ * @returns {any}
39
+ */
40
+ evaluate_variant(request) {
41
+ const ret = wasm.engine_evaluate_variant(this.__wbg_ptr, request);
42
+ if (ret[2]) {
43
+ throw takeFromExternrefTable0(ret[1]);
74
44
  }
75
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
76
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
77
- const ret = cachedTextEncoder.encodeInto(arg, view);
78
-
79
- offset += ret.written;
80
- ptr = realloc(ptr, len, offset, 1) >>> 0;
45
+ return takeFromExternrefTable0(ret[0]);
81
46
  }
82
-
83
- WASM_VECTOR_LEN = offset;
84
- return ptr;
85
- }
86
-
87
- let cachedDataViewMemory0 = null;
88
-
89
- function getDataViewMemory0() {
90
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
91
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
47
+ /**
48
+ * @returns {any}
49
+ */
50
+ list_flags() {
51
+ const ret = wasm.engine_list_flags(this.__wbg_ptr);
52
+ if (ret[2]) {
53
+ throw takeFromExternrefTable0(ret[1]);
54
+ }
55
+ return takeFromExternrefTable0(ret[0]);
92
56
  }
93
- return cachedDataViewMemory0;
57
+ /**
58
+ * @param {string} namespace
59
+ */
60
+ constructor(namespace) {
61
+ const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
62
+ const len0 = WASM_VECTOR_LEN;
63
+ const ret = wasm.engine_new(ptr0, len0);
64
+ this.__wbg_ptr = ret >>> 0;
65
+ EngineFinalization.register(this, this.__wbg_ptr, this);
66
+ return this;
67
+ }
68
+ /**
69
+ * @param {any} data
70
+ */
71
+ snapshot(data) {
72
+ const ret = wasm.engine_snapshot(this.__wbg_ptr, data);
73
+ if (ret[1]) {
74
+ throw takeFromExternrefTable0(ret[0]);
75
+ }
76
+ }
77
+ }
78
+ if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
79
+ function __wbg_get_imports() {
80
+ const import0 = {
81
+ __proto__: null,
82
+ __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
83
+ const ret = Error(getStringFromWasm0(arg0, arg1));
84
+ return ret;
85
+ },
86
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
87
+ const ret = String(arg1);
88
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
89
+ const len1 = WASM_VECTOR_LEN;
90
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
91
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
92
+ },
93
+ __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
94
+ const v = arg0;
95
+ const ret = typeof(v) === 'boolean' ? v : undefined;
96
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
97
+ },
98
+ __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
99
+ const ret = debugString(arg1);
100
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
101
+ const len1 = WASM_VECTOR_LEN;
102
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
103
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
104
+ },
105
+ __wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
106
+ const ret = arg0 in arg1;
107
+ return ret;
108
+ },
109
+ __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
110
+ const ret = typeof(arg0) === 'function';
111
+ return ret;
112
+ },
113
+ __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
114
+ const val = arg0;
115
+ const ret = typeof(val) === 'object' && val !== null;
116
+ return ret;
117
+ },
118
+ __wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
119
+ const ret = typeof(arg0) === 'string';
120
+ return ret;
121
+ },
122
+ __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
123
+ const ret = arg0 === undefined;
124
+ return ret;
125
+ },
126
+ __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
127
+ const ret = arg0 == arg1;
128
+ return ret;
129
+ },
130
+ __wbg___wbindgen_number_get_c7f42aed0525c451: function(arg0, arg1) {
131
+ const obj = arg1;
132
+ const ret = typeof(obj) === 'number' ? obj : undefined;
133
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
134
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
135
+ },
136
+ __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
137
+ const obj = arg1;
138
+ const ret = typeof(obj) === 'string' ? obj : undefined;
139
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
140
+ var len1 = WASM_VECTOR_LEN;
141
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
142
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
143
+ },
144
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
145
+ throw new Error(getStringFromWasm0(arg0, arg1));
146
+ },
147
+ __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
148
+ const ret = arg0.call(arg1);
149
+ return ret;
150
+ }, arguments); },
151
+ __wbg_done_9158f7cc8751ba32: function(arg0) {
152
+ const ret = arg0.done;
153
+ return ret;
154
+ },
155
+ __wbg_entries_e0b73aa8571ddb56: function(arg0) {
156
+ const ret = Object.entries(arg0);
157
+ return ret;
158
+ },
159
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
160
+ let deferred0_0;
161
+ let deferred0_1;
162
+ try {
163
+ deferred0_0 = arg0;
164
+ deferred0_1 = arg1;
165
+ console.error(getStringFromWasm0(arg0, arg1));
166
+ } finally {
167
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
168
+ }
169
+ },
170
+ __wbg_getTime_da7c55f52b71e8c6: function(arg0) {
171
+ const ret = arg0.getTime();
172
+ return ret;
173
+ },
174
+ __wbg_get_1affdbdd5573b16a: function() { return handleError(function (arg0, arg1) {
175
+ const ret = Reflect.get(arg0, arg1);
176
+ return ret;
177
+ }, arguments); },
178
+ __wbg_get_8360291721e2339f: function(arg0, arg1) {
179
+ const ret = arg0[arg1 >>> 0];
180
+ return ret;
181
+ },
182
+ __wbg_get_unchecked_17f53dad852b9588: function(arg0, arg1) {
183
+ const ret = arg0[arg1 >>> 0];
184
+ return ret;
185
+ },
186
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
187
+ const ret = arg0[arg1];
188
+ return ret;
189
+ },
190
+ __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3: function(arg0) {
191
+ let result;
192
+ try {
193
+ result = arg0 instanceof ArrayBuffer;
194
+ } catch (_) {
195
+ result = false;
196
+ }
197
+ const ret = result;
198
+ return ret;
199
+ },
200
+ __wbg_instanceof_Uint8Array_152ba1f289edcf3f: function(arg0) {
201
+ let result;
202
+ try {
203
+ result = arg0 instanceof Uint8Array;
204
+ } catch (_) {
205
+ result = false;
206
+ }
207
+ const ret = result;
208
+ return ret;
209
+ },
210
+ __wbg_isArray_c3109d14ffc06469: function(arg0) {
211
+ const ret = Array.isArray(arg0);
212
+ return ret;
213
+ },
214
+ __wbg_iterator_013bc09ec998c2a7: function() {
215
+ const ret = Symbol.iterator;
216
+ return ret;
217
+ },
218
+ __wbg_length_3d4ecd04bd8d22f1: function(arg0) {
219
+ const ret = arg0.length;
220
+ return ret;
221
+ },
222
+ __wbg_length_9f1775224cf1d815: function(arg0) {
223
+ const ret = arg0.length;
224
+ return ret;
225
+ },
226
+ __wbg_new_0_4d657201ced14de3: function() {
227
+ const ret = new Date();
228
+ return ret;
229
+ },
230
+ __wbg_new_0c7403db6e782f19: function(arg0) {
231
+ const ret = new Uint8Array(arg0);
232
+ return ret;
233
+ },
234
+ __wbg_new_227d7c05414eb861: function() {
235
+ const ret = new Error();
236
+ return ret;
237
+ },
238
+ __wbg_new_682678e2f47e32bc: function() {
239
+ const ret = new Array();
240
+ return ret;
241
+ },
242
+ __wbg_new_aa8d0fa9762c29bd: function() {
243
+ const ret = new Object();
244
+ return ret;
245
+ },
246
+ __wbg_next_0340c4ae324393c3: function() { return handleError(function (arg0) {
247
+ const ret = arg0.next();
248
+ return ret;
249
+ }, arguments); },
250
+ __wbg_next_7646edaa39458ef7: function(arg0) {
251
+ const ret = arg0.next;
252
+ return ret;
253
+ },
254
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
255
+ const ret = arg0.now();
256
+ return ret;
257
+ },
258
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
259
+ const ret = arg0.performance;
260
+ return ret;
261
+ },
262
+ __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
263
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
264
+ },
265
+ __wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
266
+ arg0[arg1 >>> 0] = arg2;
267
+ },
268
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
269
+ arg0[arg1] = arg2;
270
+ },
271
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
272
+ const ret = arg1.stack;
273
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
274
+ const len1 = WASM_VECTOR_LEN;
275
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
276
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
277
+ },
278
+ __wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
279
+ const ret = typeof global === 'undefined' ? null : global;
280
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
281
+ },
282
+ __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
283
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
284
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
285
+ },
286
+ __wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
287
+ const ret = typeof self === 'undefined' ? null : self;
288
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
289
+ },
290
+ __wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
291
+ const ret = typeof window === 'undefined' ? null : window;
292
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
293
+ },
294
+ __wbg_value_ee3a06f4579184fa: function(arg0) {
295
+ const ret = arg0.value;
296
+ return ret;
297
+ },
298
+ __wbindgen_cast_0000000000000001: function(arg0) {
299
+ // Cast intrinsic for `F64 -> Externref`.
300
+ const ret = arg0;
301
+ return ret;
302
+ },
303
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
304
+ // Cast intrinsic for `Ref(String) -> Externref`.
305
+ const ret = getStringFromWasm0(arg0, arg1);
306
+ return ret;
307
+ },
308
+ __wbindgen_init_externref_table: function() {
309
+ const table = wasm.__wbindgen_externrefs;
310
+ const offset = table.grow(4);
311
+ table.set(0, undefined);
312
+ table.set(offset + 0, undefined);
313
+ table.set(offset + 1, null);
314
+ table.set(offset + 2, true);
315
+ table.set(offset + 3, false);
316
+ },
317
+ };
318
+ return {
319
+ __proto__: null,
320
+ "./flipt_engine_wasm_js_bg.js": import0,
321
+ };
94
322
  }
95
323
 
96
- function isLikeNone(x) {
97
- return x === undefined || x === null;
324
+ const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
325
+ ? { register: () => {}, unregister: () => {} }
326
+ : new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr >>> 0, 1));
327
+
328
+ function addToExternrefTable0(obj) {
329
+ const idx = wasm.__externref_table_alloc();
330
+ wasm.__wbindgen_externrefs.set(idx, obj);
331
+ return idx;
98
332
  }
99
333
 
100
334
  function debugString(val) {
@@ -162,10 +396,30 @@ function debugString(val) {
162
396
  return className;
163
397
  }
164
398
 
165
- function addToExternrefTable0(obj) {
166
- const idx = wasm.__externref_table_alloc();
167
- wasm.__wbindgen_externrefs.set(idx, obj);
168
- return idx;
399
+ function getArrayU8FromWasm0(ptr, len) {
400
+ ptr = ptr >>> 0;
401
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
402
+ }
403
+
404
+ let cachedDataViewMemory0 = null;
405
+ function getDataViewMemory0() {
406
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
407
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
408
+ }
409
+ return cachedDataViewMemory0;
410
+ }
411
+
412
+ function getStringFromWasm0(ptr, len) {
413
+ ptr = ptr >>> 0;
414
+ return decodeText(ptr, len);
415
+ }
416
+
417
+ let cachedUint8ArrayMemory0 = null;
418
+ function getUint8ArrayMemory0() {
419
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
420
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
421
+ }
422
+ return cachedUint8ArrayMemory0;
169
423
  }
170
424
 
171
425
  function handleError(f, args) {
@@ -177,393 +431,131 @@ function handleError(f, args) {
177
431
  }
178
432
  }
179
433
 
180
- function getArrayU8FromWasm0(ptr, len) {
181
- ptr = ptr >>> 0;
182
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
434
+ function isLikeNone(x) {
435
+ return x === undefined || x === null;
183
436
  }
184
437
 
185
- function takeFromExternrefTable0(idx) {
186
- const value = wasm.__wbindgen_externrefs.get(idx);
187
- wasm.__externref_table_dealloc(idx);
188
- return value;
189
- }
438
+ function passStringToWasm0(arg, malloc, realloc) {
439
+ if (realloc === undefined) {
440
+ const buf = cachedTextEncoder.encode(arg);
441
+ const ptr = malloc(buf.length, 1) >>> 0;
442
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
443
+ WASM_VECTOR_LEN = buf.length;
444
+ return ptr;
445
+ }
190
446
 
191
- const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
192
- ? { register: () => {}, unregister: () => {} }
193
- : new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr >>> 0, 1));
447
+ let len = arg.length;
448
+ let ptr = malloc(len, 1) >>> 0;
194
449
 
195
- class Engine {
450
+ const mem = getUint8ArrayMemory0();
196
451
 
197
- __destroy_into_raw() {
198
- const ptr = this.__wbg_ptr;
199
- this.__wbg_ptr = 0;
200
- EngineFinalization.unregister(this);
201
- return ptr;
202
- }
452
+ let offset = 0;
203
453
 
204
- free() {
205
- const ptr = this.__destroy_into_raw();
206
- wasm.__wbg_engine_free(ptr, 0);
207
- }
208
- /**
209
- * @param {string} namespace
210
- */
211
- constructor(namespace) {
212
- const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
213
- const len0 = WASM_VECTOR_LEN;
214
- const ret = wasm.engine_new(ptr0, len0);
215
- this.__wbg_ptr = ret >>> 0;
216
- EngineFinalization.register(this, this.__wbg_ptr, this);
217
- return this;
218
- }
219
- /**
220
- * @param {any} data
221
- */
222
- snapshot(data) {
223
- const ret = wasm.engine_snapshot(this.__wbg_ptr, data);
224
- if (ret[1]) {
225
- throw takeFromExternrefTable0(ret[0]);
226
- }
227
- }
228
- /**
229
- * @param {any} request
230
- * @returns {any}
231
- */
232
- evaluate_boolean(request) {
233
- const ret = wasm.engine_evaluate_boolean(this.__wbg_ptr, request);
234
- if (ret[2]) {
235
- throw takeFromExternrefTable0(ret[1]);
236
- }
237
- return takeFromExternrefTable0(ret[0]);
238
- }
239
- /**
240
- * @param {any} request
241
- * @returns {any}
242
- */
243
- evaluate_variant(request) {
244
- const ret = wasm.engine_evaluate_variant(this.__wbg_ptr, request);
245
- if (ret[2]) {
246
- throw takeFromExternrefTable0(ret[1]);
247
- }
248
- return takeFromExternrefTable0(ret[0]);
454
+ for (; offset < len; offset++) {
455
+ const code = arg.charCodeAt(offset);
456
+ if (code > 0x7F) break;
457
+ mem[ptr + offset] = code;
249
458
  }
250
- /**
251
- * @param {any} request
252
- * @returns {any}
253
- */
254
- evaluate_batch(request) {
255
- const ret = wasm.engine_evaluate_batch(this.__wbg_ptr, request);
256
- if (ret[2]) {
257
- throw takeFromExternrefTable0(ret[1]);
459
+ if (offset !== len) {
460
+ if (offset !== 0) {
461
+ arg = arg.slice(offset);
258
462
  }
259
- return takeFromExternrefTable0(ret[0]);
463
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
464
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
465
+ const ret = cachedTextEncoder.encodeInto(arg, view);
466
+
467
+ offset += ret.written;
468
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
260
469
  }
261
- /**
262
- * @returns {any}
263
- */
264
- list_flags() {
265
- const ret = wasm.engine_list_flags(this.__wbg_ptr);
266
- if (ret[2]) {
267
- throw takeFromExternrefTable0(ret[1]);
268
- }
269
- return takeFromExternrefTable0(ret[0]);
470
+
471
+ WASM_VECTOR_LEN = offset;
472
+ return ptr;
473
+ }
474
+
475
+ function takeFromExternrefTable0(idx) {
476
+ const value = wasm.__wbindgen_externrefs.get(idx);
477
+ wasm.__externref_table_dealloc(idx);
478
+ return value;
479
+ }
480
+
481
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
482
+ cachedTextDecoder.decode();
483
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
484
+ let numBytesDecoded = 0;
485
+ function decodeText(ptr, len) {
486
+ numBytesDecoded += len;
487
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
488
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
489
+ cachedTextDecoder.decode();
490
+ numBytesDecoded = len;
270
491
  }
492
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
271
493
  }
272
- if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
273
494
 
274
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
495
+ const cachedTextEncoder = new TextEncoder();
496
+
497
+ if (!('encodeInto' in cachedTextEncoder)) {
498
+ cachedTextEncoder.encodeInto = function (arg, view) {
499
+ const buf = cachedTextEncoder.encode(arg);
500
+ view.set(buf);
501
+ return {
502
+ read: arg.length,
503
+ written: buf.length
504
+ };
505
+ };
506
+ }
507
+
508
+ let WASM_VECTOR_LEN = 0;
509
+
510
+ let wasm;
511
+ function __wbg_finalize_init(instance, module) {
512
+ wasm = instance.exports;
513
+ cachedDataViewMemory0 = null;
514
+ cachedUint8ArrayMemory0 = null;
515
+ wasm.__wbindgen_start();
516
+ return wasm;
517
+ }
275
518
 
276
519
  async function __wbg_load(module, imports) {
277
520
  if (typeof Response === 'function' && module instanceof Response) {
278
521
  if (typeof WebAssembly.instantiateStreaming === 'function') {
279
522
  try {
280
523
  return await WebAssembly.instantiateStreaming(module, imports);
281
-
282
524
  } catch (e) {
283
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
525
+ const validResponse = module.ok && expectedResponseType(module.type);
284
526
 
285
527
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
286
528
  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);
287
529
 
288
- } else {
289
- throw e;
290
- }
530
+ } else { throw e; }
291
531
  }
292
532
  }
293
533
 
294
534
  const bytes = await module.arrayBuffer();
295
535
  return await WebAssembly.instantiate(bytes, imports);
296
-
297
536
  } else {
298
537
  const instance = await WebAssembly.instantiate(module, imports);
299
538
 
300
539
  if (instance instanceof WebAssembly.Instance) {
301
540
  return { instance, module };
302
-
303
541
  } else {
304
542
  return instance;
305
543
  }
306
544
  }
307
- }
308
545
 
309
- function __wbg_get_imports() {
310
- const imports = {};
311
- imports.wbg = {};
312
- imports.wbg.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
313
- const ret = Error(getStringFromWasm0(arg0, arg1));
314
- return ret;
315
- };
316
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
317
- const ret = String(arg1);
318
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
319
- const len1 = WASM_VECTOR_LEN;
320
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
321
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
322
- };
323
- imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
324
- const v = arg0;
325
- const ret = typeof(v) === 'boolean' ? v : undefined;
326
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
327
- };
328
- imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
329
- const ret = debugString(arg1);
330
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
331
- const len1 = WASM_VECTOR_LEN;
332
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
333
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
334
- };
335
- imports.wbg.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
336
- const ret = arg0 in arg1;
337
- return ret;
338
- };
339
- imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
340
- const ret = typeof(arg0) === 'function';
341
- return ret;
342
- };
343
- imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
344
- const val = arg0;
345
- const ret = typeof(val) === 'object' && val !== null;
346
- return ret;
347
- };
348
- imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
349
- const ret = typeof(arg0) === 'string';
350
- return ret;
351
- };
352
- imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
353
- const ret = arg0 === undefined;
354
- return ret;
355
- };
356
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
357
- const ret = arg0 == arg1;
358
- return ret;
359
- };
360
- imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
361
- const obj = arg1;
362
- const ret = typeof(obj) === 'number' ? obj : undefined;
363
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
364
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
365
- };
366
- imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
367
- const obj = arg1;
368
- const ret = typeof(obj) === 'string' ? obj : undefined;
369
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
370
- var len1 = WASM_VECTOR_LEN;
371
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
372
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
373
- };
374
- imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
375
- throw new Error(getStringFromWasm0(arg0, arg1));
376
- };
377
- imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
378
- const ret = arg0.call(arg1);
379
- return ret;
380
- }, arguments) };
381
- imports.wbg.__wbg_done_2042aa2670fb1db1 = function(arg0) {
382
- const ret = arg0.done;
383
- return ret;
384
- };
385
- imports.wbg.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
386
- const ret = Object.entries(arg0);
387
- return ret;
388
- };
389
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
390
- let deferred0_0;
391
- let deferred0_1;
392
- try {
393
- deferred0_0 = arg0;
394
- deferred0_1 = arg1;
395
- console.error(getStringFromWasm0(arg0, arg1));
396
- } finally {
397
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
398
- }
399
- };
400
- imports.wbg.__wbg_getTime_14776bfb48a1bff9 = function(arg0) {
401
- const ret = arg0.getTime();
402
- return ret;
403
- };
404
- imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
405
- const ret = arg0[arg1 >>> 0];
406
- return ret;
407
- };
408
- imports.wbg.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
409
- const ret = Reflect.get(arg0, arg1);
410
- return ret;
411
- }, arguments) };
412
- imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
413
- const ret = arg0[arg1];
414
- return ret;
415
- };
416
- imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
417
- let result;
418
- try {
419
- result = arg0 instanceof ArrayBuffer;
420
- } catch (_) {
421
- result = false;
422
- }
423
- const ret = result;
424
- return ret;
425
- };
426
- imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
427
- let result;
428
- try {
429
- result = arg0 instanceof Uint8Array;
430
- } catch (_) {
431
- result = false;
546
+ function expectedResponseType(type) {
547
+ switch (type) {
548
+ case 'basic': case 'cors': case 'default': return true;
432
549
  }
433
- const ret = result;
434
- return ret;
435
- };
436
- imports.wbg.__wbg_isArray_96e0af9891d0945d = function(arg0) {
437
- const ret = Array.isArray(arg0);
438
- return ret;
439
- };
440
- imports.wbg.__wbg_iterator_e5822695327a3c39 = function() {
441
- const ret = Symbol.iterator;
442
- return ret;
443
- };
444
- imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
445
- const ret = arg0.length;
446
- return ret;
447
- };
448
- imports.wbg.__wbg_length_cdd215e10d9dd507 = function(arg0) {
449
- const ret = arg0.length;
450
- return ret;
451
- };
452
- imports.wbg.__wbg_new_0_f9740686d739025c = function() {
453
- const ret = new Date();
454
- return ret;
455
- };
456
- imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
457
- const ret = new Object();
458
- return ret;
459
- };
460
- imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
461
- const ret = new Uint8Array(arg0);
462
- return ret;
463
- };
464
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
465
- const ret = new Error();
466
- return ret;
467
- };
468
- imports.wbg.__wbg_new_e17d9f43105b08be = function() {
469
- const ret = new Array();
470
- return ret;
471
- };
472
- imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
473
- const ret = new Function(getStringFromWasm0(arg0, arg1));
474
- return ret;
475
- };
476
- imports.wbg.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
477
- const ret = arg0.next();
478
- return ret;
479
- }, arguments) };
480
- imports.wbg.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
481
- const ret = arg0.next;
482
- return ret;
483
- };
484
- imports.wbg.__wbg_now_2c95c9de01293173 = function(arg0) {
485
- const ret = arg0.now();
486
- return ret;
487
- };
488
- imports.wbg.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {
489
- const ret = arg0.performance;
490
- return ret;
491
- };
492
- imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
493
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
494
- };
495
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
496
- arg0[arg1] = arg2;
497
- };
498
- imports.wbg.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
499
- arg0[arg1 >>> 0] = arg2;
500
- };
501
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
502
- const ret = arg1.stack;
503
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
504
- const len1 = WASM_VECTOR_LEN;
505
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
506
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
507
- };
508
- imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
509
- const ret = typeof global === 'undefined' ? null : global;
510
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
511
- };
512
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
513
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
514
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
515
- };
516
- imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
517
- const ret = typeof self === 'undefined' ? null : self;
518
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
519
- };
520
- imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
521
- const ret = typeof window === 'undefined' ? null : window;
522
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
523
- };
524
- imports.wbg.__wbg_value_692627309814bb8c = function(arg0) {
525
- const ret = arg0.value;
526
- return ret;
527
- };
528
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
529
- // Cast intrinsic for `Ref(String) -> Externref`.
530
- const ret = getStringFromWasm0(arg0, arg1);
531
- return ret;
532
- };
533
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
534
- // Cast intrinsic for `F64 -> Externref`.
535
- const ret = arg0;
536
- return ret;
537
- };
538
- imports.wbg.__wbindgen_init_externref_table = function() {
539
- const table = wasm.__wbindgen_externrefs;
540
- const offset = table.grow(4);
541
- table.set(0, undefined);
542
- table.set(offset + 0, undefined);
543
- table.set(offset + 1, null);
544
- table.set(offset + 2, true);
545
- table.set(offset + 3, false);
546
- };
547
-
548
- return imports;
549
- }
550
-
551
- function __wbg_finalize_init(instance, module) {
552
- wasm = instance.exports;
553
- __wbg_init.__wbindgen_wasm_module = module;
554
- cachedDataViewMemory0 = null;
555
- cachedUint8ArrayMemory0 = null;
556
-
557
-
558
- wasm.__wbindgen_start();
559
- return wasm;
550
+ return false;
551
+ }
560
552
  }
561
553
 
562
554
  async function __wbg_init(module_or_path) {
563
555
  if (wasm !== undefined) return wasm;
564
556
 
565
557
 
566
- if (typeof module_or_path !== 'undefined') {
558
+ if (module_or_path !== undefined) {
567
559
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
568
560
  ({module_or_path} = module_or_path);
569
561
  } else {
@@ -571,7 +563,7 @@ async function __wbg_init(module_or_path) {
571
563
  }
572
564
  }
573
565
 
574
- if (typeof module_or_path === 'undefined') {
566
+ if (module_or_path === undefined) {
575
567
  module_or_path = new URL('flipt_engine_wasm_js_bg.wasm', import.meta.url);
576
568
  }
577
569
  const imports = __wbg_get_imports();
@@ -582,7 +574,7 @@ async function __wbg_init(module_or_path) {
582
574
 
583
575
  const { instance, module } = await __wbg_load(await module_or_path, imports);
584
576
 
585
- return __wbg_finalize_init(instance, module);
577
+ return __wbg_finalize_init(instance);
586
578
  }
587
579
 
588
580
  /**