@powerlines/deepkit 0.5.88 → 0.5.89

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.
@@ -6,163 +6,261 @@ import { isNull as isNull$1 } from '@stryke/type-checks/is-null';
6
6
  import { isString as isString$1 } from '@stryke/type-checks/is-string';
7
7
  import { isUndefined as isUndefined$1 } from '@stryke/type-checks/is-undefined';
8
8
 
9
- // ../../node_modules/.pnpm/@stryke+helpers@0.9.34/node_modules/@stryke/helpers/dist/get-unique.mjs
10
- function t(e7, t7 = (e8) => e8) {
11
- let n6 = /* @__PURE__ */ new Map();
12
- for (let r5 of e7) {
13
- let e8 = t7(r5);
14
- n6.has(e8) || n6.set(e8, r5);
15
- }
16
- return [...n6.values()];
9
+ // ../../node_modules/.pnpm/@stryke+helpers@0.9.36/node_modules/@stryke/helpers/dist/get-unique.mjs
10
+ function getUniqueBy(arr, mapper = (item) => item) {
11
+ const map = /* @__PURE__ */ new Map();
12
+ for (const item of arr) {
13
+ const key = mapper(item);
14
+ if (!map.has(key)) map.set(key, item);
15
+ }
16
+ return [...map.values()];
17
17
  }
18
- __name(t, "t");
18
+ __name(getUniqueBy, "getUniqueBy");
19
19
 
20
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/type-checks/src/get-object-tag.mjs
21
- var e = /* @__PURE__ */ __name((e7) => e7 == null ? e7 === void 0 ? `[object Undefined]` : `[object Null]` : Object.prototype.toString.call(e7), "e");
20
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/get-object-tag.mjs
21
+ var getObjectTag = /* @__PURE__ */ __name((value) => {
22
+ if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
23
+ return Object.prototype.toString.call(value);
24
+ }, "getObjectTag");
22
25
 
23
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/type-checks/src/is-plain-object.mjs
24
- var t2 = /* @__PURE__ */ __name((e7) => typeof e7 == `object` && !!e7, "t");
25
- var n = /* @__PURE__ */ __name((n6) => {
26
- if (!t2(n6) || e(n6) !== `[object Object]`) return false;
27
- if (Object.getPrototypeOf(n6) === null) return true;
28
- let r5 = n6;
29
- for (; Object.getPrototypeOf(r5) !== null; ) r5 = Object.getPrototypeOf(r5);
30
- return Object.getPrototypeOf(n6) === r5;
31
- }, "n");
26
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-plain-object.mjs
27
+ var isObjectLike = /* @__PURE__ */ __name((obj) => {
28
+ return typeof obj === "object" && obj !== null;
29
+ }, "isObjectLike");
30
+ var isPlainObject = /* @__PURE__ */ __name((obj) => {
31
+ if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
32
+ if (Object.getPrototypeOf(obj) === null) return true;
33
+ let proto = obj;
34
+ while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
35
+ return Object.getPrototypeOf(obj) === proto;
36
+ }, "isPlainObject");
32
37
 
33
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/type-checks/src/is-object.mjs
34
- var t3 = /* @__PURE__ */ __name((t7) => {
38
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-object.mjs
39
+ var isObject = /* @__PURE__ */ __name((value) => {
35
40
  try {
36
- return typeof t7 == `object` || !!t7 && t7?.constructor === Object || n(t7);
41
+ return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
37
42
  } catch {
38
43
  return false;
39
44
  }
40
- }, "t");
45
+ }, "isObject");
41
46
 
42
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/type-checks/src/is-string.mjs
43
- var e2 = /* @__PURE__ */ __name((e7) => {
47
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-string.mjs
48
+ var isString = /* @__PURE__ */ __name((value) => {
44
49
  try {
45
- return typeof e7 == `string`;
50
+ return typeof value === "string";
46
51
  } catch {
47
52
  return false;
48
53
  }
49
- }, "e");
54
+ }, "isString");
50
55
 
51
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/types/src/base.mjs
52
- var e3 = ``;
56
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/types/src/base.mjs
57
+ var EMPTY_STRING = "";
53
58
 
54
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/utils/strip-comments.mjs
55
- var t4 = Symbol(`singleComment`);
56
- var n2 = Symbol(`multiComment`);
57
- function r() {
58
- return ``;
59
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/strip-comments.mjs
60
+ var singleComment = Symbol("singleComment");
61
+ var multiComment = Symbol("multiComment");
62
+ function stripWithoutWhitespace() {
63
+ return "";
59
64
  }
60
- __name(r, "r");
61
- function i(e7, t7, n6) {
62
- return e7.slice(t7, n6).replace(/\S/g, ` `);
65
+ __name(stripWithoutWhitespace, "stripWithoutWhitespace");
66
+ function stripWithWhitespace(value, start, end) {
67
+ return value.slice(start, end).replace(/\S/g, " ");
63
68
  }
64
- __name(i, "i");
65
- function a(e7, t7) {
66
- let n6 = t7 - 1, r5 = 0;
67
- for (; e7[n6] === `\\`; ) --n6, r5 += 1;
68
- return !!(r5 % 2);
69
+ __name(stripWithWhitespace, "stripWithWhitespace");
70
+ function isEscaped(value, quotePosition) {
71
+ let index = quotePosition - 1;
72
+ let backslashCount = 0;
73
+ while (value[index] === "\\") {
74
+ index -= 1;
75
+ backslashCount += 1;
76
+ }
77
+ return Boolean(backslashCount % 2);
69
78
  }
70
- __name(a, "a");
71
- function o(o4, { whitespace: s = true, trailingCommas: c2 = false } = {}) {
72
- if (typeof o4 != `string`) throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof o4}\``);
73
- let l = s ? i : r, u = false, d = false, f = 0, p = ``, m = ``, h = -1;
74
- for (let r5 = 0; r5 < o4.length; r5++) {
75
- let i3 = o4[r5], s2 = o4[r5 + 1];
76
- !d && i3 === `"` && (a(o4, r5) || (u = !u)), !u && (!d && i3 + (s2 ?? e3) === `//` ? (p += o4.slice(f, r5), f = r5, d = t4, r5++) : d === t4 && i3 + (s2 ?? e3) === `\r
77
- ` ? (r5++, d = false, p += l(o4, f, r5), f = r5) : d === t4 && i3 === `
78
- ` ? (d = false, p += l(o4, f, r5), f = r5) : !d && i3 + (s2 ?? e3) === `/*` ? (p += o4.slice(f, r5), f = r5, d = n2, r5++) : d === n2 && i3 + (s2 ?? e3) === `*/` ? (r5++, d = false, p += l(o4, f, r5 + 1), f = r5 + 1) : c2 && !d && (h === -1 ? i3 === `,` && (m += p + o4.slice(f, r5), p = ``, f = r5, h = r5) : i3 === `}` || i3 === `]` ? (p += o4.slice(f, r5), m += l(p, 0, 1) + p.slice(1), p = ``, f = r5, h = -1) : i3 !== ` ` && i3 !== ` ` && i3 !== `\r` && i3 !== `
79
- ` && (p += o4.slice(f, r5), f = r5, h = -1)));
80
- }
81
- return m + p + (d ? l(o4.slice(f)) : o4.slice(f));
79
+ __name(isEscaped, "isEscaped");
80
+ function stripComments(value, { whitespace = true, trailingCommas = false } = {}) {
81
+ if (typeof value !== "string") throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof value}\``);
82
+ const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
83
+ let isInsideString = false;
84
+ let isInsideComment = false;
85
+ let offset = 0;
86
+ let buffer = "";
87
+ let result = "";
88
+ let commaIndex = -1;
89
+ for (let index = 0; index < value.length; index++) {
90
+ const currentCharacter = value[index];
91
+ const nextCharacter = value[index + 1];
92
+ if (!isInsideComment && currentCharacter === '"') {
93
+ if (!isEscaped(value, index)) isInsideString = !isInsideString;
94
+ }
95
+ if (isInsideString) continue;
96
+ if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "//") {
97
+ buffer += value.slice(offset, index);
98
+ offset = index;
99
+ isInsideComment = singleComment;
100
+ index++;
101
+ } else if (isInsideComment === singleComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "\r\n") {
102
+ index++;
103
+ isInsideComment = false;
104
+ buffer += strip(value, offset, index);
105
+ offset = index;
106
+ } else if (isInsideComment === singleComment && currentCharacter === "\n") {
107
+ isInsideComment = false;
108
+ buffer += strip(value, offset, index);
109
+ offset = index;
110
+ } else if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "/*") {
111
+ buffer += value.slice(offset, index);
112
+ offset = index;
113
+ isInsideComment = multiComment;
114
+ index++;
115
+ } else if (isInsideComment === multiComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "*/") {
116
+ index++;
117
+ isInsideComment = false;
118
+ buffer += strip(value, offset, index + 1);
119
+ offset = index + 1;
120
+ } else if (trailingCommas && !isInsideComment) {
121
+ if (commaIndex !== -1) {
122
+ if (currentCharacter === "}" || currentCharacter === "]") {
123
+ buffer += value.slice(offset, index);
124
+ result += strip(buffer, 0, 1) + buffer.slice(1);
125
+ buffer = "";
126
+ offset = index;
127
+ commaIndex = -1;
128
+ } else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") {
129
+ buffer += value.slice(offset, index);
130
+ offset = index;
131
+ commaIndex = -1;
132
+ }
133
+ } else if (currentCharacter === ",") {
134
+ result += buffer + value.slice(offset, index);
135
+ buffer = "";
136
+ offset = index;
137
+ commaIndex = index;
138
+ }
139
+ }
140
+ }
141
+ return result + buffer + (isInsideComment ? strip(value.slice(offset)) : value.slice(offset));
82
142
  }
