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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,100 +1,335 @@
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]);
44
+ }
45
+ return takeFromExternrefTable0(ret[0]);
46
+ }
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]);
56
+ }
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]);
74
75
  }
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;
81
76
  }
82
-
83
- WASM_VECTOR_LEN = offset;
84
- return ptr;
85
77
  }
78
+ if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
86
79
 
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);
92
- }
93
- return cachedDataViewMemory0;
80
+ function __wbg_get_imports() {
81
+ const import0 = {
82
+ __proto__: null,
83
+ __wbg_Error_55538483de6e3abe: function(arg0, arg1) {
84
+ const ret = Error(getStringFromWasm0(arg0, arg1));
85
+ return ret;
86
+ },
87
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
88
+ const ret = String(arg1);
89
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
90
+ const len1 = WASM_VECTOR_LEN;
91
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
92
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
93
+ },
94
+ __wbg___wbindgen_boolean_get_fe2a24fdfdb4064f: function(arg0) {
95
+ const v = arg0;
96
+ const ret = typeof(v) === 'boolean' ? v : undefined;
97
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
98
+ },
99
+ __wbg___wbindgen_debug_string_d89627202d0155b7: function(arg0, arg1) {
100
+ const ret = debugString(arg1);
101
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
102
+ const len1 = WASM_VECTOR_LEN;
103
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
104
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
105
+ },
106
+ __wbg___wbindgen_in_fe3eb6a509f75744: function(arg0, arg1) {
107
+ const ret = arg0 in arg1;
108
+ return ret;
109
+ },
110
+ __wbg___wbindgen_is_function_2a95406423ea8626: function(arg0) {
111
+ const ret = typeof(arg0) === 'function';
112
+ return ret;
113
+ },
114
+ __wbg___wbindgen_is_object_59a002e76b059312: function(arg0) {
115
+ const val = arg0;
116
+ const ret = typeof(val) === 'object' && val !== null;
117
+ return ret;
118
+ },
119
+ __wbg___wbindgen_is_string_624d5244bb2bc87c: function(arg0) {
120
+ const ret = typeof(arg0) === 'string';
121
+ return ret;
122
+ },
123
+ __wbg___wbindgen_is_undefined_87a3a837f331fef5: function(arg0) {
124
+ const ret = arg0 === undefined;
125
+ return ret;
126
+ },
127
+ __wbg___wbindgen_jsval_loose_eq_cf851f110c48f9ba: function(arg0, arg1) {
128
+ const ret = arg0 == arg1;
129
+ return ret;
130
+ },
131
+ __wbg___wbindgen_number_get_769f3676dc20c1d7: function(arg0, arg1) {
132
+ const obj = arg1;
133
+ const ret = typeof(obj) === 'number' ? obj : undefined;
134
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
135
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
136
+ },
137
+ __wbg___wbindgen_string_get_f1161390414f9b59: function(arg0, arg1) {
138
+ const obj = arg1;
139
+ const ret = typeof(obj) === 'string' ? obj : undefined;
140
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
141
+ var len1 = WASM_VECTOR_LEN;
142
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
143
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
144
+ },
145
+ __wbg___wbindgen_throw_5549492daedad139: function(arg0, arg1) {
146
+ throw new Error(getStringFromWasm0(arg0, arg1));
147
+ },
148
+ __wbg_call_6ae20895a60069a2: function() { return handleError(function (arg0, arg1) {
149
+ const ret = arg0.call(arg1);
150
+ return ret;
151
+ }, arguments); },
152
+ __wbg_done_19f92cb1f8738aba: function(arg0) {
153
+ const ret = arg0.done;
154
+ return ret;
155
+ },
156
+ __wbg_entries_28ed7cb892e12eff: function(arg0) {
157
+ const ret = Object.entries(arg0);
158
+ return ret;
159
+ },
160
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
161
+ let deferred0_0;
162
+ let deferred0_1;
163
+ try {
164
+ deferred0_0 = arg0;
165
+ deferred0_1 = arg1;
166
+ console.error(getStringFromWasm0(arg0, arg1));
167
+ } finally {
168
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
169
+ }
170
+ },
171
+ __wbg_getTime_c3af35594e283356: function(arg0) {
172
+ const ret = arg0.getTime();
173
+ return ret;
174
+ },
175
+ __wbg_get_94f5fc088edd3138: function(arg0, arg1) {
176
+ const ret = arg0[arg1 >>> 0];
177
+ return ret;
178
+ },
179
+ __wbg_get_a50328e7325d7f9b: function() { return handleError(function (arg0, arg1) {
180
+ const ret = Reflect.get(arg0, arg1);
181
+ return ret;
182
+ }, arguments); },
183
+ __wbg_get_unchecked_7c6bbabf5b0b1fbf: function(arg0, arg1) {
184
+ const ret = arg0[arg1 >>> 0];
185
+ return ret;
186
+ },
187
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
188
+ const ret = arg0[arg1];
189
+ return ret;
190
+ },
191
+ __wbg_instanceof_ArrayBuffer_8d855993947fc3a2: function(arg0) {
192
+ let result;
193
+ try {
194
+ result = arg0 instanceof ArrayBuffer;
195
+ } catch (_) {
196
+ result = false;
197
+ }
198
+ const ret = result;
199
+ return ret;
200
+ },
201
+ __wbg_instanceof_Uint8Array_ce24d58a5f4bdcc3: function(arg0) {
202
+ let result;
203
+ try {
204
+ result = arg0 instanceof Uint8Array;
205
+ } catch (_) {
206
+ result = false;
207
+ }
208
+ const ret = result;
209
+ return ret;
210
+ },
211
+ __wbg_isArray_867202cf8f195ed8: function(arg0) {
212
+ const ret = Array.isArray(arg0);
213
+ return ret;
214
+ },
215
+ __wbg_iterator_54661826e186eb6a: function() {
216
+ const ret = Symbol.iterator;
217
+ return ret;
218
+ },
219
+ __wbg_length_e6e1633fbea6cfa9: function(arg0) {
220
+ const ret = arg0.length;
221
+ return ret;
222
+ },
223
+ __wbg_length_fae3e439140f48a4: function(arg0) {
224
+ const ret = arg0.length;
225
+ return ret;
226
+ },
227
+ __wbg_new_0_e649c99e7382313f: function() {
228
+ const ret = new Date();
229
+ return ret;
230
+ },
231
+ __wbg_new_1d96678aaacca32e: function(arg0) {
232
+ const ret = new Uint8Array(arg0);
233
+ return ret;
234
+ },
235
+ __wbg_new_227d7c05414eb861: function() {
236
+ const ret = new Error();
237
+ return ret;
238
+ },
239
+ __wbg_new_4370be21fa2b2f80: function() {
240
+ const ret = new Array();
241
+ return ret;
242
+ },
243
+ __wbg_new_48e1d86cfd30c8e7: function() {
244
+ const ret = new Object();
245
+ return ret;
246
+ },
247
+ __wbg_next_55d835fe0ab5b3e7: function(arg0) {
248
+ const ret = arg0.next;
249
+ return ret;
250
+ },
251
+ __wbg_next_e34cfb9df1518d7c: function() { return handleError(function (arg0) {
252
+ const ret = arg0.next();
253
+ return ret;
254
+ }, arguments); },
255
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
256
+ const ret = arg0.now();
257
+ return ret;
258
+ },
259
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
260
+ const ret = arg0.performance;
261
+ return ret;
262
+ },
263
+ __wbg_prototypesetcall_3875d54d12ef2eec: function(arg0, arg1, arg2) {
264
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
265
+ },
266
+ __wbg_set_4702dfa37c77f492: function(arg0, arg1, arg2) {
267
+ arg0[arg1 >>> 0] = arg2;
268
+ },
269
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
270
+ arg0[arg1] = arg2;
271
+ },
272
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
273
+ const ret = arg1.stack;
274
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
275
+ const len1 = WASM_VECTOR_LEN;
276
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
277
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
278
+ },
279
+ __wbg_static_accessor_GLOBAL_8dfb7f5e26ebe523: function() {
280
+ const ret = typeof global === 'undefined' ? null : global;
281
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
282
+ },
283
+ __wbg_static_accessor_GLOBAL_THIS_941154efc8395cdd: function() {
284
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
285
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
286
+ },
287
+ __wbg_static_accessor_SELF_58dac9af822f561f: function() {
288
+ const ret = typeof self === 'undefined' ? null : self;
289
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
290
+ },
291
+ __wbg_static_accessor_WINDOW_ee64f0b3d8354c0b: function() {
292
+ const ret = typeof window === 'undefined' ? null : window;
293
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
294
+ },
295
+ __wbg_value_d5b248ce8419bd1b: function(arg0) {
296
+ const ret = arg0.value;
297
+ return ret;
298
+ },
299
+ __wbindgen_cast_0000000000000001: function(arg0) {
300
+ // Cast intrinsic for `F64 -> Externref`.
301
+ const ret = arg0;
302
+ return ret;
303
+ },
304
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
305
+ // Cast intrinsic for `Ref(String) -> Externref`.
306
+ const ret = getStringFromWasm0(arg0, arg1);
307
+ return ret;
308
+ },
309
+ __wbindgen_init_externref_table: function() {
310
+ const table = wasm.__wbindgen_externrefs;
311
+ const offset = table.grow(4);
312
+ table.set(0, undefined);
313
+ table.set(offset + 0, undefined);
314
+ table.set(offset + 1, null);
315
+ table.set(offset + 2, true);
316
+ table.set(offset + 3, false);
317
+ },
318
+ };
319
+ return {
320
+ __proto__: null,
321
+ "./flipt_engine_wasm_js_bg.js": import0,
322
+ };
94
323
  }
