@aopslabs/aops-server 0.2.9 → 0.2.11

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.
Files changed (69) hide show
  1. package/THIRD_PARTY_NOTICES +110 -35
  2. package/THIRD_PARTY_NOTICES.inventory.json +41 -25
  3. package/build/client/_app/immutable/chunks/C5WqdkdM.js +1 -0
  4. package/build/client/_app/immutable/entry/{app.A3JdvVfL.js → app.RfBghRbl.js} +2 -2
  5. package/build/client/_app/immutable/entry/start.DeqJycy8.js +1 -0
  6. package/build/client/_app/immutable/nodes/{1.DjNWgxeg.js → 1.dRPl3Pbi.js} +1 -1
  7. package/build/client/_app/version.json +1 -1
  8. package/build/handler.js +10 -3
  9. package/build/index.js +10 -3
  10. package/build/server/chunks/{agent-gateway-runtime-DV-xLmJx.js → chunks/agent-gateway-runtime.js-ftdwqFXq.js} +2 -2
  11. package/build/server/chunks/{discovery-DL0RzVks.js → chunks/discovery.js-CVLocQvp.js} +3 -3
  12. package/build/server/chunks/chunks/exports.js-BoBrqMaZ.js +215 -0
  13. package/build/server/chunks/chunks/internal.js-CQ9L-Epg.js +126 -0
  14. package/build/server/chunks/chunks/json-request-body.js-ewKk-XAX.js +18 -0
  15. package/build/server/chunks/{registry-DIreA2IZ.js → chunks/registry.js-U3x77b7r.js} +53 -11
  16. package/build/server/chunks/{request-context-9wzBoKrz.js → chunks/request-context.js-Y9Hk40z6.js} +3 -3
  17. package/build/server/chunks/chunks/root.js-Di8SnzYO.js +4187 -0
  18. package/build/server/chunks/chunks/server.js-Bf8x1V_n.js +15 -0
  19. package/build/server/chunks/chunks/uneval.js-BnYgIxRU.js +521 -0
  20. package/build/server/chunks/chunks/utils.js-DjaWGEhn.js +1623 -0
  21. package/build/server/chunks/chunks/utils2.js-BQzn9ikS.js +37 -0
  22. package/build/server/chunks/{_server.ts-DDE7Qj9s.js → entries/endpoints/api/_domain_/_...path_/_server.ts.js-ujk9Lc9B.js} +9 -7
  23. package/build/server/chunks/{_server.ts-DX-_KeHW.js → entries/endpoints/api/_server.ts.js-sSJl5nE9.js} +3 -1
  24. package/build/server/chunks/{_server.ts-BjeSh_9L.js → entries/endpoints/api/agent/discovery.json/_server.ts.js-eYRl3j62.js} +11 -9
  25. package/build/server/chunks/{_server.ts-BlqHo41R.js → entries/endpoints/api/agent/openapi.json/_server.ts.js-BfttnM60.js} +10 -8
  26. package/build/server/chunks/{_server.ts-CEZb0qQM.js → entries/endpoints/api/agent/tools/_server.ts.js-DtF6u5j-.js} +11 -9
  27. package/build/server/chunks/{_server.ts-Boj-nSfz.js → entries/endpoints/api/agent/tools/_toolId_/_server.ts.js-D4_OCEFF.js} +11 -9
  28. package/build/server/chunks/{_server.ts-D9NPnh7b.js → entries/endpoints/api/agent/tools/_toolId_/invoke/_server.ts.js-DLRXs4Li.js} +22 -20
  29. package/build/server/chunks/{_server.ts-DWGAAi-W.js → entries/endpoints/api/aops/docman/flows/_server.ts.js-6aWYpXk6.js} +12 -13
  30. package/build/server/chunks/{_server.ts-Daul6O6T.js → entries/endpoints/api/aops/projectman/flows/_server.ts.js-D_-6ferA.js} +12 -13
  31. package/build/server/chunks/{_server.ts-s5Rfq1_a.js → entries/endpoints/api/aops/settings/database/status/_server.ts.js-Owz6c-s3.js} +5 -3
  32. package/build/server/chunks/{_server.ts-Bnc8VoZt.js → entries/endpoints/api/auth/me/_server.ts.js-CSjwLMYe.js} +4 -2
  33. package/build/server/chunks/{_server.ts-QAR2kInF.js → entries/endpoints/api/health/_server.ts.js-CqZW_cm6.js} +6 -4
  34. package/build/server/chunks/entries/endpoints/api/hello/_server.ts.js-CF4gShRZ.js +11 -0
  35. package/build/server/chunks/{_server.ts-DSvQTrqh.js → entries/endpoints/api/host-admin/plugins/_server.ts.js-BJBnC_mP.js} +8 -6
  36. package/build/server/chunks/entries/endpoints/api/host-admin/runtime-config/_server.ts.js-BbVXEK2o.js +12 -0
  37. package/build/server/chunks/{_server.ts-DLm7WPPZ.js → entries/endpoints/api/host-admin/runtime-config/test/_server.ts.js-4KY0tKLf.js} +5 -3
  38. package/build/server/chunks/{_server.ts-BdY2JsaQ.js → entries/endpoints/api-info.json/_server.ts.js-DklaS6fp.js} +11 -9
  39. package/build/server/chunks/{_server.ts-BiaO5iJe.js → entries/endpoints/openapi.json/_server.ts.js-ixf1Z8a2.js} +10 -8
  40. package/build/server/chunks/{error.svelte-C3C2fP5p.js → entries/fallbacks/error.svelte.js-D7yKTuER.js} +5 -1
  41. package/build/server/chunks/{hooks.server-QpuxZ7sx.js → entries/hooks.server.js-0eTKxvgl.js} +4 -2
  42. package/build/server/chunks/{handler-BohKk247.js → handler-CejpfyJh.js} +3 -2
  43. package/build/server/chunks/index.js-CBv9Rsqj.js +4103 -0
  44. package/build/server/chunks/{manifest.js-CfVEzEmC.js → manifest.js-Bl7KqFbu.js} +24 -24
  45. package/build/server/chunks/{1-BJzlk8ku.js → nodes/1.js-BMByn53B.js} +2 -2
  46. package/npm-shrinkwrap.json +56 -50
  47. package/package.json +12 -12
  48. package/runtime/agentspace-host-adapter.mjs +19 -5
  49. package/runtime/agentspace-tooling.mjs +39 -25
  50. package/runtime/docman-host-adapter.mjs +33 -3
  51. package/runtime/docman-policy.mjs +5 -1
  52. package/runtime/manifest-policy.mjs +62 -0
  53. package/runtime-closure.package.json +22 -20
  54. package/build/client/_app/immutable/chunks/BYPZX9Wo.js +0 -1
  55. package/build/client/_app/immutable/entry/start.CiIm7sOm.js +0 -1
  56. package/build/server/chunks/_server.ts-NZjOV9Ec.js +0 -10
  57. package/build/server/chunks/_server.ts-iQyRIpt-.js +0 -9
  58. package/build/server/chunks/index.js-B0n9KWWU.js +0 -10803
  59. /package/build/server/chunks/{aops-runtime-config-CHpDUCdE.js → chunks/aops-runtime-config.js-CHpDUCdE.js} +0 -0
  60. /package/build/server/chunks/{auth-provider-C07OUlnz.js → chunks/auth-provider.js-C07OUlnz.js} +0 -0
  61. /package/build/server/chunks/{commercial-admission-loader-ZGZHRPLe.js → chunks/commercial-admission-loader.js-ZGZHRPLe.js} +0 -0
  62. /package/build/server/chunks/{plugin-error-normalize-DNeRsopQ.js → chunks/plugin-error-normalize.js-DNeRsopQ.js} +0 -0
  63. /package/build/server/chunks/{project-alias-BdnRxWft.js → chunks/project-alias.js-BdnRxWft.js} +0 -0
  64. /package/build/server/chunks/{request-base-url-zKJpVUv5.js → chunks/request-base-url.js-zKJpVUv5.js} +0 -0
  65. /package/build/server/chunks/{xf-result-BRDjvftr.js → chunks/xf-result.js-BRDjvftr.js} +0 -0
  66. /package/build/server/chunks/{_server.ts-Bly8fCZa.js → entries/endpoints/_server.ts.js-Bly8fCZa.js} +0 -0
  67. /package/build/server/chunks/{_server.ts-DbdAfdYo.js → entries/endpoints/api/chatv3/v1/rooms/_roomId_/stream/_server.ts.js-DbdAfdYo.js} +0 -0
  68. /package/build/server/chunks/{_server.ts-Cv-yaXZI.js → entries/endpoints/api-info/_server.ts.js-Cv-yaXZI.js} +0 -0
  69. /package/build/server/chunks/{0-RfB6m2nq.js → nodes/0.js-RfB6m2nq.js} +0 -0
