@mastra/server 0.14.1 → 0.14.2-alpha.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.
Files changed (77) hide show
  1. package/dist/{chunk-22OZ4DMU.js → chunk-D32MNBNS.js} +11 -5
  2. package/dist/chunk-D32MNBNS.js.map +1 -0
  3. package/dist/chunk-GU4EWMZB.cjs +769 -0
  4. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  5. package/dist/{chunk-JTI4PULF.js → chunk-ID37OH5Z.js} +33 -45
  6. package/dist/chunk-ID37OH5Z.js.map +1 -0
  7. package/dist/{chunk-WPGDPPF2.cjs → chunk-JPY7GWFC.cjs} +13 -7
  8. package/dist/chunk-JPY7GWFC.cjs.map +1 -0
  9. package/dist/{chunk-X7NUY6QT.cjs → chunk-KNGXRN26.cjs} +10 -9
  10. package/dist/chunk-KNGXRN26.cjs.map +1 -0
  11. package/dist/chunk-L265APUD.cjs +69 -0
  12. package/dist/chunk-L265APUD.cjs.map +1 -0
  13. package/dist/chunk-LF2ZLOFP.js +767 -0
  14. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  15. package/dist/{chunk-DT2MVRFD.js → chunk-LUPY3MQY.js} +3 -3
  16. package/dist/chunk-LUPY3MQY.js.map +1 -0
  17. package/dist/{chunk-IPYICGKH.cjs → chunk-PXBRCFVT.cjs} +8 -7
  18. package/dist/chunk-PXBRCFVT.cjs.map +1 -0
  19. package/dist/chunk-R7NOGUZG.js +65 -0
  20. package/dist/chunk-R7NOGUZG.js.map +1 -0
  21. package/dist/{chunk-SFBU4MIU.js → chunk-TTHEEIZ3.js} +10 -9
  22. package/dist/chunk-TTHEEIZ3.js.map +1 -0
  23. package/dist/{chunk-UUO7UO6C.cjs → chunk-UVKXRPMV.cjs} +4 -4
  24. package/dist/chunk-UVKXRPMV.cjs.map +1 -0
  25. package/dist/{chunk-MEZ5K4AI.cjs → chunk-V5EWBGBF.cjs} +33 -45
  26. package/dist/chunk-V5EWBGBF.cjs.map +1 -0
  27. package/dist/{chunk-ICCXVZ6L.js → chunk-VBORXHGM.js} +8 -7
  28. package/dist/chunk-VBORXHGM.js.map +1 -0
  29. package/dist/server/handlers/agents.cjs +12 -12
  30. package/dist/server/handlers/agents.d.ts.map +1 -1
  31. package/dist/server/handlers/agents.js +1 -1
  32. package/dist/server/handlers/legacyWorkflows.cjs +11 -11
  33. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -1
  34. package/dist/server/handlers/legacyWorkflows.js +1 -1
  35. package/dist/server/handlers/memory.cjs +16 -16
  36. package/dist/server/handlers/memory.d.ts +1 -2
  37. package/dist/server/handlers/memory.d.ts.map +1 -1
  38. package/dist/server/handlers/memory.js +1 -1
  39. package/dist/server/handlers/observability.cjs +16 -0
  40. package/dist/server/handlers/observability.cjs.map +1 -0
  41. package/dist/server/handlers/observability.d.ts +23 -0
  42. package/dist/server/handlers/observability.d.ts.map +1 -0
  43. package/dist/server/handlers/observability.js +3 -0
  44. package/dist/server/handlers/observability.js.map +1 -0
  45. package/dist/server/handlers/tools.cjs +5 -5
  46. package/dist/server/handlers/tools.js +1 -1
  47. package/dist/server/handlers/vNextNetwork.cjs +6 -6
  48. package/dist/server/handlers/vNextNetwork.cjs.map +1 -1
  49. package/dist/server/handlers/vNextNetwork.d.ts +5 -5
  50. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -1
  51. package/dist/server/handlers/vNextNetwork.js +6 -6
  52. package/dist/server/handlers/vNextNetwork.js.map +1 -1
  53. package/dist/server/handlers/workflows.cjs +16 -16
  54. package/dist/server/handlers/workflows.d.ts +3 -19
  55. package/dist/server/handlers/workflows.d.ts.map +1 -1
  56. package/dist/server/handlers/workflows.js +1 -1
  57. package/dist/server/handlers.cjs +20 -15
  58. package/dist/server/handlers.d.ts +1 -0
  59. package/dist/server/handlers.d.ts.map +1 -1
  60. package/dist/server/handlers.js +7 -6
  61. package/dist/server/utils.d.ts +3 -0
  62. package/dist/server/utils.d.ts.map +1 -0
  63. package/package.json +6 -7
  64. package/dist/chunk-22OZ4DMU.js.map +0 -1
  65. package/dist/chunk-DT2MVRFD.js.map +0 -1
  66. package/dist/chunk-ICCXVZ6L.js.map +0 -1
  67. package/dist/chunk-IPYICGKH.cjs.map +0 -1
  68. package/dist/chunk-JTI4PULF.js.map +0 -1
  69. package/dist/chunk-LCODOYFR.cjs +0 -2044
  70. package/dist/chunk-LCODOYFR.cjs.map +0 -1
  71. package/dist/chunk-MEZ5K4AI.cjs.map +0 -1
  72. package/dist/chunk-RGY4HZFK.js +0 -2041
  73. package/dist/chunk-RGY4HZFK.js.map +0 -1
  74. package/dist/chunk-SFBU4MIU.js.map +0 -1
  75. package/dist/chunk-UUO7UO6C.cjs.map +0 -1
  76. package/dist/chunk-WPGDPPF2.cjs.map +0 -1
  77. package/dist/chunk-X7NUY6QT.cjs.map +0 -1
