@tonyclaw/agent-inspector 3.0.15 → 3.0.17

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 (90) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-UaIxykqz.js → CompareDrawer-Lx-WeJNC.js} +1 -1
  3. package/.output/public/assets/{ProxyViewerContainer-DlpfcX56.js → ProxyViewerContainer-BNehwMI0.js} +31 -31
  4. package/.output/public/assets/{ReplayDialog-BFFomU1m.js → ReplayDialog-CADaXFPE.js} +1 -1
  5. package/.output/public/assets/{RequestAnatomy-DKQJBt_c.js → RequestAnatomy-CGoL8ACh.js} +1 -1
  6. package/.output/public/assets/{ResponseView-D7yotmne.js → ResponseView-BSwM1dCH.js} +2 -2
  7. package/.output/public/assets/{StreamingChunkSequence-Da-6WNFG.js → StreamingChunkSequence-qhWtSx3D.js} +1 -1
  8. package/.output/public/assets/{_sessionId-ByTXLS-w.js → _sessionId-2uq_HB8p.js} +1 -1
  9. package/.output/public/assets/index-BHXN1Fsx.css +1 -0
  10. package/.output/public/assets/{index-BrM8t5mc.js → index-DPc2wzgW.js} +1 -1
  11. package/.output/public/assets/index-T0u1foYL.js +1 -0
  12. package/.output/public/assets/{json-viewer-DyjXQdVu.js → json-viewer-uIwLntt-.js} +1 -1
  13. package/.output/public/assets/{main-Zv_gjZMb.js → main-DuFBHsus.js} +7 -7
  14. package/.output/server/_libs/@opentelemetry/semantic-conventions+[...].mjs +2658 -0
  15. package/.output/server/_libs/agent-base.mjs +234 -0
  16. package/.output/server/_libs/anthropic-ai__sdk.mjs +6042 -0
  17. package/.output/server/_libs/atomically.mjs +3 -0
  18. package/.output/server/_libs/base64-js.mjs +102 -0
  19. package/.output/server/_libs/bignumber.js.mjs +1353 -0
  20. package/.output/server/_libs/buffer-equal-constant-time.mjs +38 -0
  21. package/.output/server/_libs/data-uri-to-buffer.mjs +39 -0
  22. package/.output/server/_libs/debug.mjs +547 -0
  23. package/.output/server/_libs/ecdsa-sig-formatter.mjs +162 -0
  24. package/.output/server/_libs/extend.mjs +2 -1
  25. package/.output/server/_libs/fetch-blob.mjs +287 -0
  26. package/.output/server/_libs/formdata-polyfill.mjs +88 -0
  27. package/.output/server/_libs/gaxios.mjs +927 -0
  28. package/.output/server/_libs/gcp-metadata.mjs +322 -0
  29. package/.output/server/_libs/google-auth-library.mjs +6339 -0
  30. package/.output/server/_libs/google-logging-utils.mjs +385 -0
  31. package/.output/server/_libs/google__genai.mjs +18034 -0
  32. package/.output/server/_libs/has-flag.mjs +16 -0
  33. package/.output/server/_libs/https-proxy-agent.mjs +280 -0
  34. package/.output/server/_libs/json-bigint.mjs +413 -0
  35. package/.output/server/_libs/jwa.mjs +233 -0
  36. package/.output/server/_libs/jws.mjs +298 -0
  37. package/.output/server/_libs/lucide-react.mjs +261 -226
  38. package/.output/server/_libs/mariozechner__pi-agent-core.mjs +824 -0
  39. package/.output/server/_libs/mariozechner__pi-ai.mjs +22889 -0
  40. package/.output/server/_libs/mistralai__mistralai.mjs +32045 -0
  41. package/.output/server/_libs/ms.mjs +120 -0
  42. package/.output/server/_libs/node-domexception.mjs +17 -0
  43. package/.output/server/_libs/node-fetch.mjs +1578 -0
  44. package/.output/server/_libs/ohash.mjs +1 -1
  45. package/.output/server/_libs/openai.mjs +6766 -0
  46. package/.output/server/_libs/opentelemetry__api.mjs +1678 -0
  47. package/.output/server/_libs/p-retry.mjs +87 -0
  48. package/.output/server/_libs/partial-json.mjs +244 -0
  49. package/.output/server/_libs/react-dom.mjs +5 -5
  50. package/.output/server/_libs/react-markdown.mjs +2 -2
  51. package/.output/server/_libs/react.mjs +30 -0
  52. package/.output/server/_libs/readable-stream.mjs +5 -5
  53. package/.output/server/_libs/retry.mjs +236 -0
  54. package/.output/server/_libs/safe-buffer.mjs +63 -1
  55. package/.output/server/_libs/srvx.mjs +2 -2
  56. package/.output/server/_libs/supports-color.mjs +108 -0
  57. package/.output/server/_libs/tanstack__router-core.mjs +1 -1
  58. package/.output/server/_libs/typebox.mjs +6596 -0
  59. package/.output/server/_libs/util-deprecate.mjs +2 -2
  60. package/.output/server/_libs/vfile.mjs +2 -2
  61. package/.output/server/_libs/web-streams-polyfill.mjs +4282 -0
  62. package/.output/server/_libs/ws.mjs +3715 -0
  63. package/.output/server/_libs/zod-to-json-schema.mjs +1207 -0
  64. package/.output/server/_libs/zod.mjs +597 -9
  65. package/.output/server/{_sessionId-GcFhWT0i.mjs → _sessionId-DL2JQJwR.mjs} +14 -13
  66. package/.output/server/_ssr/{CompareDrawer-BV7dw1TN.mjs → CompareDrawer-hPTOTmyU.mjs} +14 -13
  67. package/.output/server/_ssr/{ProxyViewerContainer-CcgfvaS4.mjs → ProxyViewerContainer-k0mFaufl.mjs} +161 -91
  68. package/.output/server/_ssr/{ReplayDialog-B7sBKxIO.mjs → ReplayDialog-t6QdwnZh.mjs} +15 -14
  69. package/.output/server/_ssr/{RequestAnatomy-s_9Veje2.mjs → RequestAnatomy-BnvWxyac.mjs} +14 -13
  70. package/.output/server/_ssr/{ResponseView-DsOFPCvF.mjs → ResponseView-BhhozRRl.mjs} +14 -13
  71. package/.output/server/_ssr/{StreamingChunkSequence-CyA1XtiF.mjs → StreamingChunkSequence-Dl_laTbX.mjs} +14 -13
  72. package/.output/server/_ssr/{index-CDDRt201.mjs → index-D1-t1D8F.mjs} +25 -15
  73. package/.output/server/_ssr/index.mjs +4 -4
  74. package/.output/server/_ssr/{json-viewer-BFV-xtRM.mjs → json-viewer-D5Lh2yBU.mjs} +14 -13
  75. package/.output/server/_ssr/{router-B2Q7vHPM.mjs → router-DaLFEeWW.mjs} +597 -100
  76. package/.output/server/_tanstack-start-manifest_v-DsSiD2gY.mjs +4 -0
  77. package/.output/server/index.mjs +77 -77
  78. package/package.json +4 -1
  79. package/src/components/ProxyViewer.tsx +12 -4
  80. package/src/components/pi-agent/PiAgentPanel.tsx +204 -0
  81. package/src/lib/chunkLoadRecovery.ts +83 -0
  82. package/src/lib/piAgentContract.ts +21 -0
  83. package/src/routes/__root.tsx +6 -3
  84. package/src/routes/api/pi-agent.ts +29 -0
  85. package/src/routes/index.tsx +25 -1
  86. package/src/routes/session/$sessionId.tsx +1 -0
  87. package/src/services/piAgent.ts +390 -0
  88. package/.output/public/assets/index-CGpPRty8.js +0 -1
  89. package/.output/public/assets/index-HRfrFVYw.css +0 -1
  90. package/.output/server/_tanstack-start-manifest_v-Dm_GmuRz.mjs +0 -4
