@kya-os/agentshield-nextjs 0.2.6 → 0.2.7
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/package.json +4 -4
- package/wasm/agentshield_wasm.d.ts +33 -6
- package/wasm/agentshield_wasm.js +626 -516
- package/wasm/agentshield_wasm_bg.wasm +0 -0
package/wasm/agentshield_wasm.js
CHANGED
|
@@ -1,136 +1,149 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
4
|
-
|
|
5
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
6
|
-
|
|
7
3
|
let cachedUint8ArrayMemory0 = null;
|
|
8
4
|
|
|
9
5
|
function getUint8ArrayMemory0() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
7
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
8
|
+
}
|
|
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;
|
|
24
|
+
}
|
|
25
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
14
26
|
}
|
|
15
27
|
|
|
16
28
|
function getStringFromWasm0(ptr, len) {
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
ptr = ptr >>> 0;
|
|
30
|
+
return decodeText(ptr, len);
|
|
19
31
|
}
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
|
|
28
|
-
} catch(_) {
|
|
29
|
-
return "<failed to stringify thrown value>";
|
|
30
|
-
}
|
|
31
|
-
}());
|
|
32
|
-
console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
|
|
33
|
-
throw e;
|
|
34
|
-
}
|
|
33
|
+
let heap = new Array(128).fill(undefined);
|
|
34
|
+
|
|
35
|
+
heap.push(undefined, null, true, false);
|
|
36
|
+
|
|
37
|
+
function getObject(idx) {
|
|
38
|
+
return heap[idx];
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
let
|
|
41
|
+
let heap_next = heap.length;
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
function addHeapObject(obj) {
|
|
44
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
45
|
+
const idx = heap_next;
|
|
46
|
+
heap_next = heap[idx];
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
48
|
+
heap[idx] = obj;
|
|
49
|
+
return idx;
|
|
44
50
|
}
|
|
45
|
-
|
|
51
|
+
|
|
52
|
+
let WASM_VECTOR_LEN = 0;
|
|
53
|
+
|
|
54
|
+
const cachedTextEncoder = new TextEncoder();
|
|
55
|
+
|
|
56
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
57
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
46
58
|
const buf = cachedTextEncoder.encode(arg);
|
|
47
59
|
view.set(buf);
|
|
48
60
|
return {
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
read: arg.length,
|
|
62
|
+
written: buf.length,
|
|
51
63
|
};
|
|
52
|
-
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
53
66
|
|
|
54
67
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
68
|
+
if (realloc === undefined) {
|
|
69
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
70
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
71
|
+
getUint8ArrayMemory0()
|
|
72
|
+
.subarray(ptr, ptr + buf.length)
|
|
73
|
+
.set(buf);
|
|
74
|
+
WASM_VECTOR_LEN = buf.length;
|
|
75
|
+
return ptr;
|
|
76
|
+
}
|
|
55
77
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (realloc === undefined) {
|
|
59
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
60
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
61
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
62
|
-
WASM_VECTOR_LEN = buf.length;
|
|
63
|
-
return ptr;
|
|
64
|
-
}
|
|
78
|
+
let len = arg.length;
|
|
79
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
65
80
|
|
|
66
|
-
|
|
67
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
81
|
+
const mem = getUint8ArrayMemory0();
|
|
68
82
|
|
|
69
|
-
|
|
83
|
+
let offset = 0;
|
|
70
84
|
|
|
71
|
-
|
|
85
|
+
for (; offset < len; offset++) {
|
|
86
|
+
const code = arg.charCodeAt(offset);
|
|
87
|
+
if (code > 0x7f) break;
|
|
88
|
+
mem[ptr + offset] = code;
|
|
89
|
+
}
|
|
72
90
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
mem[ptr + offset] = code;
|
|
91
|
+
if (offset !== len) {
|
|
92
|
+
if (offset !== 0) {
|
|
93
|
+
arg = arg.slice(offset);
|
|
77
94
|
}
|
|
95
|
+
ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
|
|
96
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
97
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
78
98
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
84
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
85
|
-
const ret = encodeString(arg, view);
|
|
86
|
-
if (ret.read !== arg.length) throw new Error('failed to pass whole string');
|
|
87
|
-
offset += ret.written;
|
|
88
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
89
|
-
}
|
|
99
|
+
offset += ret.written;
|
|
100
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
101
|
+
}
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
|
|
103
|
+
WASM_VECTOR_LEN = offset;
|
|
104
|
+
return ptr;
|
|
93
105
|
}
|
|
94
106
|
|
|
95
107
|
let cachedDataViewMemory0 = null;
|
|
96
108
|
|
|
97
109
|
function getDataViewMemory0() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
110
|
+
if (
|
|
111
|
+
cachedDataViewMemory0 === null ||
|
|
112
|
+
cachedDataViewMemory0.buffer.detached === true ||
|
|
113
|
+
(cachedDataViewMemory0.buffer.detached === undefined &&
|
|
114
|
+
cachedDataViewMemory0.buffer !== wasm.memory.buffer)
|
|
115
|
+
) {
|
|
116
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
117
|
+
}
|
|
118
|
+
return cachedDataViewMemory0;
|
|
102
119
|
}
|
|
103
120
|
|
|
104
|
-
function
|
|
105
|
-
|
|
121
|
+
function dropObject(idx) {
|
|
122
|
+
if (idx < 132) return;
|
|
123
|
+
heap[idx] = heap_next;
|
|
124
|
+
heap_next = idx;
|
|
106
125
|
}
|
|
107
126
|
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
function takeObject(idx) {
|
|
128
|
+
const ret = getObject(idx);
|
|
129
|
+
dropObject(idx);
|
|
130
|
+
return ret;
|
|
112
131
|
}
|
|
113
132
|
|
|
114
133
|
function isLikeNone(x) {
|
|
115
|
-
|
|
134
|
+
return x === undefined || x === null;
|
|
116
135
|
}
|
|
117
136
|
/**
|
|
118
137
|
* Initialize the AgentShield WASM module
|
|
119
138
|
*/
|
|
120
139
|
export function init() {
|
|
121
|
-
|
|
140
|
+
wasm.init();
|
|
122
141
|
}
|
|
123
142
|
|
|
124
143
|
function _assertClass(instance, klass) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function takeFromExternrefTable0(idx) {
|
|
131
|
-
const value = wasm.__wbindgen_export_3.get(idx);
|
|
132
|
-
wasm.__externref_table_dealloc(idx);
|
|
133
|
-
return value;
|
|
144
|
+
if (!(instance instanceof klass)) {
|
|
145
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
146
|
+
}
|
|
134
147
|
}
|
|
135
148
|
/**
|
|
136
149
|
* Analyze a request and detect if it's from an agent
|
|
@@ -138,15 +151,20 @@ function takeFromExternrefTable0(idx) {
|
|
|
138
151
|
* @returns {JsDetectionResult}
|
|
139
152
|
*/
|
|
140
153
|
export function detect_agent(metadata) {
|
|
154
|
+
try {
|
|
155
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
141
156
|
_assertClass(metadata, JsRequestMetadata);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
return JsDetectionResult.__wrap(
|
|
157
|
+
wasm.detect_agent(retptr, metadata.__wbg_ptr);
|
|
158
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
159
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
160
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
161
|
+
if (r2) {
|
|
162
|
+
throw takeObject(r1);
|
|
163
|
+
}
|
|
164
|
+
return JsDetectionResult.__wrap(r0);
|
|
165
|
+
} finally {
|
|
166
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
167
|
+
}
|
|
150
168
|
}
|
|
151
169
|
|
|
152
170
|
/**
|
|
@@ -154,479 +172,571 @@ export function detect_agent(metadata) {
|
|
|
154
172
|
* @returns {string}
|
|
155
173
|
*/
|
|
156
174
|
export function version() {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
175
|
+
let deferred1_0;
|
|
176
|
+
let deferred1_1;
|
|
177
|
+
try {
|
|
178
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
179
|
+
wasm.get_version(retptr);
|
|
180
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
181
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
182
|
+
deferred1_0 = r0;
|
|
183
|
+
deferred1_1 = r1;
|
|
184
|
+
return getStringFromWasm0(r0, r1);
|
|
185
|
+
} finally {
|
|
186
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
187
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Get the version of the AgentShield library
|
|
193
|
+
* @returns {string}
|
|
194
|
+
*/
|
|
195
|
+
export function get_version() {
|
|
196
|
+
let deferred1_0;
|
|
197
|
+
let deferred1_1;
|
|
198
|
+
try {
|
|
199
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
200
|
+
wasm.get_version(retptr);
|
|
201
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
202
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
203
|
+
deferred1_0 = r0;
|
|
204
|
+
deferred1_1 = r1;
|
|
205
|
+
return getStringFromWasm0(r0, r1);
|
|
206
|
+
} finally {
|
|
207
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
208
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get build information
|
|
214
|
+
* @returns {string}
|
|
215
|
+
*/
|
|
216
|
+
export function get_build_info() {
|
|
217
|
+
let deferred1_0;
|
|
218
|
+
let deferred1_1;
|
|
219
|
+
try {
|
|
220
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
221
|
+
wasm.get_build_info(retptr);
|
|
222
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
223
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
224
|
+
deferred1_0 = r0;
|
|
225
|
+
deferred1_1 = r1;
|
|
226
|
+
return getStringFromWasm0(r0, r1);
|
|
227
|
+
} finally {
|
|
228
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
229
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
230
|
+
}
|
|
167
231
|
}
|
|
168
232
|
|
|
169
|
-
const JsDetectionResultFinalization =
|
|
233
|
+
const JsDetectionResultFinalization =
|
|
234
|
+
typeof FinalizationRegistry === 'undefined'
|
|
170
235
|
? { register: () => {}, unregister: () => {} }
|
|
171
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_jsdetectionresult_free(ptr >>> 0, 1));
|
|
236
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_jsdetectionresult_free(ptr >>> 0, 1));
|
|
172
237
|
/**
|
|
173
238
|
* JavaScript-compatible detection result
|
|
174
239
|
*/
|
|
175
240
|
export class JsDetectionResult {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
304
|
-
} finally {
|
|
305
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
306
|
-
}
|
|
241
|
+
static __wrap(ptr) {
|
|
242
|
+
ptr = ptr >>> 0;
|
|
243
|
+
const obj = Object.create(JsDetectionResult.prototype);
|
|
244
|
+
obj.__wbg_ptr = ptr;
|
|
245
|
+
JsDetectionResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
246
|
+
return obj;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
__destroy_into_raw() {
|
|
250
|
+
const ptr = this.__wbg_ptr;
|
|
251
|
+
this.__wbg_ptr = 0;
|
|
252
|
+
JsDetectionResultFinalization.unregister(this);
|
|
253
|
+
return ptr;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
free() {
|
|
257
|
+
const ptr = this.__destroy_into_raw();
|
|
258
|
+
wasm.__wbg_jsdetectionresult_free(ptr, 0);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Whether the request was identified as coming from an agent
|
|
262
|
+
* @returns {boolean}
|
|
263
|
+
*/
|
|
264
|
+
get is_agent() {
|
|
265
|
+
const ret = wasm.__wbg_get_jsdetectionresult_is_agent(this.__wbg_ptr);
|
|
266
|
+
return ret !== 0;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Whether the request was identified as coming from an agent
|
|
270
|
+
* @param {boolean} arg0
|
|
271
|
+
*/
|
|
272
|
+
set is_agent(arg0) {
|
|
273
|
+
wasm.__wbg_set_jsdetectionresult_is_agent(this.__wbg_ptr, arg0);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Confidence score (0-100 scale)
|
|
277
|
+
* @returns {number}
|
|
278
|
+
*/
|
|
279
|
+
get confidence() {
|
|
280
|
+
const ret = wasm.__wbg_get_jsdetectionresult_confidence(this.__wbg_ptr);
|
|
281
|
+
return ret;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Confidence score (0-100 scale)
|
|
285
|
+
* @param {number} arg0
|
|
286
|
+
*/
|
|
287
|
+
set confidence(arg0) {
|
|
288
|
+
wasm.__wbg_set_jsdetectionresult_confidence(this.__wbg_ptr, arg0);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get the detected agent name
|
|
292
|
+
* @returns {string | undefined}
|
|
293
|
+
*/
|
|
294
|
+
get agent() {
|
|
295
|
+
try {
|
|
296
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
297
|
+
wasm.jsdetectionresult_agent(retptr, this.__wbg_ptr);
|
|
298
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
299
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
300
|
+
let v1;
|
|
301
|
+
if (r0 !== 0) {
|
|
302
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
303
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
304
|
+
}
|
|
305
|
+
return v1;
|
|
306
|
+
} finally {
|
|
307
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Get the verification method as a string
|
|
312
|
+
* @returns {string}
|
|
313
|
+
*/
|
|
314
|
+
get verification_method() {
|
|
315
|
+
let deferred1_0;
|
|
316
|
+
let deferred1_1;
|
|
317
|
+
try {
|
|
318
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
319
|
+
wasm.jsdetectionresult_verification_method(retptr, this.__wbg_ptr);
|
|
320
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
321
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
322
|
+
deferred1_0 = r0;
|
|
323
|
+
deferred1_1 = r1;
|
|
324
|
+
return getStringFromWasm0(r0, r1);
|
|
325
|
+
} finally {
|
|
326
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
327
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Get the risk level as a string
|
|
332
|
+
* @returns {string}
|
|
333
|
+
*/
|
|
334
|
+
get risk_level() {
|
|
335
|
+
let deferred1_0;
|
|
336
|
+
let deferred1_1;
|
|
337
|
+
try {
|
|
338
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
339
|
+
wasm.jsdetectionresult_risk_level(retptr, this.__wbg_ptr);
|
|
340
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
341
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
342
|
+
deferred1_0 = r0;
|
|
343
|
+
deferred1_1 = r1;
|
|
344
|
+
return getStringFromWasm0(r0, r1);
|
|
345
|
+
} finally {
|
|
346
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
347
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Get the timestamp as a string
|
|
352
|
+
* @returns {string}
|
|
353
|
+
*/
|
|
354
|
+
get timestamp() {
|
|
355
|
+
let deferred1_0;
|
|
356
|
+
let deferred1_1;
|
|
357
|
+
try {
|
|
358
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
359
|
+
wasm.jsdetectionresult_timestamp(retptr, this.__wbg_ptr);
|
|
360
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
361
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
362
|
+
deferred1_0 = r0;
|
|
363
|
+
deferred1_1 = r1;
|
|
364
|
+
return getStringFromWasm0(r0, r1);
|
|
365
|
+
} finally {
|
|
366
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
367
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
307
368
|
}
|
|
369
|
+
}
|
|
308
370
|
}
|
|
371
|
+
if (Symbol.dispose) JsDetectionResult.prototype[Symbol.dispose] = JsDetectionResult.prototype.free;
|
|
309
372
|
|
|
310
|
-
const JsRequestMetadataFinalization =
|
|
373
|
+
const JsRequestMetadataFinalization =
|
|
374
|
+
typeof FinalizationRegistry === 'undefined'
|
|
311
375
|
? { register: () => {}, unregister: () => {} }
|
|
312
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_jsrequestmetadata_free(ptr >>> 0, 1));
|
|
376
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_jsrequestmetadata_free(ptr >>> 0, 1));
|
|
313
377
|
/**
|
|
314
378
|
* JavaScript-compatible request metadata
|
|
315
379
|
*/
|
|
316
380
|
export class JsRequestMetadata {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
381
|
+
__destroy_into_raw() {
|
|
382
|
+
const ptr = this.__wbg_ptr;
|
|
383
|
+
this.__wbg_ptr = 0;
|
|
384
|
+
JsRequestMetadataFinalization.unregister(this);
|
|
385
|
+
return ptr;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
free() {
|
|
389
|
+
const ptr = this.__destroy_into_raw();
|
|
390
|
+
wasm.__wbg_jsrequestmetadata_free(ptr, 0);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Constructor for JsRequestMetadata
|
|
394
|
+
* @param {string | null | undefined} user_agent
|
|
395
|
+
* @param {string | null | undefined} ip_address
|
|
396
|
+
* @param {string} headers
|
|
397
|
+
* @param {string} timestamp
|
|
398
|
+
* @param {string | null} [url]
|
|
399
|
+
* @param {string | null} [method]
|
|
400
|
+
* @param {string | null} [client_fingerprint]
|
|
401
|
+
*/
|
|
402
|
+
constructor(user_agent, ip_address, headers, timestamp, url, method, client_fingerprint) {
|
|
403
|
+
var ptr0 = isLikeNone(user_agent)
|
|
404
|
+
? 0
|
|
405
|
+
: passStringToWasm0(user_agent, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
406
|
+
var len0 = WASM_VECTOR_LEN;
|
|
407
|
+
var ptr1 = isLikeNone(ip_address)
|
|
408
|
+
? 0
|
|
409
|
+
: passStringToWasm0(ip_address, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
410
|
+
var len1 = WASM_VECTOR_LEN;
|
|
411
|
+
const ptr2 = passStringToWasm0(headers, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
412
|
+
const len2 = WASM_VECTOR_LEN;
|
|
413
|
+
const ptr3 = passStringToWasm0(timestamp, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
414
|
+
const len3 = WASM_VECTOR_LEN;
|
|
415
|
+
var ptr4 = isLikeNone(url)
|
|
416
|
+
? 0
|
|
417
|
+
: passStringToWasm0(url, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
418
|
+
var len4 = WASM_VECTOR_LEN;
|
|
419
|
+
var ptr5 = isLikeNone(method)
|
|
420
|
+
? 0
|
|
421
|
+
: passStringToWasm0(method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
422
|
+
var len5 = WASM_VECTOR_LEN;
|
|
423
|
+
var ptr6 = isLikeNone(client_fingerprint)
|
|
424
|
+
? 0
|
|
425
|
+
: passStringToWasm0(client_fingerprint, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
426
|
+
var len6 = WASM_VECTOR_LEN;
|
|
427
|
+
const ret = wasm.jsrequestmetadata_new(
|
|
428
|
+
ptr0,
|
|
429
|
+
len0,
|
|
430
|
+
ptr1,
|
|
431
|
+
len1,
|
|
432
|
+
ptr2,
|
|
433
|
+
len2,
|
|
434
|
+
ptr3,
|
|
435
|
+
len3,
|
|
436
|
+
ptr4,
|
|
437
|
+
len4,
|
|
438
|
+
ptr5,
|
|
439
|
+
len5,
|
|
440
|
+
ptr6,
|
|
441
|
+
len6
|
|
442
|
+
);
|
|
443
|
+
this.__wbg_ptr = ret >>> 0;
|
|
444
|
+
JsRequestMetadataFinalization.register(this, this.__wbg_ptr, this);
|
|
445
|
+
return this;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Get the user agent
|
|
449
|
+
* @returns {string | undefined}
|
|
450
|
+
*/
|
|
451
|
+
get user_agent() {
|
|
452
|
+
try {
|
|
453
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
454
|
+
wasm.jsrequestmetadata_user_agent(retptr, this.__wbg_ptr);
|
|
455
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
456
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
457
|
+
let v1;
|
|
458
|
+
if (r0 !== 0) {
|
|
459
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
460
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
461
|
+
}
|
|
462
|
+
return v1;
|
|
463
|
+
} finally {
|
|
464
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Get the IP address
|
|
469
|
+
* @returns {string | undefined}
|
|
470
|
+
*/
|
|
471
|
+
get ip_address() {
|
|
472
|
+
try {
|
|
473
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
474
|
+
wasm.jsrequestmetadata_ip_address(retptr, this.__wbg_ptr);
|
|
475
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
476
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
477
|
+
let v1;
|
|
478
|
+
if (r0 !== 0) {
|
|
479
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
480
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
481
|
+
}
|
|
482
|
+
return v1;
|
|
483
|
+
} finally {
|
|
484
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Get the headers as JSON string
|
|
489
|
+
* @returns {string}
|
|
490
|
+
*/
|
|
491
|
+
get headers() {
|
|
492
|
+
let deferred1_0;
|
|
493
|
+
let deferred1_1;
|
|
494
|
+
try {
|
|
495
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
496
|
+
wasm.jsrequestmetadata_headers(retptr, this.__wbg_ptr);
|
|
497
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
498
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
499
|
+
deferred1_0 = r0;
|
|
500
|
+
deferred1_1 = r1;
|
|
501
|
+
return getStringFromWasm0(r0, r1);
|
|
502
|
+
} finally {
|
|
503
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
504
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Get the timestamp
|
|
509
|
+
* @returns {string}
|
|
510
|
+
*/
|
|
511
|
+
get timestamp() {
|
|
512
|
+
let deferred1_0;
|
|
513
|
+
let deferred1_1;
|
|
514
|
+
try {
|
|
515
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
516
|
+
wasm.jsrequestmetadata_timestamp(retptr, this.__wbg_ptr);
|
|
517
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
518
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
519
|
+
deferred1_0 = r0;
|
|
520
|
+
deferred1_1 = r1;
|
|
521
|
+
return getStringFromWasm0(r0, r1);
|
|
522
|
+
} finally {
|
|
523
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
524
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Get the URL
|
|
529
|
+
* @returns {string | undefined}
|
|
530
|
+
*/
|
|
531
|
+
get url() {
|
|
532
|
+
try {
|
|
533
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
534
|
+
wasm.jsrequestmetadata_url(retptr, this.__wbg_ptr);
|
|
535
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
536
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
537
|
+
let v1;
|
|
538
|
+
if (r0 !== 0) {
|
|
539
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
540
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
541
|
+
}
|
|
542
|
+
return v1;
|
|
543
|
+
} finally {
|
|
544
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Get the method
|
|
549
|
+
* @returns {string | undefined}
|
|
550
|
+
*/
|
|
551
|
+
get method() {
|
|
552
|
+
try {
|
|
553
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
554
|
+
wasm.jsrequestmetadata_method(retptr, this.__wbg_ptr);
|
|
555
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
556
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
557
|
+
let v1;
|
|
558
|
+
if (r0 !== 0) {
|
|
559
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
560
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
561
|
+
}
|
|
562
|
+
return v1;
|
|
563
|
+
} finally {
|
|
564
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Get the client fingerprint
|
|
569
|
+
* @returns {string | undefined}
|
|
570
|
+
*/
|
|
571
|
+
get client_fingerprint() {
|
|
572
|
+
try {
|
|
573
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
574
|
+
wasm.jsrequestmetadata_client_fingerprint(retptr, this.__wbg_ptr);
|
|
575
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
576
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
577
|
+
let v1;
|
|
578
|
+
if (r0 !== 0) {
|
|
579
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
580
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
581
|
+
}
|
|
582
|
+
return v1;
|
|
583
|
+
} finally {
|
|
584
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
469
585
|
}
|
|
586
|
+
}
|
|
470
587
|
}
|
|
588
|
+
if (Symbol.dispose) JsRequestMetadata.prototype[Symbol.dispose] = JsRequestMetadata.prototype.free;
|
|
589
|
+
|
|
590
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
471
591
|
|
|
472
592
|
async function __wbg_load(module, imports) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
593
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
594
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
595
|
+
try {
|
|
596
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
597
|
+
} catch (e) {
|
|
598
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
599
|
+
|
|
600
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
601
|
+
console.warn(
|
|
602
|
+
'`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',
|
|
603
|
+
e
|
|
604
|
+
);
|
|
605
|
+
} else {
|
|
606
|
+
throw e;
|
|
486
607
|
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
487
610
|
|
|
488
|
-
|
|
489
|
-
|
|
611
|
+
const bytes = await module.arrayBuffer();
|
|
612
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
613
|
+
} else {
|
|
614
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
490
615
|
|
|
616
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
617
|
+
return { instance, module };
|
|
491
618
|
} else {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
495
|
-
return { instance, module };
|
|
496
|
-
|
|
497
|
-
} else {
|
|
498
|
-
return instance;
|
|
499
|
-
}
|
|
619
|
+
return instance;
|
|
500
620
|
}
|
|
621
|
+
}
|
|
501
622
|
}
|
|
502
623
|
|
|
503
624
|
function __wbg_get_imports() {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
};
|
|
557
|
-
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
558
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
return imports;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
function __wbg_init_memory(imports, memory) {
|
|
565
|
-
|
|
625
|
+
const imports = {};
|
|
626
|
+
imports.wbg = {};
|
|
627
|
+
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function (arg0, arg1) {
|
|
628
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
629
|
+
};
|
|
630
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {
|
|
631
|
+
let deferred0_0;
|
|
632
|
+
let deferred0_1;
|
|
633
|
+
try {
|
|
634
|
+
deferred0_0 = arg0;
|
|
635
|
+
deferred0_1 = arg1;
|
|
636
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
637
|
+
} finally {
|
|
638
|
+
wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
imports.wbg.__wbg_getTime_14776bfb48a1bff9 = function (arg0) {
|
|
642
|
+
const ret = getObject(arg0).getTime();
|
|
643
|
+
return ret;
|
|
644
|
+
};
|
|
645
|
+
imports.wbg.__wbg_log_8cec76766b8c0e33 = function (arg0) {
|
|
646
|
+
console.log(getObject(arg0));
|
|
647
|
+
};
|
|
648
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function () {
|
|
649
|
+
const ret = new Error();
|
|
650
|
+
return addHeapObject(ret);
|
|
651
|
+
};
|
|
652
|
+
imports.wbg.__wbg_new_93d9417ed3fb115d = function (arg0) {
|
|
653
|
+
const ret = new Date(getObject(arg0));
|
|
654
|
+
return addHeapObject(ret);
|
|
655
|
+
};
|
|
656
|
+
imports.wbg.__wbg_now_793306c526e2e3b6 = function () {
|
|
657
|
+
const ret = Date.now();
|
|
658
|
+
return ret;
|
|
659
|
+
};
|
|
660
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {
|
|
661
|
+
const ret = getObject(arg1).stack;
|
|
662
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
663
|
+
const len1 = WASM_VECTOR_LEN;
|
|
664
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
665
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
666
|
+
};
|
|
667
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
668
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
669
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
670
|
+
return addHeapObject(ret);
|
|
671
|
+
};
|
|
672
|
+
imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
|
|
673
|
+
takeObject(arg0);
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
return imports;
|
|
566
677
|
}
|
|
567
678
|
|
|
568
679
|
function __wbg_finalize_init(instance, module) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
680
|
+
wasm = instance.exports;
|
|
681
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
682
|
+
cachedDataViewMemory0 = null;
|
|
683
|
+
cachedUint8ArrayMemory0 = null;
|
|
574
684
|
|
|
575
|
-
|
|
576
|
-
|
|
685
|
+
wasm.__wbindgen_start();
|
|
686
|
+
return wasm;
|
|
577
687
|
}
|
|
578
688
|
|
|
579
689
|
function initSync(module) {
|
|
580
|
-
|
|
690
|
+
if (wasm !== undefined) return wasm;
|
|
581
691
|
|
|
582
|
-
|
|
583
|
-
if (
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
588
|
-
}
|
|
692
|
+
if (typeof module !== 'undefined') {
|
|
693
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
694
|
+
({ module } = module);
|
|
695
|
+
} else {
|
|
696
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
|
|
589
697
|
}
|
|
698
|
+
}
|
|
590
699
|
|
|
591
|
-
|
|
700
|
+
const imports = __wbg_get_imports();
|
|
592
701
|
|
|
593
|
-
|
|
702
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
703
|
+
module = new WebAssembly.Module(module);
|
|
704
|
+
}
|
|
594
705
|
|
|
595
|
-
|
|
596
|
-
module = new WebAssembly.Module(module);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
706
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
600
707
|
|
|
601
|
-
|
|
708
|
+
return __wbg_finalize_init(instance, module);
|
|
602
709
|
}
|
|
603
710
|
|
|
604
711
|
async function __wbg_init(module_or_path) {
|
|
605
|
-
|
|
606
|
-
|
|
712
|
+
if (wasm !== undefined) return wasm;
|
|
607
713
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
if (typeof module_or_path === 'undefined') {
|
|
617
|
-
module_or_path = new URL('agentshield_wasm_bg.wasm', import.meta.url);
|
|
714
|
+
if (typeof module_or_path !== 'undefined') {
|
|
715
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
716
|
+
({ module_or_path } = module_or_path);
|
|
717
|
+
} else {
|
|
718
|
+
console.warn(
|
|
719
|
+
'using deprecated parameters for the initialization function; pass a single object instead'
|
|
720
|
+
);
|
|
618
721
|
}
|
|
619
|
-
|
|
722
|
+
}
|
|
620
723
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
724
|
+
if (typeof module_or_path === 'undefined') {
|
|
725
|
+
module_or_path = new URL('agentshield_wasm_bg.wasm', import.meta.url);
|
|
726
|
+
}
|
|
727
|
+
const imports = __wbg_get_imports();
|
|
624
728
|
|
|
625
|
-
|
|
729
|
+
if (
|
|
730
|
+
typeof module_or_path === 'string' ||
|
|
731
|
+
(typeof Request === 'function' && module_or_path instanceof Request) ||
|
|
732
|
+
(typeof URL === 'function' && module_or_path instanceof URL)
|
|
733
|
+
) {
|
|
734
|
+
module_or_path = fetch(module_or_path);
|
|
735
|
+
}
|
|
626
736
|
|
|
627
|
-
|
|
737
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
628
738
|
|
|
629
|
-
|
|
739
|
+
return __wbg_finalize_init(instance, module);
|
|
630
740
|
}
|
|
631
741
|
|
|
632
742
|
export { initSync };
|