83
- __name(o, "o");
143
+ __name(stripComments, "stripComments");
84
144
 
85
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/utils/parse.mjs
86
- var t5 = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
87
- var n3 = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
88
- var r2 = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
89
- function i2(e7, t7) {
90
- if (e7 === `__proto__` || e7 === `constructor` && t7 && typeof t7 == `object` && `prototype` in t7) {
91
- console.warn(`Dropping "${e7}" key to prevent prototype pollution.`);
145
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/parse.mjs
146
+ var suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
147
+ var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
148
+ var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
149
+ function jsonParseTransform(key, value) {
150
+ if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
151
+ console.warn(`Dropping "${key}" key to prevent prototype pollution.`);
92
152
  return;
93
153
  }
94
- return t7;
154
+ return value;
95
155
  }
96
- __name(i2, "i");
97
- function a2(a3, o4 = {}) {
98
- if (typeof a3 != `string`) return a3;
99
- let s = o(a3);
100
- if (s[0] === `"` && s[s.length - 1] === `"` && !s.includes(`\\`)) return s.slice(1, -1);
101
- if (s = s.trim(), s.length <= 9) switch (s.toLowerCase()) {
102
- case `true`:
156
+ __name(jsonParseTransform, "jsonParseTransform");
157
+ function parse(value, options = {}) {
158
+ if (typeof value !== "string") return value;
159
+ let stripped = stripComments(value);
160
+ if (stripped[0] === '"' && stripped[stripped.length - 1] === '"' && !stripped.includes("\\")) return stripped.slice(1, -1);
161
+ stripped = stripped.trim();
162
+ if (stripped.length <= 9) switch (stripped.toLowerCase()) {
163
+ case "true":
103
164
  return true;
104
- case `false`:
165
+ case "false":
105
166
  return false;
106
- case `undefined`:
167
+ case "undefined":
107
168
  return;
108
- case `null`:
169
+ case "null":
109
170
  return null;
110
- case `nan`:
171
+ case "nan":
111
172
  return NaN;
112
- case `infinity`:
113
- return 1 / 0;
114
- case `-infinity`:
115
- return -1 / 0;
173
+ case "infinity":
174
+ return Number.POSITIVE_INFINITY;
175
+ case "-infinity":
176
+ return Number.NEGATIVE_INFINITY;
116
177
  }
117
- if (!r2.test(s)) {
118
- if (o4.strict) throw Error(`Invalid JSON`);
119
- return s;
178
+ if (!JsonSigRx.test(stripped)) {
179
+ if (options.strict) throw new Error("Invalid JSON");
180
+ return stripped;
120
181
  }
121
182
  try {
122
- if (t5.test(s) || n3.test(s)) {
123
- if (o4.strict) throw Error(`Possible prototype pollution`);
124
- return JSON.parse(s, i2);
183
+ if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {
184
+ if (options.strict) throw new Error("Possible prototype pollution");
185
+ return JSON.parse(stripped, jsonParseTransform);
125
186
  }
126
- return JSON.parse(s);
127
- } catch (e7) {
128
- if (o4.strict) throw e7;
129
- return a3;
187
+ return JSON.parse(stripped);
188
+ } catch (error) {
189
+ if (options.strict) throw error;
190
+ return value;
130
191
  }
131
192
  }
132
- __name(a2, "a");
193
+ __name(parse, "parse");
133
194
 
134
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/utils/code-frames.mjs
135
- var e4 = /\r\n|[\n\r\u2028\u2029]/;
136
- function t6(e7, t7, n6 = {}) {
137
- let r5 = { column: 0, line: -1, ...e7.start }, i3 = { ...r5, ...e7.end }, { linesAbove: a3 = 2, linesBelow: o4 = 3 } = n6 || {}, s = r5.line, c2 = r5.column, l = i3.line, u = i3.column, d = Math.max(s - (a3 + 1), 0), f = Math.min(t7.length, l + o4);
138
- s === -1 && (d = 0), l === -1 && (f = t7.length);
139
- let p = l - s, m = {};
140
- if (p) for (let e8 = 0; e8 <= p; e8++) {
141
- let n7 = e8 + s;
142
- c2 ? e8 === 0 ? m[n7] = [c2, (t7[n7 - 1]?.length ?? 0) - c2 + 1] : e8 === p ? m[n7] = [0, u] : m[n7] = [0, t7[n7 - e8]?.length ?? 0] : m[n7] = true;
143
- }
144
- else c2 === u ? m[s] = c2 ? [c2, 0] : true : m[s] = [c2, u - c2];
145
- return { start: d, end: f, markerLines: m };
195
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/code-frames.mjs
196
+ var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
197
+ function getMarkerLines(loc, source, opts = {}) {
198
+ const startLoc = {
199
+ column: 0,
200
+ line: -1,
201
+ ...loc.start
202
+ };
203
+ const endLoc = {
204
+ ...startLoc,
205
+ ...loc.end
206
+ };
207
+ const { linesAbove = 2, linesBelow = 3 } = opts || {};
208
+ const startLine = startLoc.line;
209
+ const startColumn = startLoc.column;
210
+ const endLine = endLoc.line;
211
+ const endColumn = endLoc.column;
212
+ let start = Math.max(startLine - (linesAbove + 1), 0);
213
+ let end = Math.min(source.length, endLine + linesBelow);
214
+ if (startLine === -1) start = 0;
215
+ if (endLine === -1) end = source.length;
216
+ const lineDiff = endLine - startLine;
217
+ const markerLines = {};
218
+ if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
219
+ const lineNumber = i + startLine;
220
+ if (!startColumn) markerLines[lineNumber] = true;
221
+ else if (i === 0) markerLines[lineNumber] = [startColumn, (source[lineNumber - 1]?.length ?? 0) - startColumn + 1];
222
+ else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
223
+ else markerLines[lineNumber] = [0, source[lineNumber - i]?.length ?? 0];
224
+ }
225
+ else if (startColumn === endColumn) markerLines[startLine] = startColumn ? [startColumn, 0] : true;
226
+ else markerLines[startLine] = [startColumn, endColumn - startColumn];
227
+ return {
228
+ start,
229
+ end,
230
+ markerLines
231
+ };
146
232
  }
147
- __name(t6, "t");
148
- function n4(n6, r5, i3 = {}) {
149
- let { start: a3, end: o4, markerLines: s } = t6(r5, n6.split(e4), i3), c2 = String(o4).length;
150
- return (i3.highlight ? i3.highlight(n6) : n6).split(e4).slice(a3, o4).map((e7, t7) => {
151
- let n7 = a3 + 1 + t7, r6 = ` ${` ${n7}`.slice(-c2)} | `, i4 = !!(s[n7] ?? false);
152
- if (i4) {
153
- let t8 = ``;
154
- if (Array.isArray(i4)) {
155
- let n8 = e7.slice(0, Math.max(i4[0] - 1, 0)).replace(/[^\t]/g, ` `), a4 = i4[1] || 1;
156
- t8 = [`
157
- `, r6.replace(/\d/g, ` `), n8, `^`.repeat(a4)].join(``);
233
+ __name(getMarkerLines, "getMarkerLines");
234
+ function codeFrameColumns(rawLines, loc, opts = {}) {
235
+ const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
236
+ const numberMaxWidth = String(end).length;
237
+ return (opts.highlight ? opts.highlight(rawLines) : rawLines).split(NEWLINE).slice(start, end).map((line, index) => {
238
+ const number = start + 1 + index;
239
+ const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} | `;
240
+ const hasMarker = Boolean(markerLines[number] ?? false);
241
+ if (hasMarker) {
242
+ let markerLine = "";
243
+ if (Array.isArray(hasMarker)) {
244
+ const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
245
+ const numberOfMarkers = hasMarker[1] || 1;
246
+ markerLine = [
247
+ "\n ",
248
+ gutter.replace(/\d/g, " "),
249
+ markerSpacing,
250
+ "^".repeat(numberOfMarkers)
251
+ ].join("");
158
252
  }
159
- return [`>`, r6, e7, t8].join(``);
253
+ return [
254
+ ">",
255
+ gutter,
256
+ line,
257
+ markerLine
258
+ ].join("");
160
259
  }
161
- return ` ${r6}${e7}`;
162
- }).join(`
163
- `);
260
+ return ` ${gutter}${line}`;
261
+ }).join("\n");
164
262
  }
165
- __name(n4, "n");
263
+ __name(codeFrameColumns, "codeFrameColumns");
166
264
 
167
265
  // ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
168
266
  function createScanner(text, ignoreTrivia = false) {
@@ -603,7 +701,7 @@ var ParseOptions;
603
701
  allowTrailingComma: false
604
702
  };
605
703
  })(ParseOptions || (ParseOptions = {}));
606
- function parse(text, errors = [], options = ParseOptions.DEFAULT) {
704
+ function parse2(text, errors = [], options = ParseOptions.DEFAULT) {
607
705
  let currentProperty = null;
608
706
  let currentParent = [];
609
707
  const previousParents = [];
@@ -651,7 +749,7 @@ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
651
749
  visit(text, visitor, options);
652
750
  return currentParent[0];
653
751
  }
654
- __name(parse, "parse");
752
+ __name(parse2, "parse");
655
753
  function visit(text, visitor, options = ParseOptions.DEFAULT) {
656
754
  const _scanner = createScanner(text, false);
657
755
  const _jsonPath = [];
@@ -982,7 +1080,7 @@ var SyntaxKind;
982
1080
  SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
983
1081
  SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
984
1082
  })(SyntaxKind || (SyntaxKind = {}));
985
- var parse2 = parse;
1083
+ var parse3 = parse2;
986
1084
  var ParseErrorCode;
987
1085
  (function(ParseErrorCode2) {
988
1086
  ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
@@ -1102,58 +1200,107 @@ var LinesAndColumns = (
1102
1200
  })()
1103
1201
  );
1104
1202
 
1105
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/utils/parse-error.mjs
1106
- function r3(r5, i3) {
1107
- let { error: a3, offset: o4, length: s } = i3, c2 = new LinesAndColumns(r5).locationForIndex(o4), l = c2?.line ?? 0, u = c2?.column ?? 0;
1108
- return l++, u++, `${printParseErrorCode(a3)} in JSON at ${l}:${u}
1109
- ${n4(r5, { start: { line: l, column: u }, end: { line: l, column: u + s } })}
1203
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/parse-error.mjs
1204
+ function formatParseError(input, parseError) {
1205
+ const { error, offset, length } = parseError;
1206
+ const result = new LinesAndColumns(input).locationForIndex(offset);
1207
+ let line = result?.line ?? 0;
1208
+ let column = result?.column ?? 0;
1209
+ line++;
1210
+ column++;
1211
+ return `${printParseErrorCode(error)} in JSON at ${line}:${column}
1212
+ ${codeFrameColumns(input, {
1213
+ start: {
1214
+ line,
1215
+ column
1216
+ },
1217
+ end: {
1218
+ line,
1219
+ column: column + length
1220
+ }
1221
+ })}
1110
1222
  `;
1111
1223
  }
1112
- __name(r3, "r");
1224
+ __name(formatParseError, "formatParseError");
1113
1225
 
1114
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/type-checks/src/is-number.mjs
1115
- var e5 = /* @__PURE__ */ __name((e7) => {
1226
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-number.mjs
1227
+ var isNumber = /* @__PURE__ */ __name((value) => {
1116
1228
  try {
1117
- return e7 instanceof Number || typeof e7 == `number` || Number(e7) === e7;
1229
+ return value instanceof Number || typeof value === "number" || Number(value) === value;
1118
1230
  } catch {
1119
1231
  return false;
1120
1232
  }
1121
- }, "e");
1233
+ }, "isNumber");
1122
1234
 
1123
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/type-checks/src/is-undefined.mjs
1124
- var e6 = /* @__PURE__ */ __name((e7) => e7 === void 0, "e");
1235
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-undefined.mjs
1236
+ var isUndefined = /* @__PURE__ */ __name((value) => {
1237
+ return value === void 0;
1238
+ }, "isUndefined");
1125
1239
 
1126
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/utils/stringify.mjs
1127
- var n5 = `@/#$ :;,.!?&=+-*%^~|\\"'\`{}[]()<>`.split(``);
1128
- var r4 = /* @__PURE__ */ __name((i3, a3 = 2) => {
1129
- let o4 = e5(a3) ? ` `.repeat(a3) : a3;
1130
- switch (i3) {
1240
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/stringify.mjs
1241
+ var invalidKeyChars = [
1242
+ "@",
1243
+ "/",
1244
+ "#",
1245
+ "$",
1246
+ " ",
1247
+ ":",
1248
+ ";",
1249
+ ",",
1250
+ ".",
1251
+ "!",
1252
+ "?",
1253
+ "&",
1254
+ "=",
1255
+ "+",
1256
+ "-",
1257
+ "*",
1258
+ "%",
1259
+ "^",
1260
+ "~",
1261
+ "|",
1262
+ "\\",
1263
+ '"',
1264
+ "'",
1265
+ "`",
1266
+ "{",
1267
+ "}",
1268
+ "[",
1269
+ "]",
1270
+ "(",
1271
+ ")",
1272
+ "<",
1273
+ ">"
1274
+ ];
1275
+ var stringify = /* @__PURE__ */ __name((value, spacing = 2) => {
1276
+ const space = isNumber(spacing) ? " ".repeat(spacing) : spacing;
1277
+ switch (value) {
1131
1278
  case null:
1132
- return `null`;
1279
+ return "null";
1133
1280
  case void 0:
1134
- return `"undefined"`;
1281
+ return '"undefined"';
1135
1282
  case true:
1136
- return `true`;
1283
+ return "true";
1137
1284
  case false:
1138
- return `false`;
1139
- case 1 / 0:
1140
- return `infinity`;
1141
- case -1 / 0:
1142
- return `-infinity`;
1143
- }
1144
- if (Array.isArray(i3)) return `[${o4}${i3.map((e7) => r4(e7, o4)).join(`,${o4}`)}${o4}]`;
1145
- if (i3 instanceof Uint8Array) return i3.toString();
1146
- switch (typeof i3) {
1147
- case `number`:
1148
- return `${i3}`;
1149
- case `string`:
1150
- return JSON.stringify(i3);
1151
- case `object`:
1152
- return `{${o4}${Object.keys(i3).filter((e7) => !e6(i3[e7])).map((e7) => `${n5.some((t7) => e7.includes(t7)) ? `"${e7}"` : e7}: ${o4}${r4(i3[e7], o4)}`).join(`,${o4}`)}${o4}}`;
1285
+ return "false";
1286
+ case Number.POSITIVE_INFINITY:
1287
+ return "infinity";
1288
+ case Number.NEGATIVE_INFINITY:
1289
+ return "-infinity";
1290
+ }
1291
+ if (Array.isArray(value)) return `[${space}${value.map((v) => stringify(v, space)).join(`,${space}`)}${space}]`;
1292
+ if (value instanceof Uint8Array) return value.toString();
1293
+ switch (typeof value) {
1294
+ case "number":
1295
+ return `${value}`;
1296
+ case "string":
1297
+ return JSON.stringify(value);
1298
+ case "object":
1299
+ return `{${space}${Object.keys(value).filter((key) => !isUndefined(value[key])).map((key) => `${invalidKeyChars.some((invalidKeyChar) => key.includes(invalidKeyChar)) ? `"${key}"` : key}: ${space}${stringify(value[key], space)}`).join(`,${space}`)}${space}}`;
1153
1300
  default:
1154
- return `null`;
1301
+ return "null";
1155
1302
  }
1156
- }, "r");
1303
+ }, "stringify");
1157
1304
 
1158
1305
  // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
1159
1306
  var DoubleIndexedKV = class {
@@ -1215,7 +1362,7 @@ var ClassRegistry = class extends Registry {
1215
1362
  __name(this, "ClassRegistry");
1216
1363
  }
1217
1364
  constructor() {
1218
- super((c2) => c2.name);
1365
+ super((c) => c.name);
1219
1366
  this.classToAllowedProps = /* @__PURE__ */ new Map();
1220
1367
  }
1221
1368
  register(value, options) {
@@ -1253,8 +1400,8 @@ function find(record, predicate) {
1253
1400
  return values.find(predicate);
1254
1401
  }
1255
1402
  const valuesNotNever = values;
1256
- for (let i3 = 0; i3 < valuesNotNever.length; i3++) {
1257
- const value = valuesNotNever[i3];
1403
+ for (let i = 0; i < valuesNotNever.length; i++) {
1404
+ const value = valuesNotNever[i];
1258
1405
  if (predicate(value)) {
1259
1406
  return value;
1260
1407
  }
@@ -1271,8 +1418,8 @@ function includes(arr, value) {
1271
1418
  }
1272
1419
  __name(includes, "includes");
1273
1420
  function findArr(record, predicate) {
1274
- for (let i3 = 0; i3 < record.length; i3++) {
1275
- const value = record[i3];
1421
+ for (let i = 0; i < record.length; i++) {
1422
+ const value = record[i];
1276
1423
  if (predicate(value)) {
1277
1424
  return value;
1278
1425
  }
@@ -1302,18 +1449,18 @@ var CustomTransformerRegistry = class {
1302
1449
 
1303
1450
  // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
1304
1451
  var getType = /* @__PURE__ */ __name((payload) => Object.prototype.toString.call(payload).slice(8, -1), "getType");
1305
- var isUndefined = /* @__PURE__ */ __name((payload) => typeof payload === "undefined", "isUndefined");
1452
+ var isUndefined2 = /* @__PURE__ */ __name((payload) => typeof payload === "undefined", "isUndefined");
1306
1453
  var isNull = /* @__PURE__ */ __name((payload) => payload === null, "isNull");
1307
- var isPlainObject = /* @__PURE__ */ __name((payload) => {
1454
+ var isPlainObject2 = /* @__PURE__ */ __name((payload) => {
1308
1455
  if (typeof payload !== "object" || payload === null) return false;
1309
1456
  if (payload === Object.prototype) return false;
1310
1457
  if (Object.getPrototypeOf(payload) === null) return true;
1311
1458
  return Object.getPrototypeOf(payload) === Object.prototype;
1312
1459
  }, "isPlainObject");
1313
- var isEmptyObject = /* @__PURE__ */ __name((payload) => isPlainObject(payload) && Object.keys(payload).length === 0, "isEmptyObject");
1460
+ var isEmptyObject = /* @__PURE__ */ __name((payload) => isPlainObject2(payload) && Object.keys(payload).length === 0, "isEmptyObject");
1314
1461
  var isArray = /* @__PURE__ */ __name((payload) => Array.isArray(payload), "isArray");
1315
- var isString = /* @__PURE__ */ __name((payload) => typeof payload === "string", "isString");
1316
- var isNumber = /* @__PURE__ */ __name((payload) => typeof payload === "number" && !isNaN(payload), "isNumber");
1462
+ var isString2 = /* @__PURE__ */ __name((payload) => typeof payload === "string", "isString");
1463
+ var isNumber2 = /* @__PURE__ */ __name((payload) => typeof payload === "number" && !isNaN(payload), "isNumber");
1317
1464
  var isBoolean = /* @__PURE__ */ __name((payload) => typeof payload === "boolean", "isBoolean");
1318
1465
  var isRegExp = /* @__PURE__ */ __name((payload) => payload instanceof RegExp, "isRegExp");
1319
1466
  var isMap = /* @__PURE__ */ __name((payload) => payload instanceof Map, "isMap");
@@ -1322,7 +1469,7 @@ var isSymbol = /* @__PURE__ */ __name((payload) => getType(payload) === "Symbol"
1322
1469
  var isDate = /* @__PURE__ */ __name((payload) => payload instanceof Date && !isNaN(payload.valueOf()), "isDate");
1323
1470
  var isError = /* @__PURE__ */ __name((payload) => payload instanceof Error, "isError");
1324
1471
  var isNaNValue = /* @__PURE__ */ __name((payload) => typeof payload === "number" && isNaN(payload), "isNaNValue");
1325
- var isPrimitive = /* @__PURE__ */ __name((payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload), "isPrimitive");
1472
+ var isPrimitive = /* @__PURE__ */ __name((payload) => isBoolean(payload) || isNull(payload) || isUndefined2(payload) || isNumber2(payload) || isString2(payload) || isSymbol(payload), "isPrimitive");
1326
1473
  var isBigint = /* @__PURE__ */ __name((payload) => typeof payload === "bigint", "isBigint");
1327
1474
  var isInfinite = /* @__PURE__ */ __name((payload) => payload === Infinity || payload === -Infinity, "isInfinite");
1328
1475
  var isTypedArray = /* @__PURE__ */ __name((payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView), "isTypedArray");
@@ -1334,12 +1481,12 @@ var stringifyPath = /* @__PURE__ */ __name((path) => path.map(String).map(escape
1334
1481
  var parsePath = /* @__PURE__ */ __name((string) => {
1335
1482
  const result = [];
1336
1483
  let segment = "";
1337
- for (let i3 = 0; i3 < string.length; i3++) {
1338
- let char = string.charAt(i3);
1339
- const isEscapedDot = char === "\\" && string.charAt(i3 + 1) === ".";
1484
+ for (let i = 0; i < string.length; i++) {
1485
+ let char = string.charAt(i);
1486
+ const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
1340
1487
  if (isEscapedDot) {
1341
1488
  segment += ".";
1342
- i3++;
1489
+ i++;
1343
1490
  continue;
1344
1491
  }
1345
1492
  const isEndOfSegment = char === ".";
@@ -1366,7 +1513,7 @@ function simpleTransformation(isApplicable, annotation, transform, untransform)
1366
1513
  }
1367
1514
  __name(simpleTransformation, "simpleTransformation");
1368
1515
  var simpleRules = [
1369
- simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
1516
+ simpleTransformation(isUndefined2, "undefined", () => null, () => void 0),
1370
1517
  simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
1371
1518
  if (typeof BigInt !== "undefined") {
1372
1519
  return BigInt(v);
@@ -1385,13 +1532,13 @@ var simpleRules = [
1385
1532
  });
1386
1533
  return baseError;
1387
1534
  }, (v, superJson) => {
1388
- const e7 = new Error(v.message);
1389
- e7.name = v.name;
1390
- e7.stack = v.stack;
1535
+ const e = new Error(v.message);
1536
+ e.name = v.name;
1537
+ e.stack = v.stack;
1391
1538
  superJson.allowedErrorProps.forEach((prop) => {
1392
- e7[prop] = v[prop];
1539
+ e[prop] = v[prop];
1393
1540
  });
1394
- return e7;
1541
+ return e;
1395
1542
  }),
1396
1543
  simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
1397
1544
  const body = regex.slice(1, regex.lastIndexOf("/"));
@@ -1447,8 +1594,8 @@ var symbolRule = compositeTransformation((s, superJson) => {
1447
1594
  "symbol",
1448
1595
  identifier
1449
1596
  ];
1450
- }, (v) => v.description, (_, a3, superJson) => {
1451
- const value = superJson.symbolRegistry.getValue(a3[1]);
1597
+ }, (v) => v.description, (_, a, superJson) => {
1598
+ const value = superJson.symbolRegistry.getValue(a[1]);
1452
1599
  if (!value) {
1453
1600
  throw new Error("Trying to deserialize unknown symbol");
1454
1601
  }
@@ -1473,8 +1620,8 @@ var typedArrayRule = compositeTransformation(isTypedArray, (v) => [
1473
1620
  v.constructor.name
1474
1621
  ], (v) => [
1475
1622
  ...v
1476
- ], (v, a3) => {
1477
- const ctor = constructorToName[a3[1]];
1623
+ ], (v, a) => {
1624
+ const ctor = constructorToName[a[1]];
1478
1625
  if (!ctor) {
1479
1626
  throw new Error("Trying to deserialize unknown typed array");
1480
1627
  }
@@ -1506,10 +1653,10 @@ var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, sup
1506
1653
  result[prop] = clazz[prop];
1507
1654
  });
1508
1655
  return result;
1509
- }, (v, a3, superJson) => {
1510
- const clazz = superJson.classRegistry.getValue(a3[1]);
1656
+ }, (v, a, superJson) => {
1657
+ const clazz = superJson.classRegistry.getValue(a[1]);
1511
1658
  if (!clazz) {
1512
- throw new Error(`Trying to deserialize unknown class '${a3[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
1659
+ throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
1513
1660
  }
1514
1661
  return Object.assign(Object.create(clazz.prototype), v);
1515
1662
  });
@@ -1524,8 +1671,8 @@ var customRule = compositeTransformation((value, superJson) => {
1524
1671
  }, (value, superJson) => {
1525
1672
  const transformer = superJson.customTransformerRegistry.findApplicable(value);
1526
1673
  return transformer.serialize(value);
1527
- }, (v, a3, superJson) => {
1528
- const transformer = superJson.customTransformerRegistry.findByName(a3[1]);
1674
+ }, (v, a, superJson) => {
1675
+ const transformer = superJson.customTransformerRegistry.findByName(a[1]);
1529
1676
  if (!transformer) {
1530
1677
  throw new Error("Trying to deserialize unknown custom value");
1531
1678
  }
@@ -1582,12 +1729,12 @@ var untransformValue = /* @__PURE__ */ __name((json, type, superJson) => {
1582
1729
  }, "untransformValue");
1583
1730
 
1584
1731
  // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
1585
- var getNthKey = /* @__PURE__ */ __name((value, n6) => {
1586
- if (n6 > value.size) throw new Error("index out of bounds");
1732
+ var getNthKey = /* @__PURE__ */ __name((value, n) => {
1733
+ if (n > value.size) throw new Error("index out of bounds");
1587
1734
  const keys = value.keys();
1588
- while (n6 > 0) {
1735
+ while (n > 0) {
1589
1736
  keys.next();
1590
- n6--;
1737
+ n--;
1591
1738
  }
1592
1739
  return keys.next().value;
1593
1740
  }, "getNthKey");
@@ -1605,13 +1752,13 @@ function validatePath(path) {
1605
1752
  __name(validatePath, "validatePath");
1606
1753
  var getDeep = /* @__PURE__ */ __name((object, path) => {
1607
1754
  validatePath(path);
1608
- for (let i3 = 0; i3 < path.length; i3++) {
1609
- const key = path[i3];
1755
+ for (let i = 0; i < path.length; i++) {
1756
+ const key = path[i];
1610
1757
  if (isSet(object)) {
1611
1758
  object = getNthKey(object, +key);
1612
1759
  } else if (isMap(object)) {
1613
1760
  const row = +key;
1614
- const type = +path[++i3] === 0 ? "key" : "value";
1761
+ const type = +path[++i] === 0 ? "key" : "value";
1615
1762
  const keyOfRow = getNthKey(object, row);
1616
1763
  switch (type) {
1617
1764
  case "key":
@@ -1633,23 +1780,23 @@ var setDeep = /* @__PURE__ */ __name((object, path, mapper) => {
1633
1780
  return mapper(object);
1634
1781
  }
1635
1782
  let parent = object;
1636
- for (let i3 = 0; i3 < path.length - 1; i3++) {
1637
- const key = path[i3];
1783
+ for (let i = 0; i < path.length - 1; i++) {
1784
+ const key = path[i];
1638
1785
  if (isArray(parent)) {
1639
1786
  const index = +key;
1640
1787
  parent = parent[index];
1641
- } else if (isPlainObject(parent)) {
1788
+ } else if (isPlainObject2(parent)) {
1642
1789
  parent = parent[key];
1643
1790
  } else if (isSet(parent)) {
1644
1791
  const row = +key;
1645
1792
  parent = getNthKey(parent, row);
1646
1793
  } else if (isMap(parent)) {
1647
- const isEnd = i3 === path.length - 2;
1794
+ const isEnd = i === path.length - 2;
1648
1795
  if (isEnd) {
1649
1796
  break;
1650
1797
  }
1651
1798
  const row = +key;
1652
- const type = +path[++i3] === 0 ? "key" : "value";
1799
+ const type = +path[++i] === 0 ? "key" : "value";
1653
1800
  const keyOfRow = getNthKey(parent, row);
1654
1801
  switch (type) {
1655
1802
  case "key":
@@ -1664,7 +1811,7 @@ var setDeep = /* @__PURE__ */ __name((object, path, mapper) => {
1664
1811
  const lastKey = path[path.length - 1];
1665
1812
  if (isArray(parent)) {
1666
1813
  parent[+lastKey] = mapper(parent[+lastKey]);
1667
- } else if (isPlainObject(parent)) {
1814
+ } else if (isPlainObject2(parent)) {
1668
1815
  parent[lastKey] = mapper(parent[lastKey]);
1669
1816
  }
1670
1817
  if (isSet(parent)) {
@@ -1750,7 +1897,7 @@ function applyReferentialEqualityAnnotations(plain, annotations) {
1750
1897
  return plain;
1751
1898
  }
1752
1899
  __name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
1753
- var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
1900
+ var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject2(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
1754
1901
  function addIdentity(object, path, identities) {
1755
1902
  const existingSet = identities.get(object);
1756
1903
  if (existingSet) {
@@ -1770,7 +1917,7 @@ function generateReferentialEqualityAnnotations(identitites, dedupe) {
1770
1917
  return;
1771
1918
  }
1772
1919
  if (!dedupe) {
1773
- paths = paths.map((path) => path.map(String)).sort((a3, b) => a3.length - b.length);
1920
+ paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
1774
1921
  }
1775
1922
  const [representativePath, ...identicalPaths] = paths;
1776
1923
  if (representativePath.length === 0) {
@@ -1844,7 +1991,7 @@ var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path
1844
1991
  transformedValue[index] = recursiveResult.transformedValue;
1845
1992
  if (isArray(recursiveResult.annotations)) {
1846
1993
  innerAnnotations[index] = recursiveResult.annotations;
1847
- } else if (isPlainObject(recursiveResult.annotations)) {
1994
+ } else if (isPlainObject2(recursiveResult.annotations)) {
1848
1995
  forEach(recursiveResult.annotations, (tree, key) => {
1849
1996
  innerAnnotations[escapeKey(index) + "." + key] = tree;
1850
1997
  });
@@ -1877,24 +2024,24 @@ function isArray2(payload) {
1877
2024
  return getType2(payload) === "Array";
1878
2025
  }
1879
2026
  __name(isArray2, "isArray");
1880
- function isPlainObject2(payload) {
2027
+ function isPlainObject3(payload) {
1881
2028
  if (getType2(payload) !== "Object") return false;
1882
2029
  const prototype = Object.getPrototypeOf(payload);
1883
2030
  return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
1884
2031
  }
1885
- __name(isPlainObject2, "isPlainObject");
2032
+ __name(isPlainObject3, "isPlainObject");
1886
2033
  function isNull2(payload) {
1887
2034
  return getType2(payload) === "Null";
1888
2035
  }
1889
2036
  __name(isNull2, "isNull");
1890
- function isOneOf(a3, b, c2, d, e7) {
1891
- return (value) => a3(value) || b(value) || !!c2 && c2(value) || !!d && d(value) || !!e7 && e7(value);
2037
+ function isOneOf(a, b, c, d, e) {
2038
+ return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
1892
2039
  }
1893
2040
  __name(isOneOf, "isOneOf");
1894
- function isUndefined2(payload) {
2041
+ function isUndefined3(payload) {
1895
2042
  return getType2(payload) === "Undefined";
1896
2043
  }
1897
- __name(isUndefined2, "isUndefined");
2044
+ __name(isUndefined3, "isUndefined");
1898
2045
 
1899
2046
  // ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
1900
2047
  function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
@@ -1914,7 +2061,7 @@ function copy(target, options = {}) {
1914
2061
  if (isArray2(target)) {
1915
2062
  return target.map((item) => copy(item, options));
1916
2063
  }
1917
- if (!isPlainObject2(target)) {
2064
+ if (!isPlainObject3(target)) {
1918
2065
  return target;
1919
2066
  }
1920
2067
  const props = Object.getOwnPropertyNames(target);
@@ -2021,48 +2168,107 @@ SuperJSON.registerCustom;
2021
2168
  SuperJSON.registerSymbol;
2022
2169
  SuperJSON.allowErrorProps;
2023
2170
 
2024
- // ../../node_modules/.pnpm/@stryke+json@0.9.35/node_modules/@stryke/json/dist/storm-json.mjs
2025
- var c = class o3 extends SuperJSON {
2171
+ // ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/storm-json.mjs
2172
+ var StormJSON = class StormJSON2 extends SuperJSON {
2026
2173
  static {
2027
- __name(this, "o");
2174
+ __name(this, "StormJSON");
2028
2175
  }
2029
- static #e;
2176
+ static #instance;
2030
2177
  static get instance() {
2031
- return o3.#e ||= new o3(), o3.#e;
2178
+ if (!StormJSON2.#instance) StormJSON2.#instance = new StormJSON2();
2179
+ return StormJSON2.#instance;
2032
2180
  }
2033
- static deserialize(e7) {
2034
- return o3.instance.deserialize(e7);
2181
+ /**
2182
+ * Deserialize the given value with superjson using the given metadata
2183
+ */
2184
+ static deserialize(payload) {
2185
+ return StormJSON2.instance.deserialize(payload);
2035
2186
  }
2036
- static serialize(e7) {
2037
- return o3.instance.serialize(e7);
2187
+ /**
2188
+ * Serialize the given value with superjson
2189
+ */
2190
+ static serialize(object) {
2191
+ return StormJSON2.instance.serialize(object);
2038
2192
  }
2039
- static parse(e7) {
2040
- return a2(e7);
2193
+ /**
2194
+ * Parse the given string value with superjson using the given metadata
2195
+ *
2196
+ * @param value - The string value to parse
2197
+ * @returns The parsed data
2198
+ */
2199
+ static parse(value) {
2200
+ return parse(value);
2041
2201
  }
2042
- static stringify(e7, t7) {
2043
- let n6 = o3.instance.customTransformerRegistry.findApplicable(e7), r5 = e7;
2044
- return n6 && n6.isApplicable(e7) && (r5 = n6.serialize(r5)), r4(r5);
2202
+ /**
2203
+ * Serializes the given data to a JSON string.
2204
+ * By default the JSON string is formatted with a 2 space indentation to be easy readable.
2205
+ *
2206
+ * @param value - Object which should be serialized to JSON
2207
+ * @param _options - JSON serialize options
2208
+ * @returns the formatted JSON representation of the object
2209
+ */
2210
+ static stringify(value, _options) {
2211
+ const customTransformer = StormJSON2.instance.customTransformerRegistry.findApplicable(value);
2212
+ let result = value;
2213
+ if (customTransformer && customTransformer.isApplicable(value)) result = customTransformer.serialize(result);
2214
+ return stringify(result);
2045
2215
  }
2046
- static parseJson(e7, t7) {
2216
+ /**
2217
+ * Parses the given JSON string and returns the object the JSON content represents.
2218
+ * By default javascript-style comments and trailing commas are allowed.
2219
+ *
2220
+ * @param strData - JSON content as string
2221
+ * @param options - JSON parse options
2222
+ * @returns Object the JSON content represents
2223
+ */
2224
+ static parseJson(strData, options) {
2047
2225
  try {
2048
- if (t7?.expectComments === false) return o3.instance.parse(e7);
2226
+ if (options?.expectComments === false) return StormJSON2.instance.parse(strData);
2049
2227
  } catch {
2050
2228
  }
2051
- let n6 = [], i3 = parse2(e7, n6, { allowTrailingComma: true, ...t7 });
2052
- if (n6.length > 0 && n6[0]) throw Error(r3(e7, n6[0]));
2053
- return i3;
2229
+ const errors = [];
2230
+ const result = parse3(strData, errors, {
2231
+ allowTrailingComma: true,
2232
+ ...options
2233
+ });
2234
+ if (errors.length > 0 && errors[0]) throw new Error(formatParseError(strData, errors[0]));
2235
+ return result;
2054
2236
  }
2055
- static register(e7, t7, n6, r5) {
2056
- o3.instance.registerCustom({ isApplicable: r5, serialize: t7, deserialize: n6 }, e7);
2237
+ /**
2238
+ * Register a custom schema with superjson
2239
+ *
2240
+ * @param name - The name of the schema
2241
+ * @param serialize - The function to serialize the schema
2242
+ * @param deserialize - The function to deserialize the schema
2243
+ * @param isApplicable - The function to check if the schema is applicable
2244
+ */
2245
+ static register(name, serialize2, deserialize2, isApplicable) {
2246
+ StormJSON2.instance.registerCustom({
2247
+ isApplicable,
2248
+ serialize: serialize2,
2249
+ deserialize: deserialize2
2250
+ }, name);
2057
2251
  }
2058
- static registerClass(n6, r5) {
2059
- o3.instance.registerClass(n6, { identifier: e2(r5) ? r5 : r5?.identifier || n6.name, allowProps: r5 && t3(r5) && r5?.allowProps && Array.isArray(r5.allowProps) ? r5.allowProps : [`__typename`] });
2252
+ /**
2253
+ * Register a class with superjson
2254
+ *
2255
+ * @param classConstructor - The class constructor to register
2256
+ */
2257
+ static registerClass(classConstructor, options) {
2258
+ StormJSON2.instance.registerClass(classConstructor, {
2259
+ identifier: isString(options) ? options : options?.identifier || classConstructor.name,
2260
+ allowProps: options && isObject(options) && options?.allowProps && Array.isArray(options.allowProps) ? options.allowProps : ["__typename"]
2261
+ });
2060
2262
  }
2061
2263
  constructor() {
2062
2264
  super({ dedupe: true });
2063
2265
  }
2064
2266
  };
2065
- c.instance.registerCustom({ isApplicable: /* @__PURE__ */ __name((e7) => Buffer.isBuffer(e7), "isApplicable"), serialize: /* @__PURE__ */ __name((e7) => e7.toString(`base64`), "serialize"), deserialize: /* @__PURE__ */ __name((e7) => Buffer.from(e7, `base64`), "deserialize") }, `Bytes`);
2267
+ StormJSON.instance.registerCustom({
2268
+ isApplicable: /* @__PURE__ */ __name((v) => Buffer.isBuffer(v), "isApplicable"),
2269
+ serialize: /* @__PURE__ */ __name((v) => v.toString("base64"), "serialize"),
2270
+ deserialize: /* @__PURE__ */ __name((v) => Buffer.from(v, "base64"), "deserialize")
2271
+ }, "Bytes");
2066
2272
  function stringifyDefaultValue(property, value) {
2067
2273
  return isSetObject(property) ? stringifyValue(property.type, value ?? property.getDefaultValue()) : stringifyValue({
2068
2274
  kind: property
@@ -2074,14 +2280,14 @@ function stringifyStringValue(value) {
2074
2280
  }
2075
2281
  __name(stringifyStringValue, "stringifyStringValue");
2076
2282
  function stringifyValue(type, value) {
2077
- return isUndefined$1(value) ? "undefined" : isNull$1(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString$1(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(c.stringify(value)) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? c.stringify(value) : type.kind === ReflectionKind.property || type.kind === ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value)?.includes('"') || String(value)?.includes("'") ? stringifyStringValue(value) : String(value);
2283
+ return isUndefined$1(value) ? "undefined" : isNull$1(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString$1(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? StormJSON.stringify(value) : type.kind === ReflectionKind.property || type.kind === ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value)?.includes('"') || String(value)?.includes("'") ? stringifyStringValue(value) : String(value);
2078
2284
  }
2079
2285
  __name(stringifyValue, "stringifyValue");
2080
2286
  function getEnumReflectionType(type) {
2081
2287
  if (type.kind !== ReflectionKind.enum) {
2082
2288
  throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
2083
2289
  }
2084
- const unique = t(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString$1(enumMember) ? {
2290
+ const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString$1(enumMember) ? {
2085
2291
  kind: ReflectionKind.string
2086
2292
  } : {
2087
2293
  kind: ReflectionKind.number
@@ -2098,7 +2304,7 @@ function getEnumReflectionType(type) {
2098
2304
  __name(getEnumReflectionType, "getEnumReflectionType");
2099
2305
  function getUnionTypes(type) {
2100
2306
  if (type.kind === ReflectionKind.union && type.types.length > 0) {
2101
- return t(type.types, (member) => member.kind);
2307
+ return getUniqueBy(type.types, (member) => member.kind);
2102
2308
  }
2103
2309
  throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
2104
2310
  }