@@ -0,0 +1,16 @@
1
+ var hasFlag;
2
+ var hasRequiredHasFlag;
3
+ function requireHasFlag() {
4
+ if (hasRequiredHasFlag) return hasFlag;
5
+ hasRequiredHasFlag = 1;
6
+ hasFlag = (flag, argv = process.argv) => {
7
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
8
+ const position = argv.indexOf(prefix + flag);
9
+ const terminatorPosition = argv.indexOf("--");
10
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
11
+ };
12
+ return hasFlag;
13
+ }
14
+ export {
15
+ requireHasFlag as r
16
+ };
@@ -0,0 +1,280 @@
1
+ import require$$2 from "assert";
2
+ import require$$0 from "net";
3
+ import require$$4 from "tls";
4
+ import { r as requireSrc } from "./debug.mjs";
5
+ import { r as requireDist$1 } from "./agent-base.mjs";
6
+ import require$$7 from "url";
7
+ function _mergeNamespaces(n, m) {
8
+ for (var i = 0; i < m.length; i++) {
9
+ const e = m[i];
10
+ if (typeof e !== "string" && !Array.isArray(e)) {
11
+ for (const k in e) {
12
+ if (k !== "default" && !(k in n)) {
13
+ const d = Object.getOwnPropertyDescriptor(e, k);
14
+ if (d) {
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function() {
18
+ return e[k];
19
+ }
20
+ });
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ return Object.freeze(n);
27
+ }
28
+ var dist = {};
29
+ var parseProxyResponse = {};
30
+ var hasRequiredParseProxyResponse;
31
+ function requireParseProxyResponse() {
32
+ if (hasRequiredParseProxyResponse) return parseProxyResponse;
33
+ hasRequiredParseProxyResponse = 1;
34
+ var __importDefault = parseProxyResponse && parseProxyResponse.__importDefault || function(mod) {
35
+ return mod && mod.__esModule ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(parseProxyResponse, "__esModule", { value: true });
38
+ parseProxyResponse.parseProxyResponse = void 0;
39
+ const debug_1 = __importDefault(requireSrc());
40
+ const debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
41
+ function parseProxyResponse$1(socket) {
42
+ return new Promise((resolve, reject) => {
43
+ let buffersLength = 0;
44
+ const buffers = [];
45
+ function read() {
46
+ const b = socket.read();
47
+ if (b)
48
+ ondata(b);
49
+ else
50
+ socket.once("readable", read);
51
+ }
52
+ function cleanup() {
53
+ socket.removeListener("end", onend);
54
+ socket.removeListener("error", onerror);
55
+ socket.removeListener("readable", read);
56
+ }
57
+ function onend() {
58
+ cleanup();
59
+ debug("onend");
60
+ reject(new Error("Proxy connection ended before receiving CONNECT response"));
61
+ }
62
+ function onerror(err) {
63
+ cleanup();
64
+ debug("onerror %o", err);
65
+ reject(err);
66
+ }
67
+ function ondata(b) {
68
+ buffers.push(b);
69
+ buffersLength += b.length;
70
+ const buffered = Buffer.concat(buffers, buffersLength);
71
+ const endOfHeaders = buffered.indexOf("\r\n\r\n");
72
+ if (endOfHeaders === -1) {
73
+ debug("have not received end of HTTP headers yet...");
74
+ read();
75
+ return;
76
+ }
77
+ const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
78
+ const firstLine = headerParts.shift();
79
+ if (!firstLine) {
80
+ socket.destroy();
81
+ return reject(new Error("No header received from proxy CONNECT response"));
82
+ }
83
+ const firstLineParts = firstLine.split(" ");
84
+ const statusCode = +firstLineParts[1];
85
+ const statusText = firstLineParts.slice(2).join(" ");
86
+ const headers = {};
87
+ for (const header of headerParts) {
88
+ if (!header)
89
+ continue;
90
+ const firstColon = header.indexOf(":");
91
+ if (firstColon === -1) {
92
+ socket.destroy();
93
+ return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
94
+ }
95
+ const key = header.slice(0, firstColon).toLowerCase();
96
+ const value = header.slice(firstColon + 1).trimStart();
97
+ const current = headers[key];
98
+ if (typeof current === "string") {
99
+ headers[key] = [current, value];
100
+ } else if (Array.isArray(current)) {
101
+ current.push(value);
102
+ } else {
103
+ headers[key] = value;
104
+ }
105
+ }
106
+ debug("got proxy server response: %o %o", firstLine, headers);
107
+ cleanup();
108
+ resolve({
109
+ connect: {
110
+ statusCode,
111
+ statusText,
112
+ headers
113
+ },
114
+ buffered
115
+ });
116
+ }
117
+ socket.on("error", onerror);
118
+ socket.on("end", onend);
119
+ read();
120
+ });
121
+ }
122
+ parseProxyResponse.parseProxyResponse = parseProxyResponse$1;
123
+ return parseProxyResponse;
124
+ }
125
+ var hasRequiredDist;
126
+ function requireDist() {
127
+ if (hasRequiredDist) return dist;
128
+ hasRequiredDist = 1;
129
+ var __createBinding = dist && dist.__createBinding || (Object.create ? (function(o, m, k, k2) {
130
+ if (k2 === void 0) k2 = k;
131
+ var desc = Object.getOwnPropertyDescriptor(m, k);
132
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
133
+ desc = { enumerable: true, get: function() {
134
+ return m[k];
135
+ } };
136
+ }
137
+ Object.defineProperty(o, k2, desc);
138
+ }) : (function(o, m, k, k2) {
139
+ if (k2 === void 0) k2 = k;
140
+ o[k2] = m[k];
141
+ }));
142
+ var __setModuleDefault = dist && dist.__setModuleDefault || (Object.create ? (function(o, v) {
143
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
144
+ }) : function(o, v) {
145
+ o["default"] = v;
146
+ });
147
+ var __importStar = dist && dist.__importStar || function(mod) {
148
+ if (mod && mod.__esModule) return mod;
149
+ var result = {};
150
+ if (mod != null) {
151
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
152
+ }
153
+ __setModuleDefault(result, mod);
154
+ return result;
155
+ };
156
+ var __importDefault = dist && dist.__importDefault || function(mod) {
157
+ return mod && mod.__esModule ? mod : { "default": mod };
158
+ };
159
+ Object.defineProperty(dist, "__esModule", { value: true });
160
+ dist.HttpsProxyAgent = void 0;
161
+ const net = __importStar(require$$0);
162
+ const tls = __importStar(require$$4);
163
+ const assert_1 = __importDefault(require$$2);
164
+ const debug_1 = __importDefault(requireSrc());
165
+ const agent_base_1 = requireDist$1();
166
+ const url_1 = require$$7;
167
+ const parse_proxy_response_1 = requireParseProxyResponse();
168
+ const debug = (0, debug_1.default)("https-proxy-agent");
169
+ const setServernameFromNonIpHost = (options) => {
170
+ if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
171
+ return {
172
+ ...options,
173
+ servername: options.host
174
+ };
175
+ }
176
+ return options;
177
+ };
178
+ class HttpsProxyAgent extends agent_base_1.Agent {
179
+ constructor(proxy, opts) {
180
+ super(opts);
181
+ this.options = { path: void 0 };
182
+ this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
183
+ this.proxyHeaders = opts?.headers ?? {};
184
+ debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
185
+ const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
186
+ const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
187
+ this.connectOpts = {
188
+ // Attempt to negotiate http/1.1 for proxy servers that support http/2
189
+ ALPNProtocols: ["http/1.1"],
190
+ ...opts ? omit(opts, "headers") : null,
191
+ host,
192
+ port
193
+ };
194
+ }
195
+ /**
196
+ * Called when the node-core HTTP client library is creating a
197
+ * new HTTP request.
198
+ */
199
+ async connect(req, opts) {
200
+ const { proxy } = this;
201
+ if (!opts.host) {
202
+ throw new TypeError('No "host" provided');
203
+ }
204
+ let socket;
205
+ if (proxy.protocol === "https:") {
206
+ debug("Creating `tls.Socket`: %o", this.connectOpts);
207
+ socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
208
+ } else {
209
+ debug("Creating `net.Socket`: %o", this.connectOpts);
210
+ socket = net.connect(this.connectOpts);
211
+ }
212
+ const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
213
+ const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
214
+ let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
215
+ `;
216
+ if (proxy.username || proxy.password) {
217
+ const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
218
+ headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
219
+ }
220
+ headers.Host = `${host}:${opts.port}`;
221
+ if (!headers["Proxy-Connection"]) {
222
+ headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
223
+ }
224
+ for (const name of Object.keys(headers)) {
225
+ payload += `${name}: ${headers[name]}\r
226
+ `;
227
+ }
228
+ const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
229
+ socket.write(`${payload}\r
230
+ `);
231
+ const { connect, buffered } = await proxyResponsePromise;
232
+ req.emit("proxyConnect", connect);
233
+ this.emit("proxyConnect", connect, req);
234
+ if (connect.statusCode === 200) {
235
+ req.once("socket", resume);
236
+ if (opts.secureEndpoint) {
237
+ debug("Upgrading socket connection to TLS");
238
+ return tls.connect({
239
+ ...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
240
+ socket
241
+ });
242
+ }
243
+ return socket;
244
+ }
245
+ socket.destroy();
246
+ const fakeSocket = new net.Socket({ writable: false });
247
+ fakeSocket.readable = true;
248
+ req.once("socket", (s) => {
249
+ debug("Replaying proxy buffer for failed request");
250
+ (0, assert_1.default)(s.listenerCount("data") > 0);
251
+ s.push(buffered);
252
+ s.push(null);
253
+ });
254
+ return fakeSocket;
255
+ }
256
+ }
257
+ HttpsProxyAgent.protocols = ["http", "https"];
258
+ dist.HttpsProxyAgent = HttpsProxyAgent;
259
+ function resume(socket) {
260
+ socket.resume();
261
+ }
262
+ function omit(obj, ...keys) {
263
+ const ret = {};
264
+ let key;
265
+ for (key in obj) {
266
+ if (!keys.includes(key)) {
267
+ ret[key] = obj[key];
268
+ }
269
+ }
270
+ return ret;
271
+ }
272
+ return dist;
273
+ }
274
+ var distExports = requireDist();
275
+ const index = /* @__PURE__ */ _mergeNamespaces({
276
+ __proto__: null
277
+ }, [distExports]);
278
+ export {
279
+ index as i
280
+ };
@@ -0,0 +1,413 @@
1
+ import { r as requireBignumber } from "./bignumber.js.mjs";
2
+ var jsonBigint = { exports: {} };
3
+ var stringify = { exports: {} };
4
+ var hasRequiredStringify;
5
+ function requireStringify() {
6
+ if (hasRequiredStringify) return stringify.exports;
7
+ hasRequiredStringify = 1;
8
+ (function(module) {
9
+ var BigNumber = requireBignumber();
10
+ var JSON = module.exports;
11
+ (function() {
12
+ var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = {
13
+ // table of character substitutions
14
+ "\b": "\\b",
15
+ " ": "\\t",
16
+ "\n": "\\n",
17
+ "\f": "\\f",
18
+ "\r": "\\r",
19
+ '"': '\\"',
20
+ "\\": "\\\\"
21
+ }, rep;
22
+ function quote(string) {
23
+ escapable.lastIndex = 0;
24
+ return escapable.test(string) ? '"' + string.replace(escapable, function(a) {
25
+ var c = meta[a];
26
+ return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
27
+ }) + '"' : '"' + string + '"';
28
+ }
29
+ function str(key, holder) {
30
+ var i, k, v, length, mind = gap, partial, value = holder[key], isBigNumber = value != null && (value instanceof BigNumber || BigNumber.isBigNumber(value));
31
+ if (value && typeof value === "object" && typeof value.toJSON === "function") {
32
+ value = value.toJSON(key);
33
+ }
34
+ if (typeof rep === "function") {
35
+ value = rep.call(holder, key, value);
36
+ }
37
+ switch (typeof value) {
38
+ case "string":
39
+ if (isBigNumber) {
40
+ return value;
41
+ } else {
42
+ return quote(value);
43
+ }
44
+ case "number":
45
+ return isFinite(value) ? String(value) : "null";
46
+ case "boolean":
47
+ case "null":
48
+ case "bigint":
49
+ return String(value);
50
+ // If the type is 'object', we might be dealing with an object or an array or
51
+ // null.
52
+ case "object":
53
+ if (!value) {
54
+ return "null";
55
+ }
56
+ gap += indent;
57
+ partial = [];
58
+ if (Object.prototype.toString.apply(value) === "[object Array]") {
59
+ length = value.length;
60
+ for (i = 0; i < length; i += 1) {
61
+ partial[i] = str(i, value) || "null";
62
+ }
63
+ v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
64
+ gap = mind;
65
+ return v;
66
+ }
67
+ if (rep && typeof rep === "object") {
68
+ length = rep.length;
69
+ for (i = 0; i < length; i += 1) {
70
+ if (typeof rep[i] === "string") {
71
+ k = rep[i];
72
+ v = str(k, value);
73
+ if (v) {
74
+ partial.push(quote(k) + (gap ? ": " : ":") + v);
75
+ }
76
+ }
77
+ }
78
+ } else {
79
+ Object.keys(value).forEach(function(k2) {
80
+ var v2 = str(k2, value);
81
+ if (v2) {
82
+ partial.push(quote(k2) + (gap ? ": " : ":") + v2);
83
+ }
84
+ });
85
+ }
86
+ v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
87
+ gap = mind;
88
+ return v;
89
+ }
90
+ }
91
+ if (typeof JSON.stringify !== "function") {
92
+ JSON.stringify = function(value, replacer, space) {
93
+ var i;
94
+ gap = "";
95
+ indent = "";
96
+ if (typeof space === "number") {
97
+ for (i = 0; i < space; i += 1) {
98
+ indent += " ";
99
+ }
100
+ } else if (typeof space === "string") {
101
+ indent = space;
102
+ }
103
+ rep = replacer;
104
+ if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
105
+ throw new Error("JSON.stringify");
106
+ }
107
+ return str("", { "": value });
108
+ };
109
+ }
110
+ })();
111
+ })(stringify);
112
+ return stringify.exports;
113
+ }
114
+ var parse;
115
+ var hasRequiredParse;
116
+ function requireParse() {
117
+ if (hasRequiredParse) return parse;
118
+ hasRequiredParse = 1;
119
+ var BigNumber = null;
120
+ const suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;
121
+ const 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)/;
122
+ var json_parse = function(options) {
123
+ var _options = {
124
+ strict: false,
125
+ // not being strict means do not generate syntax errors for "duplicate key"
126
+ storeAsString: false,
127
+ // toggles whether the values should be stored as BigNumber (default) or a string
128
+ alwaysParseAsBig: false,
129
+ // toggles whether all numbers should be Big
130
+ useNativeBigInt: false,
131
+ // toggles whether to use native BigInt instead of bignumber.js
132
+ protoAction: "error",
133
+ constructorAction: "error"
134
+ };
135
+ if (options !== void 0 && options !== null) {
136
+ if (options.strict === true) {
137
+ _options.strict = true;
138
+ }
139
+ if (options.storeAsString === true) {
140
+ _options.storeAsString = true;
141
+ }
142
+ _options.alwaysParseAsBig = options.alwaysParseAsBig === true ? options.alwaysParseAsBig : false;
143
+ _options.useNativeBigInt = options.useNativeBigInt === true ? options.useNativeBigInt : false;
144
+ if (typeof options.constructorAction !== "undefined") {
145
+ if (options.constructorAction === "error" || options.constructorAction === "ignore" || options.constructorAction === "preserve") {
146
+ _options.constructorAction = options.constructorAction;
147
+ } else {
148
+ throw new Error(
149
+ `Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${options.constructorAction}`
150
+ );
151
+ }
152
+ }
153
+ if (typeof options.protoAction !== "undefined") {
154
+ if (options.protoAction === "error" || options.protoAction === "ignore" || options.protoAction === "preserve") {
155
+ _options.protoAction = options.protoAction;
156
+ } else {
157
+ throw new Error(
158
+ `Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${options.protoAction}`
159
+ );
160
+ }
161
+ }
162
+ }
163
+ var at, ch, escapee = {
164
+ '"': '"',
165
+ "\\": "\\",
166
+ "/": "/",
167
+ b: "\b",
168
+ f: "\f",
169
+ n: "\n",
170
+ r: "\r",
171
+ t: " "
172
+ }, text, error = function(m) {
173
+ throw {
174
+ name: "SyntaxError",
175
+ message: m,
176
+ at,
177
+ text
178
+ };
179
+ }, next = function(c) {
180
+ if (c && c !== ch) {
181
+ error("Expected '" + c + "' instead of '" + ch + "'");
182
+ }
183
+ ch = text.charAt(at);
184
+ at += 1;
185
+ return ch;
186
+ }, number = function() {
187
+ var number2, string2 = "";
188
+ if (ch === "-") {
189
+ string2 = "-";
190
+ next("-");
191
+ }
192
+ while (ch >= "0" && ch <= "9") {
193
+ string2 += ch;
194
+ next();
195
+ }
196
+ if (ch === ".") {
197
+ string2 += ".";
198
+ while (next() && ch >= "0" && ch <= "9") {
199
+ string2 += ch;
200
+ }
201
+ }
202
+ if (ch === "e" || ch === "E") {
203
+ string2 += ch;
204
+ next();
205
+ if (ch === "-" || ch === "+") {
206
+ string2 += ch;
207
+ next();
208
+ }
209
+ while (ch >= "0" && ch <= "9") {
210
+ string2 += ch;
211
+ next();
212
+ }
213
+ }
214
+ number2 = +string2;
215
+ if (!isFinite(number2)) {
216
+ error("Bad number");
217
+ } else {
218
+ if (BigNumber == null) BigNumber = requireBignumber();
219
+ if (string2.length > 15)
220
+ return _options.storeAsString ? string2 : _options.useNativeBigInt ? BigInt(string2) : new BigNumber(string2);
221
+ else
222
+ return !_options.alwaysParseAsBig ? number2 : _options.useNativeBigInt ? BigInt(number2) : new BigNumber(number2);
223
+ }
224
+ }, string = function() {
225
+ var hex, i, string2 = "", uffff;
226
+ if (ch === '"') {
227
+ var startAt = at;
228
+ while (next()) {
229
+ if (ch === '"') {
230
+ if (at - 1 > startAt) string2 += text.substring(startAt, at - 1);
231
+ next();
232
+ return string2;
233
+ }
234
+ if (ch === "\\") {
235
+ if (at - 1 > startAt) string2 += text.substring(startAt, at - 1);
236
+ next();
237
+ if (ch === "u") {
238
+ uffff = 0;
239
+ for (i = 0; i < 4; i += 1) {
240
+ hex = parseInt(next(), 16);
241
+ if (!isFinite(hex)) {
242
+ break;
243
+ }
244
+ uffff = uffff * 16 + hex;
245
+ }
246
+ string2 += String.fromCharCode(uffff);
247
+ } else if (typeof escapee[ch] === "string") {
248
+ string2 += escapee[ch];
249
+ } else {
250
+ break;
251
+ }
252
+ startAt = at;
253
+ }
254
+ }
255
+ }
256
+ error("Bad string");
257
+ }, white = function() {
258
+ while (ch && ch <= " ") {
259
+ next();
260
+ }
261
+ }, word = function() {
262
+ switch (ch) {
263
+ case "t":
264
+ next("t");
265
+ next("r");
266
+ next("u");
267
+ next("e");
268
+ return true;
269
+ case "f":
270
+ next("f");
271
+ next("a");
272
+ next("l");
273
+ next("s");
274
+ next("e");
275
+ return false;
276
+ case "n":
277
+ next("n");
278
+ next("u");
279
+ next("l");
280
+ next("l");
281
+ return null;
282
+ }
283
+ error("Unexpected '" + ch + "'");
284
+ }, value, array = function() {
285
+ var array2 = [];
286
+ if (ch === "[") {
287
+ next("[");
288
+ white();
289
+ if (ch === "]") {
290
+ next("]");
291
+ return array2;
292
+ }
293
+ while (ch) {
294
+ array2.push(value());
295
+ white();
296
+ if (ch === "]") {
297
+ next("]");
298
+ return array2;
299
+ }
300
+ next(",");
301
+ white();
302
+ }
303
+ }
304
+ error("Bad array");
305
+ }, object = function() {
306
+ var key, object2 = /* @__PURE__ */ Object.create(null);
307
+ if (ch === "{") {
308
+ next("{");
309
+ white();
310
+ if (ch === "}") {
311
+ next("}");
312
+ return object2;
313
+ }
314
+ while (ch) {
315
+ key = string();
316
+ white();
317
+ next(":");
318
+ if (_options.strict === true && Object.hasOwnProperty.call(object2, key)) {
319
+ error('Duplicate key "' + key + '"');
320
+ }
321
+ if (suspectProtoRx.test(key) === true) {
322
+ if (_options.protoAction === "error") {
323
+ error("Object contains forbidden prototype property");
324
+ } else if (_options.protoAction === "ignore") {
325
+ value();
326
+ } else {
327
+ object2[key] = value();
328
+ }
329
+ } else if (suspectConstructorRx.test(key) === true) {
330
+ if (_options.constructorAction === "error") {
331
+ error("Object contains forbidden constructor property");
332
+ } else if (_options.constructorAction === "ignore") {
333
+ value();
334
+ } else {
335
+ object2[key] = value();
336
+ }
337
+ } else {
338
+ object2[key] = value();
339
+ }
340
+ white();
341
+ if (ch === "}") {
342
+ next("}");
343
+ return object2;
344
+ }
345
+ next(",");
346
+ white();
347
+ }
348
+ }
349
+ error("Bad object");
350
+ };
351
+ value = function() {
352
+ white();
353
+ switch (ch) {
354
+ case "{":
355
+ return object();
356
+ case "[":
357
+ return array();
358
+ case '"':
359
+ return string();
360
+ case "-":
361
+ return number();
362
+ default:
363
+ return ch >= "0" && ch <= "9" ? number() : word();
364
+ }
365
+ };
366
+ return function(source, reviver) {
367
+ var result;
368
+ text = source + "";
369
+ at = 0;
370
+ ch = " ";
371
+ result = value();
372
+ white();
373
+ if (ch) {
374
+ error("Syntax error");
375
+ }
376
+ return typeof reviver === "function" ? (function walk(holder, key) {
377
+ var v, value2 = holder[key];
378
+ if (value2 && typeof value2 === "object") {
379
+ Object.keys(value2).forEach(function(k) {
380
+ v = walk(value2, k);
381
+ if (v !== void 0) {
382
+ value2[k] = v;
383
+ } else {
384
+ delete value2[k];
385
+ }
386
+ });
387
+ }
388
+ return reviver.call(holder, key, value2);
389
+ })({ "": result }, "") : result;
390
+ };
391
+ };
392
+ parse = json_parse;
393
+ return parse;
394
+ }
395
+ var hasRequiredJsonBigint;
396
+ function requireJsonBigint() {
397
+ if (hasRequiredJsonBigint) return jsonBigint.exports;
398
+ hasRequiredJsonBigint = 1;
399
+ var json_stringify = requireStringify().stringify;
400
+ var json_parse = requireParse();
401
+ jsonBigint.exports = function(options) {
402
+ return {
403
+ parse: json_parse(options),
404
+ stringify: json_stringify
405
+ };
406
+ };
407
+ jsonBigint.exports.parse = json_parse();
408
+ jsonBigint.exports.stringify = json_stringify;
409
+ return jsonBigint.exports;
410
+ }
411
+ export {
412
+ requireJsonBigint as r
413
+ };