@animaapp/anima-sdk 0.2.8 → 0.3.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.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  var fn = Object.defineProperty, hn = Object.defineProperties;
2
2
  var pn = Object.getOwnPropertyDescriptors;
3
- var jt = Object.getOwnPropertySymbols;
3
+ var Nt = Object.getOwnPropertySymbols;
4
4
  var mn = Object.prototype.hasOwnProperty, yn = Object.prototype.propertyIsEnumerable;
5
- var Zt = (n) => {
5
+ var Rt = (n) => {
6
6
  throw TypeError(n);
7
7
  };
8
- var Rt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, u = (n, e) => {
8
+ var Zt = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, u = (n, e) => {
9
9
  for (var t in e || (e = {}))
10
- mn.call(e, t) && Rt(n, t, e[t]);
11
- if (jt)
12
- for (var t of jt(e))
13
- yn.call(e, t) && Rt(n, t, e[t]);
10
+ mn.call(e, t) && Zt(n, t, e[t]);
11
+ if (Nt)
12
+ for (var t of Nt(e))
13
+ yn.call(e, t) && Zt(n, t, e[t]);
14
14
  return n;
15
15
  }, y = (n, e) => hn(n, pn(e));
16
- var Mt = (n, e, t) => e.has(n) || Zt("Cannot " + t);
17
- var B = (n, e, t) => (Mt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ct = (n, e, t) => e.has(n) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ut = (n, e, t, s) => (Mt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
18
- var P = (n, e, t) => new Promise((s, r) => {
16
+ var Mt = (n, e, t) => e.has(n) || Rt("Cannot " + t);
17
+ var H = (n, e, t) => (Mt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ut = (n, e, t) => e.has(n) ? Rt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), dt = (n, e, t, s) => (Mt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t);
18
+ var F = (n, e, t) => new Promise((s, r) => {
19
19
  var a = (c) => {
20
20
  try {
21
21
  o(t.next(c));
@@ -31,12 +31,17 @@ var P = (n, e, t) => new Promise((s, r) => {
31
31
  }, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
32
32
  o((t = t.apply(n, e)).next());
33
33
  });
34
- class Ae extends Error {
35
- constructor({ name: e, reason: t, status: s }) {
36
- super(), this.name = `[Codegen Error] ${e}`, this.message = t, this.status = s;
34
+ class de extends Error {
35
+ constructor({
36
+ name: e,
37
+ reason: t,
38
+ status: s,
39
+ detail: r
40
+ }) {
41
+ super(), this.name = e, this.message = t, this.detail = r, this.status = s;
37
42
  }
38
43
  }
39
- var k;
44
+ var x;
40
45
  (function(n) {
41
46
  n.assertEqual = (r) => r;
42
47
  function e(r) {
@@ -71,12 +76,12 @@ var k;
71
76
  return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
72
77
  }
73
78
  n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
74
- })(k || (k = {}));
75
- var pt;
79
+ })(x || (x = {}));
80
+ var mt;
76
81
  (function(n) {
77
82
  n.mergeShapes = (e, t) => u(u({}, e), t);
78
- })(pt || (pt = {}));
79
- const p = k.arrayToEnum([
83
+ })(mt || (mt = {}));
84
+ const p = x.arrayToEnum([
80
85
  "string",
81
86
  "nan",
82
87
  "number",
@@ -97,7 +102,7 @@ const p = k.arrayToEnum([
97
102
  "never",
98
103
  "map",
99
104
  "set"
100
- ]), ae = (n) => {
105
+ ]), ie = (n) => {
101
106
  switch (typeof n) {
102
107
  case "undefined":
103
108
  return p.undefined;
@@ -118,7 +123,7 @@ const p = k.arrayToEnum([
118
123
  default:
119
124
  return p.unknown;
120
125
  }
121
- }, l = k.arrayToEnum([
126
+ }, l = x.arrayToEnum([
122
127
  "invalid_type",
123
128
  "invalid_literal",
124
129
  "custom",
@@ -136,7 +141,7 @@ const p = k.arrayToEnum([
136
141
  "not_multiple_of",
137
142
  "not_finite"
138
143
  ]), gn = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
139
- class U extends Error {
144
+ class z extends Error {
140
145
  get errors() {
141
146
  return this.issues;
142
147
  }
@@ -173,14 +178,14 @@ class U extends Error {
173
178
  return r(this), s;
174
179
  }
175
180
  static assert(e) {
176
- if (!(e instanceof U))
181
+ if (!(e instanceof z))
177
182
  throw new Error(`Not a ZodError: ${e}`);
178
183
  }
179
184
  toString() {
180
185
  return this.message;
181
186
  }
182
187
  get message() {
183
- return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
188
+ return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
184
189
  }
185
190
  get isEmpty() {
186
191
  return this.issues.length === 0;
@@ -195,27 +200,27 @@ class U extends Error {
195
200
  return this.flatten();
196
201
  }
197
202
  }
198
- U.create = (n) => new U(n);
199
- const ke = (n, e) => {
203
+ z.create = (n) => new z(n);
204
+ const Ae = (n, e) => {
200
205
  let t;
201
206
  switch (n.code) {
202
207
  case l.invalid_type:
203
208
  n.received === p.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
204
209
  break;
205
210
  case l.invalid_literal:
206
- t = `Invalid literal value, expected ${JSON.stringify(n.expected, k.jsonStringifyReplacer)}`;
211
+ t = `Invalid literal value, expected ${JSON.stringify(n.expected, x.jsonStringifyReplacer)}`;
207
212
  break;
208
213
  case l.unrecognized_keys:
209
- t = `Unrecognized key(s) in object: ${k.joinValues(n.keys, ", ")}`;
214
+ t = `Unrecognized key(s) in object: ${x.joinValues(n.keys, ", ")}`;
210
215
  break;
211
216
  case l.invalid_union:
212
217
  t = "Invalid input";
213
218
  break;
214
219
  case l.invalid_union_discriminator:
215
- t = `Invalid discriminator value. Expected ${k.joinValues(n.options)}`;
220
+ t = `Invalid discriminator value. Expected ${x.joinValues(n.options)}`;
216
221
  break;
217
222
  case l.invalid_enum_value:
218
- t = `Invalid enum value. Expected ${k.joinValues(n.options)}, received '${n.received}'`;
223
+ t = `Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;
219
224
  break;
220
225
  case l.invalid_arguments:
221
226
  t = "Invalid function arguments";
@@ -227,7 +232,7 @@ const ke = (n, e) => {
227
232
  t = "Invalid date";
228
233
  break;
229
234
  case l.invalid_string:
230
- typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : k.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
235
+ typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : x.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
231
236
  break;
232
237
  case l.too_small:
233
238
  n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
@@ -248,18 +253,18 @@ const ke = (n, e) => {
248
253
  t = "Number must be finite";
249
254
  break;
250
255
  default:
251
- t = e.defaultError, k.assertNever(n);
256
+ t = e.defaultError, x.assertNever(n);
252
257
  }
253
258
  return { message: t };
254
259
  };
255
- let qt = ke;
260
+ let qt = Ae;
256
261
  function vn(n) {
257
262
  qt = n;
258
263
  }
259
- function Qe() {
264
+ function et() {
260
265
  return qt;
261
266
  }
262
- const et = (n) => {
267
+ const tt = (n) => {
263
268
  const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = y(u({}, r), {
264
269
  path: a
265
270
  });
@@ -278,7 +283,7 @@ const et = (n) => {
278
283
  });
279
284
  }, _n = [];
280
285
  function h(n, e) {
281
- const t = Qe(), s = et({
286
+ const t = et(), s = tt({
282
287
  issueData: e,
283
288
  data: n.data,
284
289
  path: n.path,
@@ -289,13 +294,13 @@ function h(n, e) {
289
294
  // then schema-bound map if available
290
295
  t,
291
296
  // then global override map
292
- t === ke ? void 0 : ke
297
+ t === Ae ? void 0 : Ae
293
298
  // then global default map
294
299
  ].filter((r) => !!r)
295
300
  });
296
301
  n.common.issues.push(s);
297
302
  }
298
- class R {
303
+ class Z {
299
304
  constructor() {
300
305
  this.value = "valid";
301
306
  }
@@ -315,7 +320,7 @@ class R {
315
320
  return { status: e.value, value: s };
316
321
  }
317
322
  static mergeObjectAsync(e, t) {
318
- return P(this, null, function* () {
323
+ return F(this, null, function* () {
319
324
  const s = [];
320
325
  for (const r of t) {
321
326
  const a = yield r.key, i = yield r.value;
@@ -324,7 +329,7 @@ class R {
324
329
  value: i
325
330
  });
326
331
  }
327
- return R.mergeObjectSync(e, s);
332
+ return Z.mergeObjectSync(e, s);
328
333
  });
329
334
  }
330
335
  static mergeObjectSync(e, t) {
@@ -340,8 +345,8 @@ class R {
340
345
  }
341
346
  const v = Object.freeze({
342
347
  status: "aborted"
343
- }), we = (n) => ({ status: "dirty", value: n }), $ = (n) => ({ status: "valid", value: n }), mt = (n) => n.status === "aborted", yt = (n) => n.status === "dirty", ye = (n) => n.status === "valid", Ze = (n) => typeof Promise != "undefined" && n instanceof Promise;
344
- function tt(n, e, t, s) {
348
+ }), Te = (n) => ({ status: "dirty", value: n }), P = (n) => ({ status: "valid", value: n }), yt = (n) => n.status === "aborted", gt = (n) => n.status === "dirty", be = (n) => n.status === "valid", Pe = (n) => typeof Promise != "undefined" && n instanceof Promise;
349
+ function nt(n, e, t, s) {
345
350
  if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
346
351
  return e.get(n);
347
352
  }
@@ -353,8 +358,8 @@ var m;
353
358
  (function(n) {
354
359
  n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
355
360
  })(m || (m = {}));
356
- var Ce, Ie;
357
- class Q {
361
+ var je, Ne;
362
+ class te {
358
363
  constructor(e, t, s, r) {
359
364
  this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
360
365
  }
@@ -362,8 +367,8 @@ class Q {
362
367
  return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
363
368
  }
364
369
  }
365
- const $t = (n, e) => {
366
- if (ye(e))
370
+ const Pt = (n, e) => {
371
+ if (be(e))
367
372
  return { success: !0, data: e.value };
368
373
  if (!n.common.issues.length)
369
374
  throw new Error("Validation failed but no issues detected.");
@@ -372,12 +377,12 @@ const $t = (n, e) => {
372
377
  get error() {
373
378
  if (this._error)
374
379
  return this._error;
375
- const t = new U(n.common.issues);
380
+ const t = new z(n.common.issues);
376
381
  return this._error = t, this._error;
377
382
  }
378
383
  };
379
384
  };
380
- function w(n) {
385
+ function b(n) {
381
386
  if (!n)
382
387
  return {};
383
388
  const { errorMap: e, invalid_type_error: t, required_error: s, description: r } = n;
@@ -389,18 +394,18 @@ function w(n) {
389
394
  return i.code === "invalid_enum_value" ? { message: f != null ? f : o.defaultError } : typeof o.data == "undefined" ? { message: (c = f != null ? f : s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = f != null ? f : t) !== null && d !== void 0 ? d : o.defaultError };
390
395
  }, description: r };
391
396
  }
392
- class x {
397
+ class w {
393
398
  get description() {
394
399
  return this._def.description;
395
400
  }
396
401
  _getType(e) {
397
- return ae(e.data);
402
+ return ie(e.data);
398
403
  }
399
404
  _getOrReturnCtx(e, t) {
400
405
  return t || {
401
406
  common: e.parent.common,
402
407
  data: e.data,
403
- parsedType: ae(e.data),
408
+ parsedType: ie(e.data),
404
409
  schemaErrorMap: this._def.errorMap,
405
410
  path: e.path,
406
411
  parent: e.parent
@@ -408,11 +413,11 @@ class x {
408
413
  }
409
414
  _processInputParams(e) {
410
415
  return {
411
- status: new R(),
416
+ status: new Z(),
412
417
  ctx: {
413
418
  common: e.parent.common,
414
419
  data: e.data,
415
- parsedType: ae(e.data),
420
+ parsedType: ie(e.data),
416
421
  schemaErrorMap: this._def.errorMap,
417
422
  path: e.path,
418
423
  parent: e.parent
@@ -421,7 +426,7 @@ class x {
421
426
  }
422
427
  _parseSync(e) {
423
428
  const t = this._parse(e);
424
- if (Ze(t))
429
+ if (Pe(t))
425
430
  throw new Error("Synchronous parse encountered promise.");
426
431
  return t;
427
432
  }
@@ -447,9 +452,9 @@ class x {
447
452
  schemaErrorMap: this._def.errorMap,
448
453
  parent: null,
449
454
  data: e,
450
- parsedType: ae(e)
455
+ parsedType: ie(e)
451
456
  }, a = this._parseSync({ data: e, path: r.path, parent: r });
452
- return $t(r, a);
457
+ return Pt(r, a);
453
458
  }
454
459
  "~validate"(e) {
455
460
  var t, s;
@@ -462,12 +467,12 @@ class x {
462
467
  schemaErrorMap: this._def.errorMap,
463
468
  parent: null,
464
469
  data: e,
465
- parsedType: ae(e)
470
+ parsedType: ie(e)
466
471
  };
467
472
  if (!this["~standard"].async)
468
473
  try {
469
474
  const a = this._parseSync({ data: e, path: [], parent: r });
470
- return ye(a) ? {
475
+ return be(a) ? {
471
476
  value: a.value
472
477
  } : {
473
478
  issues: r.common.issues
@@ -478,14 +483,14 @@ class x {
478
483
  async: !0
479
484
  };
480
485
  }
481
- return this._parseAsync({ data: e, path: [], parent: r }).then((a) => ye(a) ? {
486
+ return this._parseAsync({ data: e, path: [], parent: r }).then((a) => be(a) ? {
482
487
  value: a.value
483
488
  } : {
484
489
  issues: r.common.issues
485
490
  });
486
491
  }
487
492
  parseAsync(e, t) {
488
- return P(this, null, function* () {
493
+ return F(this, null, function* () {
489
494
  const s = yield this.safeParseAsync(e, t);
490
495
  if (s.success)
491
496
  return s.data;
@@ -493,7 +498,7 @@ class x {
493
498
  });
494
499
  }
495
500
  safeParseAsync(e, t) {
496
- return P(this, null, function* () {
501
+ return F(this, null, function* () {
497
502
  const s = {
498
503
  common: {
499
504
  issues: [],
@@ -504,9 +509,9 @@ class x {
504
509
  schemaErrorMap: this._def.errorMap,
505
510
  parent: null,
506
511
  data: e,
507
- parsedType: ae(e)
508
- }, r = this._parse({ data: e, path: s.path, parent: s }), a = yield Ze(r) ? r : Promise.resolve(r);
509
- return $t(s, a);
512
+ parsedType: ie(e)
513
+ }, r = this._parse({ data: e, path: s.path, parent: s }), a = yield Pe(r) ? r : Promise.resolve(r);
514
+ return Pt(s, a);
510
515
  });
511
516
  }
512
517
  refine(e, t) {
@@ -522,7 +527,7 @@ class x {
522
527
  return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
523
528
  }
524
529
  _refinement(e) {
525
- return new J({
530
+ return new G({
526
531
  schema: this,
527
532
  typeName: g.ZodEffects,
528
533
  effect: { type: "refinement", refinement: e }
@@ -539,28 +544,28 @@ class x {
539
544
  };
540
545
  }
541
546
  optional() {
542
- return Y.create(this, this._def);
547
+ return ee.create(this, this._def);
543
548
  }
544
549
  nullable() {
545
- return fe.create(this, this._def);
550
+ return me.create(this, this._def);
546
551
  }
547
552
  nullish() {
548
553
  return this.nullable().optional();
549
554
  }
550
555
  array() {
551
- return H.create(this);
556
+ return K.create(this);
552
557
  }
553
558
  promise() {
554
- return Se.create(this, this._def);
559
+ return Oe.create(this, this._def);
555
560
  }
556
561
  or(e) {
557
- return Fe.create([this, e], this._def);
562
+ return Le.create([this, e], this._def);
558
563
  }
559
564
  and(e) {
560
- return Le.create(this, e, this._def);
565
+ return Ve.create(this, e, this._def);
561
566
  }
562
567
  transform(e) {
563
- return new J(y(u({}, w(this._def)), {
568
+ return new G(y(u({}, b(this._def)), {
564
569
  schema: this,
565
570
  typeName: g.ZodEffects,
566
571
  effect: { type: "transform", transform: e }
@@ -568,21 +573,21 @@ class x {
568
573
  }
569
574
  default(e) {
570
575
  const t = typeof e == "function" ? e : () => e;
571
- return new We(y(u({}, w(this._def)), {
576
+ return new qe(y(u({}, b(this._def)), {
572
577
  innerType: this,
573
578
  defaultValue: t,
574
579
  typeName: g.ZodDefault
575
580
  }));
576
581
  }
577
582
  brand() {
578
- return new At(u({
583
+ return new Ot(u({
579
584
  typeName: g.ZodBranded,
580
585
  type: this
581
- }, w(this._def)));
586
+ }, b(this._def)));
582
587
  }
583
588
  catch(e) {
584
589
  const t = typeof e == "function" ? e : () => e;
585
- return new Be(y(u({}, w(this._def)), {
590
+ return new He(y(u({}, b(this._def)), {
586
591
  innerType: this,
587
592
  catchValue: t,
588
593
  typeName: g.ZodCatch
@@ -595,10 +600,10 @@ class x {
595
600
  }));
596
601
  }
597
602
  pipe(e) {
598
- return Je.create(this, e);
603
+ return Ge.create(this, e);
599
604
  }
600
605
  readonly() {
601
- return qe.create(this);
606
+ return Je.create(this);
602
607
  }
603
608
  isOptional() {
604
609
  return this.safeParse(void 0).success;
@@ -607,23 +612,23 @@ class x {
607
612
  return this.safeParse(null).success;
608
613
  }
609
614
  }
610
- const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, En = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, An = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
611
- let dt;
612
- const Cn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, In = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Nn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, jn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Rn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Jt = "((\\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])))", Mn = new RegExp(`^${Jt}$`);
613
- function Gt(n) {
615
+ const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, An = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, En = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
616
+ let lt;
617
+ const Cn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, In = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, jn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Nn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Zn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Rn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Jt = "((\\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])))", Mn = new RegExp(`^${Jt}$`);
618
+ function Kt(n) {
614
619
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
615
620
  return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
616
621
  }
617
- function $n(n) {
618
- return new RegExp(`^${Gt(n)}$`);
622
+ function Pn(n) {
623
+ return new RegExp(`^${Kt(n)}$`);
619
624
  }
620
- function Kt(n) {
621
- let e = `${Jt}T${Gt(n)}`;
625
+ function Gt(n) {
626
+ let e = `${Jt}T${Kt(n)}`;
622
627
  const t = [];
623
628
  return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
624
629
  }
625
- function Pn(n, e) {
626
- return !!((e === "v4" || !e) && Cn.test(n) || (e === "v6" || !e) && Nn.test(n));
630
+ function $n(n, e) {
631
+ return !!((e === "v4" || !e) && Cn.test(n) || (e === "v6" || !e) && jn.test(n));
627
632
  }
628
633
  function Fn(n, e) {
629
634
  if (!Sn.test(n))
@@ -635,10 +640,10 @@ function Fn(n, e) {
635
640
  return !1;
636
641
  }
637
642
  }
638
- function Ln(n, e) {
639
- return !!((e === "v4" || !e) && In.test(n) || (e === "v6" || !e) && jn.test(n));
643
+ function Dn(n, e) {
644
+ return !!((e === "v4" || !e) && In.test(n) || (e === "v6" || !e) && Nn.test(n));
640
645
  }
641
- class q extends x {
646
+ class J extends w {
642
647
  _parse(e) {
643
648
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
644
649
  const a = this._getOrReturnCtx(e);
@@ -648,7 +653,7 @@ class q extends x {
648
653
  received: a.parsedType
649
654
  }), v;
650
655
  }
651
- const s = new R();
656
+ const s = new Z();
652
657
  let r;
653
658
  for (const a of this._def.checks)
654
659
  if (a.kind === "min")
@@ -687,13 +692,13 @@ class q extends x {
687
692
  message: a.message
688
693
  }), s.dirty());
689
694
  } else if (a.kind === "email")
690
- An.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
695
+ En.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
691
696
  validation: "email",
692
697
  code: l.invalid_string,
693
698
  message: a.message
694
699
  }), s.dirty());
695
700
  else if (a.kind === "emoji")
696
- dt || (dt = new RegExp(On, "u")), dt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
701
+ lt || (lt = new RegExp(On, "u")), lt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
697
702
  validation: "emoji",
698
703
  code: l.invalid_string,
699
704
  message: a.message
@@ -754,7 +759,7 @@ class q extends x {
754
759
  code: l.invalid_string,
755
760
  validation: { endsWith: a.value },
756
761
  message: a.message
757
- }), s.dirty()) : a.kind === "datetime" ? Kt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
762
+ }), s.dirty()) : a.kind === "datetime" ? Gt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
758
763
  code: l.invalid_string,
759
764
  validation: "datetime",
760
765
  message: a.message
@@ -762,15 +767,15 @@ class q extends x {
762
767
  code: l.invalid_string,
763
768
  validation: "date",
764
769
  message: a.message
765
- }), s.dirty()) : a.kind === "time" ? $n(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
770
+ }), s.dirty()) : a.kind === "time" ? Pn(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
766
771
  code: l.invalid_string,
767
772
  validation: "time",
768
773
  message: a.message
769
- }), s.dirty()) : a.kind === "duration" ? En.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
774
+ }), s.dirty()) : a.kind === "duration" ? An.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
770
775
  validation: "duration",
771
776
  code: l.invalid_string,
772
777
  message: a.message
773
- }), s.dirty()) : a.kind === "ip" ? Pn(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
778
+ }), s.dirty()) : a.kind === "ip" ? $n(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
774
779
  validation: "ip",
775
780
  code: l.invalid_string,
776
781
  message: a.message
@@ -778,19 +783,19 @@ class q extends x {
778
783
  validation: "jwt",
779
784
  code: l.invalid_string,
780
785
  message: a.message
781
- }), s.dirty()) : a.kind === "cidr" ? Ln(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
786
+ }), s.dirty()) : a.kind === "cidr" ? Dn(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
782
787
  validation: "cidr",
783
788
  code: l.invalid_string,
784
789
  message: a.message
785
- }), s.dirty()) : a.kind === "base64" ? Rn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
790
+ }), s.dirty()) : a.kind === "base64" ? Zn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
786
791
  validation: "base64",
787
792
  code: l.invalid_string,
788
793
  message: a.message
789
- }), s.dirty()) : a.kind === "base64url" ? Zn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
794
+ }), s.dirty()) : a.kind === "base64url" ? Rn.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
790
795
  validation: "base64url",
791
796
  code: l.invalid_string,
792
797
  message: a.message
793
- }), s.dirty()) : k.assertNever(a);
798
+ }), s.dirty()) : x.assertNever(a);
794
799
  return { status: s.value, value: e.data };
795
800
  }
796
801
  _regex(e, t, s) {
@@ -800,7 +805,7 @@ class q extends x {
800
805
  }, m.errToObj(s)));
801
806
  }
802
807
  _addCheck(e) {
803
- return new q(y(u({}, this._def), {
808
+ return new J(y(u({}, this._def), {
804
809
  checks: [...this._def.checks, e]
805
810
  }));
806
811
  }
@@ -926,17 +931,17 @@ class q extends x {
926
931
  return this.min(1, m.errToObj(e));
927
932
  }
928
933
  trim() {
929
- return new q(y(u({}, this._def), {
934
+ return new J(y(u({}, this._def), {
930
935
  checks: [...this._def.checks, { kind: "trim" }]
931
936
  }));
932
937
  }
933
938
  toLowerCase() {
934
- return new q(y(u({}, this._def), {
939
+ return new J(y(u({}, this._def), {
935
940
  checks: [...this._def.checks, { kind: "toLowerCase" }]
936
941
  }));
937
942
  }
938
943
  toUpperCase() {
939
- return new q(y(u({}, this._def), {
944
+ return new J(y(u({}, this._def), {
940
945
  checks: [...this._def.checks, { kind: "toUpperCase" }]
941
946
  }));
942
947
  }
@@ -1001,19 +1006,19 @@ class q extends x {
1001
1006
  return e;
1002
1007
  }
1003
1008
  }
1004
- q.create = (n) => {
1009
+ J.create = (n) => {
1005
1010
  var e;
1006
- return new q(u({
1011
+ return new J(u({
1007
1012
  checks: [],
1008
1013
  typeName: g.ZodString,
1009
1014
  coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
1010
- }, w(n)));
1015
+ }, b(n)));
1011
1016
  };
1012
- function Dn(n, e) {
1017
+ function Ln(n, e) {
1013
1018
  const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = parseInt(n.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
1014
1019
  return a % i / Math.pow(10, r);
1015
1020
  }
1016
- class ue extends x {
1021
+ class fe extends w {
1017
1022
  constructor() {
1018
1023
  super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1019
1024
  }
@@ -1027,9 +1032,9 @@ class ue extends x {
1027
1032
  }), v;
1028
1033
  }
1029
1034
  let s;
1030
- const r = new R();
1035
+ const r = new Z();
1031
1036
  for (const a of this._def.checks)
1032
- a.kind === "int" ? k.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
1037
+ a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
1033
1038
  code: l.invalid_type,
1034
1039
  expected: "integer",
1035
1040
  received: "float",
@@ -1048,14 +1053,14 @@ class ue extends x {
1048
1053
  inclusive: a.inclusive,
1049
1054
  exact: !1,
1050
1055
  message: a.message
1051
- }), r.dirty()) : a.kind === "multipleOf" ? Dn(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), h(s, {
1056
+ }), r.dirty()) : a.kind === "multipleOf" ? Ln(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), h(s, {
1052
1057
  code: l.not_multiple_of,
1053
1058
  multipleOf: a.value,
1054
1059
  message: a.message
1055
1060
  }), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
1056
1061
  code: l.not_finite,
1057
1062
  message: a.message
1058
- }), r.dirty()) : k.assertNever(a);
1063
+ }), r.dirty()) : x.assertNever(a);
1059
1064
  return { status: r.value, value: e.data };
1060
1065
  }
1061
1066
  gte(e, t) {
@@ -1071,7 +1076,7 @@ class ue extends x {
1071
1076
  return this.setLimit("max", e, !1, m.toString(t));
1072
1077
  }
1073
1078
  setLimit(e, t, s, r) {
1074
- return new ue(y(u({}, this._def), {
1079
+ return new fe(y(u({}, this._def), {
1075
1080
  checks: [
1076
1081
  ...this._def.checks,
1077
1082
  {
@@ -1084,7 +1089,7 @@ class ue extends x {
1084
1089
  }));
1085
1090
  }
1086
1091
  _addCheck(e) {
1087
- return new ue(y(u({}, this._def), {
1092
+ return new fe(y(u({}, this._def), {
1088
1093
  checks: [...this._def.checks, e]
1089
1094
  }));
1090
1095
  }
@@ -1165,7 +1170,7 @@ class ue extends x {
1165
1170
  return e;
1166
1171
  }
1167
1172
  get isInt() {
1168
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && k.isInteger(e.value));
1173
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
1169
1174
  }
1170
1175
  get isFinite() {
1171
1176
  let e = null, t = null;
@@ -1177,12 +1182,12 @@ class ue extends x {
1177
1182
  return Number.isFinite(t) && Number.isFinite(e);
1178
1183
  }
1179
1184
  }
1180
- ue.create = (n) => new ue(u({
1185
+ fe.create = (n) => new fe(u({
1181
1186
  checks: [],
1182
1187
  typeName: g.ZodNumber,
1183
1188
  coerce: (n == null ? void 0 : n.coerce) || !1
1184
- }, w(n)));
1185
- class de extends x {
1189
+ }, b(n)));
1190
+ class he extends w {
1186
1191
  constructor() {
1187
1192
  super(...arguments), this.min = this.gte, this.max = this.lte;
1188
1193
  }
@@ -1196,7 +1201,7 @@ class de extends x {
1196
1201
  if (this._getType(e) !== p.bigint)
1197
1202
  return this._getInvalidInput(e);
1198
1203
  let s;
1199
- const r = new R();
1204
+ const r = new Z();
1200
1205
  for (const a of this._def.checks)
1201
1206
  a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), h(s, {
1202
1207
  code: l.too_small,
@@ -1214,7 +1219,7 @@ class de extends x {
1214
1219
  code: l.not_multiple_of,
1215
1220
  multipleOf: a.value,
1216
1221
  message: a.message
1217
- }), r.dirty()) : k.assertNever(a);
1222
+ }), r.dirty()) : x.assertNever(a);
1218
1223
  return { status: r.value, value: e.data };
1219
1224
  }
1220
1225
  _getInvalidInput(e) {
@@ -1238,7 +1243,7 @@ class de extends x {
1238
1243
  return this.setLimit("max", e, !1, m.toString(t));
1239
1244
  }
1240
1245
  setLimit(e, t, s, r) {
1241
- return new de(y(u({}, this._def), {
1246
+ return new he(y(u({}, this._def), {
1242
1247
  checks: [
1243
1248
  ...this._def.checks,
1244
1249
  {
@@ -1251,7 +1256,7 @@ class de extends x {
1251
1256
  }));
1252
1257
  }
1253
1258
  _addCheck(e) {
1254
- return new de(y(u({}, this._def), {
1259
+ return new he(y(u({}, this._def), {
1255
1260
  checks: [...this._def.checks, e]
1256
1261
  }));
1257
1262
  }
@@ -1307,15 +1312,15 @@ class de extends x {
1307
1312
  return e;
1308
1313
  }
1309
1314
  }
1310
- de.create = (n) => {
1315
+ he.create = (n) => {
1311
1316
  var e;
1312
- return new de(u({
1317
+ return new he(u({
1313
1318
  checks: [],
1314
1319
  typeName: g.ZodBigInt,
1315
1320
  coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1
1316
- }, w(n)));
1321
+ }, b(n)));
1317
1322
  };
1318
- class Me extends x {
1323
+ class $e extends w {
1319
1324
  _parse(e) {
1320
1325
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
1321
1326
  const s = this._getOrReturnCtx(e);
@@ -1325,14 +1330,14 @@ class Me extends x {
1325
1330
  received: s.parsedType
1326
1331
  }), v;
1327
1332
  }
1328
- return $(e.data);
1333
+ return P(e.data);
1329
1334
  }
1330
1335
  }
1331
- Me.create = (n) => new Me(u({
1336
+ $e.create = (n) => new $e(u({
1332
1337
  typeName: g.ZodBoolean,
1333
1338
  coerce: (n == null ? void 0 : n.coerce) || !1
1334
- }, w(n)));
1335
- class ge extends x {
1339
+ }, b(n)));
1340
+ class we extends w {
1336
1341
  _parse(e) {
1337
1342
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
1338
1343
  const a = this._getOrReturnCtx(e);
@@ -1348,7 +1353,7 @@ class ge extends x {
1348
1353
  code: l.invalid_date
1349
1354
  }), v;
1350
1355
  }
1351
- const s = new R();
1356
+ const s = new Z();
1352
1357
  let r;
1353
1358
  for (const a of this._def.checks)
1354
1359
  a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), h(r, {
@@ -1365,14 +1370,14 @@ class ge extends x {
1365
1370
  exact: !1,
1366
1371
  maximum: a.value,
1367
1372
  type: "date"
1368
- }), s.dirty()) : k.assertNever(a);
1373
+ }), s.dirty()) : x.assertNever(a);
1369
1374
  return {
1370
1375
  status: s.value,
1371
1376
  value: new Date(e.data.getTime())
1372
1377
  };
1373
1378
  }
1374
1379
  _addCheck(e) {
1375
- return new ge(y(u({}, this._def), {
1380
+ return new we(y(u({}, this._def), {
1376
1381
  checks: [...this._def.checks, e]
1377
1382
  }));
1378
1383
  }
@@ -1403,12 +1408,12 @@ class ge extends x {
1403
1408
  return e != null ? new Date(e) : null;
1404
1409
  }
1405
1410
  }
1406
- ge.create = (n) => new ge(u({
1411
+ we.create = (n) => new we(u({
1407
1412
  checks: [],
1408
1413
  coerce: (n == null ? void 0 : n.coerce) || !1,
1409
1414
  typeName: g.ZodDate
1410
- }, w(n)));
1411
- class nt extends x {
1415
+ }, b(n)));
1416
+ class st extends w {
1412
1417
  _parse(e) {
1413
1418
  if (this._getType(e) !== p.symbol) {
1414
1419
  const s = this._getOrReturnCtx(e);
@@ -1418,13 +1423,13 @@ class nt extends x {
1418
1423
  received: s.parsedType
1419
1424
  }), v;
1420
1425
  }
1421
- return $(e.data);
1426
+ return P(e.data);
1422
1427
  }
1423
1428
  }
1424
- nt.create = (n) => new nt(u({
1429
+ st.create = (n) => new st(u({
1425
1430
  typeName: g.ZodSymbol
1426
- }, w(n)));
1427
- class $e extends x {
1431
+ }, b(n)));
1432
+ class Fe extends w {
1428
1433
  _parse(e) {
1429
1434
  if (this._getType(e) !== p.undefined) {
1430
1435
  const s = this._getOrReturnCtx(e);
@@ -1434,13 +1439,13 @@ class $e extends x {
1434
1439
  received: s.parsedType
1435
1440
  }), v;
1436
1441
  }
1437
- return $(e.data);
1442
+ return P(e.data);
1438
1443
  }
1439
1444
  }
1440
- $e.create = (n) => new $e(u({
1445
+ Fe.create = (n) => new Fe(u({
1441
1446
  typeName: g.ZodUndefined
1442
- }, w(n)));
1443
- class Pe extends x {
1447
+ }, b(n)));
1448
+ class De extends w {
1444
1449
  _parse(e) {
1445
1450
  if (this._getType(e) !== p.null) {
1446
1451
  const s = this._getOrReturnCtx(e);
@@ -1450,35 +1455,35 @@ class Pe extends x {
1450
1455
  received: s.parsedType
1451
1456
  }), v;
1452
1457
  }
1453
- return $(e.data);
1458
+ return P(e.data);
1454
1459
  }
1455
1460
  }
1456
- Pe.create = (n) => new Pe(u({
1461
+ De.create = (n) => new De(u({
1457
1462
  typeName: g.ZodNull
1458
- }, w(n)));
1459
- class Te extends x {
1463
+ }, b(n)));
1464
+ class Ee extends w {
1460
1465
  constructor() {
1461
1466
  super(...arguments), this._any = !0;
1462
1467
  }
1463
1468
  _parse(e) {
1464
- return $(e.data);
1469
+ return P(e.data);
1465
1470
  }
1466
1471
  }
1467
- Te.create = (n) => new Te(u({
1472
+ Ee.create = (n) => new Ee(u({
1468
1473
  typeName: g.ZodAny
1469
- }, w(n)));
1470
- class me extends x {
1474
+ }, b(n)));
1475
+ class _e extends w {
1471
1476
  constructor() {
1472
1477
  super(...arguments), this._unknown = !0;
1473
1478
  }
1474
1479
  _parse(e) {
1475
- return $(e.data);
1480
+ return P(e.data);
1476
1481
  }
1477
1482
  }
1478
- me.create = (n) => new me(u({
1483
+ _e.create = (n) => new _e(u({
1479
1484
  typeName: g.ZodUnknown
1480
- }, w(n)));
1481
- class ie extends x {
1485
+ }, b(n)));
1486
+ class oe extends w {
1482
1487
  _parse(e) {
1483
1488
  const t = this._getOrReturnCtx(e);
1484
1489
  return h(t, {
@@ -1488,10 +1493,10 @@ class ie extends x {
1488
1493
  }), v;
1489
1494
  }
1490
1495
  }
1491
- ie.create = (n) => new ie(u({
1496
+ oe.create = (n) => new oe(u({
1492
1497
  typeName: g.ZodNever
1493
- }, w(n)));
1494
- class st extends x {
1498
+ }, b(n)));
1499
+ class rt extends w {
1495
1500
  _parse(e) {
1496
1501
  if (this._getType(e) !== p.undefined) {
1497
1502
  const s = this._getOrReturnCtx(e);
@@ -1501,13 +1506,13 @@ class st extends x {
1501
1506
  received: s.parsedType
1502
1507
  }), v;
1503
1508
  }
1504
- return $(e.data);
1509
+ return P(e.data);
1505
1510
  }
1506
1511
  }
1507
- st.create = (n) => new st(u({
1512
+ rt.create = (n) => new rt(u({
1508
1513
  typeName: g.ZodVoid
1509
- }, w(n)));
1510
- class H extends x {
1514
+ }, b(n)));
1515
+ class K extends w {
1511
1516
  _parse(e) {
1512
1517
  const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
1513
1518
  if (t.parsedType !== p.array)
@@ -1543,25 +1548,25 @@ class H extends x {
1543
1548
  exact: !1,
1544
1549
  message: r.maxLength.message
1545
1550
  }), s.dirty()), t.common.async)
1546
- return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new Q(t, i, t.path, o)))).then((i) => R.mergeArray(s, i));
1547
- const a = [...t.data].map((i, o) => r.type._parseSync(new Q(t, i, t.path, o)));
1548
- return R.mergeArray(s, a);
1551
+ return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new te(t, i, t.path, o)))).then((i) => Z.mergeArray(s, i));
1552
+ const a = [...t.data].map((i, o) => r.type._parseSync(new te(t, i, t.path, o)));
1553
+ return Z.mergeArray(s, a);
1549
1554
  }
1550
1555
  get element() {
1551
1556
  return this._def.type;
1552
1557
  }
1553
1558
  min(e, t) {
1554
- return new H(y(u({}, this._def), {
1559
+ return new K(y(u({}, this._def), {
1555
1560
  minLength: { value: e, message: m.toString(t) }
1556
1561
  }));
1557
1562
  }
1558
1563
  max(e, t) {
1559
- return new H(y(u({}, this._def), {
1564
+ return new K(y(u({}, this._def), {
1560
1565
  maxLength: { value: e, message: m.toString(t) }
1561
1566
  }));
1562
1567
  }
1563
1568
  length(e, t) {
1564
- return new H(y(u({}, this._def), {
1569
+ return new K(y(u({}, this._def), {
1565
1570
  exactLength: { value: e, message: m.toString(t) }
1566
1571
  }));
1567
1572
  }
@@ -1569,35 +1574,35 @@ class H extends x {
1569
1574
  return this.min(1, e);
1570
1575
  }
1571
1576
  }
1572
- H.create = (n, e) => new H(u({
1577
+ K.create = (n, e) => new K(u({
1573
1578
  type: n,
1574
1579
  minLength: null,
1575
1580
  maxLength: null,
1576
1581
  exactLength: null,
1577
1582
  typeName: g.ZodArray
1578
- }, w(e)));
1579
- function be(n) {
1583
+ }, b(e)));
1584
+ function ke(n) {
1580
1585
  if (n instanceof S) {
1581
1586
  const e = {};
1582
1587
  for (const t in n.shape) {
1583
1588
  const s = n.shape[t];
1584
- e[t] = Y.create(be(s));
1589
+ e[t] = ee.create(ke(s));
1585
1590
  }
1586
1591
  return new S(y(u({}, n._def), {
1587
1592
  shape: () => e
1588
1593
  }));
1589
- } else return n instanceof H ? new H(y(u({}, n._def), {
1590
- type: be(n.element)
1591
- })) : n instanceof Y ? Y.create(be(n.unwrap())) : n instanceof fe ? fe.create(be(n.unwrap())) : n instanceof ee ? ee.create(n.items.map((e) => be(e))) : n;
1594
+ } else return n instanceof K ? new K(y(u({}, n._def), {
1595
+ type: ke(n.element)
1596
+ })) : n instanceof ee ? ee.create(ke(n.unwrap())) : n instanceof me ? me.create(ke(n.unwrap())) : n instanceof ne ? ne.create(n.items.map((e) => ke(e))) : n;
1592
1597
  }
1593
- class S extends x {
1598
+ class S extends w {
1594
1599
  constructor() {
1595
1600
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1596
1601
  }
1597
1602
  _getCached() {
1598
1603
  if (this._cached !== null)
1599
1604
  return this._cached;
1600
- const e = this._def.shape(), t = k.objectKeys(e);
1605
+ const e = this._def.shape(), t = x.objectKeys(e);
1601
1606
  return this._cached = { shape: e, keys: t };
1602
1607
  }
1603
1608
  _parse(e) {
@@ -1610,7 +1615,7 @@ class S extends x {
1610
1615
  }), v;
1611
1616
  }
1612
1617
  const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1613
- if (!(this._def.catchall instanceof ie && this._def.unknownKeys === "strip"))
1618
+ if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
1614
1619
  for (const d in r.data)
1615
1620
  i.includes(d) || o.push(d);
1616
1621
  const c = [];
@@ -1618,11 +1623,11 @@ class S extends x {
1618
1623
  const f = a[d], _ = r.data[d];
1619
1624
  c.push({
1620
1625
  key: { status: "valid", value: d },
1621
- value: f._parse(new Q(r, _, r.path, d)),
1626
+ value: f._parse(new te(r, _, r.path, d)),
1622
1627
  alwaysSet: d in r.data
1623
1628
  });
1624
1629
  }
1625
- if (this._def.catchall instanceof ie) {
1630
+ if (this._def.catchall instanceof oe) {
1626
1631
  const d = this._def.unknownKeys;
1627
1632
  if (d === "passthrough")
1628
1633
  for (const f of o)
@@ -1643,25 +1648,25 @@ class S extends x {
1643
1648
  c.push({
1644
1649
  key: { status: "valid", value: f },
1645
1650
  value: d._parse(
1646
- new Q(r, _, r.path, f)
1651
+ new te(r, _, r.path, f)
1647
1652
  //, ctx.child(key), value, getParsedType(value)
1648
1653
  ),
1649
1654
  alwaysSet: f in r.data
1650
1655
  });
1651
1656
  }
1652
1657
  }
1653
- return r.common.async ? Promise.resolve().then(() => P(this, null, function* () {
1658
+ return r.common.async ? Promise.resolve().then(() => F(this, null, function* () {
1654
1659
  const d = [];
1655
1660
  for (const f of c) {
1656
- const _ = yield f.key, I = yield f.value;
1661
+ const _ = yield f.key, j = yield f.value;
1657
1662
  d.push({
1658
1663
  key: _,
1659
- value: I,
1664
+ value: j,
1660
1665
  alwaysSet: f.alwaysSet
1661
1666
  });
1662
1667
  }
1663
1668
  return d;
1664
- })).then((d) => R.mergeObjectSync(s, d)) : R.mergeObjectSync(s, c);
1669
+ })).then((d) => Z.mergeObjectSync(s, d)) : Z.mergeObjectSync(s, c);
1665
1670
  }
1666
1671
  get shape() {
1667
1672
  return this._def.shape();
@@ -1792,7 +1797,7 @@ class S extends x {
1792
1797
  }
1793
1798
  pick(e) {
1794
1799
  const t = {};
1795
- return k.objectKeys(e).forEach((s) => {
1800
+ return x.objectKeys(e).forEach((s) => {
1796
1801
  e[s] && this.shape[s] && (t[s] = this.shape[s]);
1797
1802
  }), new S(y(u({}, this._def), {
1798
1803
  shape: () => t
@@ -1800,7 +1805,7 @@ class S extends x {
1800
1805
  }
1801
1806
  omit(e) {
1802
1807
  const t = {};
1803
- return k.objectKeys(this.shape).forEach((s) => {
1808
+ return x.objectKeys(this.shape).forEach((s) => {
1804
1809
  e[s] || (t[s] = this.shape[s]);
1805
1810
  }), new S(y(u({}, this._def), {
1806
1811
  shape: () => t
@@ -1810,11 +1815,11 @@ class S extends x {
1810
1815
  * @deprecated
1811
1816
  */
1812
1817
  deepPartial() {
1813
- return be(this);
1818
+ return ke(this);
1814
1819
  }
1815
1820
  partial(e) {
1816
1821
  const t = {};
1817
- return k.objectKeys(this.shape).forEach((s) => {
1822
+ return x.objectKeys(this.shape).forEach((s) => {
1818
1823
  const r = this.shape[s];
1819
1824
  e && !e[s] ? t[s] = r : t[s] = r.optional();
1820
1825
  }), new S(y(u({}, this._def), {
@@ -1823,12 +1828,12 @@ class S extends x {
1823
1828
  }
1824
1829
  required(e) {
1825
1830
  const t = {};
1826
- return k.objectKeys(this.shape).forEach((s) => {
1831
+ return x.objectKeys(this.shape).forEach((s) => {
1827
1832
  if (e && !e[s])
1828
1833
  t[s] = this.shape[s];
1829
1834
  else {
1830
1835
  let a = this.shape[s];
1831
- for (; a instanceof Y; )
1836
+ for (; a instanceof ee; )
1832
1837
  a = a._def.innerType;
1833
1838
  t[s] = a;
1834
1839
  }
@@ -1837,28 +1842,28 @@ class S extends x {
1837
1842
  }));
1838
1843
  }
1839
1844
  keyof() {
1840
- return Xt(k.objectKeys(this.shape));
1845
+ return Xt(x.objectKeys(this.shape));
1841
1846
  }
1842
1847
  }
1843
1848
  S.create = (n, e) => new S(u({
1844
1849
  shape: () => n,
1845
1850
  unknownKeys: "strip",
1846
- catchall: ie.create(),
1851
+ catchall: oe.create(),
1847
1852
  typeName: g.ZodObject
1848
- }, w(e)));
1853
+ }, b(e)));
1849
1854
  S.strictCreate = (n, e) => new S(u({
1850
1855
  shape: () => n,
1851
1856
  unknownKeys: "strict",
1852
- catchall: ie.create(),
1857
+ catchall: oe.create(),
1853
1858
  typeName: g.ZodObject
1854
- }, w(e)));
1859
+ }, b(e)));
1855
1860
  S.lazycreate = (n, e) => new S(u({
1856
1861
  shape: n,
1857
1862
  unknownKeys: "strip",
1858
- catchall: ie.create(),
1863
+ catchall: oe.create(),
1859
1864
  typeName: g.ZodObject
1860
- }, w(e)));
1861
- class Fe extends x {
1865
+ }, b(e)));
1866
+ class Le extends w {
1862
1867
  _parse(e) {
1863
1868
  const { ctx: t } = this._processInputParams(e), s = this._def.options;
1864
1869
  function r(a) {
@@ -1868,14 +1873,14 @@ class Fe extends x {
1868
1873
  for (const o of a)
1869
1874
  if (o.result.status === "dirty")
1870
1875
  return t.common.issues.push(...o.ctx.common.issues), o.result;
1871
- const i = a.map((o) => new U(o.ctx.common.issues));
1876
+ const i = a.map((o) => new z(o.ctx.common.issues));
1872
1877
  return h(t, {
1873
1878
  code: l.invalid_union,
1874
1879
  unionErrors: i
1875
1880
  }), v;
1876
1881
  }
1877
1882
  if (t.common.async)
1878
- return Promise.all(s.map((a) => P(this, null, function* () {
1883
+ return Promise.all(s.map((a) => F(this, null, function* () {
1879
1884
  const i = y(u({}, t), {
1880
1885
  common: y(u({}, t.common), {
1881
1886
  issues: []
@@ -1911,7 +1916,7 @@ class Fe extends x {
1911
1916
  }
1912
1917
  if (a)
1913
1918
  return t.common.issues.push(...a.ctx.common.issues), a.result;
1914
- const o = i.map((c) => new U(c));
1919
+ const o = i.map((c) => new z(c));
1915
1920
  return h(t, {
1916
1921
  code: l.invalid_union,
1917
1922
  unionErrors: o
@@ -1922,12 +1927,12 @@ class Fe extends x {
1922
1927
  return this._def.options;
1923
1928
  }
1924
1929
  }
1925
- Fe.create = (n, e) => new Fe(u({
1930
+ Le.create = (n, e) => new Le(u({
1926
1931
  options: n,
1927
1932
  typeName: g.ZodUnion
1928
- }, w(e)));
1929
- const re = (n) => n instanceof Ve ? re(n.schema) : n instanceof J ? re(n.innerType()) : n instanceof Ue ? [n.value] : n instanceof le ? n.options : n instanceof ze ? k.objectValues(n.enum) : n instanceof We ? re(n._def.innerType) : n instanceof $e ? [void 0] : n instanceof Pe ? [null] : n instanceof Y ? [void 0, ...re(n.unwrap())] : n instanceof fe ? [null, ...re(n.unwrap())] : n instanceof At || n instanceof qe ? re(n.unwrap()) : n instanceof Be ? re(n._def.innerType) : [];
1930
- class it extends x {
1933
+ }, b(e)));
1934
+ const ae = (n) => n instanceof ze ? ae(n.schema) : n instanceof G ? ae(n.innerType()) : n instanceof We ? [n.value] : n instanceof pe ? n.options : n instanceof Be ? x.objectValues(n.enum) : n instanceof qe ? ae(n._def.innerType) : n instanceof Fe ? [void 0] : n instanceof De ? [null] : n instanceof ee ? [void 0, ...ae(n.unwrap())] : n instanceof me ? [null, ...ae(n.unwrap())] : n instanceof Ot || n instanceof Je ? ae(n.unwrap()) : n instanceof He ? ae(n._def.innerType) : [];
1935
+ class ot extends w {
1931
1936
  _parse(e) {
1932
1937
  const { ctx: t } = this._processInputParams(e);
1933
1938
  if (t.parsedType !== p.object)
@@ -1971,7 +1976,7 @@ class it extends x {
1971
1976
  static create(e, t, s) {
1972
1977
  const r = /* @__PURE__ */ new Map();
1973
1978
  for (const a of t) {
1974
- const i = re(a.shape[e]);
1979
+ const i = ae(a.shape[e]);
1975
1980
  if (!i.length)
1976
1981
  throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1977
1982
  for (const o of i) {
@@ -1980,22 +1985,22 @@ class it extends x {
1980
1985
  r.set(o, a);
1981
1986
  }
1982
1987
  }
1983
- return new it(u({
1988
+ return new ot(u({
1984
1989
  typeName: g.ZodDiscriminatedUnion,
1985
1990
  discriminator: e,
1986
1991
  options: t,
1987
1992
  optionsMap: r
1988
- }, w(s)));
1993
+ }, b(s)));
1989
1994
  }
1990
1995
  }
1991
- function gt(n, e) {
1992
- const t = ae(n), s = ae(e);
1996
+ function vt(n, e) {
1997
+ const t = ie(n), s = ie(e);
1993
1998
  if (n === e)
1994
1999
  return { valid: !0, data: n };
1995
2000
  if (t === p.object && s === p.object) {
1996
- const r = k.objectKeys(e), a = k.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = u(u({}, n), e);
2001
+ const r = x.objectKeys(e), a = x.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = u(u({}, n), e);
1997
2002
  for (const o of a) {
1998
- const c = gt(n[o], e[o]);
2003
+ const c = vt(n[o], e[o]);
1999
2004
  if (!c.valid)
2000
2005
  return { valid: !1 };
2001
2006
  i[o] = c.data;
@@ -2006,7 +2011,7 @@ function gt(n, e) {
2006
2011
  return { valid: !1 };
2007
2012
  const r = [];
2008
2013
  for (let a = 0; a < n.length; a++) {
2009
- const i = n[a], o = e[a], c = gt(i, o);
2014
+ const i = n[a], o = e[a], c = vt(i, o);
2010
2015
  if (!c.valid)
2011
2016
  return { valid: !1 };
2012
2017
  r.push(c.data);
@@ -2014,13 +2019,13 @@ function gt(n, e) {
2014
2019
  return { valid: !0, data: r };
2015
2020
  } else return t === p.date && s === p.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2016
2021
  }
2017
- class Le extends x {
2022
+ class Ve extends w {
2018
2023
  _parse(e) {
2019
2024
  const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
2020
- if (mt(a) || mt(i))
2025
+ if (yt(a) || yt(i))
2021
2026
  return v;
2022
- const o = gt(a.value, i.value);
2023
- return o.valid ? ((yt(a) || yt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
2027
+ const o = vt(a.value, i.value);
2028
+ return o.valid ? ((gt(a) || gt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
2024
2029
  code: l.invalid_intersection_types
2025
2030
  }), v);
2026
2031
  };
@@ -2046,12 +2051,12 @@ class Le extends x {
2046
2051
  }));
2047
2052
  }
2048
2053
  }
2049
- Le.create = (n, e, t) => new Le(u({
2054
+ Ve.create = (n, e, t) => new Ve(u({
2050
2055
  left: n,
2051
2056
  right: e,
2052
2057
  typeName: g.ZodIntersection
2053
- }, w(t)));
2054
- class ee extends x {
2058
+ }, b(t)));
2059
+ class ne extends w {
2055
2060
  _parse(e) {
2056
2061
  const { status: t, ctx: s } = this._processInputParams(e);
2057
2062
  if (s.parsedType !== p.array)
@@ -2077,29 +2082,29 @@ class ee extends x {
2077
2082
  }), t.dirty());
2078
2083
  const a = [...s.data].map((i, o) => {
2079
2084
  const c = this._def.items[o] || this._def.rest;
2080
- return c ? c._parse(new Q(s, i, s.path, o)) : null;
2085
+ return c ? c._parse(new te(s, i, s.path, o)) : null;
2081
2086
  }).filter((i) => !!i);
2082
- return s.common.async ? Promise.all(a).then((i) => R.mergeArray(t, i)) : R.mergeArray(t, a);
2087
+ return s.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
2083
2088
  }
2084
2089
  get items() {
2085
2090
  return this._def.items;
2086
2091
  }
2087
2092
  rest(e) {
2088
- return new ee(y(u({}, this._def), {
2093
+ return new ne(y(u({}, this._def), {
2089
2094
  rest: e
2090
2095
  }));
2091
2096
  }
2092
2097
  }
2093
- ee.create = (n, e) => {
2098
+ ne.create = (n, e) => {
2094
2099
  if (!Array.isArray(n))
2095
2100
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2096
- return new ee(u({
2101
+ return new ne(u({
2097
2102
  items: n,
2098
2103
  typeName: g.ZodTuple,
2099
2104
  rest: null
2100
- }, w(e)));
2105
+ }, b(e)));
2101
2106
  };
2102
- class De extends x {
2107
+ class Ue extends w {
2103
2108
  get keySchema() {
2104
2109
  return this._def.keyType;
2105
2110
  }
@@ -2117,28 +2122,28 @@ class De extends x {
2117
2122
  const r = [], a = this._def.keyType, i = this._def.valueType;
2118
2123
  for (const o in s.data)
2119
2124
  r.push({
2120
- key: a._parse(new Q(s, o, s.path, o)),
2121
- value: i._parse(new Q(s, s.data[o], s.path, o)),
2125
+ key: a._parse(new te(s, o, s.path, o)),
2126
+ value: i._parse(new te(s, s.data[o], s.path, o)),
2122
2127
  alwaysSet: o in s.data
2123
2128
  });
2124
- return s.common.async ? R.mergeObjectAsync(t, r) : R.mergeObjectSync(t, r);
2129
+ return s.common.async ? Z.mergeObjectAsync(t, r) : Z.mergeObjectSync(t, r);
2125
2130
  }
2126
2131
  get element() {
2127
2132
  return this._def.valueType;
2128
2133
  }
2129
2134
  static create(e, t, s) {
2130
- return t instanceof x ? new De(u({
2135
+ return t instanceof w ? new Ue(u({
2131
2136
  keyType: e,
2132
2137
  valueType: t,
2133
2138
  typeName: g.ZodRecord
2134
- }, w(s))) : new De(u({
2135
- keyType: q.create(),
2139
+ }, b(s))) : new Ue(u({
2140
+ keyType: J.create(),
2136
2141
  valueType: e,
2137
2142
  typeName: g.ZodRecord
2138
- }, w(t)));
2143
+ }, b(t)));
2139
2144
  }
2140
2145
  }
2141
- class rt extends x {
2146
+ class at extends w {
2142
2147
  get keySchema() {
2143
2148
  return this._def.keyType;
2144
2149
  }
@@ -2154,12 +2159,12 @@ class rt extends x {
2154
2159
  received: s.parsedType
2155
2160
  }), v;
2156
2161
  const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], d) => ({
2157
- key: r._parse(new Q(s, o, s.path, [d, "key"])),
2158
- value: a._parse(new Q(s, c, s.path, [d, "value"]))
2162
+ key: r._parse(new te(s, o, s.path, [d, "key"])),
2163
+ value: a._parse(new te(s, c, s.path, [d, "value"]))
2159
2164
  }));
2160
2165
  if (s.common.async) {
2161
2166
  const o = /* @__PURE__ */ new Map();
2162
- return Promise.resolve().then(() => P(this, null, function* () {
2167
+ return Promise.resolve().then(() => F(this, null, function* () {
2163
2168
  for (const c of i) {
2164
2169
  const d = yield c.key, f = yield c.value;
2165
2170
  if (d.status === "aborted" || f.status === "aborted")
@@ -2180,12 +2185,12 @@ class rt extends x {
2180
2185
  }
2181
2186
  }
2182
2187
  }
2183
- rt.create = (n, e, t) => new rt(u({
2188
+ at.create = (n, e, t) => new at(u({
2184
2189
  valueType: e,
2185
2190
  keyType: n,
2186
2191
  typeName: g.ZodMap
2187
- }, w(t)));
2188
- class ve extends x {
2192
+ }, b(t)));
2193
+ class xe extends w {
2189
2194
  _parse(e) {
2190
2195
  const { status: t, ctx: s } = this._processInputParams(e);
2191
2196
  if (s.parsedType !== p.set)
@@ -2220,16 +2225,16 @@ class ve extends x {
2220
2225
  }
2221
2226
  return { status: t.value, value: d };
2222
2227
  }
2223
- const o = [...s.data.values()].map((c, d) => a._parse(new Q(s, c, s.path, d)));
2228
+ const o = [...s.data.values()].map((c, d) => a._parse(new te(s, c, s.path, d)));
2224
2229
  return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2225
2230
  }
2226
2231
  min(e, t) {
2227
- return new ve(y(u({}, this._def), {
2232
+ return new xe(y(u({}, this._def), {
2228
2233
  minSize: { value: e, message: m.toString(t) }
2229
2234
  }));
2230
2235
  }
2231
2236
  max(e, t) {
2232
- return new ve(y(u({}, this._def), {
2237
+ return new xe(y(u({}, this._def), {
2233
2238
  maxSize: { value: e, message: m.toString(t) }
2234
2239
  }));
2235
2240
  }
@@ -2240,13 +2245,13 @@ class ve extends x {
2240
2245
  return this.min(1, e);
2241
2246
  }
2242
2247
  }
2243
- ve.create = (n, e) => new ve(u({
2248
+ xe.create = (n, e) => new xe(u({
2244
2249
  valueType: n,
2245
2250
  minSize: null,
2246
2251
  maxSize: null,
2247
2252
  typeName: g.ZodSet
2248
- }, w(e)));
2249
- class xe extends x {
2253
+ }, b(e)));
2254
+ class Se extends w {
2250
2255
  constructor() {
2251
2256
  super(...arguments), this.validate = this.implement;
2252
2257
  }
@@ -2259,14 +2264,14 @@ class xe extends x {
2259
2264
  received: t.parsedType
2260
2265
  }), v;
2261
2266
  function s(o, c) {
2262
- return et({
2267
+ return tt({
2263
2268
  data: o,
2264
2269
  path: t.path,
2265
2270
  errorMaps: [
2266
2271
  t.common.contextualErrorMap,
2267
2272
  t.schemaErrorMap,
2268
- Qe(),
2269
- ke
2273
+ et(),
2274
+ Ae
2270
2275
  ].filter((d) => !!d),
2271
2276
  issueData: {
2272
2277
  code: l.invalid_arguments,
@@ -2275,14 +2280,14 @@ class xe extends x {
2275
2280
  });
2276
2281
  }
2277
2282
  function r(o, c) {
2278
- return et({
2283
+ return tt({
2279
2284
  data: o,
2280
2285
  path: t.path,
2281
2286
  errorMaps: [
2282
2287
  t.common.contextualErrorMap,
2283
2288
  t.schemaErrorMap,
2284
- Qe(),
2285
- ke
2289
+ et(),
2290
+ Ae
2286
2291
  ].filter((d) => !!d),
2287
2292
  issueData: {
2288
2293
  code: l.invalid_return_type,
@@ -2291,27 +2296,27 @@ class xe extends x {
2291
2296
  });
2292
2297
  }
2293
2298
  const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2294
- if (this._def.returns instanceof Se) {
2299
+ if (this._def.returns instanceof Oe) {
2295
2300
  const o = this;
2296
- return $(function(...c) {
2297
- return P(this, null, function* () {
2298
- const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((A) => {
2299
- throw d.addIssue(s(c, A)), d;
2301
+ return P(function(...c) {
2302
+ return F(this, null, function* () {
2303
+ const d = new z([]), f = yield o._def.args.parseAsync(c, a).catch((O) => {
2304
+ throw d.addIssue(s(c, O)), d;
2300
2305
  }), _ = yield Reflect.apply(i, this, f);
2301
- return yield o._def.returns._def.type.parseAsync(_, a).catch((A) => {
2302
- throw d.addIssue(r(_, A)), d;
2306
+ return yield o._def.returns._def.type.parseAsync(_, a).catch((O) => {
2307
+ throw d.addIssue(r(_, O)), d;
2303
2308
  });
2304
2309
  });
2305
2310
  });
2306
2311
  } else {
2307
2312
  const o = this;
2308
- return $(function(...c) {
2313
+ return P(function(...c) {
2309
2314
  const d = o._def.args.safeParse(c, a);
2310
2315
  if (!d.success)
2311
- throw new U([s(c, d.error)]);
2316
+ throw new z([s(c, d.error)]);
2312
2317
  const f = Reflect.apply(i, this, d.data), _ = o._def.returns.safeParse(f, a);
2313
2318
  if (!_.success)
2314
- throw new U([r(f, _.error)]);
2319
+ throw new z([r(f, _.error)]);
2315
2320
  return _.data;
2316
2321
  });
2317
2322
  }
@@ -2323,12 +2328,12 @@ class xe extends x {
2323
2328
  return this._def.returns;
2324
2329
  }
2325
2330
  args(...e) {
2326
- return new xe(y(u({}, this._def), {
2327
- args: ee.create(e).rest(me.create())
2331
+ return new Se(y(u({}, this._def), {
2332
+ args: ne.create(e).rest(_e.create())
2328
2333
  }));
2329
2334
  }
2330
2335
  returns(e) {
2331
- return new xe(y(u({}, this._def), {
2336
+ return new Se(y(u({}, this._def), {
2332
2337
  returns: e
2333
2338
  }));
2334
2339
  }
@@ -2339,14 +2344,14 @@ class xe extends x {
2339
2344
  return this.parse(e);
2340
2345
  }
2341
2346
  static create(e, t, s) {
2342
- return new xe(u({
2343
- args: e || ee.create([]).rest(me.create()),
2344
- returns: t || me.create(),
2347
+ return new Se(u({
2348
+ args: e || ne.create([]).rest(_e.create()),
2349
+ returns: t || _e.create(),
2345
2350
  typeName: g.ZodFunction
2346
- }, w(s)));
2351
+ }, b(s)));
2347
2352
  }
2348
2353
  }
2349
- class Ve extends x {
2354
+ class ze extends w {
2350
2355
  get schema() {
2351
2356
  return this._def.getter();
2352
2357
  }
@@ -2355,11 +2360,11 @@ class Ve extends x {
2355
2360
  return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2356
2361
  }
2357
2362
  }
2358
- Ve.create = (n, e) => new Ve(u({
2363
+ ze.create = (n, e) => new ze(u({
2359
2364
  getter: n,
2360
2365
  typeName: g.ZodLazy
2361
- }, w(e)));
2362
- class Ue extends x {
2366
+ }, b(e)));
2367
+ class We extends w {
2363
2368
  _parse(e) {
2364
2369
  if (e.data !== this._def.value) {
2365
2370
  const t = this._getOrReturnCtx(e);
@@ -2375,30 +2380,30 @@ class Ue extends x {
2375
2380
  return this._def.value;
2376
2381
  }
2377
2382
  }
2378
- Ue.create = (n, e) => new Ue(u({
2383
+ We.create = (n, e) => new We(u({
2379
2384
  value: n,
2380
2385
  typeName: g.ZodLiteral
2381
- }, w(e)));
2386
+ }, b(e)));
2382
2387
  function Xt(n, e) {
2383
- return new le(u({
2388
+ return new pe(u({
2384
2389
  values: n,
2385
2390
  typeName: g.ZodEnum
2386
- }, w(e)));
2391
+ }, b(e)));
2387
2392
  }
2388
- class le extends x {
2393
+ class pe extends w {
2389
2394
  constructor() {
2390
- super(...arguments), Ce.set(this, void 0);
2395
+ super(...arguments), je.set(this, void 0);
2391
2396
  }
2392
2397
  _parse(e) {
2393
2398
  if (typeof e.data != "string") {
2394
2399
  const t = this._getOrReturnCtx(e), s = this._def.values;
2395
2400
  return h(t, {
2396
- expected: k.joinValues(s),
2401
+ expected: x.joinValues(s),
2397
2402
  received: t.parsedType,
2398
2403
  code: l.invalid_type
2399
2404
  }), v;
2400
2405
  }
2401
- if (tt(this, Ce) || Ht(this, Ce, new Set(this._def.values)), !tt(this, Ce).has(e.data)) {
2406
+ if (nt(this, je) || Ht(this, je, new Set(this._def.values)), !nt(this, je).has(e.data)) {
2402
2407
  const t = this._getOrReturnCtx(e), s = this._def.values;
2403
2408
  return h(t, {
2404
2409
  received: t.data,
@@ -2406,7 +2411,7 @@ class le extends x {
2406
2411
  options: s
2407
2412
  }), v;
2408
2413
  }
2409
- return $(e.data);
2414
+ return P(e.data);
2410
2415
  }
2411
2416
  get options() {
2412
2417
  return this._def.values;
@@ -2430,48 +2435,48 @@ class le extends x {
2430
2435
  return e;
2431
2436
  }
2432
2437
  extract(e, t = this._def) {
2433
- return le.create(e, u(u({}, this._def), t));
2438
+ return pe.create(e, u(u({}, this._def), t));
2434
2439
  }
2435
2440
  exclude(e, t = this._def) {
2436
- return le.create(this.options.filter((s) => !e.includes(s)), u(u({}, this._def), t));
2441
+ return pe.create(this.options.filter((s) => !e.includes(s)), u(u({}, this._def), t));
2437
2442
  }
2438
2443
  }
2439
- Ce = /* @__PURE__ */ new WeakMap();
2440
- le.create = Xt;
2441
- class ze extends x {
2444
+ je = /* @__PURE__ */ new WeakMap();
2445
+ pe.create = Xt;
2446
+ class Be extends w {
2442
2447
  constructor() {
2443
- super(...arguments), Ie.set(this, void 0);
2448
+ super(...arguments), Ne.set(this, void 0);
2444
2449
  }
2445
2450
  _parse(e) {
2446
- const t = k.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2451
+ const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2447
2452
  if (s.parsedType !== p.string && s.parsedType !== p.number) {
2448
- const r = k.objectValues(t);
2453
+ const r = x.objectValues(t);
2449
2454
  return h(s, {
2450
- expected: k.joinValues(r),
2455
+ expected: x.joinValues(r),
2451
2456
  received: s.parsedType,
2452
2457
  code: l.invalid_type
2453
2458
  }), v;
2454
2459
  }
2455
- if (tt(this, Ie) || Ht(this, Ie, new Set(k.getValidEnumValues(this._def.values))), !tt(this, Ie).has(e.data)) {
2456
- const r = k.objectValues(t);
2460
+ if (nt(this, Ne) || Ht(this, Ne, new Set(x.getValidEnumValues(this._def.values))), !nt(this, Ne).has(e.data)) {
2461
+ const r = x.objectValues(t);
2457
2462
  return h(s, {
2458
2463
  received: s.data,
2459
2464
  code: l.invalid_enum_value,
2460
2465
  options: r
2461
2466
  }), v;
2462
2467
  }
2463
- return $(e.data);
2468
+ return P(e.data);
2464
2469
  }
2465
2470
  get enum() {
2466
2471
  return this._def.values;
2467
2472
  }
2468
2473
  }
2469
- Ie = /* @__PURE__ */ new WeakMap();
2470
- ze.create = (n, e) => new ze(u({
2474
+ Ne = /* @__PURE__ */ new WeakMap();
2475
+ Be.create = (n, e) => new Be(u({
2471
2476
  values: n,
2472
2477
  typeName: g.ZodNativeEnum
2473
- }, w(e)));
2474
- class Se extends x {
2478
+ }, b(e)));
2479
+ class Oe extends w {
2475
2480
  unwrap() {
2476
2481
  return this._def.type;
2477
2482
  }
@@ -2484,17 +2489,17 @@ class Se extends x {
2484
2489
  received: t.parsedType
2485
2490
  }), v;
2486
2491
  const s = t.parsedType === p.promise ? t.data : Promise.resolve(t.data);
2487
- return $(s.then((r) => this._def.type.parseAsync(r, {
2492
+ return P(s.then((r) => this._def.type.parseAsync(r, {
2488
2493
  path: t.path,
2489
2494
  errorMap: t.common.contextualErrorMap
2490
2495
  })));
2491
2496
  }
2492
2497
  }
2493
- Se.create = (n, e) => new Se(u({
2498
+ Oe.create = (n, e) => new Oe(u({
2494
2499
  type: n,
2495
2500
  typeName: g.ZodPromise
2496
- }, w(e)));
2497
- class J extends x {
2501
+ }, b(e)));
2502
+ class G extends w {
2498
2503
  innerType() {
2499
2504
  return this._def.schema;
2500
2505
  }
@@ -2513,7 +2518,7 @@ class J extends x {
2513
2518
  if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
2514
2519
  const i = r.transform(s.data, a);
2515
2520
  if (s.common.async)
2516
- return Promise.resolve(i).then((o) => P(this, null, function* () {
2521
+ return Promise.resolve(i).then((o) => F(this, null, function* () {
2517
2522
  if (t.value === "aborted")
2518
2523
  return v;
2519
2524
  const c = yield this._def.schema._parseAsync({
@@ -2521,7 +2526,7 @@ class J extends x {
2521
2526
  path: s.path,
2522
2527
  parent: s
2523
2528
  });
2524
- return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? we(c.value) : c;
2529
+ return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? Te(c.value) : c;
2525
2530
  }));
2526
2531
  {
2527
2532
  if (t.value === "aborted")
@@ -2531,7 +2536,7 @@ class J extends x {
2531
2536
  path: s.path,
2532
2537
  parent: s
2533
2538
  });
2534
- return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? we(o.value) : o;
2539
+ return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? Te(o.value) : o;
2535
2540
  }
2536
2541
  }
2537
2542
  if (r.type === "refinement") {
@@ -2560,52 +2565,52 @@ class J extends x {
2560
2565
  path: s.path,
2561
2566
  parent: s
2562
2567
  });
2563
- if (!ye(i))
2568
+ if (!be(i))
2564
2569
  return i;
2565
2570
  const o = r.transform(i.value, a);
2566
2571
  if (o instanceof Promise)
2567
2572
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2568
2573
  return { status: t.value, value: o };
2569
2574
  } else
2570
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => ye(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2571
- k.assertNever(r);
2575
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => be(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2576
+ x.assertNever(r);
2572
2577
  }
2573
2578
  }
2574
- J.create = (n, e, t) => new J(u({
2579
+ G.create = (n, e, t) => new G(u({
2575
2580
  schema: n,
2576
2581
  typeName: g.ZodEffects,
2577
2582
  effect: e
2578
- }, w(t)));
2579
- J.createWithPreprocess = (n, e, t) => new J(u({
2583
+ }, b(t)));
2584
+ G.createWithPreprocess = (n, e, t) => new G(u({
2580
2585
  schema: e,
2581
2586
  effect: { type: "preprocess", transform: n },
2582
2587
  typeName: g.ZodEffects
2583
- }, w(t)));
2584
- class Y extends x {
2588
+ }, b(t)));
2589
+ class ee extends w {
2585
2590
  _parse(e) {
2586
- return this._getType(e) === p.undefined ? $(void 0) : this._def.innerType._parse(e);
2591
+ return this._getType(e) === p.undefined ? P(void 0) : this._def.innerType._parse(e);
2587
2592
  }
2588
2593
  unwrap() {
2589
2594
  return this._def.innerType;
2590
2595
  }
2591
2596
  }
2592
- Y.create = (n, e) => new Y(u({
2597
+ ee.create = (n, e) => new ee(u({
2593
2598
  innerType: n,
2594
2599
  typeName: g.ZodOptional
2595
- }, w(e)));
2596
- class fe extends x {
2600
+ }, b(e)));
2601
+ class me extends w {
2597
2602
  _parse(e) {
2598
- return this._getType(e) === p.null ? $(null) : this._def.innerType._parse(e);
2603
+ return this._getType(e) === p.null ? P(null) : this._def.innerType._parse(e);
2599
2604
  }
2600
2605
  unwrap() {
2601
2606
  return this._def.innerType;
2602
2607
  }
2603
2608
  }
2604
- fe.create = (n, e) => new fe(u({
2609
+ me.create = (n, e) => new me(u({
2605
2610
  innerType: n,
2606
2611
  typeName: g.ZodNullable
2607
- }, w(e)));
2608
- class We extends x {
2612
+ }, b(e)));
2613
+ class qe extends w {
2609
2614
  _parse(e) {
2610
2615
  const { ctx: t } = this._processInputParams(e);
2611
2616
  let s = t.data;
@@ -2619,12 +2624,12 @@ class We extends x {
2619
2624
  return this._def.innerType;
2620
2625
  }
2621
2626
  }
2622
- We.create = (n, e) => new We(u({
2627
+ qe.create = (n, e) => new qe(u({
2623
2628
  innerType: n,
2624
2629
  typeName: g.ZodDefault,
2625
2630
  defaultValue: typeof e.default == "function" ? e.default : () => e.default
2626
- }, w(e)));
2627
- class Be extends x {
2631
+ }, b(e)));
2632
+ class He extends w {
2628
2633
  _parse(e) {
2629
2634
  const { ctx: t } = this._processInputParams(e), s = y(u({}, t), {
2630
2635
  common: y(u({}, t.common), {
@@ -2635,11 +2640,11 @@ class Be extends x {
2635
2640
  path: s.path,
2636
2641
  parent: u({}, s)
2637
2642
  });
2638
- return Ze(r) ? r.then((a) => ({
2643
+ return Pe(r) ? r.then((a) => ({
2639
2644
  status: "valid",
2640
2645
  value: a.status === "valid" ? a.value : this._def.catchValue({
2641
2646
  get error() {
2642
- return new U(s.common.issues);
2647
+ return new z(s.common.issues);
2643
2648
  },
2644
2649
  input: s.data
2645
2650
  })
@@ -2647,7 +2652,7 @@ class Be extends x {
2647
2652
  status: "valid",
2648
2653
  value: r.status === "valid" ? r.value : this._def.catchValue({
2649
2654
  get error() {
2650
- return new U(s.common.issues);
2655
+ return new z(s.common.issues);
2651
2656
  },
2652
2657
  input: s.data
2653
2658
  })
@@ -2657,12 +2662,12 @@ class Be extends x {
2657
2662
  return this._def.innerType;
2658
2663
  }
2659
2664
  }
2660
- Be.create = (n, e) => new Be(u({
2665
+ He.create = (n, e) => new He(u({
2661
2666
  innerType: n,
2662
2667
  typeName: g.ZodCatch,
2663
2668
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
2664
- }, w(e)));
2665
- class at extends x {
2669
+ }, b(e)));
2670
+ class it extends w {
2666
2671
  _parse(e) {
2667
2672
  if (this._getType(e) !== p.nan) {
2668
2673
  const s = this._getOrReturnCtx(e);
@@ -2675,11 +2680,11 @@ class at extends x {
2675
2680
  return { status: "valid", value: e.data };
2676
2681
  }
2677
2682
  }
2678
- at.create = (n) => new at(u({
2683
+ it.create = (n) => new it(u({
2679
2684
  typeName: g.ZodNaN
2680
- }, w(n)));
2685
+ }, b(n)));
2681
2686
  const Vn = Symbol("zod_brand");
2682
- class At extends x {
2687
+ class Ot extends w {
2683
2688
  _parse(e) {
2684
2689
  const { ctx: t } = this._processInputParams(e), s = t.data;
2685
2690
  return this._def.type._parse({
@@ -2692,17 +2697,17 @@ class At extends x {
2692
2697
  return this._def.type;
2693
2698
  }
2694
2699
  }
2695
- class Je extends x {
2700
+ class Ge extends w {
2696
2701
  _parse(e) {
2697
2702
  const { status: t, ctx: s } = this._processInputParams(e);
2698
2703
  if (s.common.async)
2699
- return P(this, null, function* () {
2704
+ return F(this, null, function* () {
2700
2705
  const a = yield this._def.in._parseAsync({
2701
2706
  data: s.data,
2702
2707
  path: s.path,
2703
2708
  parent: s
2704
2709
  });
2705
- return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), we(a.value)) : this._def.out._parseAsync({
2710
+ return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), Te(a.value)) : this._def.out._parseAsync({
2706
2711
  data: a.value,
2707
2712
  path: s.path,
2708
2713
  parent: s
@@ -2725,34 +2730,34 @@ class Je extends x {
2725
2730
  }
2726
2731
  }
2727
2732
  static create(e, t) {
2728
- return new Je({
2733
+ return new Ge({
2729
2734
  in: e,
2730
2735
  out: t,
2731
2736
  typeName: g.ZodPipeline
2732
2737
  });
2733
2738
  }
2734
2739
  }
2735
- class qe extends x {
2740
+ class Je extends w {
2736
2741
  _parse(e) {
2737
- const t = this._def.innerType._parse(e), s = (r) => (ye(r) && (r.value = Object.freeze(r.value)), r);
2738
- return Ze(t) ? t.then((r) => s(r)) : s(t);
2742
+ const t = this._def.innerType._parse(e), s = (r) => (be(r) && (r.value = Object.freeze(r.value)), r);
2743
+ return Pe(t) ? t.then((r) => s(r)) : s(t);
2739
2744
  }
2740
2745
  unwrap() {
2741
2746
  return this._def.innerType;
2742
2747
  }
2743
2748
  }
2744
- qe.create = (n, e) => new qe(u({
2749
+ Je.create = (n, e) => new Je(u({
2745
2750
  innerType: n,
2746
2751
  typeName: g.ZodReadonly
2747
- }, w(e)));
2752
+ }, b(e)));
2748
2753
  function Yt(n, e = {}, t) {
2749
- return n ? Te.create().superRefine((s, r) => {
2754
+ return n ? Ee.create().superRefine((s, r) => {
2750
2755
  var a, i;
2751
2756
  if (!n(s)) {
2752
2757
  const o = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, c = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
2753
2758
  r.addIssue(y(u({ code: "custom" }, d), { fatal: c }));
2754
2759
  }
2755
- }) : Te.create();
2760
+ }) : Ee.create();
2756
2761
  }
2757
2762
  const Un = {
2758
2763
  object: S.lazycreate
@@ -2763,94 +2768,94 @@ var g;
2763
2768
  })(g || (g = {}));
2764
2769
  const zn = (n, e = {
2765
2770
  message: `Input not instance of ${n.name}`
2766
- }) => Yt((t) => t instanceof n, e), Qt = q.create, en = ue.create, Wn = at.create, Bn = de.create, tn = Me.create, qn = ge.create, Hn = nt.create, Jn = $e.create, Gn = Pe.create, Kn = Te.create, Xn = me.create, Yn = ie.create, Qn = st.create, es = H.create, ts = S.create, ns = S.strictCreate, ss = Fe.create, rs = it.create, as = Le.create, is = ee.create, os = De.create, cs = rt.create, us = ve.create, ds = xe.create, ls = Ve.create, fs = Ue.create, hs = le.create, ps = ze.create, ms = Se.create, Pt = J.create, ys = Y.create, gs = fe.create, vs = J.createWithPreprocess, _s = Je.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
2767
- string: (n) => q.create(y(u({}, n), { coerce: !0 })),
2768
- number: (n) => ue.create(y(u({}, n), { coerce: !0 })),
2769
- boolean: (n) => Me.create(y(u({}, n), {
2771
+ }) => Yt((t) => t instanceof n, e), Qt = J.create, en = fe.create, Wn = it.create, Bn = he.create, tn = $e.create, qn = we.create, Hn = st.create, Jn = Fe.create, Kn = De.create, Gn = Ee.create, Xn = _e.create, Yn = oe.create, Qn = rt.create, es = K.create, ts = S.create, ns = S.strictCreate, ss = Le.create, rs = ot.create, as = Ve.create, is = ne.create, os = Ue.create, cs = at.create, us = xe.create, ds = Se.create, ls = ze.create, fs = We.create, hs = pe.create, ps = Be.create, ms = Oe.create, $t = G.create, ys = ee.create, gs = me.create, vs = G.createWithPreprocess, _s = Ge.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
2772
+ string: (n) => J.create(y(u({}, n), { coerce: !0 })),
2773
+ number: (n) => fe.create(y(u({}, n), { coerce: !0 })),
2774
+ boolean: (n) => $e.create(y(u({}, n), {
2770
2775
  coerce: !0
2771
2776
  })),
2772
- bigint: (n) => de.create(y(u({}, n), { coerce: !0 })),
2773
- date: (n) => ge.create(y(u({}, n), { coerce: !0 }))
2777
+ bigint: (n) => he.create(y(u({}, n), { coerce: !0 })),
2778
+ date: (n) => we.create(y(u({}, n), { coerce: !0 }))
2774
2779
  }, Ts = v;
2775
- var C = /* @__PURE__ */ Object.freeze({
2780
+ var I = /* @__PURE__ */ Object.freeze({
2776
2781
  __proto__: null,
2777
- defaultErrorMap: ke,
2782
+ defaultErrorMap: Ae,
2778
2783
  setErrorMap: vn,
2779
- getErrorMap: Qe,
2780
- makeIssue: et,
2784
+ getErrorMap: et,
2785
+ makeIssue: tt,
2781
2786
  EMPTY_PATH: _n,
2782
2787
  addIssueToContext: h,
2783
- ParseStatus: R,
2788
+ ParseStatus: Z,
2784
2789
  INVALID: v,
2785
- DIRTY: we,
2786
- OK: $,
2787
- isAborted: mt,
2788
- isDirty: yt,
2789
- isValid: ye,
2790
- isAsync: Ze,
2790
+ DIRTY: Te,
2791
+ OK: P,
2792
+ isAborted: yt,
2793
+ isDirty: gt,
2794
+ isValid: be,
2795
+ isAsync: Pe,
2791
2796
  get util() {
2792
- return k;
2797
+ return x;
2793
2798
  },
2794
2799
  get objectUtil() {
2795
- return pt;
2800
+ return mt;
2796
2801
  },
2797
2802
  ZodParsedType: p,
2798
- getParsedType: ae,
2799
- ZodType: x,
2800
- datetimeRegex: Kt,
2801
- ZodString: q,
2802
- ZodNumber: ue,
2803
- ZodBigInt: de,
2804
- ZodBoolean: Me,
2805
- ZodDate: ge,
2806
- ZodSymbol: nt,
2807
- ZodUndefined: $e,
2808
- ZodNull: Pe,
2809
- ZodAny: Te,
2810
- ZodUnknown: me,
2811
- ZodNever: ie,
2812
- ZodVoid: st,
2813
- ZodArray: H,
2803
+ getParsedType: ie,
2804
+ ZodType: w,
2805
+ datetimeRegex: Gt,
2806
+ ZodString: J,
2807
+ ZodNumber: fe,
2808
+ ZodBigInt: he,
2809
+ ZodBoolean: $e,
2810
+ ZodDate: we,
2811
+ ZodSymbol: st,
2812
+ ZodUndefined: Fe,
2813
+ ZodNull: De,
2814
+ ZodAny: Ee,
2815
+ ZodUnknown: _e,
2816
+ ZodNever: oe,
2817
+ ZodVoid: rt,
2818
+ ZodArray: K,
2814
2819
  ZodObject: S,
2815
- ZodUnion: Fe,
2816
- ZodDiscriminatedUnion: it,
2817
- ZodIntersection: Le,
2818
- ZodTuple: ee,
2819
- ZodRecord: De,
2820
- ZodMap: rt,
2821
- ZodSet: ve,
2822
- ZodFunction: xe,
2823
- ZodLazy: Ve,
2824
- ZodLiteral: Ue,
2825
- ZodEnum: le,
2826
- ZodNativeEnum: ze,
2827
- ZodPromise: Se,
2828
- ZodEffects: J,
2829
- ZodTransformer: J,
2830
- ZodOptional: Y,
2831
- ZodNullable: fe,
2832
- ZodDefault: We,
2833
- ZodCatch: Be,
2834
- ZodNaN: at,
2820
+ ZodUnion: Le,
2821
+ ZodDiscriminatedUnion: ot,
2822
+ ZodIntersection: Ve,
2823
+ ZodTuple: ne,
2824
+ ZodRecord: Ue,
2825
+ ZodMap: at,
2826
+ ZodSet: xe,
2827
+ ZodFunction: Se,
2828
+ ZodLazy: ze,
2829
+ ZodLiteral: We,
2830
+ ZodEnum: pe,
2831
+ ZodNativeEnum: Be,
2832
+ ZodPromise: Oe,
2833
+ ZodEffects: G,
2834
+ ZodTransformer: G,
2835
+ ZodOptional: ee,
2836
+ ZodNullable: me,
2837
+ ZodDefault: qe,
2838
+ ZodCatch: He,
2839
+ ZodNaN: it,
2835
2840
  BRAND: Vn,
2836
- ZodBranded: At,
2837
- ZodPipeline: Je,
2838
- ZodReadonly: qe,
2841
+ ZodBranded: Ot,
2842
+ ZodPipeline: Ge,
2843
+ ZodReadonly: Je,
2839
2844
  custom: Yt,
2840
- Schema: x,
2841
- ZodSchema: x,
2845
+ Schema: w,
2846
+ ZodSchema: w,
2842
2847
  late: Un,
2843
2848
  get ZodFirstPartyTypeKind() {
2844
2849
  return g;
2845
2850
  },
2846
2851
  coerce: ks,
2847
- any: Kn,
2852
+ any: Gn,
2848
2853
  array: es,
2849
2854
  bigint: Bn,
2850
2855
  boolean: tn,
2851
2856
  date: qn,
2852
2857
  discriminatedUnion: rs,
2853
- effect: Pt,
2858
+ effect: $t,
2854
2859
  enum: hs,
2855
2860
  function: ds,
2856
2861
  instanceof: zn,
@@ -2861,7 +2866,7 @@ var C = /* @__PURE__ */ Object.freeze({
2861
2866
  nan: Wn,
2862
2867
  nativeEnum: ps,
2863
2868
  never: Yn,
2864
- null: Gn,
2869
+ null: Kn,
2865
2870
  nullable: gs,
2866
2871
  number: en,
2867
2872
  object: ts,
@@ -2877,7 +2882,7 @@ var C = /* @__PURE__ */ Object.freeze({
2877
2882
  strictObject: ns,
2878
2883
  string: Qt,
2879
2884
  symbol: Hn,
2880
- transformer: Pt,
2885
+ transformer: $t,
2881
2886
  tuple: is,
2882
2887
  undefined: Jn,
2883
2888
  union: ss,
@@ -2886,17 +2891,17 @@ var C = /* @__PURE__ */ Object.freeze({
2886
2891
  NEVER: Ts,
2887
2892
  ZodIssueCode: l,
2888
2893
  quotelessJson: gn,
2889
- ZodError: U
2894
+ ZodError: z
2890
2895
  });
2891
- const Ss = C.object({
2892
- language: C.enum(["typescript", "javascript"]).optional(),
2893
- disableMarkedForExport: C.boolean().optional()
2896
+ const Ss = I.object({
2897
+ language: I.enum(["typescript", "javascript"]).optional(),
2898
+ disableMarkedForExport: I.boolean().optional()
2894
2899
  }).and(
2895
- C.union([
2896
- C.object({
2897
- framework: C.literal("react"),
2898
- model: C.string().optional(),
2899
- styling: C.enum([
2900
+ I.union([
2901
+ I.object({
2902
+ framework: I.literal("react"),
2903
+ model: I.string().optional(),
2904
+ styling: I.enum([
2900
2905
  "plain_css",
2901
2906
  "css_modules",
2902
2907
  "styled_components",
@@ -2905,19 +2910,19 @@ const Ss = C.object({
2905
2910
  "scss",
2906
2911
  "inline_styles"
2907
2912
  ]),
2908
- uiLibrary: C.enum(["mui", "antd", "radix", "shadcn"]).optional(),
2909
- enableUILibraryTheming: C.boolean().optional(),
2910
- enableCompactStructure: C.boolean().optional(),
2911
- enableAutoSplit: C.boolean().optional(),
2912
- autoSplitThreshold: C.number().optional()
2913
+ uiLibrary: I.enum(["mui", "antd", "radix", "shadcn"]).optional(),
2914
+ enableUILibraryTheming: I.boolean().optional(),
2915
+ enableCompactStructure: I.boolean().optional(),
2916
+ enableAutoSplit: I.boolean().optional(),
2917
+ autoSplitThreshold: I.number().optional()
2913
2918
  }),
2914
- C.object({
2915
- framework: C.literal("html"),
2916
- styling: C.enum(["plain_css", "inline_styles"]),
2917
- enableTranslation: C.boolean().optional()
2919
+ I.object({
2920
+ framework: I.literal("html"),
2921
+ styling: I.enum(["plain_css", "inline_styles"]),
2922
+ enableTranslation: I.boolean().optional()
2918
2923
  })
2919
2924
  ])
2920
- ), Es = (n) => {
2925
+ ), As = (n) => {
2921
2926
  const e = Ss.safeParse(n);
2922
2927
  if (e.success === !1) {
2923
2928
  const t = new Error("Invalid codegen settings");
@@ -2925,37 +2930,37 @@ const Ss = C.object({
2925
2930
  }
2926
2931
  return e.data;
2927
2932
  };
2928
- var D, He;
2929
- class Zr {
2933
+ var V, Ke;
2934
+ class Rr {
2930
2935
  constructor({
2931
2936
  auth: e,
2932
2937
  apiBaseAddress: t = "https://public-api.animaapp.com"
2933
2938
  } = {}) {
2934
- ct(this, D);
2935
- ct(this, He);
2936
- ut(this, He, t), e && (this.auth = e);
2939
+ ut(this, V);
2940
+ ut(this, Ke);
2941
+ dt(this, Ke, t), e && (this.auth = e);
2937
2942
  }
2938
2943
  hasAuth() {
2939
- return !!B(this, D);
2944
+ return !!H(this, V);
2940
2945
  }
2941
2946
  set auth(e) {
2942
- ut(this, D, e);
2947
+ dt(this, V, e);
2943
2948
  }
2944
2949
  get headers() {
2945
2950
  const e = {
2946
2951
  "Content-Type": "application/json"
2947
2952
  };
2948
- return B(this, D) && (e.Authorization = `Bearer ${B(this, D).token}`, "teamId" in B(this, D) && (e["X-Team-Id"] = B(this, D).teamId)), e;
2953
+ return H(this, V) && (e.Authorization = `Bearer ${H(this, V).token}`, "teamId" in H(this, V) && (e["X-Team-Id"] = H(this, V).teamId)), e;
2949
2954
  }
2950
2955
  generateCode(s) {
2951
- return P(this, arguments, function* (e, t = {}) {
2952
- var _, I, A, O, Z, W, te, oe;
2956
+ return F(this, arguments, function* (e, t = {}) {
2957
+ var _, j, O, C, R, B, se, ce, L, ue;
2953
2958
  if (this.hasAuth() === !1)
2954
2959
  throw new Error('It needs to set "auth" before calling this method.');
2955
- const r = {}, a = Es(e.settings);
2960
+ const r = {}, a = As(e.settings);
2956
2961
  let i = e.tracking;
2957
- B(this, D) && "userId" in B(this, D) && B(this, D).userId && (i != null && i.externalId || (i = { externalId: B(this, D).userId }));
2958
- const o = yield fetch(`${B(this, He)}/v1/codegen`, {
2962
+ H(this, V) && "userId" in H(this, V) && H(this, V).userId && (i != null && i.externalId || (i = { externalId: H(this, V).userId }));
2963
+ const o = yield fetch(`${H(this, Ke)}/v1/codegen`, {
2959
2964
  method: "POST",
2960
2965
  headers: y(u({}, this.headers), {
2961
2966
  Accept: "text/event-stream"
@@ -2980,20 +2985,31 @@ class Zr {
2980
2985
  })
2981
2986
  });
2982
2987
  if (!o.ok) {
2983
- let N;
2984
- try {
2985
- N = (yield o.json()).message || `HTTP error! status: ${o.status}`;
2986
- } catch (ne) {
2987
- N = `HTTP error! status: ${o.status}`;
2988
- }
2989
- throw new Ae({
2990
- name: "HTTP Error",
2991
- reason: N,
2988
+ const q = yield o.json().catch(() => "HTTP error from Anima API");
2989
+ throw typeof q == "string" ? new de({
2990
+ name: q,
2991
+ reason: "Unknown",
2992
+ detail: { status: o.status },
2993
+ status: o.status
2994
+ }) : typeof q != "object" ? new de({
2995
+ name: `Error "${q}"`,
2996
+ reason: "Unknown",
2997
+ detail: { status: o.status },
2998
+ status: o.status
2999
+ }) : ((_ = q.error) == null ? void 0 : _.name) === "ZodError" ? new de({
3000
+ name: "HTTP error from Anima API",
3001
+ reason: "Invalid body payload",
3002
+ detail: q.error.issues,
3003
+ status: o.status
3004
+ }) : new de({
3005
+ name: ((j = q.error) == null ? void 0 : j.name) || "HTTP error from Anima API",
3006
+ reason: "Unknown",
3007
+ detail: { status: o.status },
2992
3008
  status: o.status
2993
3009
  });
2994
3010
  }
2995
3011
  if (!o.body)
2996
- throw new Ae({
3012
+ throw new de({
2997
3013
  name: "Stream Error",
2998
3014
  reason: "Response body is null",
2999
3015
  status: o.status
@@ -3002,73 +3018,73 @@ class Zr {
3002
3018
  let f = "";
3003
3019
  try {
3004
3020
  for (; ; ) {
3005
- const { done: N, value: ne } = yield c.read();
3006
- if (N)
3021
+ const { done: q, value: ct } = yield c.read();
3022
+ if (q)
3007
3023
  break;
3008
- f += d.decode(ne, { stream: !0 });
3009
- const Ge = f.split(`
3024
+ f += d.decode(ct, { stream: !0 });
3025
+ const E = f.split(`
3010
3026
  `);
3011
- f = Ge.pop() || "";
3012
- for (const _e of Ge)
3013
- if (!(!_e.trim() || _e.startsWith(":")) && _e.startsWith("data: ")) {
3014
- let b;
3027
+ f = E.pop() || "";
3028
+ for (const ye of E)
3029
+ if (!(!ye.trim() || ye.startsWith(":")) && ye.startsWith("data: ")) {
3030
+ let k;
3015
3031
  try {
3016
- b = JSON.parse(_e.slice(6));
3017
- } catch (ot) {
3032
+ k = JSON.parse(ye.slice(6));
3033
+ } catch ($) {
3018
3034
  continue;
3019
3035
  }
3020
- switch (b.type) {
3036
+ switch (k.type) {
3021
3037
  case "queueing": {
3022
- typeof t == "function" ? t(b) : (_ = t.onQueueing) == null || _.call(t);
3038
+ typeof t == "function" ? t(k) : (O = t.onQueueing) == null || O.call(t);
3023
3039
  break;
3024
3040
  }
3025
3041
  case "start": {
3026
- r.sessionId = b.sessionId, typeof t == "function" ? t(b) : (I = t.onStart) == null || I.call(t, { sessionId: b.sessionId });
3042
+ r.sessionId = k.sessionId, typeof t == "function" ? t(k) : (C = t.onStart) == null || C.call(t, { sessionId: k.sessionId });
3027
3043
  break;
3028
3044
  }
3029
3045
  case "pre_codegen": {
3030
- typeof t == "function" ? t(b) : (A = t.onPreCodegen) == null || A.call(t, { message: b.message });
3046
+ typeof t == "function" ? t(k) : (R = t.onPreCodegen) == null || R.call(t, { message: k.message });
3031
3047
  break;
3032
3048
  }
3033
3049
  case "assets_uploaded": {
3034
- typeof t == "function" ? t(b) : (O = t.onAssetsUploaded) == null || O.call(t);
3050
+ typeof t == "function" ? t(k) : (B = t.onAssetsUploaded) == null || B.call(t);
3035
3051
  break;
3036
3052
  }
3037
3053
  case "assets_list": {
3038
- r.assets = b.payload.assets, typeof t == "function" ? t(b) : (Z = t.onAssetsList) == null || Z.call(t, b.payload);
3054
+ r.assets = k.payload.assets, typeof t == "function" ? t(k) : (se = t.onAssetsList) == null || se.call(t, k.payload);
3039
3055
  break;
3040
3056
  }
3041
3057
  case "figma_metadata": {
3042
- r.figmaFileName = b.figmaFileName, r.figmaSelectedFrameName = b.figmaSelectedFrameName, typeof t == "function" ? t(b) : (W = t.onFigmaMetadata) == null || W.call(t, {
3043
- figmaFileName: b.figmaFileName,
3044
- figmaSelectedFrameName: b.figmaSelectedFrameName
3058
+ r.figmaFileName = k.figmaFileName, r.figmaSelectedFrameName = k.figmaSelectedFrameName, typeof t == "function" ? t(k) : (ce = t.onFigmaMetadata) == null || ce.call(t, {
3059
+ figmaFileName: k.figmaFileName,
3060
+ figmaSelectedFrameName: k.figmaSelectedFrameName
3045
3061
  });
3046
3062
  break;
3047
3063
  }
3048
3064
  case "generating_code": {
3049
- b.payload.status === "success" && (r.files = b.payload.files), typeof t == "function" ? t(b) : (te = t.onGeneratingCode) == null || te.call(t, {
3050
- status: b.payload.status,
3051
- progress: b.payload.progress,
3052
- files: b.payload.files
3065
+ k.payload.status === "success" && (r.files = k.payload.files), typeof t == "function" ? t(k) : (L = t.onGeneratingCode) == null || L.call(t, {
3066
+ status: k.payload.status,
3067
+ progress: k.payload.progress,
3068
+ files: k.payload.files
3053
3069
  });
3054
3070
  break;
3055
3071
  }
3056
3072
  case "codegen_completed": {
3057
- typeof t == "function" ? t(b) : (oe = t.onCodegenCompleted) == null || oe.call(t);
3073
+ typeof t == "function" ? t(k) : (ue = t.onCodegenCompleted) == null || ue.call(t);
3058
3074
  break;
3059
3075
  }
3060
3076
  case "error":
3061
- throw new Ae({
3062
- name: b.payload.errorName,
3063
- reason: b.payload.reason
3077
+ throw new de({
3078
+ name: k.payload.errorName,
3079
+ reason: k.payload.reason
3064
3080
  });
3065
3081
  case "done": {
3066
3082
  if (!r.files)
3067
- throw new Ae({
3083
+ throw new de({
3068
3084
  name: "Invalid response",
3069
- reason: "No files found"
3085
+ reason: "No code generated"
3070
3086
  });
3071
- return r.tokenUsage = b.payload.tokenUsage, r;
3087
+ return r.tokenUsage = k.payload.tokenUsage, r;
3072
3088
  }
3073
3089
  }
3074
3090
  }
@@ -3076,7 +3092,7 @@ class Zr {
3076
3092
  } finally {
3077
3093
  c.cancel();
3078
3094
  }
3079
- throw new Ae({
3095
+ throw new de({
3080
3096
  name: "Connection",
3081
3097
  reason: "Connection closed before the 'done' message",
3082
3098
  status: 500
@@ -3084,7 +3100,7 @@ class Zr {
3084
3100
  });
3085
3101
  }
3086
3102
  }
3087
- D = new WeakMap(), He = new WeakMap();
3103
+ V = new WeakMap(), Ke = new WeakMap();
3088
3104
  const Mr = (n) => {
3089
3105
  var e;
3090
3106
  if (!n)
@@ -3098,14 +3114,15 @@ const Mr = (n) => {
3098
3114
  } catch (t) {
3099
3115
  return [!1, "", ""];
3100
3116
  }
3101
- }, $r = ({
3117
+ }, Pr = ({
3102
3118
  fileKey: n,
3103
- nodeId: e
3119
+ nodeId: e,
3120
+ duplicate: t
3104
3121
  }) => {
3105
- const t = new URL("https://www.figma.com");
3106
- return t.pathname = `design/${n}`, e && t.searchParams.set("node-id", e.replace(":", "-")), t;
3122
+ const s = new URL("https://www.figma.com");
3123
+ return s.pathname = `design/${n}`, t && (s.pathname = `${s.pathname}/duplicate`), e && s.searchParams.set("node-id", e.replace(":", "-")), s;
3107
3124
  };
3108
- class Pr extends Error {
3125
+ class $r extends Error {
3109
3126
  constructor(e, t) {
3110
3127
  super(e), this.response = t;
3111
3128
  }
@@ -3118,7 +3135,7 @@ const Fr = ({
3118
3135
  function r(a) {
3119
3136
  if (s.has(a) || !n[a])
3120
3137
  return;
3121
- s.add(a), t[a] = n[a], As(n[a].content).forEach((o) => {
3138
+ s.add(a), t[a] = n[a], Es(n[a].content).forEach((o) => {
3122
3139
  try {
3123
3140
  const c = Os(a, o);
3124
3141
  if (c.startsWith("src/")) {
@@ -3139,7 +3156,7 @@ const Fr = ({
3139
3156
  a.startsWith(e) ? r(a) : a.startsWith("src/") || (t[a] = i);
3140
3157
  }), t;
3141
3158
  };
3142
- function As(n) {
3159
+ function Es(n) {
3143
3160
  const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
3144
3161
  let r;
3145
3162
  for (; (r = e.exec(n)) !== null; )
@@ -3166,46 +3183,46 @@ class Is extends Error {
3166
3183
  }
3167
3184
  }
3168
3185
  const sn = "Rate Limit Exceeded";
3169
- class Ns extends Error {
3186
+ class js extends Error {
3170
3187
  constructor({ fileKey: e }) {
3171
3188
  super(sn), this.fileKey = e;
3172
3189
  }
3173
3190
  }
3174
3191
  const rn = "Not Found";
3175
- class js extends Error {
3192
+ class Ns extends Error {
3176
3193
  constructor({ fileKey: e }) {
3177
3194
  super(rn), this.fileKey = e;
3178
3195
  }
3179
3196
  }
3180
- const Rs = (n) => n.message === rn, an = "Unknown Figma API Exception";
3181
- class Zs extends Error {
3197
+ const Zs = (n) => n.message === rn, an = "Unknown Figma API Exception";
3198
+ class Rs extends Error {
3182
3199
  constructor({ fileKey: e, cause: t }) {
3183
3200
  super(an), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
3184
3201
  }
3185
3202
  }
3186
- const Lr = (n) => n.message === an, Ms = (n) => n.message === sn, $s = (n) => [nn, ...[
3203
+ const Dr = (n) => n.message === an, Ms = (n) => n.message === sn, Ps = (n) => [nn, ...[
3187
3204
  "Invalid Figma token",
3188
3205
  "Figma token expired"
3189
3206
  ]].includes(
3190
3207
  n.message
3191
- ), Ps = (n, e) => {
3208
+ ), $s = (n, e) => {
3192
3209
  var s, r, a, i;
3193
3210
  const t = ((s = n == null ? void 0 : n.cause) == null ? void 0 : s.body) || n.body;
3194
3211
  throw (t == null ? void 0 : t.status) === 403 ? new Is({
3195
3212
  fileKey: e,
3196
3213
  reason: (((a = (r = n == null ? void 0 : n.cause) == null ? void 0 : r.body) == null ? void 0 : a.reason) || ((i = n.body) == null ? void 0 : i.reason) || "Access denied").toString()
3197
- }) : (t == null ? void 0 : t.status) === 429 ? new Ns({ fileKey: e }) : (t == null ? void 0 : t.status) === 404 ? new js({ fileKey: e }) : new Zs({ fileKey: e, cause: n });
3198
- }, Dr = (n) => Rs(n) ? "NotFound" : Ms(n) ? "RateLimitExceeded" : $s(n) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
3199
- var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwnPropertyDescriptors, Ft = Object.getOwnPropertySymbols, Vs = Object.prototype.hasOwnProperty, Us = Object.prototype.propertyIsEnumerable, Lt = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), on = (n) => {
3214
+ }) : (t == null ? void 0 : t.status) === 429 ? new js({ fileKey: e }) : (t == null ? void 0 : t.status) === 404 ? new Ns({ fileKey: e }) : new Rs({ fileKey: e, cause: n });
3215
+ }, Lr = (n) => Zs(n) ? "NotFound" : Ms(n) ? "RateLimitExceeded" : Ps(n) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
3216
+ var Fs = Object.defineProperty, Ds = Object.defineProperties, Ls = Object.getOwnPropertyDescriptors, Ft = Object.getOwnPropertySymbols, Vs = Object.prototype.hasOwnProperty, Us = Object.prototype.propertyIsEnumerable, Dt = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), on = (n) => {
3200
3217
  throw TypeError(n);
3201
- }, Dt = (n, e, t) => e in n ? Fs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, V = (n, e) => {
3218
+ }, Lt = (n, e, t) => e in n ? Fs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, U = (n, e) => {
3202
3219
  for (var t in e || (e = {}))
3203
- Vs.call(e, t) && Dt(n, t, e[t]);
3220
+ Vs.call(e, t) && Lt(n, t, e[t]);
3204
3221
  if (Ft)
3205
3222
  for (var t of Ft(e))
3206
- Us.call(e, t) && Dt(n, t, e[t]);
3223
+ Us.call(e, t) && Lt(n, t, e[t]);
3207
3224
  return n;
3208
- }, Ot = (n, e) => Ls(n, Ds(e)), Ct = (n, e, t) => e.has(n) || on("Cannot " + t), T = (n, e, t) => (Ct(n, e, "read from private field"), t ? t.call(n) : e.get(n)), z = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, s) => (Ct(n, e, "write to private field"), e.set(n, t), t), X = (n, e, t) => (Ct(n, e, "access private method"), t), E = (n, e, t) => new Promise((s, r) => {
3225
+ }, Ct = (n, e) => Ds(n, Ls(e)), It = (n, e, t) => e.has(n) || on("Cannot " + t), T = (n, e, t) => (It(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), N = (n, e, t, s) => (It(n, e, "write to private field"), e.set(n, t), t), Q = (n, e, t) => (It(n, e, "access private method"), t), A = (n, e, t) => new Promise((s, r) => {
3209
3226
  var a = (c) => {
3210
3227
  try {
3211
3228
  o(t.next(c));
@@ -3220,59 +3237,59 @@ var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwn
3220
3237
  }
3221
3238
  }, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
3222
3239
  o((t = t.apply(n, e)).next());
3223
- }), zs = (n, e, t) => (e = n[Lt("asyncIterator")]) ? e.call(n) : (n = n[Lt("iterator")](), e = {}, t = (s, r) => (r = n[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(n, a), c = a.done, Promise.resolve(a.value).then((d) => i({ value: d, done: c }), o)))), t("next"), t("return"), e), Ws = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
3240
+ }), zs = (n, e, t) => (e = n[Dt("asyncIterator")]) ? e.call(n) : (n = n[Dt("iterator")](), e = {}, t = (s, r) => (r = n[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(n, a), c = a.done, Promise.resolve(a.value).then((d) => i({ value: d, done: c }), o)))), t("next"), t("return"), e), Ws = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
3224
3241
  function Bs(n) {
3225
3242
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
3226
3243
  }
3227
- var vt = { exports: {} }, qs = vt.exports, Vt;
3244
+ var _t = { exports: {} }, qs = _t.exports, Vt;
3228
3245
  function Hs() {
3229
3246
  return Vt || (Vt = 1, function(n, e) {
3230
3247
  (function(t, s) {
3231
3248
  n.exports = s();
3232
3249
  })(qs, function() {
3233
- var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", I = i && typeof Set.prototype.entries == "function", A = a && typeof Map.prototype.entries == "function", O = I && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), Z = A && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), W = f && typeof Array.prototype[Symbol.iterator] == "function", te = W && Object.getPrototypeOf([][Symbol.iterator]()), oe = f && typeof String.prototype[Symbol.iterator] == "function", N = oe && Object.getPrototypeOf(""[Symbol.iterator]()), ne = 8, Ge = -1;
3234
- function _e(b) {
3235
- var ot = typeof b;
3236
- if (ot !== "object")
3237
- return ot;
3238
- if (b === null)
3250
+ var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", j = i && typeof Set.prototype.entries == "function", O = a && typeof Map.prototype.entries == "function", C = j && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), R = O && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", se = B && Object.getPrototypeOf([][Symbol.iterator]()), ce = f && typeof String.prototype[Symbol.iterator] == "function", L = ce && Object.getPrototypeOf(""[Symbol.iterator]()), ue = 8, q = -1;
3251
+ function ct(E) {
3252
+ var ye = typeof E;
3253
+ if (ye !== "object")
3254
+ return ye;
3255
+ if (E === null)
3239
3256
  return "null";
3240
- if (b === s)
3257
+ if (E === s)
3241
3258
  return "global";
3242
- if (Array.isArray(b) && (_ === !1 || !(Symbol.toStringTag in b)))
3259
+ if (Array.isArray(E) && (_ === !1 || !(Symbol.toStringTag in E)))
3243
3260
  return "Array";
3244
3261
  if (typeof window == "object" && window !== null) {
3245
- if (typeof window.location == "object" && b === window.location)
3262
+ if (typeof window.location == "object" && E === window.location)
3246
3263
  return "Location";
3247
- if (typeof window.document == "object" && b === window.document)
3264
+ if (typeof window.document == "object" && E === window.document)
3248
3265
  return "Document";
3249
3266
  if (typeof window.navigator == "object") {
3250
- if (typeof window.navigator.mimeTypes == "object" && b === window.navigator.mimeTypes)
3267
+ if (typeof window.navigator.mimeTypes == "object" && E === window.navigator.mimeTypes)
3251
3268
  return "MimeTypeArray";
3252
- if (typeof window.navigator.plugins == "object" && b === window.navigator.plugins)
3269
+ if (typeof window.navigator.plugins == "object" && E === window.navigator.plugins)
3253
3270
  return "PluginArray";
3254
3271
  }
3255
- if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && b instanceof window.HTMLElement) {
3256
- if (b.tagName === "BLOCKQUOTE")
3272
+ if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && E instanceof window.HTMLElement) {
3273
+ if (E.tagName === "BLOCKQUOTE")
3257
3274
  return "HTMLQuoteElement";
3258
- if (b.tagName === "TD")
3275
+ if (E.tagName === "TD")
3259
3276
  return "HTMLTableDataCellElement";
3260
- if (b.tagName === "TH")
3277
+ if (E.tagName === "TH")
3261
3278
  return "HTMLTableHeaderCellElement";
3262
3279
  }
3263
3280
  }
3264
- var Nt = _ && b[Symbol.toStringTag];
3265
- if (typeof Nt == "string")
3266
- return Nt;
3267
- var L = Object.getPrototypeOf(b);
3268
- return L === RegExp.prototype ? "RegExp" : L === Date.prototype ? "Date" : t && L === Promise.prototype ? "Promise" : i && L === Set.prototype ? "Set" : a && L === Map.prototype ? "Map" : c && L === WeakSet.prototype ? "WeakSet" : o && L === WeakMap.prototype ? "WeakMap" : d && L === DataView.prototype ? "DataView" : a && L === Z ? "Map Iterator" : i && L === O ? "Set Iterator" : W && L === te ? "Array Iterator" : oe && L === N ? "String Iterator" : L === null ? "Object" : Object.prototype.toString.call(b).slice(ne, Ge);
3281
+ var k = _ && E[Symbol.toStringTag];
3282
+ if (typeof k == "string")
3283
+ return k;
3284
+ var $ = Object.getPrototypeOf(E);
3285
+ return $ === RegExp.prototype ? "RegExp" : $ === Date.prototype ? "Date" : t && $ === Promise.prototype ? "Promise" : i && $ === Set.prototype ? "Set" : a && $ === Map.prototype ? "Map" : c && $ === WeakSet.prototype ? "WeakSet" : o && $ === WeakMap.prototype ? "WeakMap" : d && $ === DataView.prototype ? "DataView" : a && $ === R ? "Map Iterator" : i && $ === C ? "Set Iterator" : B && $ === se ? "Array Iterator" : ce && $ === L ? "String Iterator" : $ === null ? "Object" : Object.prototype.toString.call(E).slice(ue, q);
3269
3286
  }
3270
- return _e;
3287
+ return ct;
3271
3288
  });
3272
- }(vt)), vt.exports;
3289
+ }(_t)), _t.exports;
3273
3290
  }
3274
3291
  var Js = Hs();
3275
- const Gs = /* @__PURE__ */ Bs(Js), It = typeof Buffer != "undefined", Ks = It && typeof Buffer.from != "undefined", Xs = It ? (
3292
+ const Ks = /* @__PURE__ */ Bs(Js), jt = typeof Buffer != "undefined", Gs = jt && typeof Buffer.from != "undefined", Xs = jt ? (
3276
3293
  /**
3277
3294
  * is value is Buffer?
3278
3295
  *
@@ -3293,7 +3310,7 @@ const Gs = /* @__PURE__ */ Bs(Js), It = typeof Buffer != "undefined", Ks = It &&
3293
3310
  function() {
3294
3311
  return !1;
3295
3312
  }
3296
- ), Ys = Ks ? (
3313
+ ), Ys = Gs ? (
3297
3314
  /**
3298
3315
  * copy Buffer
3299
3316
  *
@@ -3303,7 +3320,7 @@ const Gs = /* @__PURE__ */ Bs(Js), It = typeof Buffer != "undefined", Ks = It &&
3303
3320
  function(n) {
3304
3321
  return Buffer.from(n);
3305
3322
  }
3306
- ) : It ? (
3323
+ ) : jt ? (
3307
3324
  /**
3308
3325
  * copy Buffer
3309
3326
  *
@@ -3328,8 +3345,8 @@ const Gs = /* @__PURE__ */ Bs(Js), It = typeof Buffer != "undefined", Ks = It &&
3328
3345
  return n;
3329
3346
  }
3330
3347
  );
3331
- function Ee(n) {
3332
- return Xs(n) ? "Buffer" : Gs(n);
3348
+ function Ce(n) {
3349
+ return Xs(n) ? "Buffer" : Ks(n);
3333
3350
  }
3334
3351
  const Qs = /* @__PURE__ */ new Set([
3335
3352
  "Arguments",
@@ -3339,7 +3356,7 @@ const Qs = /* @__PURE__ */ new Set([
3339
3356
  "Set"
3340
3357
  ]);
3341
3358
  function er(n, e, t = null) {
3342
- switch (t || Ee(n)) {
3359
+ switch (t || Ce(n)) {
3343
3360
  case "Arguments":
3344
3361
  case "Array":
3345
3362
  case "Object":
@@ -3350,11 +3367,11 @@ function er(n, e, t = null) {
3350
3367
  return e;
3351
3368
  }
3352
3369
  }
3353
- function _t(n) {
3370
+ function bt(n) {
3354
3371
  return Qs.has(n);
3355
3372
  }
3356
3373
  function Ut(n, e, t, s = null) {
3357
- switch (s || Ee(n)) {
3374
+ switch (s || Ce(n)) {
3358
3375
  case "Arguments":
3359
3376
  case "Array":
3360
3377
  case "Object":
@@ -3369,7 +3386,7 @@ function Ut(n, e, t, s = null) {
3369
3386
  }
3370
3387
  return n;
3371
3388
  }
3372
- const tr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, nr = typeof global != "undefined" && global !== null && global.Object === Object && global, sr = typeof self != "undefined" && self !== null && self.Object === Object && self, lt = tr || nr || sr || Function("return this")();
3389
+ const tr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, nr = typeof global != "undefined" && global !== null && global.Object === Object && global, sr = typeof self != "undefined" && self !== null && self.Object === Object && self, ft = tr || nr || sr || Function("return this")();
3373
3390
  function rr(n) {
3374
3391
  return n.slice(0);
3375
3392
  }
@@ -3394,8 +3411,8 @@ function dr(n) {
3394
3411
  function lr(n) {
3395
3412
  return new String(n);
3396
3413
  }
3397
- function se(n, e) {
3398
- return lt[e].from ? lt[e].from(n) : new lt[e](n);
3414
+ function re(n, e) {
3415
+ return ft[e].from ? ft[e].from(n) : new ft[e](n);
3399
3416
  }
3400
3417
  function M(n) {
3401
3418
  return n;
@@ -3424,15 +3441,15 @@ const mr = /* @__PURE__ */ new Map([
3424
3441
  ["String", lr],
3425
3442
  // typed arrays
3426
3443
  // TODO: pass bound function
3427
- ["Float32Array", se],
3428
- ["Float64Array", se],
3429
- ["Int16Array", se],
3430
- ["Int32Array", se],
3431
- ["Int8Array", se],
3432
- ["Uint16Array", se],
3433
- ["Uint32Array", se],
3434
- ["Uint8Array", se],
3435
- ["Uint8ClampedArray", se],
3444
+ ["Float32Array", re],
3445
+ ["Float64Array", re],
3446
+ ["Int16Array", re],
3447
+ ["Int32Array", re],
3448
+ ["Int8Array", re],
3449
+ ["Uint16Array", re],
3450
+ ["Uint32Array", re],
3451
+ ["Uint8Array", re],
3452
+ ["Uint8ClampedArray", re],
3436
3453
  // shallow copy
3437
3454
  ["Array Iterator", M],
3438
3455
  ["Map Iterator", M],
@@ -3471,9 +3488,9 @@ const mr = /* @__PURE__ */ new Map([
3471
3488
  ]);
3472
3489
  function yr() {
3473
3490
  }
3474
- function bt(n, e = null, t = yr) {
3491
+ function wt(n, e = null, t = yr) {
3475
3492
  arguments.length === 2 && typeof e == "function" && (t = e, e = null);
3476
- const s = e || Ee(n), r = mr.get(s);
3493
+ const s = e || Ce(n), r = mr.get(s);
3477
3494
  if (s === "Object") {
3478
3495
  const a = t(n, s);
3479
3496
  if (a !== void 0)
@@ -3481,7 +3498,7 @@ function bt(n, e = null, t = yr) {
3481
3498
  }
3482
3499
  return r ? r(n, s) : n;
3483
3500
  }
3484
- function Oe(n, e = {}) {
3501
+ function Ie(n, e = {}) {
3485
3502
  typeof e == "function" && (e = {
3486
3503
  customizer: e
3487
3504
  });
@@ -3490,15 +3507,15 @@ function Oe(n, e = {}) {
3490
3507
  customizer: t
3491
3508
  // TODO: max depth
3492
3509
  // depth = Infinity,
3493
- } = e, s = Ee(n);
3494
- if (!_t(s))
3495
- return wt(n, null, null, null);
3496
- const r = bt(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
3497
- return wt(n, r, a, i);
3498
- }
3499
- function wt(n, e, t, s, r) {
3500
- const a = Ee(n), i = bt(n, a);
3501
- if (!_t(a))
3510
+ } = e, s = Ce(n);
3511
+ if (!bt(s))
3512
+ return xt(n, null, null, null);
3513
+ const r = wt(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
3514
+ return xt(n, r, a, i);
3515
+ }
3516
+ function xt(n, e, t, s, r) {
3517
+ const a = Ce(n), i = wt(n, a);
3518
+ if (!bt(a))
3502
3519
  return i;
3503
3520
  let o;
3504
3521
  switch (a) {
@@ -3519,11 +3536,11 @@ function wt(n, e, t, s, r) {
3519
3536
  if (s.has(d))
3520
3537
  Ut(e, c, t.get(d), a);
3521
3538
  else {
3522
- const f = Ee(d), _ = bt(d, f);
3523
- _t(f) && (t.set(d, _), s.add(d)), Ut(
3539
+ const f = Ce(d), _ = wt(d, f);
3540
+ bt(f) && (t.set(d, _), s.add(d)), Ut(
3524
3541
  e,
3525
3542
  c,
3526
- wt(
3543
+ xt(
3527
3544
  d,
3528
3545
  _,
3529
3546
  t,
@@ -3536,32 +3553,32 @@ function wt(n, e, t, s, r) {
3536
3553
  return e;
3537
3554
  }
3538
3555
  const gr = (n) => new Promise((e) => setTimeout(e, n));
3539
- var Ke, he, Xe, xt, cn;
3556
+ var Xe, ge, Ye, kt, cn;
3540
3557
  class vr {
3541
3558
  constructor({ maxAttempts: e = 3, func: t }) {
3542
- z(this, xt), z(this, Ke), z(this, he), z(this, Xe), j(this, Ke, e), j(this, Xe, t), j(this, he, 0);
3559
+ W(this, kt), W(this, Xe), W(this, ge), W(this, Ye), N(this, Xe, e), N(this, Ye, t), N(this, ge, 0);
3543
3560
  }
3544
3561
  run() {
3545
- return E(this, null, function* () {
3562
+ return A(this, null, function* () {
3546
3563
  try {
3547
- return yield T(this, Xe).call(this);
3564
+ return yield T(this, Ye).call(this);
3548
3565
  } catch (e) {
3549
- if (j(this, he, T(this, he) + 1), T(this, he) > T(this, Ke))
3566
+ if (N(this, ge, T(this, ge) + 1), T(this, ge) > T(this, Xe))
3550
3567
  throw console.error("Max attempts reached"), e;
3551
- const t = X(this, xt, cn).call(this);
3568
+ const t = Q(this, kt, cn).call(this);
3552
3569
  return yield gr(t), yield this.run();
3553
3570
  }
3554
3571
  });
3555
3572
  }
3556
3573
  }
3557
- Ke = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakSet(), cn = function() {
3558
- return T(this, he) * 1e3 * 1.5;
3574
+ Xe = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakSet(), cn = function() {
3575
+ return T(this, ge) * 1e3 * 1.5;
3559
3576
  };
3560
3577
  function _r() {
3561
3578
  return typeof CompressionStream != "undefined";
3562
3579
  }
3563
3580
  function br(n) {
3564
- return E(this, null, function* () {
3581
+ return A(this, null, function* () {
3565
3582
  const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
3566
3583
  try {
3567
3584
  for (var s = zs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
@@ -3582,7 +3599,7 @@ function br(n) {
3582
3599
  });
3583
3600
  }
3584
3601
  function wr(n) {
3585
- return E(this, null, function* () {
3602
+ return A(this, null, function* () {
3586
3603
  const e = yield new Blob(n).arrayBuffer();
3587
3604
  return new Uint8Array(e);
3588
3605
  });
@@ -3620,7 +3637,7 @@ class Wt extends Error {
3620
3637
  }
3621
3638
  }
3622
3639
  }
3623
- class Ne extends Error {
3640
+ class Ze extends Error {
3624
3641
  constructor(e = {}) {
3625
3642
  const { canceled: t = !1 } = e;
3626
3643
  super("Abort Error"), this.name = "Abort Error", this.canceled = t;
@@ -3631,7 +3648,7 @@ class kr extends Error {
3631
3648
  super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
3632
3649
  }
3633
3650
  }
3634
- class ft extends Error {
3651
+ class ht extends Error {
3635
3652
  constructor(e) {
3636
3653
  super(e), this.name = "Request Validation Error";
3637
3654
  }
@@ -3642,14 +3659,14 @@ function un() {
3642
3659
  () => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
3643
3660
  ).join("");
3644
3661
  }
3645
- function kt() {
3662
+ function Tt() {
3646
3663
  return Math.floor(Date.now() / 1e3).toString();
3647
3664
  }
3648
3665
  const Tr = 5 * 60 * 1e3, Sr = 1 * 1e3;
3649
- var pe, F, G, Tt, St, je;
3650
- class Er {
3666
+ var ve, D, X, St, At, Re;
3667
+ class Ar {
3651
3668
  constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
3652
- z(this, G), z(this, pe), z(this, F), this.baseAddress = t, j(this, pe, e), j(this, F, {}), this.plugins = [];
3669
+ W(this, X), W(this, ve), W(this, D), this.baseAddress = t, N(this, ve, e), N(this, D, {}), this.plugins = [];
3653
3670
  }
3654
3671
  get headers() {
3655
3672
  throw new Error("Missing implementation");
@@ -3661,54 +3678,54 @@ class Er {
3661
3678
  this.plugins = this.plugins.filter((t) => t.name !== e);
3662
3679
  }
3663
3680
  withOptions(e = {}) {
3664
- return j(this, F, e), this;
3681
+ return N(this, D, e), this;
3665
3682
  }
3666
3683
  get(e) {
3667
- return E(this, arguments, function* (t, s = {}) {
3684
+ return A(this, arguments, function* (t, s = {}) {
3668
3685
  const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
3669
3686
  let o = a != null ? a : this.headers;
3670
- const c = Oe(T(this, F));
3671
- return j(this, F, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Ot(V({}, o), { "X-Request-Nonce": un(), "X-Request-Timestamp": kt() })), c.async ? yield X(this, G, St).call(this, `${i}${t}`, c.async, { headers: o }) : yield X(this, G, Tt).call(this, `${i}${t}`, c, { headers: o });
3687
+ const c = Ie(T(this, D));
3688
+ return N(this, D, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = Ct(U({}, o), { "X-Request-Nonce": un(), "X-Request-Timestamp": Tt() })), c.async ? yield Q(this, X, At).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, St).call(this, `${i}${t}`, c, { headers: o });
3672
3689
  });
3673
3690
  }
3674
3691
  post(e, t) {
3675
- return E(this, arguments, function* (s, r, a = {}) {
3676
- const i = Oe(T(this, F));
3677
- return j(this, F, {}), X(this, G, je).call(this, s, "POST", r, a, i);
3692
+ return A(this, arguments, function* (s, r, a = {}) {
3693
+ const i = Ie(T(this, D));
3694
+ return N(this, D, {}), Q(this, X, Re).call(this, s, "POST", r, a, i);
3678
3695
  });
3679
3696
  }
3680
3697
  put(e, t) {
3681
- return E(this, arguments, function* (s, r, a = {}) {
3682
- const i = Oe(T(this, F));
3683
- return j(this, F, {}), X(this, G, je).call(this, s, "PUT", r, a, i);
3698
+ return A(this, arguments, function* (s, r, a = {}) {
3699
+ const i = Ie(T(this, D));
3700
+ return N(this, D, {}), Q(this, X, Re).call(this, s, "PUT", r, a, i);
3684
3701
  });
3685
3702
  }
3686
3703
  delete(e, t) {
3687
- return E(this, arguments, function* (s, r, a = {}) {
3688
- const i = Oe(T(this, F));
3689
- return j(this, F, {}), X(this, G, je).call(this, s, "DELETE", r, a, i);
3704
+ return A(this, arguments, function* (s, r, a = {}) {
3705
+ const i = Ie(T(this, D));
3706
+ return N(this, D, {}), Q(this, X, Re).call(this, s, "DELETE", r, a, i);
3690
3707
  });
3691
3708
  }
3692
3709
  patch(e, t) {
3693
- return E(this, arguments, function* (s, r, a = {}) {
3694
- const i = Oe(T(this, F));
3695
- return j(this, F, {}), X(this, G, je).call(this, s, "PATCH", r, a, i);
3710
+ return A(this, arguments, function* (s, r, a = {}) {
3711
+ const i = Ie(T(this, D));
3712
+ return N(this, D, {}), Q(this, X, Re).call(this, s, "PATCH", r, a, i);
3696
3713
  });
3697
3714
  }
3698
3715
  }
3699
- pe = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakSet(), Tt = function(n, e, t) {
3700
- return E(this, null, function* () {
3701
- const s = () => E(this, null, function* () {
3716
+ ve = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), St = function(n, e, t) {
3717
+ return A(this, null, function* () {
3718
+ const s = () => A(this, null, function* () {
3702
3719
  var c, d;
3703
3720
  try {
3704
- return yield T(this, pe).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
3721
+ return yield T(this, ve).call(this, n, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
3705
3722
  } catch (f) {
3706
- throw f instanceof Error && f.name === "AbortError" ? new Ne({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
3723
+ throw f instanceof Error && f.name === "AbortError" ? new Ze({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
3707
3724
  }
3708
3725
  }), { headers: r } = t != null ? t : {}, a = (c, d) => {
3709
3726
  var f, _;
3710
3727
  return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[d]) || "";
3711
- }, i = (c) => E(this, null, function* () {
3728
+ }, i = (c) => A(this, null, function* () {
3712
3729
  var d;
3713
3730
  if (!c.ok) {
3714
3731
  const _ = yield c.text().catch();
@@ -3723,15 +3740,15 @@ pe = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), G = /* @_
3723
3740
  }
3724
3741
  if (e.requestValidation && process.env.UI_TESTS !== !0)
3725
3742
  try {
3726
- const _ = a(c, "x-response-nonce"), I = r == null ? void 0 : r["X-Request-Nonce"];
3727
- if (!_ || _ !== I)
3728
- throw new ft("Response nonce mismatch");
3729
- const A = Number(a(c, "x-response-timestamp")), O = Number(kt()), Z = 60 * 60 * 24;
3730
- if (isNaN(A) || Math.abs(O - A) > Z)
3731
- throw new ft("Invalid response timestamp");
3743
+ const _ = a(c, "x-response-nonce"), j = r == null ? void 0 : r["X-Request-Nonce"];
3744
+ if (!_ || _ !== j)
3745
+ throw new ht("Response nonce mismatch");
3746
+ const O = Number(a(c, "x-response-timestamp")), C = Number(Tt()), R = 60 * 60 * 24;
3747
+ if (isNaN(O) || Math.abs(C - O) > R)
3748
+ throw new ht("Invalid response timestamp");
3732
3749
  } catch (_) {
3733
- const I = _ instanceof Error ? _.message : "Request validation failed";
3734
- throw new ft(I);
3750
+ const j = _ instanceof Error ? _.message : "Request validation failed";
3751
+ throw new ht(j);
3735
3752
  }
3736
3753
  let f = yield c.text();
3737
3754
  try {
@@ -3750,8 +3767,8 @@ pe = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), G = /* @_
3750
3767
  const o = yield s();
3751
3768
  return yield i(o);
3752
3769
  });
3753
- }, St = function(n, e, t) {
3754
- return E(this, null, function* () {
3770
+ }, At = function(n, e, t) {
3771
+ return A(this, null, function* () {
3755
3772
  var s, r;
3756
3773
  const {
3757
3774
  onProgress: a,
@@ -3761,70 +3778,70 @@ pe = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), G = /* @_
3761
3778
  } = e, d = `${n}/async`, f = `${n}/async/job`;
3762
3779
  let _;
3763
3780
  try {
3764
- _ = yield T(this, pe).call(this, d, V(V({}, t), i && { signal: i }));
3765
- } catch (O) {
3766
- throw O instanceof Error && O.name === "AbortError" ? new Ne({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : O;
3781
+ _ = yield T(this, ve).call(this, d, U(U({}, t), i && { signal: i }));
3782
+ } catch (C) {
3783
+ throw C instanceof Error && C.name === "AbortError" ? new Ze({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : C;
3767
3784
  }
3768
3785
  if (!_.ok) {
3769
- const O = yield _.text().catch();
3786
+ const C = yield _.text().catch();
3770
3787
  throw new Wt({
3771
3788
  url: n,
3772
3789
  method: (r = t == null ? void 0 : t.method) != null ? r : "GET",
3773
3790
  statusCode: _.status,
3774
3791
  requestHeaders: this.headers,
3775
3792
  responseHeaders: _.headers,
3776
- body: O
3793
+ body: C
3777
3794
  });
3778
3795
  }
3779
- const I = yield _.json(), { job_id: A } = I;
3780
- if (!A)
3796
+ const j = yield _.json(), { job_id: O } = j;
3797
+ if (!O)
3781
3798
  throw new Error("Job ID not found in response");
3782
- return new Promise((O, Z) => E(this, null, function* () {
3783
- const W = setTimeout(() => {
3784
- Z(new Error("Job timed out"));
3785
- }, c), te = (oe = 0) => E(this, null, function* () {
3799
+ return new Promise((C, R) => A(this, null, function* () {
3800
+ const B = setTimeout(() => {
3801
+ R(new Error("Job timed out"));
3802
+ }, c), se = (ce = 0) => A(this, null, function* () {
3786
3803
  if (i != null && i.aborted) {
3787
- clearTimeout(W), T(this, pe).call(this, `${f}/${A}/cancel`, { method: "POST", headers: this.headers }).then(() => {
3788
- Z(new Ne({ canceled: !0 }));
3789
- }).catch((N) => {
3790
- Z(new Ne({ canceled: !1 }));
3804
+ clearTimeout(B), T(this, ve).call(this, `${f}/${O}/cancel`, { method: "POST", headers: this.headers }).then(() => {
3805
+ R(new Ze({ canceled: !0 }));
3806
+ }).catch((L) => {
3807
+ R(new Ze({ canceled: !1 }));
3791
3808
  });
3792
3809
  return;
3793
3810
  }
3794
3811
  try {
3795
- const N = yield (yield T(this, pe).call(this, `${f}/${A}`, { headers: this.headers })).json();
3796
- if (N.status === "success") {
3797
- clearTimeout(W);
3798
- const ne = N.response_json;
3799
- O(ne);
3800
- } else if (N.status === "failed")
3801
- clearTimeout(W), Z(new kr(N.response_json));
3812
+ const L = yield (yield T(this, ve).call(this, `${f}/${O}`, { headers: this.headers })).json();
3813
+ if (L.status === "success") {
3814
+ clearTimeout(B);
3815
+ const ue = L.response_json;
3816
+ C(ue);
3817
+ } else if (L.status === "failed")
3818
+ clearTimeout(B), R(new kr(L.response_json));
3802
3819
  else {
3803
- a && a(N.response_json);
3804
- const ne = o(oe);
3805
- setTimeout(() => te(oe + 1), ne);
3820
+ a && a(L.response_json);
3821
+ const ue = o(ce);
3822
+ setTimeout(() => se(ce + 1), ue);
3806
3823
  }
3807
- } catch (N) {
3808
- Z(N);
3824
+ } catch (L) {
3825
+ R(L);
3809
3826
  }
3810
3827
  });
3811
- te();
3828
+ se();
3812
3829
  }));
3813
3830
  });
3814
- }, je = function(n, e, t, s, r) {
3815
- return E(this, null, function* () {
3831
+ }, Re = function(n, e, t, s, r) {
3832
+ return A(this, null, function* () {
3816
3833
  const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
3817
3834
  let c = i != null ? i : this.headers;
3818
- r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Ot(V({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp": kt() }));
3835
+ r.extraHeaders && (c = U(U({}, c), r.extraHeaders)), r.requestValidation && (c = Ct(U({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp": Tt() }));
3819
3836
  let d = s.skipBodyJsonStringify ? t : JSON.stringify(t);
3820
- return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield X(this, G, St).call(this, `${o}${n}`, r.async, {
3837
+ return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield Q(this, X, At).call(this, `${o}${n}`, r.async, {
3821
3838
  method: e,
3822
3839
  headers: c,
3823
3840
  body: d
3824
- }) : yield X(this, G, Tt).call(this, `${o}${n}`, r, { method: e, headers: c, body: d });
3841
+ }) : yield Q(this, X, St).call(this, `${o}${n}`, r, { method: e, headers: c, body: d });
3825
3842
  });
3826
3843
  };
3827
- const Bt = (n, e, t, s) => n instanceof Ne ? n : new xr({ resource: e, api: String(t), args: s, cause: n }), ht = (n, e) => new Proxy(e, {
3844
+ const Bt = (n, e, t, s) => n instanceof Ze ? n : new xr({ resource: e, api: String(t), args: s, cause: n }), pt = (n, e) => new Proxy(e, {
3828
3845
  get(t, s) {
3829
3846
  return (...r) => {
3830
3847
  var a;
@@ -3845,118 +3862,118 @@ const Bt = (n, e, t, s) => n instanceof Ne ? n : new xr({ resource: e, api: Stri
3845
3862
  };
3846
3863
  }
3847
3864
  });
3848
- var Re;
3849
- class Ar {
3865
+ var Me;
3866
+ class Er {
3850
3867
  constructor(e) {
3851
- z(this, Re), this.resourceName = "Files", j(this, Re, e);
3868
+ W(this, Me), this.resourceName = "Files", N(this, Me, e);
3852
3869
  }
3853
3870
  get(e) {
3854
- return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
3855
- const r = new URLSearchParams(V({
3871
+ return A(this, arguments, function* ({ fileKey: t, params: s = {} }) {
3872
+ const r = new URLSearchParams(U({
3856
3873
  plugin_data: "857346721138427857"
3857
3874
  }, s)).toString(), a = `v1/files/${t}?${r}`;
3858
- return yield T(this, Re).get(a);
3875
+ return yield T(this, Me).get(a);
3859
3876
  });
3860
3877
  }
3861
3878
  getImageFills(e) {
3862
- return E(this, arguments, function* ({ fileKey: t }) {
3879
+ return A(this, arguments, function* ({ fileKey: t }) {
3863
3880
  var s, r;
3864
3881
  const a = `v1/files/${t}/images`;
3865
- return (r = (s = (yield T(this, Re).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
3882
+ return (r = (s = (yield T(this, Me).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
3866
3883
  });
3867
3884
  }
3868
3885
  }
3869
- Re = /* @__PURE__ */ new WeakMap();
3886
+ Me = /* @__PURE__ */ new WeakMap();
3870
3887
  const Or = (n, e, t) => {
3871
3888
  const s = e.sort();
3872
3889
  return `${n}-${s.join("-")}-${t}`;
3873
3890
  }, Cr = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
3874
- var K, Et, dn;
3891
+ var Y, Et, dn;
3875
3892
  class Ir {
3876
3893
  constructor(e) {
3877
- z(this, Et), z(this, K), this.resourceName = "Images", j(this, K, e);
3894
+ W(this, Et), W(this, Y), this.resourceName = "Images", N(this, Y, e);
3878
3895
  }
3879
3896
  /**
3880
3897
  * Return the URL for the _layer_ images for the given nodes.
3881
3898
  * Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
3882
3899
  */
3883
3900
  get(e) {
3884
- return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
3885
- const i = Or(t, s, r), o = T(this, K).cache.images.entries.get(i);
3901
+ return A(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
3902
+ const i = Or(t, s, r), o = T(this, Y).cache.images.entries.get(i);
3886
3903
  if (Cr(o))
3887
3904
  return o.result;
3888
- o && T(this, K).cache.images.entries.delete(i);
3889
- const c = T(this, K).cache.images.pendingRequests.get(i);
3905
+ o && T(this, Y).cache.images.entries.delete(i);
3906
+ const c = T(this, Y).cache.images.pendingRequests.get(i);
3890
3907
  if (c)
3891
3908
  return c;
3892
- const d = X(this, Et, dn).call(this, i, t, s, r, a);
3893
- T(this, K).cache.images.pendingRequests.set(i, d);
3909
+ const d = Q(this, Et, dn).call(this, i, t, s, r, a);
3910
+ T(this, Y).cache.images.pendingRequests.set(i, d);
3894
3911
  try {
3895
3912
  return yield d;
3896
3913
  } finally {
3897
- T(this, K).cache.images.pendingRequests.delete(i);
3914
+ T(this, Y).cache.images.pendingRequests.delete(i);
3898
3915
  }
3899
3916
  });
3900
3917
  }
3901
3918
  }
3902
- K = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakSet(), dn = function(n, e, t, s, r) {
3903
- return E(this, null, function* () {
3904
- const a = yield T(this, K).get(
3919
+ Y = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakSet(), dn = function(n, e, t, s, r) {
3920
+ return A(this, null, function* () {
3921
+ const a = yield T(this, Y).get(
3905
3922
  `v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
3906
3923
  );
3907
- return T(this, K).cache.images.entries.set(n, {
3924
+ return T(this, Y).cache.images.entries.set(n, {
3908
3925
  result: a,
3909
3926
  ts: Date.now()
3910
3927
  }), a;
3911
3928
  });
3912
3929
  };
3913
- var Ye;
3914
- class Nr {
3930
+ var Qe;
3931
+ class jr {
3915
3932
  constructor(e) {
3916
- z(this, Ye), this.resourceName = "Nodes", j(this, Ye, e);
3933
+ W(this, Qe), this.resourceName = "Nodes", N(this, Qe, e);
3917
3934
  }
3918
3935
  get(e) {
3919
- return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
3920
- const a = Ot(V({}, r), {
3936
+ return A(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
3937
+ const a = Ct(U({}, r), {
3921
3938
  ids: s.join(",")
3922
- }), i = new URLSearchParams(V({
3939
+ }), i = new URLSearchParams(U({
3923
3940
  plugin_data: "857346721138427857"
3924
3941
  }, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
3925
- return yield T(this, Ye).get(o);
3942
+ return yield T(this, Qe).get(o);
3926
3943
  });
3927
3944
  }
3928
3945
  }
3929
- Ye = /* @__PURE__ */ new WeakMap();
3930
- var ce;
3931
- class ln extends Er {
3946
+ Qe = /* @__PURE__ */ new WeakMap();
3947
+ var le;
3948
+ class ln extends Ar {
3932
3949
  constructor({
3933
3950
  baseAddress: e = "https://api.figma.com/",
3934
3951
  fetch: t = globalThis.fetch.bind(globalThis)
3935
3952
  } = {}) {
3936
- super({ fetch: t, baseAddress: e }), z(this, ce, ""), this.cache = {
3953
+ super({ fetch: t, baseAddress: e }), W(this, le, ""), this.cache = {
3937
3954
  images: {
3938
3955
  entries: /* @__PURE__ */ new Map(),
3939
3956
  pendingRequests: /* @__PURE__ */ new Map()
3940
3957
  }
3941
- }, this.files = ht(this, new Ar(this)), this.nodes = ht(this, new Nr(this)), this.images = ht(this, new Ir(this));
3958
+ }, this.files = pt(this, new Er(this)), this.nodes = pt(this, new jr(this)), this.images = pt(this, new Ir(this));
3942
3959
  }
3943
3960
  set token(e) {
3944
3961
  if (!e.startsWith("figd_") && !e.startsWith("figu_"))
3945
3962
  throw new Error("Invalid Figma access token");
3946
- j(this, ce, e);
3963
+ N(this, le, e);
3947
3964
  }
3948
3965
  get token() {
3949
- return T(this, ce);
3966
+ return T(this, le);
3950
3967
  }
3951
3968
  get headers() {
3952
3969
  const e = {
3953
3970
  "Content-Type": "application/json"
3954
3971
  };
3955
- return T(this, ce).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = T(this, ce) : T(this, ce).startsWith("figu_") && (e.Authorization = `Bearer ${T(this, ce)}`), e;
3972
+ return T(this, le).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = T(this, le) : T(this, le).startsWith("figu_") && (e.Authorization = `Bearer ${T(this, le)}`), e;
3956
3973
  }
3957
3974
  }
3958
- ce = /* @__PURE__ */ new WeakMap();
3959
- const Vr = (r) => P(void 0, [r], function* ({
3975
+ le = /* @__PURE__ */ new WeakMap();
3976
+ const Vr = (r) => F(void 0, [r], function* ({
3960
3977
  fileKey: n,
3961
3978
  authToken: e,
3962
3979
  figmaRestApi: t = new ln(),
@@ -3971,7 +3988,7 @@ const Vr = (r) => P(void 0, [r], function* ({
3971
3988
  } catch (a) {
3972
3989
  throw console.error(a), a;
3973
3990
  }
3974
- }), Ur = (a) => P(void 0, [a], function* ({
3991
+ }), Ur = (a) => F(void 0, [a], function* ({
3975
3992
  fileKey: n,
3976
3993
  authToken: e,
3977
3994
  nodeIds: t,
@@ -3986,15 +4003,12 @@ const Vr = (r) => P(void 0, [r], function* ({
3986
4003
  params: u({}, r)
3987
4004
  })).nodes;
3988
4005
  } catch (i) {
3989
- return Ps(i, n);
4006
+ return $s(i, n);
3990
4007
  }
3991
- }), jr = (n, e) => new ReadableStream({
4008
+ }), Nr = (n, e) => new ReadableStream({
3992
4009
  start(t) {
3993
4010
  n.generateCode(e, (s) => {
3994
- s.type === "error" ? (console.log("NOT SURE IF THIS IS REACHABLE, ALL ERRORS ARE THROWING"), t.enqueue({
3995
- type: "error",
3996
- payload: { message: s.payload.reason }
3997
- })) : t.enqueue(s), (s.type === "aborted" || s.type === "error") && t.close();
4011
+ s.type === "error" || t.enqueue(s), (s.type === "aborted" || s.type === "error") && t.close();
3998
4012
  }).then((s) => {
3999
4013
  t.enqueue({
4000
4014
  type: "done",
@@ -4007,32 +4021,34 @@ const Vr = (r) => P(void 0, [r], function* ({
4007
4021
  t.enqueue({
4008
4022
  type: "error",
4009
4023
  payload: {
4024
+ name: "name" in s ? s.name : "Unknown error",
4010
4025
  message: "message" in s ? s.message : "Unknown",
4011
- status: "status" in s ? s.status : void 0
4026
+ status: "status" in s ? s.status : void 0,
4027
+ detail: "detail" in s ? s.detail : void 0
4012
4028
  }
4013
4029
  }), t.close();
4014
4030
  });
4015
4031
  }
4016
- }), zr = (n, e) => P(void 0, null, function* () {
4017
- var c, d, f, _, I, A, O;
4018
- const t = jr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
4032
+ }), zr = (n, e) => F(void 0, null, function* () {
4033
+ var c, d, f, _, j, O, C;
4034
+ const t = Nr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
4019
4035
  if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (d = a.value) == null ? void 0 : d.payload) != null && f.status))
4020
4036
  return new Response(JSON.stringify(a.value), {
4021
- status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (A = (I = a.value) == null ? void 0 : I.payload) == null ? void 0 : A.status) != null ? O : 500,
4037
+ status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (C = (O = (j = a.value) == null ? void 0 : j.payload) == null ? void 0 : O.status) != null ? C : 500,
4022
4038
  headers: {
4023
4039
  "Content-Type": "application/json"
4024
4040
  }
4025
4041
  });
4026
4042
  const i = new TextEncoder(), o = r.pipeThrough(
4027
4043
  new TransformStream({
4028
- transform(Z, W) {
4029
- const te = `event: ${Z.type}
4044
+ transform(R, B) {
4045
+ const se = `event: ${R.type}
4030
4046
  data: ${JSON.stringify(
4031
- Z
4047
+ R
4032
4048
  )}
4033
4049
 
4034
4050
  `;
4035
- W.enqueue(i.encode(te));
4051
+ B.enqueue(i.encode(se));
4036
4052
  }
4037
4053
  })
4038
4054
  );
@@ -4046,26 +4062,26 @@ data: ${JSON.stringify(
4046
4062
  });
4047
4063
  });
4048
4064
  export {
4049
- Zr as Anima,
4050
- Ae as CodegenError,
4065
+ Rr as Anima,
4066
+ de as CodegenError,
4051
4067
  Is as FigmaTokenIssue,
4052
- js as NotFound,
4053
- Ns as RateLimitExceeded,
4054
- Pr as ResponseError,
4055
- Zs as UnknownFigmaApiException,
4068
+ Ns as NotFound,
4069
+ js as RateLimitExceeded,
4070
+ $r as ResponseError,
4071
+ Rs as UnknownFigmaApiException,
4056
4072
  zr as createCodegenResponseEventStream,
4057
- jr as createCodegenStream,
4058
- $r as formatToFigmaLink,
4059
- Dr as getFigmaApiErrorType,
4073
+ Nr as createCodegenStream,
4074
+ Pr as formatToFigmaLink,
4075
+ Lr as getFigmaApiErrorType,
4060
4076
  Vr as getFigmaFile,
4061
4077
  Ur as getFileNodes,
4062
4078
  Fr as getRelatedScreenFiles,
4063
- Ps as handleFigmaApiError,
4064
- $s as isFigmaTokenIssue,
4065
- Rs as isNotFound,
4079
+ $s as handleFigmaApiError,
4080
+ Ps as isFigmaTokenIssue,
4081
+ Zs as isNotFound,
4066
4082
  Ms as isRateLimitExceeded,
4067
- Lr as isUnknownFigmaApiException,
4083
+ Dr as isUnknownFigmaApiException,
4068
4084
  Mr as isValidFigmaUrl,
4069
- Es as validateSettings
4085
+ As as validateSettings
4070
4086
  };
4071
4087
  //# sourceMappingURL=index.js.map