@@ -0,0 +1,15 @@
1
+ let base = "";
2
+ let assets = base;
3
+ const app_dir = "_app";
4
+ const relative = true;
5
+ const initial = { base, assets };
6
+ function override(paths) {
7
+ base = paths.base;
8
+ assets = paths.assets;
9
+ }
10
+ function reset() {
11
+ base = initial.base;
12
+ assets = initial.assets;
13
+ }
14
+
15
+ export { app_dir as a, base as b, assets as c, reset as d, override as o, relative as r };
@@ -0,0 +1,521 @@
1
+ const UNDEFINED = -1;
2
+ const HOLE = -2;
3
+ const NAN = -3;
4
+ const POSITIVE_INFINITY = -4;
5
+ const NEGATIVE_INFINITY = -5;
6
+ const NEGATIVE_ZERO = -6;
7
+ const SPARSE = -7;
8
+ const MAX_ARRAY_LEN = 2 ** 32 - 1;
9
+ const MAX_ARRAY_INDEX = MAX_ARRAY_LEN - 1;
10
+ const escaped = {
11
+ "<": "\\u003C",
12
+ "\\": "\\\\",
13
+ "\b": "\\b",
14
+ "\f": "\\f",
15
+ "\n": "\\n",
16
+ "\r": "\\r",
17
+ " ": "\\t",
18
+ "\u2028": "\\u2028",
19
+ "\u2029": "\\u2029"
20
+ };
21
+ class DevalueError extends Error {
22
+ /**
23
+ * @param {string} message
24
+ * @param {string[]} keys
25
+ * @param {any} [value] - The value that failed to be serialized
26
+ * @param {any} [root] - The root value being serialized
27
+ */
28
+ constructor(message, keys, value, root) {
29
+ super(message);
30
+ this.name = "DevalueError";
31
+ this.path = keys.join("");
32
+ this.value = value;
33
+ this.root = root;
34
+ }
35
+ }
36
+ function is_primitive(thing) {
37
+ return thing === null || typeof thing !== "object" && typeof thing !== "function";
38
+ }
39
+ const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
40
+ function is_plain_object(thing) {
41
+ const proto = Object.getPrototypeOf(thing);
42
+ return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
43
+ }
44
+ function get_type(thing) {
45
+ return Object.prototype.toString.call(thing).slice(8, -1);
46
+ }
47
+ function get_escaped_char(char) {
48
+ switch (char) {
49
+ case '"':
50
+ return '\\"';
51
+ case "<":
52
+ return "\\u003C";
53
+ case "\\":
54
+ return "\\\\";
55
+ case "\n":
56
+ return "\\n";
57
+ case "\r":
58
+ return "\\r";
59
+ case " ":
60
+ return "\\t";
61
+ case "\b":
62
+ return "\\b";
63
+ case "\f":
64
+ return "\\f";
65
+ case "\u2028":
66
+ return "\\u2028";
67
+ case "\u2029":
68
+ return "\\u2029";
69
+ default:
70
+ return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
71
+ }
72
+ }
73
+ function stringify_string(str) {
74
+ let result = "";
75
+ let last_pos = 0;
76
+ const len = str.length;
77
+ for (let i = 0; i < len; i += 1) {
78
+ const char = str[i];
79
+ const replacement = get_escaped_char(char);
80
+ if (replacement) {
81
+ result += str.slice(last_pos, i) + replacement;
82
+ last_pos = i + 1;
83
+ }
84
+ }
85
+ return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
86
+ }
87
+ function enumerable_symbols(object) {
88
+ return Object.getOwnPropertySymbols(object).filter(
89
+ (symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable
90
+ );
91
+ }
92
+ const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
93
+ function stringify_key(key) {
94
+ return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
95
+ }
96
+ function is_valid_array_index(n) {
97
+ if (!Number.isInteger(n)) return false;
98
+ if (n < 0) return false;
99
+ if (n > MAX_ARRAY_INDEX) return false;
100
+ return true;
101
+ }
102
+ function is_valid_array_len(n) {
103
+ if (!Number.isInteger(n)) return false;
104
+ if (n < 0) return false;
105
+ if (n > MAX_ARRAY_LEN) return false;
106
+ return true;
107
+ }
108
+ function is_valid_array_index_string(s) {
109
+ if (s.length === 0) return false;
110
+ if (s.length > 1 && s.charCodeAt(0) === 48) return false;
111
+ for (let i = 0; i < s.length; i++) {
112
+ const c = s.charCodeAt(i);
113
+ if (c < 48 || c > 57) return false;
114
+ }
115
+ return is_valid_array_index(+s);
116
+ }
117
+ function array_index_cut(keys) {
118
+ for (var i = keys.length - 1; i >= 0; i--) {
119
+ if (is_valid_array_index_string(keys[i])) {
120
+ break;
121
+ }
122
+ }
123
+ return i + 1;
124
+ }
125
+ function valid_array_indices(array) {
126
+ const keys = Object.keys(array);
127
+ keys.length = array_index_cut(keys);
128
+ return keys;
129
+ }
130
+ const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$";
131
+ const unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g;
132
+ const reserved = /^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;
133
+ function uneval(value, replacer) {
134
+ const counts = /* @__PURE__ */ new Map();
135
+ const keys = [];
136
+ const custom = /* @__PURE__ */ new Map();
137
+ function walk(thing) {
138
+ if (!is_primitive(thing)) {
139
+ if (counts.has(thing)) {
140
+ counts.set(thing, counts.get(thing) + 1);
141
+ return;
142
+ }
143
+ counts.set(thing, 1);
144
+ if (replacer) {
145
+ const str2 = replacer(thing, (value2) => uneval(value2, replacer));
146
+ if (typeof str2 === "string") {
147
+ custom.set(thing, str2);
148
+ return;
149
+ }
150
+ }
151
+ if (typeof thing === "function") {
152
+ throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
153
+ }
154
+ const type = get_type(thing);
155
+ switch (type) {
156
+ case "Number":
157
+ case "BigInt":
158
+ case "String":
159
+ case "Boolean":
160
+ case "Date":
161
+ case "RegExp":
162
+ case "URL":
163
+ case "URLSearchParams":
164
+ return;
165
+ case "Array":
166
+ thing.forEach((value2, i) => {
167
+ keys.push(`[${i}]`);
168
+ walk(value2);
169
+ keys.pop();
170
+ });
171
+ break;
172
+ case "Set":
173
+ Array.from(thing).forEach(walk);
174
+ break;
175
+ case "Map":
176
+ for (const [key, value2] of thing) {
177
+ keys.push(`.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`);
178
+ walk(key);
179
+ walk(value2);
180
+ keys.pop();
181
+ }
182
+ break;
183
+ case "Int8Array":
184
+ case "Uint8Array":
185
+ case "Uint8ClampedArray":
186
+ case "Int16Array":
187
+ case "Uint16Array":
188
+ case "Float16Array":
189
+ case "Int32Array":
190
+ case "Uint32Array":
191
+ case "Float32Array":
192
+ case "Float64Array":
193
+ case "BigInt64Array":
194
+ case "BigUint64Array":
195
+ case "DataView":
196
+ walk(thing.buffer);
197
+ return;
198
+ case "ArrayBuffer":
199
+ return;
200
+ case "Temporal.Duration":
201
+ case "Temporal.Instant":
202
+ case "Temporal.PlainDate":
203
+ case "Temporal.PlainTime":
204
+ case "Temporal.PlainDateTime":
205
+ case "Temporal.PlainMonthDay":
206
+ case "Temporal.PlainYearMonth":
207
+ case "Temporal.ZonedDateTime":
208
+ return;
209
+ default:
210
+ if (!is_plain_object(thing)) {
211
+ throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
212
+ }
213
+ if (enumerable_symbols(thing).length > 0) {
214
+ throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
215
+ }
216
+ for (const key of Object.keys(thing)) {
217
+ if (key === "__proto__") {
218
+ throw new DevalueError(
219
+ `Cannot stringify objects with __proto__ keys`,
220
+ keys,
221
+ thing,
222
+ value
223
+ );
224
+ }
225
+ keys.push(stringify_key(key));
226
+ walk(thing[key]);
227
+ keys.pop();
228
+ }
229
+ }
230
+ } else if (typeof thing === "symbol") {
231
+ throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
232
+ }
233
+ }
234
+ walk(value);
235
+ const names = /* @__PURE__ */ new Map();
236
+ Array.from(counts).filter((entry) => entry[1] > 1).sort((a, b) => b[1] - a[1]).forEach((entry, i) => {
237
+ names.set(entry[0], get_name(i));
238
+ });
239
+ function stringify(thing) {
240
+ if (names.has(thing)) {
241
+ return names.get(thing);
242
+ }
243
+ if (is_primitive(thing)) {
244
+ return stringify_primitive(thing);
245
+ }
246
+ if (custom.has(thing)) {
247
+ return custom.get(thing);
248
+ }
249
+ const type = get_type(thing);
250
+ switch (type) {
251
+ case "Number":
252
+ case "String":
253
+ case "Boolean":
254
+ case "BigInt":
255
+ return `Object(${stringify(thing.valueOf())})`;
256
+ case "RegExp":
257
+ const { source, flags } = thing;
258
+ return flags ? `new RegExp(${stringify_string(source)},"${flags}")` : `new RegExp(${stringify_string(source)})`;
259
+ case "Date":
260
+ return `new Date(${thing.getTime()})`;
261
+ case "URL":
262
+ return `new URL(${stringify_string(thing.toString())})`;
263
+ case "URLSearchParams":
264
+ return `new URLSearchParams(${stringify_string(thing.toString())})`;
265
+ case "Array": {
266
+ let has_holes = false;
267
+ let result = "[";
268
+ for (let i = 0; i < thing.length; i += 1) {
269
+ if (i > 0) result += ",";
270
+ if (Object.hasOwn(thing, i)) {
271
+ result += stringify(thing[i]);
272
+ } else if (!has_holes) {
273
+ const populated_keys = valid_array_indices(
274
+ /** @type {any[]} */
275
+ thing
276
+ );
277
+ const population = populated_keys.length;
278
+ const d = String(thing.length).length;
279
+ const hole_cost = thing.length + 2;
280
+ const sparse_cost = 25 + d + population * (d + 2);
281
+ if (hole_cost > sparse_cost) {
282
+ const entries = populated_keys.map((k) => `${k}:${stringify(thing[k])}`).join(",");
283
+ return `Object.assign(Array(${thing.length}),{${entries}})`;
284
+ }
285
+ has_holes = true;
286
+ }
287
+ }
288
+ const tail = thing.length === 0 || thing.length - 1 in thing ? "" : ",";
289
+ return result + tail + "]";
290
+ }
291
+ case "Set":
292
+ case "Map":
293
+ return `new ${type}([${Array.from(thing).map(stringify).join(",")}])`;
294
+ case "Int8Array":
295
+ case "Uint8Array":
296
+ case "Uint8ClampedArray":
297
+ case "Int16Array":
298
+ case "Uint16Array":
299
+ case "Float16Array":
300
+ case "Int32Array":
301
+ case "Uint32Array":
302
+ case "Float32Array":
303
+ case "Float64Array":
304
+ case "BigInt64Array":
305
+ case "BigUint64Array": {
306
+ let str2 = `new ${type}`;
307
+ if (!names.has(thing.buffer)) {
308
+ str2 += `([${stringify_typed_array_elements(new thing.constructor(thing.buffer))}])`;
309
+ } else {
310
+ str2 += `(${stringify(thing.buffer)})`;
311
+ }
312
+ if (thing.byteLength !== thing.buffer.byteLength) {
313
+ const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
314
+ const end = start + thing.length;
315
+ str2 += `.subarray(${start},${end})`;
316
+ }
317
+ return str2;
318
+ }
319
+ case "DataView": {
320
+ let str2 = `new DataView`;
321
+ if (!names.has(thing.buffer)) {
322
+ str2 += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
323
+ } else {
324
+ str2 += `(${stringify(thing.buffer)}`;
325
+ }
326
+ if (thing.byteLength !== thing.buffer.byteLength) {
327
+ str2 += `,${thing.byteOffset},${thing.byteLength}`;
328
+ }
329
+ return str2 + ")";
330
+ }
331
+ case "ArrayBuffer": {
332
+ const ui8 = new Uint8Array(thing);
333
+ return `new Uint8Array([${ui8.toString()}]).buffer`;
334
+ }
335
+ case "Temporal.Duration":
336
+ case "Temporal.Instant":
337
+ case "Temporal.PlainDate":
338
+ case "Temporal.PlainTime":
339
+ case "Temporal.PlainDateTime":
340
+ case "Temporal.PlainMonthDay":
341
+ case "Temporal.PlainYearMonth":
342
+ case "Temporal.ZonedDateTime":
343
+ return `${type}.from(${stringify_string(thing.toString())})`;
344
+ default:
345
+ const keys2 = Object.keys(thing);
346
+ const obj = keys2.map((key) => `${safe_key(key)}:${stringify(thing[key])}`).join(",");
347
+ const proto = Object.getPrototypeOf(thing);
348
+ if (proto === null) {
349
+ return keys2.length > 0 ? `{${obj},__proto__:null}` : `{__proto__:null}`;
350
+ }
351
+ return `{${obj}}`;
352
+ }
353
+ }
354
+ const str = stringify(value);
355
+ if (names.size) {
356
+ const params = [];
357
+ const statements = [];
358
+ const values = [];
359
+ const reconstructions = [];
360
+ names.forEach((name, thing) => {
361
+ params.push(name);
362
+ if (custom.has(thing)) {
363
+ values.push(
364
+ /** @type {string} */
365
+ custom.get(thing)
366
+ );
367
+ return;
368
+ }
369
+ if (is_primitive(thing)) {
370
+ values.push(stringify_primitive(thing));
371
+ return;
372
+ }
373
+ const type = get_type(thing);
374
+ switch (type) {
375
+ case "Number":
376
+ case "String":
377
+ case "Boolean":
378
+ case "BigInt":
379
+ values.push(`Object(${stringify(thing.valueOf())})`);
380
+ break;
381
+ case "RegExp":
382
+ const { source, flags } = thing;
383
+ const regexp = flags ? `new RegExp(${stringify_string(source)},"${flags}")` : `new RegExp(${stringify_string(source)})`;
384
+ values.push(regexp);
385
+ break;
386
+ case "Date":
387
+ values.push(`new Date(${thing.getTime()})`);
388
+ break;
389
+ case "URL":
390
+ values.push(`new URL(${stringify_string(thing.toString())})`);
391
+ break;
392
+ case "URLSearchParams":
393
+ values.push(`new URLSearchParams(${stringify_string(thing.toString())})`);
394
+ break;
395
+ case "Array":
396
+ values.push(`Array(${thing.length})`);
397
+ thing.forEach((v, i) => {
398
+ statements.push(`${name}[${i}]=${stringify(v)}`);
399
+ });
400
+ break;
401
+ case "Set": {
402
+ values.push(`new Set`);
403
+ const adds = Array.from(thing).map((v) => `.add(${stringify(v)})`);
404
+ if (adds.length > 0) statements.push(name + adds.join(""));
405
+ break;
406
+ }
407
+ case "Map": {
408
+ values.push(`new Map`);
409
+ const sets = Array.from(thing).map(
410
+ ([k, v]) => `.set(${stringify(k)}, ${stringify(v)})`
411
+ );
412
+ if (sets.length > 0) statements.push(name + sets.join(""));
413
+ break;
414
+ }
415
+ case "Int8Array":
416
+ case "Uint8Array":
417
+ case "Uint8ClampedArray":
418
+ case "Int16Array":
419
+ case "Uint16Array":
420
+ case "Float16Array":
421
+ case "Int32Array":
422
+ case "Uint32Array":
423
+ case "Float32Array":
424
+ case "Float64Array":
425
+ case "BigInt64Array":
426
+ case "BigUint64Array": {
427
+ let str2 = `new ${type}`;
428
+ if (!names.has(thing.buffer)) {
429
+ str2 += `([${stringify_typed_array_elements(new thing.constructor(thing.buffer))}])`;
430
+ } else {
431
+ str2 += `(${stringify(thing.buffer)})`;
432
+ }
433
+ if (thing.byteLength !== thing.buffer.byteLength) {
434
+ const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
435
+ const end = start + thing.length;
436
+ str2 += `.subarray(${start},${end})`;
437
+ }
438
+ values.push(`{}`);
439
+ reconstructions.push(`${name}=${str2}`);
440
+ break;
441
+ }
442
+ case "DataView": {
443
+ let str2 = `new DataView`;
444
+ if (!names.has(thing.buffer)) {
445
+ str2 += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
446
+ } else {
447
+ str2 += `(${stringify(thing.buffer)}`;
448
+ }
449
+ if (thing.byteLength !== thing.buffer.byteLength) {
450
+ str2 += `,${thing.byteOffset},${thing.byteLength}`;
451
+ }
452
+ str2 += ")";
453
+ values.push(`{}`);
454
+ reconstructions.push(`${name}=${str2}`);
455
+ break;
456
+ }
457
+ case "ArrayBuffer":
458
+ values.push(`new Uint8Array([${new Uint8Array(thing)}]).buffer`);
459
+ break;
460
+ case "Temporal.Duration":
461
+ case "Temporal.Instant":
462
+ case "Temporal.PlainDate":
463
+ case "Temporal.PlainTime":
464
+ case "Temporal.PlainDateTime":
465
+ case "Temporal.PlainMonthDay":
466
+ case "Temporal.PlainYearMonth":
467
+ case "Temporal.ZonedDateTime":
468
+ values.push(`${type}.from(${stringify_string(thing.toString())})`);
469
+ break;
470
+ default:
471
+ values.push(Object.getPrototypeOf(thing) === null ? "Object.create(null)" : "{}");
472
+ Object.keys(thing).forEach((key) => {
473
+ statements.push(`${name}${safe_prop(key)}=${stringify(thing[key])}`);
474
+ });
475
+ }
476
+ });
477
+ statements.push(`return ${str}`);
478
+ const body = [...reconstructions, ...statements].join(";");
479
+ return `(function(${params.join(",")}){${body}}(${values.join(",")}))`;
480
+ } else {
481
+ return str;
482
+ }
483
+ }
484
+ function stringify_typed_array_elements(array) {
485
+ if (array instanceof BigInt64Array || array instanceof BigUint64Array) {
486
+ return Array.from(array, (element) => `${element}n`).join(",");
487
+ }
488
+ return array.toString();
489
+ }
490
+ function get_name(num) {
491
+ let name = "";
492
+ do {
493
+ name = chars[num % chars.length] + name;
494
+ num = ~~(num / chars.length) - 1;
495
+ } while (num >= 0);
496
+ return reserved.test(name) ? `${name}0` : name;
497
+ }
498
+ function escape_unsafe_char(c) {
499
+ return escaped[c] || c;
500
+ }
501
+ function escape_unsafe_chars(str) {
502
+ return str.replace(unsafe_chars, escape_unsafe_char);
503
+ }
504
+ function safe_key(key) {
505
+ return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? key : escape_unsafe_chars(JSON.stringify(key));
506
+ }
507
+ function safe_prop(key) {
508
+ return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? `.${key}` : `[${escape_unsafe_chars(JSON.stringify(key))}]`;
509
+ }
510
+ function stringify_primitive(thing) {
511
+ const type = typeof thing;
512
+ if (type === "string") return stringify_string(thing);
513
+ if (thing === void 0) return "void 0";
514
+ if (thing === 0 && 1 / thing < 0) return "-0";
515
+ const str = String(thing);
516
+ if (type === "number") return str.replace(/^(-)?0\./, "$1.");
517
+ if (type === "bigint") return thing + "n";
518
+ return str;
519
+ }
520
+
521
+ export { DevalueError as D, HOLE as H, MAX_ARRAY_INDEX as M, NAN as N, POSITIVE_INFINITY as P, SPARSE as S, UNDEFINED as U, NEGATIVE_INFINITY as a, NEGATIVE_ZERO as b, is_valid_array_index as c, stringify_string as d, is_plain_object as e, enumerable_symbols as f, get_type as g, is_valid_array_len as i, stringify_key as s, uneval as u, valid_array_indices as v };