95
324
 
96
- function isLikeNone(x) {
97
- return x === undefined || x === null;
325
+ const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
326
+ ? { register: () => {}, unregister: () => {} }
327
+ : new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr >>> 0, 1));
328
+
329
+ function addToExternrefTable0(obj) {
330
+ const idx = wasm.__externref_table_alloc();
331
+ wasm.__wbindgen_externrefs.set(idx, obj);
332
+ return idx;
98
333
  }
99
334
 
100
335
  function debugString(val) {
@@ -162,10 +397,30 @@ function debugString(val) {
162
397
  return className;
163
398
  }
164
399
 
165
- function addToExternrefTable0(obj) {
166
- const idx = wasm.__externref_table_alloc();
167
- wasm.__wbindgen_externrefs.set(idx, obj);
168
- return idx;
400
+ function getArrayU8FromWasm0(ptr, len) {
401
+ ptr = ptr >>> 0;
402
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
403
+ }
404
+
405
+ let cachedDataViewMemory0 = null;
406
+ function getDataViewMemory0() {
407
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
408
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
409
+ }
410
+ return cachedDataViewMemory0;
411
+ }
412
+
413
+ function getStringFromWasm0(ptr, len) {
414
+ ptr = ptr >>> 0;
415
+ return decodeText(ptr, len);
416
+ }
417
+
418
+ let cachedUint8ArrayMemory0 = null;
419
+ function getUint8ArrayMemory0() {
420
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
421
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
422
+ }
423
+ return cachedUint8ArrayMemory0;
169
424
  }