@@ -0,0 +1,767 @@
1
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
2
+ var DoubleIndexedKV = class {
3
+ constructor() {
4
+ this.keyToValue = /* @__PURE__ */ new Map();
5
+ this.valueToKey = /* @__PURE__ */ new Map();
6
+ }
7
+ set(key, value) {
8
+ this.keyToValue.set(key, value);
9
+ this.valueToKey.set(value, key);
10
+ }
11
+ getByKey(key) {
12
+ return this.keyToValue.get(key);
13
+ }
14
+ getByValue(value) {
15
+ return this.valueToKey.get(value);
16
+ }
17
+ clear() {
18
+ this.keyToValue.clear();
19
+ this.valueToKey.clear();
20
+ }
21
+ };
22
+
23
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
24
+ var Registry = class {
25
+ constructor(generateIdentifier) {
26
+ this.generateIdentifier = generateIdentifier;
27
+ this.kv = new DoubleIndexedKV();
28
+ }
29
+ register(value, identifier) {
30
+ if (this.kv.getByValue(value)) {
31
+ return;
32
+ }
33
+ if (!identifier) {
34
+ identifier = this.generateIdentifier(value);
35
+ }
36
+ this.kv.set(identifier, value);
37
+ }
38
+ clear() {
39
+ this.kv.clear();
40
+ }
41
+ getIdentifier(value) {
42
+ return this.kv.getByValue(value);
43
+ }
44
+ getValue(identifier) {
45
+ return this.kv.getByKey(identifier);
46
+ }
47
+ };
48
+
49
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
50
+ var ClassRegistry = class extends Registry {
51
+ constructor() {
52
+ super((c) => c.name);
53
+ this.classToAllowedProps = /* @__PURE__ */ new Map();
54
+ }
55
+ register(value, options) {
56
+ if (typeof options === "object") {
57
+ if (options.allowProps) {
58
+ this.classToAllowedProps.set(value, options.allowProps);
59
+ }
60
+ super.register(value, options.identifier);
61
+ } else {
62
+ super.register(value, options);
63
+ }
64
+ }
65
+ getAllowedProps(value) {
66
+ return this.classToAllowedProps.get(value);
67
+ }
68
+ };
69
+
70
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
71
+ function valuesOfObj(record) {
72
+ if ("values" in Object) {
73
+ return Object.values(record);
74
+ }
75
+ const values = [];
76
+ for (const key in record) {
77
+ if (record.hasOwnProperty(key)) {
78
+ values.push(record[key]);
79
+ }
80
+ }
81
+ return values;
82
+ }
83
+ function find(record, predicate) {
84
+ const values = valuesOfObj(record);
85
+ if ("find" in values) {
86
+ return values.find(predicate);
87
+ }
88
+ const valuesNotNever = values;
89
+ for (let i = 0; i < valuesNotNever.length; i++) {
90
+ const value = valuesNotNever[i];
91
+ if (predicate(value)) {
92
+ return value;
93
+ }
94
+ }
95
+ return void 0;
96
+ }
97
+ function forEach(record, run) {
98
+ Object.entries(record).forEach(([key, value]) => run(value, key));
99
+ }
100
+ function includes(arr, value) {
101
+ return arr.indexOf(value) !== -1;
102
+ }
103
+ function findArr(record, predicate) {
104
+ for (let i = 0; i < record.length; i++) {
105
+ const value = record[i];
106
+ if (predicate(value)) {
107
+ return value;
108
+ }
109
+ }
110
+ return void 0;
111
+ }
112
+
113
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
114
+ var CustomTransformerRegistry = class {
115
+ constructor() {
116
+ this.transfomers = {};
117
+ }
118
+ register(transformer) {
119
+ this.transfomers[transformer.name] = transformer;
120
+ }
121
+ findApplicable(v) {
122
+ return find(this.transfomers, (transformer) => transformer.isApplicable(v));
123
+ }
124
+ findByName(name) {
125
+ return this.transfomers[name];
126
+ }
127
+ };
128
+
129
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
130
+ var getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
131
+ var isUndefined = (payload) => typeof payload === "undefined";
132
+ var isNull = (payload) => payload === null;
133
+ var isPlainObject = (payload) => {
134
+ if (typeof payload !== "object" || payload === null)
135
+ return false;
136
+ if (payload === Object.prototype)
137
+ return false;
138
+ if (Object.getPrototypeOf(payload) === null)
139
+ return true;
140
+ return Object.getPrototypeOf(payload) === Object.prototype;
141
+ };
142
+ var isEmptyObject = (payload) => isPlainObject(payload) && Object.keys(payload).length === 0;
143
+ var isArray = (payload) => Array.isArray(payload);
144
+ var isString = (payload) => typeof payload === "string";
145
+ var isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
146
+ var isBoolean = (payload) => typeof payload === "boolean";
147
+ var isRegExp = (payload) => payload instanceof RegExp;
148
+ var isMap = (payload) => payload instanceof Map;
149
+ var isSet = (payload) => payload instanceof Set;
150
+ var isSymbol = (payload) => getType(payload) === "Symbol";
151
+ var isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
152
+ var isError = (payload) => payload instanceof Error;
153
+ var isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
154
+ var isPrimitive = (payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
155
+ var isBigint = (payload) => typeof payload === "bigint";
156
+ var isInfinite = (payload) => payload === Infinity || payload === -Infinity;
157
+ var isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
158
+ var isURL = (payload) => payload instanceof URL;
159
+
160
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
161
+ var escapeKey = (key) => key.replace(/\./g, "\\.");
162
+ var stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
163
+ var parsePath = (string) => {
164
+ const result = [];
165
+ let segment = "";
166
+ for (let i = 0; i < string.length; i++) {
167
+ let char = string.charAt(i);
168
+ const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
169
+ if (isEscapedDot) {
170
+ segment += ".";
171
+ i++;
172
+ continue;
173
+ }
174
+ const isEndOfSegment = char === ".";
175
+ if (isEndOfSegment) {
176
+ result.push(segment);
177
+ segment = "";
178
+ continue;
179
+ }
180
+ segment += char;
181
+ }
182
+ const lastSegment = segment;
183
+ result.push(lastSegment);
184
+ return result;
185
+ };
186
+
187
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
188
+ function simpleTransformation(isApplicable, annotation, transform, untransform) {
189
+ return {
190
+ isApplicable,
191
+ annotation,
192
+ transform,
193
+ untransform
194
+ };
195
+ }
196
+ var simpleRules = [
197
+ simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
198
+ simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
199
+ if (typeof BigInt !== "undefined") {
200
+ return BigInt(v);
201
+ }
202
+ console.error("Please add a BigInt polyfill.");
203
+ return v;
204
+ }),
205
+ simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
206
+ simpleTransformation(isError, "Error", (v, superJson) => {
207
+ const baseError = {
208
+ name: v.name,
209
+ message: v.message
210
+ };
211
+ superJson.allowedErrorProps.forEach((prop) => {
212
+ baseError[prop] = v[prop];
213
+ });
214
+ return baseError;
215
+ }, (v, superJson) => {
216
+ const e = new Error(v.message);
217
+ e.name = v.name;
218
+ e.stack = v.stack;
219
+ superJson.allowedErrorProps.forEach((prop) => {
220
+ e[prop] = v[prop];
221
+ });
222
+ return e;
223
+ }),
224
+ simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
225
+ const body = regex.slice(1, regex.lastIndexOf("/"));
226
+ const flags = regex.slice(regex.lastIndexOf("/") + 1);
227
+ return new RegExp(body, flags);
228
+ }),
229
+ simpleTransformation(
230
+ isSet,
231
+ "set",
232
+ // (sets only exist in es6+)
233
+ // eslint-disable-next-line es5/no-es6-methods
234
+ (v) => [...v.values()],
235
+ (v) => new Set(v)
236
+ ),
237
+ simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
238
+ simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
239
+ if (isNaNValue(v)) {
240
+ return "NaN";
241
+ }
242
+ if (v > 0) {
243
+ return "Infinity";
244
+ } else {
245
+ return "-Infinity";
246
+ }
247
+ }, Number),
248
+ simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
249
+ return "-0";
250
+ }, Number),
251
+ simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
252
+ ];
253
+ function compositeTransformation(isApplicable, annotation, transform, untransform) {
254
+ return {
255
+ isApplicable,
256
+ annotation,
257
+ transform,
258
+ untransform
259
+ };
260
+ }
261
+ var symbolRule = compositeTransformation((s, superJson) => {
262
+ if (isSymbol(s)) {
263
+ const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
264
+ return isRegistered;
265
+ }
266
+ return false;
267
+ }, (s, superJson) => {
268
+ const identifier = superJson.symbolRegistry.getIdentifier(s);
269
+ return ["symbol", identifier];
270
+ }, (v) => v.description, (_, a, superJson) => {
271
+ const value = superJson.symbolRegistry.getValue(a[1]);
272
+ if (!value) {
273
+ throw new Error("Trying to deserialize unknown symbol");
274
+ }
275
+ return value;
276
+ });
277
+ var constructorToName = [
278
+ Int8Array,
279
+ Uint8Array,
280
+ Int16Array,
281
+ Uint16Array,
282
+ Int32Array,
283
+ Uint32Array,
284
+ Float32Array,
285
+ Float64Array,
286
+ Uint8ClampedArray
287
+ ].reduce((obj, ctor) => {
288
+ obj[ctor.name] = ctor;
289
+ return obj;
290
+ }, {});
291
+ var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
292
+ const ctor = constructorToName[a[1]];
293
+ if (!ctor) {
294
+ throw new Error("Trying to deserialize unknown typed array");
295
+ }
296
+ return new ctor(v);
297
+ });
298
+ function isInstanceOfRegisteredClass(potentialClass, superJson) {
299
+ if (potentialClass?.constructor) {
300
+ const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
301
+ return isRegistered;
302
+ }
303
+ return false;
304
+ }
305
+ var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
306
+ const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
307
+ return ["class", identifier];
308
+ }, (clazz, superJson) => {
309
+ const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
310
+ if (!allowedProps) {
311
+ return { ...clazz };
312
+ }
313
+ const result = {};
314
+ allowedProps.forEach((prop) => {
315
+ result[prop] = clazz[prop];
316
+ });
317
+ return result;
318
+ }, (v, a, superJson) => {
319
+ const clazz = superJson.classRegistry.getValue(a[1]);
320
+ if (!clazz) {
321
+ throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
322
+ }
323
+ return Object.assign(Object.create(clazz.prototype), v);
324
+ });
325
+ var customRule = compositeTransformation((value, superJson) => {
326
+ return !!superJson.customTransformerRegistry.findApplicable(value);
327
+ }, (value, superJson) => {
328
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
329
+ return ["custom", transformer.name];
330
+ }, (value, superJson) => {
331
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
332
+ return transformer.serialize(value);
333
+ }, (v, a, superJson) => {
334
+ const transformer = superJson.customTransformerRegistry.findByName(a[1]);
335
+ if (!transformer) {
336
+ throw new Error("Trying to deserialize unknown custom value");
337
+ }
338
+ return transformer.deserialize(v);
339
+ });
340
+ var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
341
+ var transformValue = (value, superJson) => {
342
+ const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
343
+ if (applicableCompositeRule) {
344
+ return {
345
+ value: applicableCompositeRule.transform(value, superJson),
346
+ type: applicableCompositeRule.annotation(value, superJson)
347
+ };
348
+ }
349
+ const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
350
+ if (applicableSimpleRule) {
351
+ return {
352
+ value: applicableSimpleRule.transform(value, superJson),
353
+ type: applicableSimpleRule.annotation
354
+ };
355
+ }
356
+ return void 0;
357
+ };
358
+ var simpleRulesByAnnotation = {};
359
+ simpleRules.forEach((rule) => {
360
+ simpleRulesByAnnotation[rule.annotation] = rule;
361
+ });
362
+ var untransformValue = (json, type, superJson) => {
363
+ if (isArray(type)) {
364
+ switch (type[0]) {
365
+ case "symbol":
366
+ return symbolRule.untransform(json, type, superJson);
367
+ case "class":
368
+ return classRule.untransform(json, type, superJson);
369
+ case "custom":
370
+ return customRule.untransform(json, type, superJson);
371
+ case "typed-array":
372
+ return typedArrayRule.untransform(json, type, superJson);
373
+ default:
374
+ throw new Error("Unknown transformation: " + type);
375
+ }
376
+ } else {
377
+ const transformation = simpleRulesByAnnotation[type];
378
+ if (!transformation) {
379
+ throw new Error("Unknown transformation: " + type);
380
+ }
381
+ return transformation.untransform(json, superJson);
382
+ }
383
+ };
384
+
385
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
386
+ var getNthKey = (value, n) => {
387
+ if (n > value.size)
388
+ throw new Error("index out of bounds");
389
+ const keys = value.keys();
390
+ while (n > 0) {
391
+ keys.next();
392
+ n--;
393
+ }
394
+ return keys.next().value;
395
+ };
396
+ function validatePath(path) {
397
+ if (includes(path, "__proto__")) {
398
+ throw new Error("__proto__ is not allowed as a property");
399
+ }
400
+ if (includes(path, "prototype")) {
401
+ throw new Error("prototype is not allowed as a property");
402
+ }
403
+ if (includes(path, "constructor")) {
404
+ throw new Error("constructor is not allowed as a property");
405
+ }
406
+ }
407
+ var getDeep = (object, path) => {
408
+ validatePath(path);
409
+ for (let i = 0; i < path.length; i++) {
410
+ const key = path[i];
411
+ if (isSet(object)) {
412
+ object = getNthKey(object, +key);
413
+ } else if (isMap(object)) {
414
+ const row = +key;
415
+ const type = +path[++i] === 0 ? "key" : "value";
416
+ const keyOfRow = getNthKey(object, row);
417
+ switch (type) {
418
+ case "key":
419
+ object = keyOfRow;
420
+ break;
421
+ case "value":
422
+ object = object.get(keyOfRow);
423
+ break;
424
+ }
425
+ } else {
426
+ object = object[key];
427
+ }
428
+ }
429
+ return object;
430
+ };
431
+ var setDeep = (object, path, mapper) => {
432
+ validatePath(path);
433
+ if (path.length === 0) {
434
+ return mapper(object);
435
+ }
436
+ let parent = object;
437
+ for (let i = 0; i < path.length - 1; i++) {
438
+ const key = path[i];
439
+ if (isArray(parent)) {
440
+ const index = +key;
441
+ parent = parent[index];
442
+ } else if (isPlainObject(parent)) {
443
+ parent = parent[key];
444
+ } else if (isSet(parent)) {
445
+ const row = +key;
446
+ parent = getNthKey(parent, row);
447
+ } else if (isMap(parent)) {
448
+ const isEnd = i === path.length - 2;
449
+ if (isEnd) {
450
+ break;
451
+ }
452
+ const row = +key;
453
+ const type = +path[++i] === 0 ? "key" : "value";
454
+ const keyOfRow = getNthKey(parent, row);
455
+ switch (type) {
456
+ case "key":
457
+ parent = keyOfRow;
458
+ break;
459
+ case "value":
460
+ parent = parent.get(keyOfRow);
461
+ break;
462
+ }
463
+ }
464
+ }
465
+ const lastKey = path[path.length - 1];
466
+ if (isArray(parent)) {
467
+ parent[+lastKey] = mapper(parent[+lastKey]);
468
+ } else if (isPlainObject(parent)) {
469
+ parent[lastKey] = mapper(parent[lastKey]);
470
+ }
471
+ if (isSet(parent)) {
472
+ const oldValue = getNthKey(parent, +lastKey);
473
+ const newValue = mapper(oldValue);
474
+ if (oldValue !== newValue) {
475
+ parent.delete(oldValue);
476
+ parent.add(newValue);
477
+ }
478
+ }
479
+ if (isMap(parent)) {
480
+ const row = +path[path.length - 2];
481
+ const keyToRow = getNthKey(parent, row);
482
+ const type = +lastKey === 0 ? "key" : "value";
483
+ switch (type) {
484
+ case "key": {
485
+ const newKey = mapper(keyToRow);
486
+ parent.set(newKey, parent.get(keyToRow));
487
+ if (newKey !== keyToRow) {
488
+ parent.delete(keyToRow);
489
+ }
490
+ break;
491
+ }
492
+ case "value": {
493
+ parent.set(keyToRow, mapper(parent.get(keyToRow)));
494
+ break;
495
+ }
496
+ }
497
+ }
498
+ return object;
499
+ };
500
+
501
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
502
+ function traverse(tree, walker2, origin = []) {
503
+ if (!tree) {
504
+ return;
505
+ }
506
+ if (!isArray(tree)) {
507
+ forEach(tree, (subtree, key) => traverse(subtree, walker2, [...origin, ...parsePath(key)]));
508
+ return;
509
+ }
510
+ const [nodeValue, children] = tree;
511
+ if (children) {
512
+ forEach(children, (child, key) => {
513
+ traverse(child, walker2, [...origin, ...parsePath(key)]);
514
+ });
515
+ }
516
+ walker2(nodeValue, origin);
517
+ }
518
+ function applyValueAnnotations(plain, annotations, superJson) {
519
+ traverse(annotations, (type, path) => {
520
+ plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
521
+ });
522
+ return plain;
523
+ }
524
+ function applyReferentialEqualityAnnotations(plain, annotations) {
525
+ function apply(identicalPaths, path) {
526
+ const object = getDeep(plain, parsePath(path));
527
+ identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
528
+ plain = setDeep(plain, identicalObjectPath, () => object);
529
+ });
530
+ }
531
+ if (isArray(annotations)) {
532
+ const [root, other] = annotations;
533
+ root.forEach((identicalPath) => {
534
+ plain = setDeep(plain, parsePath(identicalPath), () => plain);
535
+ });
536
+ if (other) {
537
+ forEach(other, apply);
538
+ }
539
+ } else {
540
+ forEach(annotations, apply);
541
+ }
542
+ return plain;
543
+ }
544
+ var isDeep = (object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson);
545
+ function addIdentity(object, path, identities) {
546
+ const existingSet = identities.get(object);
547
+ if (existingSet) {
548
+ existingSet.push(path);
549
+ } else {
550
+ identities.set(object, [path]);
551
+ }
552
+ }
553
+ function generateReferentialEqualityAnnotations(identitites, dedupe) {
554
+ const result = {};
555
+ let rootEqualityPaths = void 0;
556
+ identitites.forEach((paths) => {
557
+ if (paths.length <= 1) {
558
+ return;
559
+ }
560
+ if (!dedupe) {
561
+ paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
562
+ }
563
+ const [representativePath, ...identicalPaths] = paths;
564
+ if (representativePath.length === 0) {
565
+ rootEqualityPaths = identicalPaths.map(stringifyPath);
566
+ } else {
567
+ result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
568
+ }
569
+ });
570
+ if (rootEqualityPaths) {
571
+ if (isEmptyObject(result)) {
572
+ return [rootEqualityPaths];
573
+ } else {
574
+ return [rootEqualityPaths, result];
575
+ }
576
+ } else {
577
+ return isEmptyObject(result) ? void 0 : result;
578
+ }
579
+ }
580
+ var walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
581
+ const primitive = isPrimitive(object);
582
+ if (!primitive) {
583
+ addIdentity(object, path, identities);
584
+ const seen = seenObjects.get(object);
585
+ if (seen) {
586
+ return dedupe ? {
587
+ transformedValue: null
588
+ } : seen;
589
+ }
590
+ }
591
+ if (!isDeep(object, superJson)) {
592
+ const transformed2 = transformValue(object, superJson);
593
+ const result2 = transformed2 ? {
594
+ transformedValue: transformed2.value,
595
+ annotations: [transformed2.type]
596
+ } : {
597
+ transformedValue: object
598
+ };
599
+ if (!primitive) {
600
+ seenObjects.set(object, result2);
601
+ }
602
+ return result2;
603
+ }
604
+ if (includes(objectsInThisPath, object)) {
605
+ return {
606
+ transformedValue: null
607
+ };
608
+ }
609
+ const transformationResult = transformValue(object, superJson);
610
+ const transformed = transformationResult?.value ?? object;
611
+ const transformedValue = isArray(transformed) ? [] : {};
612
+ const innerAnnotations = {};
613
+ forEach(transformed, (value, index) => {
614
+ if (index === "__proto__" || index === "constructor" || index === "prototype") {
615
+ throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
616
+ }
617
+ const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
618
+ transformedValue[index] = recursiveResult.transformedValue;
619
+ if (isArray(recursiveResult.annotations)) {
620
+ innerAnnotations[index] = recursiveResult.annotations;
621
+ } else if (isPlainObject(recursiveResult.annotations)) {
622
+ forEach(recursiveResult.annotations, (tree, key) => {
623
+ innerAnnotations[escapeKey(index) + "." + key] = tree;
624
+ });
625
+ }
626
+ });
627
+ const result = isEmptyObject(innerAnnotations) ? {
628
+ transformedValue,
629
+ annotations: !!transformationResult ? [transformationResult.type] : void 0
630
+ } : {
631
+ transformedValue,
632
+ annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
633
+ };
634
+ if (!primitive) {
635
+ seenObjects.set(object, result);
636
+ }
637
+ return result;
638
+ };
639
+
640
+ // ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
641
+ function getType2(payload) {
642
+ return Object.prototype.toString.call(payload).slice(8, -1);
643
+ }
644
+ function isArray2(payload) {
645
+ return getType2(payload) === "Array";
646
+ }
647
+ function isPlainObject2(payload) {
648
+ if (getType2(payload) !== "Object")
649
+ return false;
650
+ const prototype = Object.getPrototypeOf(payload);
651
+ return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
652
+ }
653
+
654
+ // ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
655
+ function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
656
+ const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
657
+ if (propType === "enumerable")
658
+ carry[key] = newVal;
659
+ if (includeNonenumerable && propType === "nonenumerable") {
660
+ Object.defineProperty(carry, key, {
661
+ value: newVal,
662
+ enumerable: false,
663
+ writable: true,
664
+ configurable: true
665
+ });
666
+ }
667
+ }
668
+ function copy(target, options = {}) {
669
+ if (isArray2(target)) {
670
+ return target.map((item) => copy(item, options));
671
+ }
672
+ if (!isPlainObject2(target)) {
673
+ return target;
674
+ }
675
+ const props = Object.getOwnPropertyNames(target);
676
+ const symbols = Object.getOwnPropertySymbols(target);
677
+ return [...props, ...symbols].reduce((carry, key) => {
678
+ if (isArray2(options.props) && !options.props.includes(key)) {
679
+ return carry;
680
+ }
681
+ const val = target[key];
682
+ const newVal = copy(val, options);
683
+ assignProp(carry, key, newVal, target, options.nonenumerable);
684
+ return carry;
685
+ }, {});
686
+ }
687
+
688
+ // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
689
+ var SuperJSON = class {
690
+ /**
691
+ * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
692
+ */
693
+ constructor({ dedupe = false } = {}) {
694
+ this.classRegistry = new ClassRegistry();
695
+ this.symbolRegistry = new Registry((s) => s.description ?? "");
696
+ this.customTransformerRegistry = new CustomTransformerRegistry();
697
+ this.allowedErrorProps = [];
698
+ this.dedupe = dedupe;
699
+ }
700
+ serialize(object) {
701
+ const identities = /* @__PURE__ */ new Map();
702
+ const output = walker(object, identities, this, this.dedupe);
703
+ const res = {
704
+ json: output.transformedValue
705
+ };
706
+ if (output.annotations) {
707
+ res.meta = {
708
+ ...res.meta,
709
+ values: output.annotations
710
+ };
711
+ }
712
+ const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
713
+ if (equalityAnnotations) {
714
+ res.meta = {
715
+ ...res.meta,
716
+ referentialEqualities: equalityAnnotations
717
+ };
718
+ }
719
+ return res;
720
+ }
721
+ deserialize(payload) {
722
+ const { json, meta } = payload;
723
+ let result = copy(json);
724
+ if (meta?.values) {
725
+ result = applyValueAnnotations(result, meta.values, this);
726
+ }
727
+ if (meta?.referentialEqualities) {
728
+ result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
729
+ }
730
+ return result;
731
+ }
732
+ stringify(object) {
733
+ return JSON.stringify(this.serialize(object));
734
+ }
735
+ parse(string) {
736
+ return this.deserialize(JSON.parse(string));
737
+ }
738
+ registerClass(v, options) {
739
+ this.classRegistry.register(v, options);
740
+ }
741
+ registerSymbol(v, identifier) {
742
+ this.symbolRegistry.register(v, identifier);
743
+ }
744
+ registerCustom(transformer, name) {
745
+ this.customTransformerRegistry.register({
746
+ name,
747
+ ...transformer
748
+ });
749
+ }
750
+ allowErrorProps(...props) {
751
+ this.allowedErrorProps.push(...props);
752
+ }
753
+ };
754
+ SuperJSON.defaultInstance = new SuperJSON();
755
+ SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
756
+ SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
757
+ SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
758
+ SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
759
+ SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
760
+ SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
761
+ SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
762
+ SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
763
+ var stringify = SuperJSON.stringify;
764
+
765
+ export { stringify };
766
+ //# sourceMappingURL=chunk-LF2ZLOFP.js.map
767
+ //# sourceMappingURL=chunk-LF2ZLOFP.js.map