@xyo-network/sdk-protocol 7.4.2 → 8.0.0

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.
@@ -1,79 +1,6 @@
1
1
  "use strict";
2
2
  (() => {
3
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
4
- var _a;
5
- // @__NO_SIDE_EFFECTS__
6
- function $constructor(name, initializer2, params) {
7
- function init(inst, def) {
8
- if (!inst._zod) {
9
- Object.defineProperty(inst, "_zod", {
10
- value: {
11
- def,
12
- constr: _,
13
- traits: /* @__PURE__ */ new Set()
14
- },
15
- enumerable: false
16
- });
17
- }
18
- if (inst._zod.traits.has(name)) {
19
- return;
20
- }
21
- inst._zod.traits.add(name);
22
- initializer2(inst, def);
23
- const proto = _.prototype;
24
- const keys = Object.keys(proto);
25
- for (let i = 0; i < keys.length; i++) {
26
- const k = keys[i];
27
- if (!(k in inst)) {
28
- inst[k] = proto[k].bind(inst);
29
- }
30
- }
31
- }
32
- const Parent = params?.Parent ?? Object;
33
- class Definition extends Parent {
34
- }
35
- Object.defineProperty(Definition, "name", { value: name });
36
- function _(def) {
37
- var _a3;
38
- const inst = params?.Parent ? new Definition() : this;
39
- init(inst, def);
40
- (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
41
- for (const fn of inst._zod.deferred) {
42
- fn();
43
- }
44
- return inst;
45
- }
46
- Object.defineProperty(_, "init", { value: init });
47
- Object.defineProperty(_, Symbol.hasInstance, {
48
- value: (inst) => {
49
- if (params?.Parent && inst instanceof params.Parent)
50
- return true;
51
- return inst?._zod?.traits?.has(name);
52
- }
53
- });
54
- Object.defineProperty(_, "name", { value: name });
55
- return _;
56
- }
57
- var $ZodAsyncError = class extends Error {
58
- constructor() {
59
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
60
- }
61
- };
62
- var $ZodEncodeError = class extends Error {
63
- constructor(name) {
64
- super(`Encountered unidirectional transform during encode: ${name}`);
65
- this.name = "ZodEncodeError";
66
- }
67
- };
68
- (_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
69
- var globalConfig = globalThis.__zod_globalConfig;
70
- function config(newConfig) {
71
- if (newConfig)
72
- Object.assign(globalConfig, newConfig);
73
- return globalConfig;
74
- }
75
-
76
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
3
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
77
4
  function jsonStringifyReplacer(_, value) {
78
5
  if (typeof value === "bigint")
79
6
  return value.toString();
@@ -150,13 +77,6 @@
150
77
  return { ...params, error: () => params.error };
151
78
  return params;
152
79
  }
153
- var NUMBER_FORMAT_RANGES = {
154
- safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
155
- int32: [-2147483648, 2147483647],
156
- uint32: [0, 4294967295],
157
- float32: [-34028234663852886e22, 34028234663852886e22],
158
- float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
159
- };
160
80
  function aborted(x, startIndex = 0) {
161
81
  if (x.aborted === true)
162
82
  return true;
@@ -188,15 +108,35 @@
188
108
  function unwrapMessage(message) {
189
109
  return typeof message === "string" ? message : message?.message;
190
110
  }
111
+ function attachSchema(issues, start, inst) {
112
+ var _a3;
113
+ for (let i = start; i < issues.length; i++) {
114
+ (_a3 = issues[i]).schema ?? (_a3.schema = inst);
115
+ }
116
+ }
191
117
  function finalizeIssue(iss, ctx, config2) {
192
- const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
193
- const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
194
- rest.path ?? (rest.path = []);
195
- rest.message = message;
118
+ var _a3;
119
+ const traits = iss.inst?._zod?.traits;
120
+ if (traits?.has("$ZodType")) {
121
+ if (traits.has("$ZodCheck"))
122
+ (_a3 = iss).schema ?? (_a3.schema = iss.inst);
123
+ else
124
+ iss.schema = iss.inst;
125
+ }
126
+ const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
127
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
128
+ const full = {};
129
+ for (const k of Object.keys(iss)) {
130
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
131
+ continue;
132
+ full[k] = iss[k];
133
+ }
134
+ full.path ?? (full.path = []);
135
+ full.message = message;
196
136
  if (ctx?.reportInput) {
197
- rest.input = _input;
137
+ full.input = iss.input;
198
138
  }
199
- return rest;
139
+ return full;
200
140
  }
201
141
  function issue(...args) {
202
142
  const [iss, input, inst] = args;
@@ -210,53 +150,270 @@
210
150
  }
211
151
  return { ...iss };
212
152
  }
213
-
214
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
215
- var initializer = (inst, def) => {
216
- inst.name = "$ZodError";
217
- Object.defineProperty(inst, "_zod", {
218
- value: inst._zod,
219
- enumerable: false
153
+ function members(proto, table) {
154
+ for (const key in table) {
155
+ const desc = Object.getOwnPropertyDescriptor(table, key);
156
+ if (desc.get)
157
+ Object.defineProperty(proto, key, { ...desc, enumerable: false });
158
+ else
159
+ defineBound(proto, key, desc.value);
160
+ }
161
+ }
162
+ function own(inst, key, value, enumerable = true) {
163
+ Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
164
+ return value;
165
+ }
166
+ function hide(inst, key, value) {
167
+ return own(inst, key, value, false);
168
+ }
169
+ function defineBound(proto, key, fn) {
170
+ Object.defineProperty(proto, key, {
171
+ configurable: true,
172
+ get() {
173
+ return this == null ? fn : own(this, key, fn.bind(this));
174
+ },
175
+ set(value) {
176
+ own(this, key, value);
177
+ }
220
178
  });
221
- Object.defineProperty(inst, "issues", {
222
- value: def,
223
- enumerable: false
179
+ }
180
+ var installing;
181
+ var broke = false;
182
+ var breaker = {
183
+ configurable: true,
184
+ get() {
185
+ broke = true;
186
+ return void 0;
187
+ }
188
+ };
189
+ function defineLazyInternal(inst, key, compute) {
190
+ const proto = Object.getPrototypeOf(inst._zod);
191
+ if (key in proto && installing !== inst._zod) {
192
+ installing = void 0;
193
+ return;
194
+ }
195
+ installing = inst._zod;
196
+ Object.defineProperty(proto, key, {
197
+ configurable: true,
198
+ get() {
199
+ Object.defineProperty(this, key, breaker);
200
+ const outer = broke;
201
+ broke = false;
202
+ try {
203
+ const value = compute(this);
204
+ if (broke)
205
+ delete this[key];
206
+ else
207
+ Object.defineProperty(this, key, { configurable: true, writable: true, value });
208
+ broke = broke || outer;
209
+ return value;
210
+ } catch (err) {
211
+ delete this[key];
212
+ broke = broke || outer;
213
+ throw err;
214
+ }
215
+ },
216
+ set(value) {
217
+ Object.defineProperty(this, key, { configurable: true, writable: true, value });
218
+ }
224
219
  });
225
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
226
- Object.defineProperty(inst, "toString", {
227
- value: () => inst.message,
228
- enumerable: false
220
+ }
221
+
222
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
223
+ var _a;
224
+ var _zodDesc = { value: void 0, enumerable: false };
225
+ var _E = "captureStackTrace" in Error ? Error : null;
226
+ function newError(Definition) {
227
+ const E = _E;
228
+ if (E) {
229
+ const saved = E.stackTraceLimit;
230
+ if (typeof saved === "number") {
231
+ try {
232
+ E.stackTraceLimit = 0;
233
+ } catch {
234
+ _E = null;
235
+ return new Definition();
236
+ }
237
+ try {
238
+ return new Definition();
239
+ } finally {
240
+ E.stackTraceLimit = saved;
241
+ }
242
+ }
243
+ }
244
+ return new Definition();
245
+ }
246
+ // @__NO_SIDE_EFFECTS__
247
+ function $constructor(name, initializer2, proto, params) {
248
+ const zodProto = {};
249
+ function Internals(def) {
250
+ this.def = def;
251
+ this.constr = _;
252
+ this.traits = /* @__PURE__ */ new Set();
253
+ }
254
+ Internals.prototype = zodProto;
255
+ const protoMembers = proto;
256
+ const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
257
+ function init(inst, def) {
258
+ if (!inst._zod) {
259
+ _zodDesc.value = new Internals(def);
260
+ try {
261
+ Object.defineProperty(inst, "_zod", _zodDesc);
262
+ } finally {
263
+ _zodDesc.value = void 0;
264
+ }
265
+ } else if (inst._zod.traits.has(name)) {
266
+ return;
267
+ }
268
+ inst._zod.traits.add(name);
269
+ initializer2(inst, def);
270
+ if (initialized) {
271
+ const own2 = Object.getPrototypeOf(inst);
272
+ const ctorProto = inst._zod.constr.prototype;
273
+ let up = own2;
274
+ while (up && up !== ctorProto)
275
+ up = Object.getPrototypeOf(up);
276
+ const target = up ?? own2;
277
+ if (!initialized.has(target)) {
278
+ initialized.add(target);
279
+ members(target, protoMembers);
280
+ }
281
+ }
282
+ const proto2 = _.prototype;
283
+ for (const k in proto2) {
284
+ if (!Object.prototype.hasOwnProperty.call(proto2, k))
285
+ continue;
286
+ if (!(k in inst)) {
287
+ inst[k] = proto2[k].bind(inst);
288
+ }
289
+ }
290
+ }
291
+ const Parent = params?.Parent ?? Object;
292
+ class Definition extends Parent {
293
+ }
294
+ Object.defineProperty(Definition, "name", { value: name });
295
+ function _(def) {
296
+ const inst = params?.Parent ? newError(Definition) : this;
297
+ init(inst, def);
298
+ const deferred = inst._zod.deferred;
299
+ if (deferred) {
300
+ for (const fn of deferred) {
301
+ fn();
302
+ }
303
+ inst._zod.deferred = void 0;
304
+ }
305
+ const pp = globalThis.__zod_globalConfig?.postProcessor;
306
+ if (pp)
307
+ pp(inst);
308
+ return inst;
309
+ }
310
+ Object.defineProperty(_, "init", { value: init });
311
+ Object.defineProperty(_, Symbol.hasInstance, {
312
+ value: (inst) => {
313
+ if (params?.Parent && inst instanceof params.Parent)
314
+ return true;
315
+ return inst?._zod?.traits?.has(name);
316
+ }
229
317
  });
318
+ Object.defineProperty(_, "name", { value: name });
319
+ return _;
320
+ }
321
+ var $ZodAsyncError = class extends Error {
322
+ constructor() {
323
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
324
+ }
230
325
  };
231
- var $ZodError = $constructor("$ZodError", initializer);
232
- var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
233
-
234
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
235
- var _parse = (_Err) => (schema, value, _ctx, _params) => {
236
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
237
- const result = schema._zod.run({ value, issues: [] }, ctx);
238
- if (result instanceof Promise) {
239
- throw new $ZodAsyncError();
326
+ var $ZodEncodeError = class extends Error {
327
+ constructor(name) {
328
+ super(`Encountered unidirectional transform during encode: ${name}`);
329
+ this.name = "ZodEncodeError";
240
330
  }
241
- if (result.issues.length) {
242
- const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
243
- captureStackTrace(e, _params?.callee);
244
- throw e;
331
+ };
332
+ (_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
333
+ var globalConfig = globalThis.__zod_globalConfig;
334
+ function config(newConfig) {
335
+ if (newConfig)
336
+ Object.assign(globalConfig, newConfig);
337
+ return globalConfig;
338
+ }
339
+
340
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
341
+ function _getMessage() {
342
+ const internals = this._zod;
343
+ internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
344
+ return internals.message;
345
+ }
346
+ function _setMessage(value) {
347
+ this._zod.message = value;
348
+ }
349
+ var _messageDesc = {
350
+ get: _getMessage,
351
+ set: _setMessage,
352
+ enumerable: true,
353
+ configurable: true
354
+ };
355
+ var _issuesDesc = { value: void 0, enumerable: false };
356
+ var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
357
+ var initializer = (inst, def) => {
358
+ inst.name = "$ZodError";
359
+ _issuesDesc.value = def;
360
+ Object.defineProperty(inst, "issues", _issuesDesc);
361
+ _issuesDesc.value = void 0;
362
+ Object.defineProperty(inst, "message", _messageDesc);
363
+ const proto = Object.getPrototypeOf(inst);
364
+ if (!_installedToString.has(proto)) {
365
+ _installedToString.add(proto);
366
+ Object.defineProperty(proto, "toString", {
367
+ configurable: true,
368
+ enumerable: false,
369
+ get() {
370
+ const value = () => this.message;
371
+ Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
372
+ return value;
373
+ },
374
+ set(value) {
375
+ Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
376
+ }
377
+ });
245
378
  }
246
- return result.value;
379
+ };
380
+ var $ZodError = $constructor("$ZodError", initializer);
381
+ var $ZodRealError = $constructor("$ZodError", initializer, void 0, {
382
+ Parent: Error
383
+ });
384
+
385
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
386
+ var _parse = (_Err) => {
387
+ const fn = (schema, value, _ctx, _params) => {
388
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
389
+ const result = schema._zod.run({ value, issues: [] }, ctx);
390
+ if (result instanceof Promise) {
391
+ throw new $ZodAsyncError();
392
+ }
393
+ if (result.issues.length) {
394
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
395
+ captureStackTrace(e, _params?.callee ?? fn);
396
+ throw e;
397
+ }
398
+ return result.value;
399
+ };
400
+ return fn;
247
401
  };
248
402
  var parse = /* @__PURE__ */ _parse($ZodRealError);
249
- var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
250
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
251
- let result = schema._zod.run({ value, issues: [] }, ctx);
252
- if (result instanceof Promise)
253
- result = await result;
254
- if (result.issues.length) {
255
- const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
256
- captureStackTrace(e, params?.callee);
257
- throw e;
258
- }
259
- return result.value;
403
+ var _parseAsync = (_Err) => {
404
+ const fn = async (schema, value, _ctx, params) => {
405
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
406
+ let result = schema._zod.run({ value, issues: [] }, ctx);
407
+ if (result instanceof Promise)
408
+ result = await result;
409
+ if (result.issues.length) {
410
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
411
+ captureStackTrace(e, params?.callee ?? fn);
412
+ throw e;
413
+ }
414
+ return result.value;
415
+ };
416
+ return fn;
260
417
  };
261
418
  var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
262
419
  var _safeParse = (_Err) => (schema, value, _ctx) => {
@@ -265,37 +422,45 @@
265
422
  if (result instanceof Promise) {
266
423
  throw new $ZodAsyncError();
267
424
  }
268
- return result.issues.length ? {
269
- success: false,
270
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
271
- } : { success: true, data: result.value };
425
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
272
426
  };
273
427
  var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
428
+ function failure(Err, issues, ctx) {
429
+ let error;
430
+ return {
431
+ success: false,
432
+ get error() {
433
+ if (!error) {
434
+ error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
435
+ issues = void 0;
436
+ ctx = void 0;
437
+ }
438
+ return error;
439
+ },
440
+ set error(e) {
441
+ error = e;
442
+ issues = void 0;
443
+ ctx = void 0;
444
+ }
445
+ };
446
+ }
274
447
  var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
275
448
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
276
449
  let result = schema._zod.run({ value, issues: [] }, ctx);
277
450
  if (result instanceof Promise)
278
451
  result = await result;
279
- return result.issues.length ? {
280
- success: false,
281
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
282
- } : { success: true, data: result.value };
452
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
283
453
  };
284
454
  var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
285
455
 
286
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
287
- var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
288
- var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
289
- var string = (params) => {
290
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
291
- return new RegExp(`^${regex}$`);
292
- };
456
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
457
+ var anyString = /^[\s\S]{0,}$/;
293
458
  var bigint = /^-?\d+n?$/;
294
459
  var number = /^-?\d+(?:\.\d+)?$/;
295
460
  var boolean = /^(?:true|false)$/i;
296
461
  var _null = /^null$/i;
297
462
 
298
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
463
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
299
464
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
300
465
  var _a3;
301
466
  inst._zod ?? (inst._zod = {});
@@ -310,22 +475,12 @@
310
475
  var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
311
476
  $ZodCheck.init(inst, def);
312
477
  const origin = numericOriginMap[typeof def.value];
313
- inst._zod.onattach.push((inst2) => {
314
- const bag = inst2._zod.bag;
315
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
316
- if (def.value > curr) {
317
- if (def.inclusive)
318
- bag.minimum = def.value;
319
- else
320
- bag.exclusiveMinimum = def.value;
321
- }
322
- });
323
478
  inst._zod.check = (payload) => {
324
479
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
325
480
  return;
326
481
  }
327
482
  payload.issues.push({
328
- origin,
483
+ origin: numericOriginMap[typeof payload.value] ?? origin,
329
484
  code: "too_small",
330
485
  minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
331
486
  input: payload.value,
@@ -338,14 +493,6 @@
338
493
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
339
494
  var _a3, _b;
340
495
  $ZodCheck.init(inst, def);
341
- inst._zod.onattach.push((inst2) => {
342
- const bag = inst2._zod.bag;
343
- bag.format = def.format;
344
- if (def.pattern) {
345
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
346
- bag.patterns.add(def.pattern);
347
- }
348
- });
349
496
  if (def.pattern)
350
497
  (_a3 = inst._zod).check ?? (_a3.check = (payload) => {
351
498
  def.pattern.lastIndex = 0;
@@ -383,24 +530,22 @@
383
530
  };
384
531
  });
385
532
 
386
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
533
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
387
534
  var version = {
388
535
  major: 4,
389
- minor: 4,
390
- patch: 3
536
+ minor: 6,
537
+ patch: 5
391
538
  };
392
539
 
393
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
540
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
394
541
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
395
542
  var _a3;
396
543
  inst ?? (inst = {});
397
544
  inst._zod.def = def;
398
545
  inst._zod.bag = inst._zod.bag || {};
399
546
  inst._zod.version = version;
400
- const checks = [...inst._zod.def.checks ?? []];
401
- if (inst._zod.traits.has("$ZodCheck")) {
402
- checks.unshift(inst);
403
- }
547
+ const defChecks = inst._zod.def.checks;
548
+ const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
404
549
  for (const ch of checks) {
405
550
  for (const fn of ch._zod.onattach) {
406
551
  fn(inst);
@@ -413,6 +558,8 @@
413
558
  });
414
559
  } else {
415
560
  const runChecks = (payload, checks2, ctx) => {
561
+ if (payload.memo)
562
+ return payload;
416
563
  let isAborted = aborted(payload);
417
564
  let asyncResult;
418
565
  for (const ch of checks2) {
@@ -436,6 +583,7 @@
436
583
  const nextLen = payload.issues.length;
437
584
  if (nextLen === currLen)
438
585
  return;
586
+ attachSchema(payload.issues, currLen, inst);
439
587
  if (!isAborted)
440
588
  isAborted = aborted(payload, currLen);
441
589
  });
@@ -443,6 +591,7 @@
443
591
  const nextLen = payload.issues.length;
444
592
  if (nextLen === currLen)
445
593
  continue;
594
+ attachSchema(payload.issues, currLen, inst);
446
595
  if (!isAborted)
447
596
  isAborted = aborted(payload, currLen);
448
597
  }
@@ -489,22 +638,39 @@
489
638
  return runChecks(result, checks, ctx);
490
639
  };
491
640
  }
492
- defineLazy(inst, "~standard", () => ({
641
+ }, {
642
+ // Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
643
+ get "~standard"() {
644
+ return hide(this, "~standard", standardProps(this));
645
+ },
646
+ set "~standard"(value) {
647
+ own(this, "~standard", value);
648
+ }
649
+ });
650
+ var toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
651
+ async function validateAsync(inst, value) {
652
+ const ctx = { async: true };
653
+ return toStandardResult(await inst._zod.run({ value, issues: [] }, ctx), ctx);
654
+ }
655
+ function standardProps(inst) {
656
+ return {
493
657
  validate: (value) => {
658
+ const ctx = { async: false };
494
659
  try {
495
- const r = safeParse(inst, value);
496
- return r.success ? { value: r.data } : { issues: r.error?.issues };
660
+ const r = inst._zod.run({ value, issues: [] }, ctx);
661
+ if (!(r instanceof Promise))
662
+ return toStandardResult(r, ctx);
497
663
  } catch (_) {
498
- return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
499
664
  }
665
+ return validateAsync(inst, value);
500
666
  },
501
667
  vendor: "zod",
502
668
  version: 1
503
- }));
504
- });
669
+ };
670
+ }
505
671
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
506
672
  $ZodType.init(inst, def);
507
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
673
+ inst._zod.pattern = def.pattern ?? anyString;
508
674
  inst._zod.parse = (payload, _) => {
509
675
  if (def.coerce)
510
676
  try {
@@ -524,7 +690,7 @@
524
690
  });
525
691
  var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
526
692
  $ZodType.init(inst, def);
527
- inst._zod.pattern = inst._zod.bag.pattern ?? number;
693
+ inst._zod.pattern = number;
528
694
  inst._zod.parse = (payload, _ctx) => {
529
695
  if (def.coerce)
530
696
  try {
@@ -535,7 +701,7 @@
535
701
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
536
702
  return payload;
537
703
  }
538
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
704
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
539
705
  payload.issues.push({
540
706
  expected: "number",
541
707
  code: "invalid_type",
@@ -612,6 +778,8 @@
612
778
  }
613
779
  var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
614
780
  $ZodType.init(inst, def);
781
+ const memo = globalConfig.memoizer;
782
+ memo?.attach(inst);
615
783
  inst._zod.parse = (payload, ctx) => {
616
784
  const input = payload.value;
617
785
  if (!Array.isArray(input)) {
@@ -623,8 +791,9 @@
623
791
  });
624
792
  return payload;
625
793
  }
626
- payload.value = Array(input.length);
794
+ payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
627
795
  const proms = [];
796
+ const abortEarly = ctx?.abortEarly;
628
797
  for (let i = 0; i < input.length; i++) {
629
798
  const item = input[i];
630
799
  const result = def.element._zod.run({
@@ -635,6 +804,8 @@
635
804
  proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
636
805
  } else {
637
806
  handleArrayResult(result, payload, i);
807
+ if (abortEarly && result.issues.length !== 0 && aborted(result))
808
+ break;
638
809
  }
639
810
  }
640
811
  if (proms.length) {
@@ -665,17 +836,17 @@
665
836
  }
666
837
  var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
667
838
  $ZodType.init(inst, def);
668
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
669
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
670
- defineLazy(inst._zod, "values", () => {
671
- if (def.options.every((o) => o._zod.values)) {
672
- return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
839
+ defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0);
840
+ defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
841
+ defineLazyInternal(inst, "values", (zod) => {
842
+ if (zod.def.options.every((o) => o._zod.values)) {
843
+ return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
673
844
  }
674
845
  return void 0;
675
846
  });
676
- defineLazy(inst._zod, "pattern", () => {
677
- if (def.options.every((o) => o._zod.pattern)) {
678
- const patterns = def.options.map((o) => o._zod.pattern);
847
+ defineLazyInternal(inst, "pattern", (zod) => {
848
+ if (zod.def.options.every((o) => o._zod.pattern)) {
849
+ const patterns = zod.def.options.map((o) => o._zod.pattern);
679
850
  return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
680
851
  }
681
852
  return void 0;
@@ -710,6 +881,8 @@
710
881
  });
711
882
  var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
712
883
  $ZodType.init(inst, def);
884
+ const memo = globalConfig.memoizer;
885
+ memo?.attach(inst);
713
886
  inst._zod.parse = (payload, ctx) => {
714
887
  const input = payload.value;
715
888
  if (!isPlainObject(input)) {
@@ -723,12 +896,14 @@
723
896
  }
724
897
  const proms = [];
725
898
  const values = def.keyType._zod.values;
726
- if (values) {
727
- payload.value = {};
899
+ if (values && !def.partial) {
900
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
728
901
  const recordKeys = /* @__PURE__ */ new Set();
729
902
  for (const key of values) {
730
903
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
731
904
  recordKeys.add(typeof key === "number" ? key.toString() : key);
905
+ if (key === "__proto__")
906
+ continue;
732
907
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
733
908
  if (keyResult instanceof Promise) {
734
909
  throw new Error("Async schemas not supported in object keys currently");
@@ -745,6 +920,8 @@
745
920
  continue;
746
921
  }
747
922
  const outKey = keyResult.value;
923
+ if (outKey === "__proto__")
924
+ continue;
748
925
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
749
926
  if (result instanceof Promise) {
750
927
  proms.push(result.then((result2) => {
@@ -764,8 +941,14 @@
764
941
  let unrecognized;
765
942
  for (const key in input) {
766
943
  if (!recordKeys.has(key)) {
767
- unrecognized = unrecognized ?? [];
768
- unrecognized.push(key);
944
+ if (def.mode === "loose") {
945
+ if (key === "__proto__")
946
+ continue;
947
+ payload.value[key] = input[key];
948
+ } else {
949
+ unrecognized = unrecognized ?? [];
950
+ unrecognized.push(key);
951
+ }
769
952
  }
770
953
  }
771
954
  if (unrecognized && unrecognized.length > 0) {
@@ -773,11 +956,13 @@
773
956
  code: "unrecognized_keys",
774
957
  input,
775
958
  inst,
776
- keys: unrecognized
959
+ keys: unrecognized,
960
+ continue: true
777
961
  });
778
962
  }
779
963
  } else {
780
- payload.value = {};
964
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
965
+ let unrecognized;
781
966
  for (const key of Reflect.ownKeys(input)) {
782
967
  if (key === "__proto__")
783
968
  continue;
@@ -800,6 +985,9 @@
800
985
  if (keyResult.issues.length) {
801
986
  if (def.mode === "loose") {
802
987
  payload.value[key] = input[key];
988
+ } else if (values) {
989
+ unrecognized = unrecognized ?? [];
990
+ unrecognized.push(key);
803
991
  } else {
804
992
  payload.issues.push({
805
993
  code: "invalid_key",
@@ -812,21 +1000,33 @@
812
1000
  }
813
1001
  continue;
814
1002
  }
1003
+ const outKey = keyResult.value;
1004
+ if (outKey === "__proto__")
1005
+ continue;
815
1006
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
816
1007
  if (result instanceof Promise) {
817
1008
  proms.push(result.then((result2) => {
818
1009
  if (result2.issues.length) {
819
1010
  payload.issues.push(...prefixIssues(key, result2.issues));
820
1011
  }
821
- payload.value[keyResult.value] = result2.value;
1012
+ payload.value[outKey] = result2.value;
822
1013
  }));
823
1014
  } else {
824
1015
  if (result.issues.length) {
825
1016
  payload.issues.push(...prefixIssues(key, result.issues));
826
1017
  }
827
- payload.value[keyResult.value] = result.value;
1018
+ payload.value[outKey] = result.value;
828
1019
  }
829
1020
  }
1021
+ if (unrecognized && unrecognized.length > 0) {
1022
+ payload.issues.push({
1023
+ code: "unrecognized_keys",
1024
+ input,
1025
+ inst,
1026
+ keys: unrecognized,
1027
+ continue: true
1028
+ });
1029
+ }
830
1030
  }
831
1031
  if (proms.length) {
832
1032
  return Promise.all(proms).then(() => payload);
@@ -837,6 +1037,7 @@
837
1037
  var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
838
1038
  $ZodType.init(inst, def);
839
1039
  inst._zod.optin = "optional";
1040
+ globalConfig.memoizer?.guard(inst);
840
1041
  inst._zod.parse = (payload, ctx) => {
841
1042
  if (ctx.direction === "backward") {
842
1043
  throw new $ZodEncodeError(inst.constructor.name);
@@ -846,7 +1047,6 @@
846
1047
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
847
1048
  return output.then((output2) => {
848
1049
  payload.value = output2;
849
- payload.fallback = true;
850
1050
  return payload;
851
1051
  });
852
1052
  }
@@ -854,16 +1054,15 @@
854
1054
  throw new $ZodAsyncError();
855
1055
  }
856
1056
  payload.value = _out;
857
- payload.fallback = true;
858
1057
  return payload;
859
1058
  };
860
1059
  });
861
1060
  var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
862
1061
  $ZodType.init(inst, def);
863
- defineLazy(inst._zod, "values", () => def.in._zod.values);
864
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
865
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
866
- defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
1062
+ defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
1063
+ defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
1064
+ defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
1065
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
867
1066
  inst._zod.parse = (payload, ctx) => {
868
1067
  if (ctx.direction === "backward") {
869
1068
  const right = def.out._zod.run(payload, ctx);
@@ -880,11 +1079,11 @@
880
1079
  };
881
1080
  });
882
1081
  function handlePipeResult(left, next, ctx) {
883
- if (left.issues.length) {
1082
+ if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
884
1083
  left.aborted = true;
885
1084
  return left;
886
1085
  }
887
- return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
1086
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
888
1087
  }
889
1088
  var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
890
1089
  $ZodType.init(inst, def);
@@ -894,10 +1093,10 @@
894
1093
  d._cachedInner = def.getter();
895
1094
  return d._cachedInner;
896
1095
  });
897
- defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
898
- defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
899
- defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? void 0);
900
- defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? void 0);
1096
+ defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
1097
+ defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
1098
+ defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? void 0);
1099
+ defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? void 0);
901
1100
  inst._zod.parse = (payload, ctx) => {
902
1101
  const inner = inst._zod.innerType;
903
1102
  return inner._zod.run(payload, ctx);
@@ -937,21 +1136,19 @@
937
1136
  }
938
1137
  }
939
1138
 
940
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
1139
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
1140
+ function snapshotChecks(def) {
1141
+ if (def.checks)
1142
+ def.checks = [...def.checks];
1143
+ return def;
1144
+ }
941
1145
  // @__NO_SIDE_EFFECTS__
942
1146
  function _string(Class, params) {
943
- return new Class({
944
- type: "string",
945
- ...normalizeParams(params)
946
- });
1147
+ return new Class(snapshotChecks({ type: "string", ...normalizeParams(params) }));
947
1148
  }
948
1149
  // @__NO_SIDE_EFFECTS__
949
1150
  function _number(Class, params) {
950
- return new Class({
951
- type: "number",
952
- checks: [],
953
- ...normalizeParams(params)
954
- });
1151
+ return new Class(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
955
1152
  }
956
1153
  // @__NO_SIDE_EFFECTS__
957
1154
  function _boolean(Class, params) {
@@ -1007,36 +1204,56 @@
1007
1204
  return schema;
1008
1205
  }
1009
1206
 
1010
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js
1207
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/mini/schemas.js
1011
1208
  var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
1012
1209
  if (!inst._zod)
1013
1210
  throw new Error("Uninitialized schema in ZodMiniType.");
1014
1211
  $ZodType.init(inst, def);
1015
1212
  inst.def = def;
1016
1213
  inst.type = def.type;
1017
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
1018
- inst.safeParse = (data, params) => safeParse(inst, data, params);
1019
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
1020
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
1021
- inst.check = (...checks) => {
1022
- return inst.clone({
1214
+ }, {
1215
+ // `with` is an alias for `check`: the same function object, not a wrapper.
1216
+ get with() {
1217
+ return this.check;
1218
+ },
1219
+ set with(value) {
1220
+ own(this, "with", value);
1221
+ },
1222
+ parse(data, params) {
1223
+ return parse(this, data, params, { callee: this.parse });
1224
+ },
1225
+ parseAsync(data, params) {
1226
+ return parseAsync(this, data, params, { callee: this.parseAsync });
1227
+ },
1228
+ safeParse(data, params) {
1229
+ return safeParse(this, data, params);
1230
+ },
1231
+ safeParseAsync(data, params) {
1232
+ return safeParseAsync(this, data, params);
1233
+ },
1234
+ check(...checks) {
1235
+ const def = this.def;
1236
+ return this.clone({
1023
1237
  ...def,
1024
1238
  checks: [
1025
1239
  ...def.checks ?? [],
1026
- ...checks.map((ch) => typeof ch === "function" ? {
1027
- _zod: { check: ch, def: { check: "custom" }, onattach: [] }
1028
- } : ch)
1240
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
1029
1241
  ]
1030
1242
  }, { parent: true });
1031
- };
1032
- inst.with = inst.check;
1033
- inst.clone = (_def, params) => clone(inst, _def, params);
1034
- inst.brand = () => inst;
1035
- inst.register = ((reg, meta2) => {
1036
- reg.add(inst, meta2);
1037
- return inst;
1038
- });
1039
- inst.apply = (fn) => fn(inst);
1243
+ },
1244
+ clone(_def, params) {
1245
+ return clone(this, _def, params);
1246
+ },
1247
+ brand() {
1248
+ return this;
1249
+ },
1250
+ register(reg, meta2) {
1251
+ reg.add(this, meta2);
1252
+ return this;
1253
+ },
1254
+ apply(fn, ...args) {
1255
+ return args.length === 0 ? fn(this) : fn(this, ...args);
1256
+ }
1040
1257
  });
1041
1258
  var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
1042
1259
  $ZodString.init(inst, def);
@@ -1372,7 +1589,7 @@
1372
1589
  }
1373
1590
  };
1374
1591
 
1375
- // ../../node_modules/.pnpm/@ariestools+sdk@8.1.9_@opentelemetry+api@1.9.1_zod@4.4.3/node_modules/@ariestools/sdk/dist/browser/index.mjs
1592
+ // ../../node_modules/.pnpm/@ariestools+sdk@9.0.0_@opentelemetry+api@1.9.1_zod@4.6.5/node_modules/@ariestools/sdk/dist/browser/index.mjs
1376
1593
  var __defProp = Object.defineProperty;
1377
1594
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1378
1595
  var __decorateClass = (decorators, target, key, kind) => {
@@ -1533,12 +1750,128 @@
1533
1750
  throw toFetchError(error, { url: url.toString(), method: init.method });
1534
1751
  }
1535
1752
  }
1536
- async function parseJsonResponse(response, context = {}) {
1753
+ function validateMaxResponseBytes(maxResponseBytes) {
1754
+ if (maxResponseBytes !== void 0 && (!Number.isSafeInteger(maxResponseBytes) || maxResponseBytes <= 0)) {
1755
+ throw new RangeError("maxResponseBytes must be a positive safe integer");
1756
+ }
1757
+ }
1758
+ function abortError(signal) {
1759
+ const reason = signal.reason;
1760
+ let isTimeout = false;
1761
+ try {
1762
+ isTimeout = typeof reason === "object" && reason !== null && "name" in reason && reason.name === "TimeoutError" || classifyFetchError(reason).type === "timeout";
1763
+ } catch {
1764
+ }
1765
+ return new FetchError("Response body read was aborted", {
1766
+ type: isTimeout ? "timeout" : "aborted",
1767
+ cause: reason
1768
+ });
1769
+ }
1770
+ function readChunk(reader, signal) {
1771
+ if (signal == null) return reader.read();
1772
+ return new Promise((resolve, reject) => {
1773
+ let settled = false;
1774
+ const finish = (outcome) => {
1775
+ if (settled) return;
1776
+ settled = true;
1777
+ signal.removeEventListener("abort", onAbort);
1778
+ if ("error" in outcome) reject(toFetchError(outcome.error));
1779
+ else resolve(outcome.value);
1780
+ };
1781
+ const onAbort = () => finish({ error: abortError(signal) });
1782
+ signal.addEventListener("abort", onAbort, { once: true });
1783
+ if (signal.aborted) {
1784
+ onAbort();
1785
+ return;
1786
+ }
1787
+ try {
1788
+ void reader.read().then((value) => signal.aborted ? onAbort() : finish({ value })).catch((error) => finish({ error }));
1789
+ } catch (error) {
1790
+ finish({ error });
1791
+ }
1792
+ });
1793
+ }
1794
+ function cancelReader(reader, reason) {
1795
+ try {
1796
+ void reader.cancel(reason).catch(() => {
1797
+ });
1798
+ } catch {
1799
+ }
1800
+ }
1801
+ async function readStreamText(reader, maxResponseBytes, signal, response) {
1802
+ const decoder = new TextDecoder();
1803
+ const parts = [];
1804
+ let bytes = 0;
1805
+ let completed = false;
1806
+ let failure2;
1807
+ try {
1808
+ while (true) {
1809
+ const result = await readChunk(reader, signal);
1810
+ if (signal?.aborted === true) throw abortError(signal);
1811
+ if (result.done) {
1812
+ parts.push(decoder.decode());
1813
+ completed = true;
1814
+ return parts.join("");
1815
+ }
1816
+ const chunk = result.value;
1817
+ if (!ArrayBuffer.isView(chunk) || Object.prototype.toString.call(chunk) !== "[object Uint8Array]") {
1818
+ throw new TypeError("Response body chunks must be Uint8Array values");
1819
+ }
1820
+ if (maxResponseBytes !== void 0) {
1821
+ if (chunk.byteLength > maxResponseBytes - bytes) {
1822
+ throw new FetchError("Response body exceeds maxResponseBytes", {
1823
+ type: "response-too-large",
1824
+ status: response.status,
1825
+ statusText: response.statusText
1826
+ });
1827
+ }
1828
+ bytes += chunk.byteLength;
1829
+ }
1830
+ const text = decoder.decode(chunk, { stream: true });
1831
+ if (text !== "") parts.push(text);
1832
+ }
1833
+ } catch (error) {
1834
+ failure2 = error;
1835
+ throw error;
1836
+ } finally {
1837
+ if (!completed) cancelReader(reader, failure2);
1838
+ reader.releaseLock();
1839
+ }
1840
+ }
1841
+ async function readResponseText(response, options = {}) {
1842
+ const { maxResponseBytes, signal } = options;
1843
+ validateMaxResponseBytes(maxResponseBytes);
1844
+ if (maxResponseBytes === void 0 && signal == null) return await response.text();
1845
+ if (response.bodyUsed) throw new TypeError("Response body has already been consumed");
1846
+ const body = response.body;
1847
+ if (body === null) {
1848
+ if (signal?.aborted === true) throw abortError(signal);
1849
+ return "";
1850
+ }
1851
+ return await readStreamText(body.getReader(), maxResponseBytes, signal, response);
1852
+ }
1853
+ function contextualizeReadError(error, context, options) {
1854
+ const failure2 = toFetchError(error, context);
1855
+ if (options.maxResponseBytes === void 0 && options.signal == null) return failure2;
1856
+ if ((failure2.url !== void 0 || context.url === void 0) && (failure2.method !== void 0 || context.method === void 0)) return failure2;
1857
+ return new FetchError(failure2.message, {
1858
+ body: failure2.body,
1859
+ cause: failure2.cause,
1860
+ code: failure2.code,
1861
+ method: failure2.method ?? context.method,
1862
+ response: failure2.response,
1863
+ status: failure2.status,
1864
+ statusText: failure2.statusText,
1865
+ type: failure2.type,
1866
+ url: failure2.url ?? context.url
1867
+ });
1868
+ }
1869
+ async function parseJsonResponse(response, context = {}, options = {}) {
1537
1870
  let text;
1538
1871
  try {
1539
- text = await response.text();
1872
+ text = await readResponseText(response, options);
1540
1873
  } catch (error) {
1541
- throw toFetchError(error, context);
1874
+ throw contextualizeReadError(error, context, options);
1542
1875
  }
1543
1876
  if (text.trim() === "") return null;
1544
1877
  try {
@@ -1555,15 +1888,43 @@
1555
1888
  });
1556
1889
  }
1557
1890
  }
1558
- async function tryParseJson(response) {
1891
+ async function tryParseJson(response, options = {}, context = {}) {
1892
+ let text;
1559
1893
  try {
1560
- const text = await response.text();
1561
- if (text.trim() === "") return null;
1562
- return JSON.parse(text);
1894
+ text = await readResponseText(response, options);
1895
+ } catch (error) {
1896
+ if (options.maxResponseBytes !== void 0 || options.signal != null) throw contextualizeReadError(error, context, options);
1897
+ return null;
1898
+ }
1899
+ try {
1900
+ return text.trim() === "" ? null : JSON.parse(text);
1563
1901
  } catch {
1564
1902
  return null;
1565
1903
  }
1566
1904
  }
1905
+ function noop() {
1906
+ }
1907
+ function requestSignal(signal, timeout) {
1908
+ if (timeout === void 0 || timeout === 0) return { signal, close: noop };
1909
+ const timeoutSignal = AbortSignal.timeout(timeout);
1910
+ if (signal == null) return { signal: timeoutSignal, close: noop };
1911
+ const controller = new AbortController();
1912
+ const close = () => {
1913
+ signal.removeEventListener("abort", onCallerAbort);
1914
+ timeoutSignal.removeEventListener("abort", onTimeout);
1915
+ };
1916
+ const abort = (source) => {
1917
+ if (!controller.signal.aborted) controller.abort(source.reason);
1918
+ close();
1919
+ };
1920
+ const onCallerAbort = () => abort(signal);
1921
+ const onTimeout = () => abort(timeoutSignal);
1922
+ signal.addEventListener("abort", onCallerAbort, { once: true });
1923
+ timeoutSignal.addEventListener("abort", onTimeout, { once: true });
1924
+ if (signal.aborted) onCallerAbort();
1925
+ else if (timeoutSignal.aborted) onTimeout();
1926
+ return { signal: controller.signal, close };
1927
+ }
1567
1928
  var FetchClientError = class extends FetchError {
1568
1929
  /** Effective request configuration, including the resolved request URL. */
1569
1930
  config;
@@ -1671,6 +2032,7 @@
1671
2032
  baseURL: _baseURL,
1672
2033
  data: requestData,
1673
2034
  headers,
2035
+ maxResponseBytes,
1674
2036
  method = "GET",
1675
2037
  params: _params,
1676
2038
  signal,
@@ -1679,37 +2041,44 @@
1679
2041
  validateStatus: validateStatusOption,
1680
2042
  ...requestInit
1681
2043
  } = merged;
1682
- const init = {
1683
- ...requestInit,
1684
- method,
1685
- headers: buildHeaders(headers, requestData !== void 0),
1686
- signal: timeout !== void 0 && timeout !== 0 ? AbortSignal.timeout(timeout) : signal
1687
- };
1688
- if (requestData !== void 0) {
1689
- init.body = JSON.stringify(requestData);
1690
- }
1691
- const response = await fetchCompress(url, init);
1692
- const data = response.ok ? await parseJsonResponse(response, { url, method }) : await tryParseJson(response);
1693
- const result = {
1694
- data,
1695
- headers: response.headers,
1696
- response,
1697
- status: response.status,
1698
- statusText: response.statusText
1699
- };
1700
- const validateStatus = validateStatusOption === void 0 ? (s) => s >= 200 && s < 300 : validateStatusOption;
1701
- if (validateStatus && !validateStatus(response.status)) {
1702
- throw new FetchClientError(
1703
- `Request failed with status ${response.status} ${response.statusText}`,
1704
- result,
1705
- {
1706
- ...merged,
1707
- method,
1708
- url
1709
- }
1710
- );
2044
+ validateMaxResponseBytes(maxResponseBytes);
2045
+ const scope = requestSignal(signal, timeout);
2046
+ try {
2047
+ const init = {
2048
+ ...requestInit,
2049
+ method,
2050
+ headers: buildHeaders(headers, requestData !== void 0),
2051
+ signal: scope.signal
2052
+ };
2053
+ if (requestData !== void 0) {
2054
+ init.body = JSON.stringify(requestData);
2055
+ }
2056
+ const response = await fetchCompress(url, init);
2057
+ const readOptions = { maxResponseBytes, signal: scope.signal };
2058
+ const data = response.ok ? await parseJsonResponse(response, { url, method }, readOptions) : await tryParseJson(response, readOptions, { url, method });
2059
+ const result = {
2060
+ data,
2061
+ headers: response.headers,
2062
+ response,
2063
+ status: response.status,
2064
+ statusText: response.statusText
2065
+ };
2066
+ const validateStatus = validateStatusOption === void 0 ? (s) => s >= 200 && s < 300 : validateStatusOption;
2067
+ if (validateStatus && !validateStatus(response.status)) {
2068
+ throw new FetchClientError(
2069
+ `Request failed with status ${response.status} ${response.statusText}`,
2070
+ result,
2071
+ {
2072
+ ...merged,
2073
+ method,
2074
+ url
2075
+ }
2076
+ );
2077
+ }
2078
+ return result;
2079
+ } finally {
2080
+ scope.close();
1711
2081
  }
1712
- return result;
1713
2082
  }
1714
2083
  };
1715
2084
  var FetchJsonClient = class _FetchJsonClient extends FetchClient {
@@ -3093,7 +3462,7 @@
3093
3462
  const prototype = Object.getPrototypeOf(value);
3094
3463
  return prototype === Object.prototype || prototype === null;
3095
3464
  };
3096
- function merge(target, source, options) {
3465
+ function merge2(target, source, options) {
3097
3466
  if (!source || typeof source !== "object") return target;
3098
3467
  for (const key of Reflect.ownKeys(source)) {
3099
3468
  if (isUnsafeKey(key)) {
@@ -3108,7 +3477,7 @@
3108
3477
  if (targetValue === void 0 || targetValue === null || typeof targetValue !== "object" || !isPlainObject2(targetValue)) {
3109
3478
  target[key] = {};
3110
3479
  }
3111
- merge(target[key], value, options);
3480
+ merge2(target[key], value, options);
3112
3481
  } else {
3113
3482
  target[key] = value;
3114
3483
  }
@@ -3119,7 +3488,7 @@
3119
3488
  return function deepMerge2(...objects) {
3120
3489
  const result = options.mutate === true ? objects[0] ?? {} : {};
3121
3490
  for (const obj of objects) {
3122
- merge(result, obj, options);
3491
+ merge2(result, obj, options);
3123
3492
  }
3124
3493
  return result;
3125
3494
  };
@@ -3220,7 +3589,12 @@
3220
3589
  var toJsonObject = zodToFactory(JsonObjectZod, "toJsonObject");
3221
3590
  var subtle = globalThis.crypto?.subtle;
3222
3591
 
3223
- // ../../node_modules/.pnpm/@ariestools+threads@8.1.9_@opentelemetry+api@1.9.1_observable-fns@0.6.1_supports-color@7.2.0_zod@4.4.3/node_modules/@ariestools/threads/dist/browser/worker/worker.browser.mjs
3592
+ // ../../node_modules/.pnpm/@ariestools+sdk@9.0.0_@opentelemetry+api@1.9.1_zod@4.6.5/node_modules/@ariestools/sdk/dist/neutral/enum.mjs
3593
+ var Enum2 = (obj) => {
3594
+ return obj;
3595
+ };
3596
+
3597
+ // ../../node_modules/.pnpm/@ariestools+threads@9.0.0_@opentelemetry+api@1.9.1_observable-fns@0.6.1_supports-color@7.2.0_zod@4.6.5/node_modules/@ariestools/threads/dist/browser/worker/worker.browser.mjs
3224
3598
  var DefaultErrorSerializer = {
3225
3599
  deserialize: (message) => {
3226
3600
  const error = Object.create(Error.prototype);
@@ -3264,12 +3638,30 @@
3264
3638
  function isTransferDescriptor(thing) {
3265
3639
  return thing != null && typeof thing === "object" && Reflect.get(thing, $transferable) === true;
3266
3640
  }
3641
+ var MasterMessageType = Enum2({
3642
+ /** Cancel a previously submitted job. */
3643
+ cancel: "cancel",
3644
+ /** Run a job in the worker. */
3645
+ run: "run"
3646
+ });
3647
+ var WorkerMessageType = Enum2({
3648
+ /** A job failed. */
3649
+ error: "error",
3650
+ /** The worker exposed its callable API. */
3651
+ init: "init",
3652
+ /** A job produced a result. */
3653
+ result: "result",
3654
+ /** A job started running. */
3655
+ running: "running",
3656
+ /** An error escaped the worker job handler. */
3657
+ uncaughtError: "uncaughtError"
3658
+ });
3267
3659
  var isErrorEvent = (value) => value !== void 0 && value.error !== void 0;
3268
3660
  function createExpose(implementation, self2) {
3269
3661
  let exposeCalled = false;
3270
3662
  const activeSubscriptions = /* @__PURE__ */ new Map();
3271
- const isMasterJobCancelMessage = (thing) => thing?.type === "cancel";
3272
- const isMasterJobRunMessage = (thing) => thing?.type === "run";
3663
+ const isMasterJobCancelMessage = (thing) => thing?.type === MasterMessageType.cancel;
3664
+ const isMasterJobRunMessage = (thing) => thing?.type === MasterMessageType.run;
3273
3665
  const isObservable = (thing) => isSomeObservable(thing) || isZenObservable(thing);
3274
3666
  function isZenObservable(thing) {
3275
3667
  return thing != null && typeof thing === "object" && typeof thing.subscribe === "function";
@@ -3280,8 +3672,7 @@
3280
3672
  function postFunctionInitMessage() {
3281
3673
  const initMessage = {
3282
3674
  exposed: { type: "function" },
3283
- type: "init"
3284
- /* init */
3675
+ type: WorkerMessageType.init
3285
3676
  };
3286
3677
  implementation.postMessageToMaster(initMessage);
3287
3678
  }
@@ -3291,8 +3682,7 @@
3291
3682
  methods: methodNames,
3292
3683
  type: "module"
3293
3684
  },
3294
- type: "init"
3295
- /* init */
3685
+ type: WorkerMessageType.init
3296
3686
  };
3297
3687
  implementation.postMessageToMaster(initMessage);
3298
3688
  }
@@ -3300,7 +3690,7 @@
3300
3690
  const { payload: error, transferables } = deconstructTransfer(rawError);
3301
3691
  const errorMessage = {
3302
3692
  error: serialize(error),
3303
- type: "error",
3693
+ type: WorkerMessageType.error,
3304
3694
  uid
3305
3695
  };
3306
3696
  implementation.postMessageToMaster(errorMessage, transferables);
@@ -3310,7 +3700,7 @@
3310
3700
  const resultMessage = {
3311
3701
  complete: completed ? true : void 0,
3312
3702
  payload,
3313
- type: "result",
3703
+ type: WorkerMessageType.result,
3314
3704
  uid
3315
3705
  };
3316
3706
  implementation.postMessageToMaster(resultMessage, transferables);
@@ -3318,7 +3708,7 @@
3318
3708
  function postJobStartMessage(uid, resultType) {
3319
3709
  const startMessage = {
3320
3710
  resultType,
3321
- type: "running",
3711
+ type: WorkerMessageType.running,
3322
3712
  uid
3323
3713
  };
3324
3714
  implementation.postMessageToMaster(startMessage);
@@ -3327,8 +3717,7 @@
3327
3717
  try {
3328
3718
  const errorMessage = {
3329
3719
  error: serialize(error),
3330
- type: "uncaughtError"
3331
- /* uncaughtError */
3720
+ type: WorkerMessageType.uncaughtError
3332
3721
  };
3333
3722
  implementation.postMessageToMaster(errorMessage);
3334
3723
  } catch (subError) {