170
425
 
171
426
  function handleError(f, args) {
@@ -177,393 +432,131 @@ function handleError(f, args) {
177
432
  }
178
433
  }
179
434
 
180
- function getArrayU8FromWasm0(ptr, len) {
181
- ptr = ptr >>> 0;
182
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
435
+ function isLikeNone(x) {
436
+ return x === undefined || x === null;
183
437
  }
184
438
 
185
- function takeFromExternrefTable0(idx) {
186
- const value = wasm.__wbindgen_externrefs.get(idx);
187
- wasm.__externref_table_dealloc(idx);
188
- return value;
189
- }
439
+ function passStringToWasm0(arg, malloc, realloc) {
440
+ if (realloc === undefined) {
441
+ const buf = cachedTextEncoder.encode(arg);
442
+ const ptr = malloc(buf.length, 1) >>> 0;
443
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
444
+ WASM_VECTOR_LEN = buf.length;
445
+ return ptr;
446
+ }
190
447
 
191
- const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
192
- ? { register: () => {}, unregister: () => {} }
193
- : new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr >>> 0, 1));
448
+ let len = arg.length;
449
+ let ptr = malloc(len, 1) >>> 0;
194
450
 
195
- class Engine {
451
+ const mem = getUint8ArrayMemory0();
196
452
 
197
- __destroy_into_raw() {
198
- const ptr = this.__wbg_ptr;
199
- this.__wbg_ptr = 0;
200
- EngineFinalization.unregister(this);
201
- return ptr;
202
- }
453
+ let offset = 0;
203
454
 
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]);
455
+ for (; offset < len; offset++) {
456
+ const code = arg.charCodeAt(offset);
457
+ if (code > 0x7F) break;
458
+ mem[ptr + offset] = code;
249
459
  }
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]);
460
+ if (offset !== len) {
461
+ if (offset !== 0) {
462
+ arg = arg.slice(offset);
258
463
  }
259
- return takeFromExternrefTable0(ret[0]);
464
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
465
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
466
+ const ret = cachedTextEncoder.encodeInto(arg, view);
467
+
468
+ offset += ret.written;
469
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
260
470
  }
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]);
471
+
472
+ WASM_VECTOR_LEN = offset;
473
+ return ptr;
474
+ }
475
+
476
+ function takeFromExternrefTable0(idx) {
477
+ const value = wasm.__wbindgen_externrefs.get(idx);
478
+ wasm.__externref_table_dealloc(idx);
479
+ return value;
480
+ }
481
+
482
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
483
+ cachedTextDecoder.decode();
484
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
485
+ let numBytesDecoded = 0;
486
+ function decodeText(ptr, len) {
487
+ numBytesDecoded += len;
488
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
489
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
490
+ cachedTextDecoder.decode();
491
+ numBytesDecoded = len;
270
492
  }
493
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
271
494
  }
272
- if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
273
495
 
274
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
496
+ const cachedTextEncoder = new TextEncoder();
497
+
498
+ if (!('encodeInto' in cachedTextEncoder)) {
499
+ cachedTextEncoder.encodeInto = function (arg, view) {
500
+ const buf = cachedTextEncoder.encode(arg);
501
+ view.set(buf);
502
+ return {
503
+ read: arg.length,
504
+ written: buf.length
505
+ };
506
+ };
507
+ }
508
+
509
+ let WASM_VECTOR_LEN = 0;
510
+
511
+ let wasm;
512
+ function __wbg_finalize_init(instance, module) {
513
+ wasm = instance.exports;
514
+ cachedDataViewMemory0 = null;
515
+ cachedUint8ArrayMemory0 = null;
516
+ wasm.__wbindgen_start();
517
+ return wasm;
518
+ }
275
519
 
276
520
  async function __wbg_load(module, imports) {
277
521
  if (typeof Response === 'function' && module instanceof Response) {
278
522
  if (typeof WebAssembly.instantiateStreaming === 'function') {
279
523
  try {
280
524
  return await WebAssembly.instantiateStreaming(module, imports);
281
-
282
525
  } catch (e) {
283
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
526
+ const validResponse = module.ok && expectedResponseType(module.type);
284
527
 
285
528
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
286
529
  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
530
 
288
- } else {
289
- throw e;
290
- }
531
+ } else { throw e; }
291
532
  }
292
533
  }
293
534
 
294
535
  const bytes = await module.arrayBuffer();
295
536
  return await WebAssembly.instantiate(bytes, imports);
296
-
297
537
  } else {
298
538
  const instance = await WebAssembly.instantiate(module, imports);
299
539
 
300
540
  if (instance instanceof WebAssembly.Instance) {
301
541
  return { instance, module };
302
-
303
542
  } else {
304
543
  return instance;
305
544
  }
306
545
  }
307
- }
308
546
 
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;
547
+ function expectedResponseType(type) {
548
+ switch (type) {
549
+ case 'basic': case 'cors': case 'default': return true;
432
550
  }
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;
551
+ return false;
552
+ }
560
553
  }
561
554
 
562
555
  async function __wbg_init(module_or_path) {
563
556
  if (wasm !== undefined) return wasm;
564
557
 
565
558
 
566
- if (typeof module_or_path !== 'undefined') {
559
+ if (module_or_path !== undefined) {
567
560
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
568
561
  ({module_or_path} = module_or_path);
569
562
  } else {
@@ -571,7 +564,7 @@ async function __wbg_init(module_or_path) {
571
564
  }
572
565
  }
573
566
 
574
- if (typeof module_or_path === 'undefined') {
567
+ if (module_or_path === undefined) {
575
568
  module_or_path = new URL('flipt_engine_wasm_js_bg.wasm', import.meta.url);
576
569
  }
577
570
  const imports = __wbg_get_imports();
@@ -582,7 +575,7 @@ async function __wbg_init(module_or_path) {
582
575
 
583
576
  const { instance, module } = await __wbg_load(await module_or_path, imports);
584
577
 
585
- return __wbg_finalize_init(instance, module);
578
+ return __wbg_finalize_init(instance);
586
579
  }
587
580
 
588
581
  /**